summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 23:20:46 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 23:20:46 +0000
commit2da8d317072968241f986ffed0be477900831889 (patch)
tree761eedfabaaba837480c3604c0cfcf10e8d7d07c /webkit
parentb9a0b1b39c5bcf551178cab7a2aa5f24d5afc929 (diff)
downloadchromium_src-2da8d317072968241f986ffed0be477900831889.zip
chromium_src-2da8d317072968241f986ffed0be477900831889.tar.gz
chromium_src-2da8d317072968241f986ffed0be477900831889.tar.bz2
Reland changes to enable worker layout tests. Compared to last review (http://codereview.chromium.org/50045), the following changes are made:
1) Add chrome/test/worker/DEPS to address checkdeps error. 2) Change test_expectations.txt to skip some worker layout tests. 3) Add test_worker.vcproj to webkit.sln so that test_worker.dll can be built for WebKit build. Review URL: http://codereview.chromium.org/56074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webworkerclient_impl.cc10
-rw-r--r--webkit/glue/webworkerclient_impl.h3
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt19
-rw-r--r--webkit/tools/test_shell/test_shell.gyp2
-rw-r--r--webkit/tools/test_shell/test_shell.vcproj8
-rw-r--r--webkit/tools/test_shell/test_shell_tests.vcproj8
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h5
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate.cc11
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h1
-rw-r--r--webkit/tools/test_shell/test_webworker_helper.cc90
-rw-r--r--webkit/tools/test_shell/test_webworker_helper.h53
-rw-r--r--webkit/webkit.sln29
12 files changed, 229 insertions, 10 deletions
diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc
index 11ccfca..68cd330 100644
--- a/webkit/glue/webworkerclient_impl.cc
+++ b/webkit/glue/webworkerclient_impl.cc
@@ -67,13 +67,17 @@ WebWorkerClientImpl::~WebWorkerClientImpl() {
}
void WebWorkerClientImpl::set_webworker(WebWorker* webworker) {
- webworker_.reset(webworker);
+ webworker_ = webworker;
}
void WebWorkerClientImpl::startWorkerContext(
const WebCore::KURL& scriptURL,
const WebCore::String& userAgent,
const WebCore::String& sourceCode) {
+ // Worker.terminate() could be called from JS before the context is started.
+ if (asked_to_terminate_)
+ return;
+
webworker_->StartWorkerContext(webkit_glue::KURLToGURL(scriptURL),
webkit_glue::StringToString16(userAgent),
webkit_glue::StringToString16(sourceCode));
@@ -89,6 +93,10 @@ void WebWorkerClientImpl::terminateWorkerContext() {
void WebWorkerClientImpl::postMessageToWorkerContext(
const WebCore::String& message) {
+ // Worker.terminate() could be called from JS before the context is started.
+ if (asked_to_terminate_)
+ return;
+
++unconfirmed_message_count_;
webworker_->PostMessageToWorkerContext(
webkit_glue::StringToString16(message));
diff --git a/webkit/glue/webworkerclient_impl.h b/webkit/glue/webworkerclient_impl.h
index 4c8277c..5a8a4cd 100644
--- a/webkit/glue/webworkerclient_impl.h
+++ b/webkit/glue/webworkerclient_impl.h
@@ -7,7 +7,6 @@
#if ENABLE(WORKERS)
-#include "base/scoped_ptr.h"
#include "webkit/glue/webworkerclient.h"
#include "WorkerContextProxy.h"
@@ -61,7 +60,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy,
WTF::RefPtr<WebCore::ScriptExecutionContext> script_execution_context_;
WebCore::Worker* worker_;
- scoped_ptr<WebWorker> webworker_;
+ WebWorker* webworker_;
bool asked_to_terminate_;
uint32 unconfirmed_message_count_;
bool worker_context_had_pending_activity_;
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 53f4788..67cb82b 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -451,6 +451,19 @@ DEFER : LayoutTests/fast/replaced/table-percent-height.html = FAIL
DEFER : LayoutTests/fast/events/stopPropagation-submit.html = FAIL
// -----------------------------------------------------------------
+// Workers
+// -----------------------------------------------------------------
+
+SKIP LINUX MAC : LayoutTests/fast/workers = TIMEOUT FAIL
+SKIP : LayoutTests/fast/workers/stress-js-execution.html = TIMEOUT FAIL
+SKIP : LayoutTests/fast/workers/worker-timeout.html = TIMEOUT FAIL
+SKIP : LayoutTests/http/tests/workers = TIMEOUT FAIL
+SKIP : LayoutTests/http/tests/xmlhttprequest/workers = TIMEOUT FAIL
+
+// General V8 bug.
+SKIP : LayoutTests/fast/workers/worker-replace-self.html = TIMEOUT FAIL
+
+// -----------------------------------------------------------------
// PENDING TESTS (forked to pending/, need to be sent upstream)
// -----------------------------------------------------------------
@@ -464,10 +477,6 @@ DEFER : LayoutTests/fast/repaint/bugzilla-6473.html = PASS FAIL
// Tests deferred until we provide support for a particular feature.
// -----------------------------------------------------------------
-// Worker related tests (ENABLE_WORKERS):
-DEFER SKIP : LayoutTests/fast/workers = TIMEOUT FAIL
-DEFER SKIP : LayoutTests/http/tests/workers = TIMEOUT FAIL
-DEFER SKIP : LayoutTests/http/tests/xmlhttprequest/workers = TIMEOUT
DEFER: LayoutTests/fast/events/dispatchEvent-crash.html = FAIL
// These tests rely on the keygen tag, which we haven't wired up.
@@ -2312,7 +2321,7 @@ DEFER WIN LINUX : LayoutTests/fast/text/complex-text-opacity.html = FAIL
// Needs rebaseline. See WebKit 41980
DEFER WIN LINUX : LayoutTests/fast/transforms/transforms-with-zoom.html = FAIL
-
+
// Merge WebKit: 41944:41999, Linux failures.
DEFER LINUX : LayoutTests/fast/events/tabindex-focus-blur-all.html = FAIL
DEFER LINUX : LayoutTests/fast/forms/focus2.html = FAIL
diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp
index e6f3a1e..fa40326 100644
--- a/webkit/tools/test_shell/test_shell.gyp
+++ b/webkit/tools/test_shell/test_shell.gyp
@@ -65,6 +65,8 @@
'test_webview_delegate.h',
'test_webview_delegate_gtk.cc',
'test_webview_delegate_win.cc',
+ 'test_webworker_helper.cc',
+ 'test_webworker_helper.h',
'text_input_controller.cc',
'text_input_controller.h',
'webview_host.h',
diff --git a/webkit/tools/test_shell/test_shell.vcproj b/webkit/tools/test_shell/test_shell.vcproj
index b4d6410..12d36f0 100644
--- a/webkit/tools/test_shell/test_shell.vcproj
+++ b/webkit/tools/test_shell/test_shell.vcproj
@@ -322,6 +322,14 @@
>
</File>
<File
+ RelativePath=".\test_webworker_helper.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\test_webworker_helper.h"
+ >
+ </File>
+ <File
RelativePath=".\text_input_controller.cc"
>
</File>
diff --git a/webkit/tools/test_shell/test_shell_tests.vcproj b/webkit/tools/test_shell/test_shell_tests.vcproj
index 4311ba6..77ac1ef 100644
--- a/webkit/tools/test_shell/test_shell_tests.vcproj
+++ b/webkit/tools/test_shell/test_shell_tests.vcproj
@@ -287,6 +287,14 @@
>
</File>
<File
+ RelativePath=".\test_webworker_helper.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\test_webworker_helper.h"
+ >
+ </File>
+ <File
RelativePath=".\text_input_controller.cc"
>
</File>
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index 6a87100..ac3dcfc 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -33,6 +33,7 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
WebKit::registerExtension(extensions_v8::GearsExtension::Get());
WebKit::registerExtension(extensions_v8::IntervalExtension::Get());
+ WebKit::enableWebWorkers();
}
~TestShellWebKitInit() {
@@ -42,10 +43,10 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
virtual WebKit::WebMimeRegistry* mimeRegistry() {
return &mime_registry_;
}
-
+
WebKit::WebClipboard* clipboard() {
if (!clipboard_.get()) {
- // Mock out clipboard calls in layout test mode so that tests don't mess
+ // Mock out clipboard calls in layout test mode so that tests don't mess
// with each other's copies/pastes when running in parallel.
if (TestShell::layout_test_mode()) {
clipboard_.reset(new MockWebClipboardImpl());
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 2a39260..a2cf6c0 100755
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -6,6 +6,8 @@
// as the WebViewDelegate for the TestShellWebHost. The host is expected to
// have initialized a MessageLoop before these methods are called.
+#include "config.h"
+
#include "webkit/tools/test_shell/test_webview_delegate.h"
#include "base/file_util.h"
@@ -29,6 +31,7 @@
#include "webkit/glue/window_open_disposition.h"
#include "webkit/tools/test_shell/test_navigation_controller.h"
#include "webkit/tools/test_shell/test_shell.h"
+#include "webkit/tools/test_shell/test_webworker_helper.h"
#if defined(OS_WIN)
// TODO(port): make these files work everywhere.
@@ -849,3 +852,11 @@ std::wstring TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) {
return L"frame (anonymous)";
}
}
+
+WebWorker* TestWebViewDelegate::CreateWebWorker(WebWorkerClient* client) {
+#if ENABLE(WORKERS)
+ return TestWebWorkerHelper::CreateWebWorker(client);
+#else
+ return NULL;
+#endif
+}
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index c24eccc..1204ded 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -83,6 +83,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
const std::string& mime_type,
const std::string& clsid,
std::string* actual_mime_type);
+ virtual WebWorker* CreateWebWorker(WebWorkerClient* client);
virtual void OpenURL(WebView* webview,
const GURL& url,
const GURL& referrer,
diff --git a/webkit/tools/test_shell/test_webworker_helper.cc b/webkit/tools/test_shell/test_webworker_helper.cc
new file mode 100644
index 0000000..c365a2b
--- /dev/null
+++ b/webkit/tools/test_shell/test_webworker_helper.cc
@@ -0,0 +1,90 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include <wtf/MainThread.h>
+#include <wtf/Threading.h>
+#undef LOG
+
+#include "build/build_config.h"
+
+#include "webkit/tools/test_shell/test_webworker_helper.h"
+
+#include "base/logging.h"
+#include "base/file_util.h"
+#include "base/path_service.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
+#include "webkit/glue/webworkerclient.h"
+
+
+WebWorker* TestWebWorkerHelper::CreateWebWorker(WebWorkerClient* client) {
+ TestWebWorkerHelper* loader = new TestWebWorkerHelper();
+ return loader->CreateWebWorker_(client, loader);
+}
+
+TestWebWorkerHelper::TestWebWorkerHelper() :
+#if defined(OS_WIN)
+ module_(NULL),
+#endif
+ CreateWebWorker_(NULL) {
+ Load();
+}
+
+TestWebWorkerHelper::~TestWebWorkerHelper() {
+}
+
+bool TestWebWorkerHelper::IsMainThread() const {
+ return WTF::isMainThread();
+}
+
+void TestWebWorkerHelper::DispatchToMainThread(WTF::MainThreadFunction* func,
+ void* context) {
+ return WTF::callOnMainThread(func, context);
+}
+
+bool TestWebWorkerHelper::Load() {
+#if defined(OS_WIN)
+ FilePath path;
+ PathService::Get(base::DIR_EXE, &path);
+ path = path.AppendASCII("test_worker.dll");
+
+ module_ = LoadLibrary(path.value().c_str());
+ if (module_ == 0)
+ return false;
+
+ CreateWebWorker_ = reinterpret_cast<CreateWebWorkerFunc>
+ (GetProcAddress(module_, "CreateWebWorker"));
+ if (!CreateWebWorker_) {
+ FreeLibrary(module_);
+ module_ = 0;
+ return false;
+ }
+
+ return true;
+#else
+ NOTIMPLEMENTED();
+ return false;
+#endif
+}
+
+void TestWebWorkerHelper::Unload() {
+ // Since this is called from DLL, delay the unloading until it can be
+ // invoked from EXE.
+ return WTF::callOnMainThread(UnloadHelper, this);
+}
+
+void TestWebWorkerHelper::UnloadHelper(void* param) {
+ TestWebWorkerHelper* this_ptr = static_cast<TestWebWorkerHelper*>(param);
+
+#if defined(OS_WIN)
+ if (this_ptr->module_) {
+ FreeLibrary(this_ptr->module_);
+ this_ptr->module_ = 0;
+ }
+#else
+ NOTIMPLEMENTED();
+#endif
+
+ delete this_ptr;
+}
diff --git a/webkit/tools/test_shell/test_webworker_helper.h b/webkit/tools/test_shell/test_webworker_helper.h
new file mode 100644
index 0000000..0e6c2b0
--- /dev/null
+++ b/webkit/tools/test_shell/test_webworker_helper.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBWORKER_HELPER_H__
+#define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBWORKER_HELPER_H__
+
+#include <vector>
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
+#include "base/basictypes.h"
+#include "base/port.h"
+
+#include <wtf/MainThread.h>
+
+class TestWebWorkerHelper;
+class WebWorker;
+class WebWorkerClient;
+
+// Function to call in test_worker DLL.
+typedef WebWorker* (API_CALL *CreateWebWorkerFunc)(
+ WebWorkerClient* webworker_client,
+ TestWebWorkerHelper* webworker_helper);;
+
+class TestWebWorkerHelper {
+ public:
+ static WebWorker* CreateWebWorker(WebWorkerClient* client);
+
+ TestWebWorkerHelper();
+ ~TestWebWorkerHelper();
+
+ virtual bool IsMainThread() const;
+ virtual void DispatchToMainThread(WTF::MainThreadFunction* func,
+ void* context);
+ virtual void Unload();
+
+ private:
+ bool Load();
+ static void UnloadHelper(void* param);
+
+#if defined(OS_WIN)
+ // TODO(port): Remove ifdefs when we have portable replacement for HMODULE.
+ HMODULE module_;
+#endif // defined(OS_WIN)
+
+ CreateWebWorkerFunc CreateWebWorker_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestWebWorkerHelper);
+};
+
+#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBWORKER_HELPER_H__
diff --git a/webkit/webkit.sln b/webkit/webkit.sln
index aa2b459..7e25d4f 100644
--- a/webkit/webkit.sln
+++ b/webkit/webkit.sln
@@ -231,6 +231,30 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "printing", "..\printing\pri
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icui18n", "..\third_party\icu38\icui18n.vcproj", "{F22022F0-2D3B-5610-4E80-C674A8E01C5A}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_worker", "..\chrome\test\worker\test_worker.vcproj", "{3E03D462-780D-4C4D-B22E-5E095E6CF110}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165}
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
+ {238CE175-76CE-4A25-A676-69D115885601} = {238CE175-76CE-4A25-A676-69D115885601}
+ {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243}
+ {49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {49909552-0B0C-4C14-8CF6-DB8A2ADE0934}
+ {5916D37D-8C97-424F-A904-74E52594C2D6} = {5916D37D-8C97-424F-A904-74E52594C2D6}
+ {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65} = {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}
+ {625A8F11-2B4E-45B4-BD99-C6D629C606C0} = {625A8F11-2B4E-45B4-BD99-C6D629C606C0}
+ {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D}
+ {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C}
+ {A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {C0334F9A-1168-4101-9DD8-C30FB252D435} = {C0334F9A-1168-4101-9DD8-C30FB252D435}
+ {C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD}
+ {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09} = {C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}
+ {CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D}
+ {D6047981-23AE-4623-9373-514FDAFAE60F} = {D6047981-23AE-4623-9373-514FDAFAE60F}
+ {EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C}
+ {F4F4BCAA-EA59-445C-A119-3E6C29647A51} = {F4F4BCAA-EA59-445C-A119-3E6C29647A51}
+ {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED} = {FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -285,6 +309,10 @@ Global
{326E9795-E760-410A-B69A-3F79DB3F5243}.Debug|Win32.Build.0 = Debug|Win32
{326E9795-E760-410A-B69A-3F79DB3F5243}.Release|Win32.ActiveCfg = Release|Win32
{326E9795-E760-410A-B69A-3F79DB3F5243}.Release|Win32.Build.0 = Release|Win32
+ {3E03D462-780D-4C4D-B22E-5E095E6CF110}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3E03D462-780D-4C4D-B22E-5E095E6CF110}.Debug|Win32.Build.0 = Debug|Win32
+ {3E03D462-780D-4C4D-B22E-5E095E6CF110}.Release|Win32.ActiveCfg = Release|Win32
+ {3E03D462-780D-4C4D-B22E-5E095E6CF110}.Release|Win32.Build.0 = Release|Win32
{494E414B-1655-48CE-996D-6413ECFB7829}.Debug|Win32.ActiveCfg = Debug|Win32
{494E414B-1655-48CE-996D-6413ECFB7829}.Debug|Win32.Build.0 = Debug|Win32
{494E414B-1655-48CE-996D-6413ECFB7829}.Release|Win32.ActiveCfg = Release|Win32
@@ -446,6 +474,7 @@ Global
{2E2D3301-2EC4-4C0F-B889-87073B30F673} = {1DFD10B5-A673-4C3A-BA1D-3546FC4B7740}
{2F7EDFA2-EE27-4D83-8454-9EFBD5779203} = {4BC2C9E2-78FA-446A-B6E0-85689A2B4D3D}
{326E9795-E760-410A-B69A-3F79DB3F5243} = {2C5FC2FE-B8B0-44B9-A7C4-E5B5E7292F6B}
+ {3E03D462-780D-4C4D-B22E-5E095E6CF110} = {4A249B49-19FB-4BD1-B017-718E7A4448EF}
{494E414B-1655-48CE-996D-6413ECFB7829} = {4BC2C9E2-78FA-446A-B6E0-85689A2B4D3D}
{49909552-0B0C-4C14-8CF6-DB8A2ADE0934} = {1DFD10B5-A673-4C3A-BA1D-3546FC4B7740}
{5597AD47-3494-4750-A235-4F9C2F864700} = {4BC2C9E2-78FA-446A-B6E0-85689A2B4D3D}