OSDN Git Service

Merge WebKit at r71558: Initial merge by git.
[android-x86/external-webkit.git] / WebKitTools / TestWebKitAPI / InjectedBundleController.cpp
index 2674801..5942ec8 100644 (file)
@@ -45,7 +45,7 @@ InjectedBundleController::InjectedBundleController()
 {
 }
 
-void InjectedBundleController::initialize(WKBundleRef bundle)
+void InjectedBundleController::initialize(WKBundleRef bundle, WKTypeRef initializationUserData)
 {
     m_bundle = bundle;
 
@@ -57,6 +57,12 @@ void InjectedBundleController::initialize(WKBundleRef bundle)
         didReceiveMessage
     };
     WKBundleSetClient(m_bundle, &client);
+
+    // Initialize the test from the "initializationUserData".
+    assert(WKGetTypeID(initializationUserData) == WKStringGetTypeID());
+    WKStringRef testName = static_cast<WKStringRef>(initializationUserData);
+
+    initializeTestNamed(bundle, Util::toSTD(testName));
 }
 
 void InjectedBundleController::didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
@@ -76,16 +82,6 @@ void InjectedBundleController::willDestroyPage(WKBundleRef bundle, WKBundlePageR
 void InjectedBundleController::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
 {
     InjectedBundleController* self = static_cast<InjectedBundleController*>(const_cast<void*>(clientInfo));
-
-    if (WKStringIsEqualToUTF8CString(messageName, "BundleTestInstantiator")) {
-        assert(WKGetTypeID(messageBody) == WKStringGetTypeID());
-        WKStringRef messageBodyString = static_cast<WKStringRef>(messageBody);
-
-        self->initializeTestNamed(bundle, Util::toSTD(messageBodyString));
-
-        return;
-    }
-
     assert(self->m_currentTest);
     self->m_currentTest->didReceiveMessage(bundle, messageName, messageBody);
 }