summaryrefslogtreecommitdiffstats
path: root/WebKitTools/TestWebKitAPI
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-11-10 15:31:59 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-11-17 13:35:59 -0800
commit28040489d744e0c5d475a88663056c9040ed5320 (patch)
treec463676791e4a63e452a95f0a12b2a8519730693 /WebKitTools/TestWebKitAPI
parenteff9be92c41913c92fb1d3b7983c071f3e718678 (diff)
downloadexternal_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'WebKitTools/TestWebKitAPI')
-rw-r--r--WebKitTools/TestWebKitAPI/InjectedBundleController.cpp18
-rw-r--r--WebKitTools/TestWebKitAPI/InjectedBundleController.h2
-rw-r--r--WebKitTools/TestWebKitAPI/InjectedBundleMain.cpp4
-rw-r--r--WebKitTools/TestWebKitAPI/PlatformUtilities.cpp9
-rw-r--r--WebKitTools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp5
5 files changed, 14 insertions, 24 deletions
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
index 2674801..5942ec8 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
@@ -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);
}
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.h b/WebKitTools/TestWebKitAPI/InjectedBundleController.h
index 8b45fff..91c571e 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleController.h
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.h
@@ -38,7 +38,7 @@ class InjectedBundleController {
public:
static InjectedBundleController& shared();
- void initialize(WKBundleRef);
+ void initialize(WKBundleRef, WKTypeRef);
void dumpTestNames();
void initializeTestNamed(WKBundleRef bundle, const std::string&);
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleMain.cpp b/WebKitTools/TestWebKitAPI/InjectedBundleMain.cpp
index 8f9e8ad..355c35b 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleMain.cpp
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleMain.cpp
@@ -31,7 +31,7 @@ extern "C" __declspec(dllexport)
#else
extern "C"
#endif
-void WKBundleInitialize(WKBundleRef bundle)
+void WKBundleInitialize(WKBundleRef bundle, WKTypeRef initializationUserData)
{
- TestWebKitAPI::InjectedBundleController::shared().initialize(bundle);
+ TestWebKitAPI::InjectedBundleController::shared().initialize(bundle, initializationUserData);
}
diff --git a/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp b/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp
index 2fadf3a..281fb13 100644
--- a/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp
+++ b/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp
@@ -37,13 +37,10 @@ WKContextRef createContextForInjectedBundleTest(const std::string& testName)
{
WKRetainPtr<WKStringRef> injectedBundlePath(AdoptWK, createInjectedBundlePath());
WKContextRef context = WKContextCreateWithInjectedBundlePath(injectedBundlePath.get());
-
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BundleTestInstantiator"));
- WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithUTF8CString(testName.c_str()));
- // Enqueue message to instantiate the bundle test.
- WKContextPostMessageToInjectedBundle(context, messageName.get(), messageBody.get());
-
+ WKRetainPtr<WKStringRef> testNameString(AdoptWK, WKStringCreateWithUTF8CString(testName.c_str()));
+ WKContextSetInitializationUserDataForInjectedBundle(context, testNameString.get());
+
return context;
}
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp
index b7db746..0ccee5a 100644
--- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/FailedLoad.cpp
@@ -41,10 +41,7 @@ static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef f
TEST_ASSERT(WKFrameGetFrameLoadState(frame) == kWKFrameLoadStateFinished);
WKURLRef url = WKFrameCopyProvisionalURL(frame);
- WKURLRef emptyURL = WKURLCreateWithUTF8CString("");
- TEST_ASSERT(WKURLIsEqual(url, emptyURL));
- WKRelease(url);
- WKRelease(emptyURL);
+ TEST_ASSERT(!url);
testDone = true;
}