diff options
author | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 21:00:55 +0000 |
---|---|---|
committer | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 21:00:55 +0000 |
commit | 02473008f5f1948494b9fb69e5781746b66f6f80 (patch) | |
tree | 0e3682014c915ca2ce26f21012478740e48d6897 | |
parent | 83dde5448f2650827fc26a02168c18e6c5825ae8 (diff) | |
download | chromium_src-02473008f5f1948494b9fb69e5781746b66f6f80.zip chromium_src-02473008f5f1948494b9fb69e5781746b66f6f80.tar.gz chromium_src-02473008f5f1948494b9fb69e5781746b66f6f80.tar.bz2 |
Replace worker support in test shell with a dummy implementation.
The current implementation doesn't really work so no worker tests
are run from test shell.
The dummy implementation is only present to allow tests
to pass that enumerate objects and their properties generically
(without actually using the objects like
fast/js/instanceof-operator.html).
BUG=18676
TEST=layout tests fast/js/instanceof-operator.html
Review URL: http://codereview.chromium.org/193082
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26010 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/tools/layout_tests/test_expectations.txt | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gyp | 44 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_web_worker.h (renamed from webkit/tools/test_shell/test_worker/test_webworker.h) | 63 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webworker_helper.cc | 122 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webworker_helper.h | 61 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_worker/test_webworker.cc | 124 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_worker/test_worker.def | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_worker/test_worker.exp | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_worker/test_worker_main.cc | 252 |
10 files changed, 37 insertions, 640 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt index bc1fee2..b9cc789 100644 --- a/webkit/tools/layout_tests/test_expectations.txt +++ b/webkit/tools/layout_tests/test_expectations.txt @@ -2161,9 +2161,6 @@ BUG16823 MAC : LayoutTests/editing/style/non-inheritable-styles.html = FAIL BUG16823 MAC : LayoutTests/editing/style/smoosh-styles-003.html = FAIL BUG16823 MAC : LayoutTests/fast/lists/drag-into-marker.html = FAIL -// Failures from WebKit merge 45936:45958 -BUG18676 LINUX MAC : LayoutTests/fast/js/instanceof-operator.html = CRASH - // New test from WebKit merge 46050:46087 BUG17170 : LayoutTests/fast/dom/prototype-inheritance.html = FAIL diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp index f7540fb..f14f4c5 100644 --- a/webkit/tools/test_shell/test_shell.gyp +++ b/webkit/tools/test_shell/test_shell.gyp @@ -85,12 +85,11 @@ 'test_shell_switches.h', 'test_shell_win.cc', 'test_shell_webkit_init.h', + 'test_web_worker.h', 'test_webview_delegate.cc', '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', @@ -218,7 +217,7 @@ }, 'conditions': [ ['OS=="win"', { - 'dependencies': ['test_worker', 'layout_test_helper'], + 'dependencies': ['layout_test_helper'], 'resource_include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit', ], @@ -608,45 +607,6 @@ }, ], }], - # Need to do the same for Linux. We build a separate dylib/dll/so - # so V8 can have a second set of global variables and run workers. - # Normally, workers run in a separate process. - ['OS!="linux"', { - 'targets': [ - { - 'target_name': 'test_worker', - 'type': 'shared_library', - 'xcode_settings': { - 'EXPORTED_SYMBOLS_FILE': 'test_worker/test_worker.exp', - }, - 'msvs_guid': '3E03D462-780D-4C4D-B22E-5E095E6CF110', - 'msvs_disabled_warnings': [4800], - 'dependencies': [ - '../../../base/base.gyp:base', - '../../../base/base.gyp:base_gfx', - '../../../net/net.gyp:net', - '../../../skia/skia.gyp:skia', - '../../../testing/gtest.gyp:gtest', - '../../../third_party/npapi/npapi.gyp:npapi', - '../../webkit.gyp:glue', - '../../webkit.gyp:webkit', - # For simple_clipboard_impl.cc - 'test_shell_common', - ], - 'sources': [ - 'test_worker/test_webworker.cc', - 'test_worker/test_webworker.h', - 'test_worker/test_worker_main.cc', - 'test_worker/test_worker.def', - ], - 'conditions': [ - ['OS!="win"', { - 'sources!' : ['test_worker/test_worker.def'], - }], - ], - }, - ], - }], ['OS=="win"', { 'targets': [ { diff --git a/webkit/tools/test_shell/test_worker/test_webworker.h b/webkit/tools/test_shell/test_web_worker.h index ea6aaa8..2adcb42 100644 --- a/webkit/tools/test_shell/test_worker/test_webworker.h +++ b/webkit/tools/test_shell/test_web_worker.h @@ -2,47 +2,57 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_TEST_WORKER_TEST_WEBWORKER_H_ -#define CHROME_TEST_WORKER_TEST_WEBWORKER_H_ +#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEB_WORKER_H_ +#define WEBKIT_TOOLS_TEST_SHELL_TEST_WEB_WORKER_H_ #if ENABLE(WORKERS) -#include <vector> - #include "base/basictypes.h" #include "base/ref_counted.h" -#include "webkit/api/public/WebNotificationPresenter.h" -#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebMessagePortChannel.h" #include "webkit/api/public/WebWorker.h" #include "webkit/api/public/WebWorkerClient.h" -class GURL; -class TestWebWorkerHelper; +namespace WebKit { +class WebNotificationPresenter; +class WebString; +class WebURL; +} class TestWebWorker : public WebKit::WebWorker, public WebKit::WebWorkerClient, public base::RefCounted<TestWebWorker> { public: - TestWebWorker(WebWorkerClient* client, TestWebWorkerHelper* webworker_helper); + TestWebWorker() { + AddRef(); // Adds the reference held for worker object. + AddRef(); // Adds the reference held for worker context object. + } // WebWorker methods: virtual void startWorkerContext(const WebKit::WebURL& script_url, const WebKit::WebString& user_agent, - const WebKit::WebString& source_code); - virtual void terminateWorkerContext(); + const WebKit::WebString& source_code) { + } + virtual void terminateWorkerContext() { + } virtual void postMessageToWorkerContext( const WebKit::WebString& message, - const WebKit::WebMessagePortChannelArray& channel); - virtual void workerObjectDestroyed(); + const WebKit::WebMessagePortChannelArray& channel) { + } + virtual void workerObjectDestroyed() { + Release(); // Releases the reference held for worker object. + } // WebWorkerClient methods: virtual void postMessageToWorkerObject( const WebKit::WebString& message, - const WebKit::WebMessagePortChannelArray& channel); + const WebKit::WebMessagePortChannelArray& channel) { + } virtual void postExceptionToWorkerObject( const WebKit::WebString& error_message, int line_number, - const WebKit::WebString& source_url); + const WebKit::WebString& source_url) { + } virtual void postConsoleMessageToWorkerObject( int destination_id, int source_id, @@ -50,10 +60,13 @@ class TestWebWorker : public WebKit::WebWorker, int message_level, const WebKit::WebString& message, int line_number, - const WebKit::WebString& source_url); - virtual void confirmMessageFromWorkerObject(bool has_pending_activity); - virtual void reportPendingActivity(bool has_pending_activity); - virtual void workerContextDestroyed(); + const WebKit::WebString& source_url) { + } + virtual void confirmMessageFromWorkerObject(bool has_pending_activity) { } + virtual void reportPendingActivity(bool has_pending_activity) { } + virtual void workerContextDestroyed() { + Release(); // Releases the reference held for worker context object. + } virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client) { return NULL; } @@ -62,19 +75,9 @@ class TestWebWorker : public WebKit::WebWorker, } private: - friend class base::RefCounted<TestWebWorker>; - virtual ~TestWebWorker(); - - static void InvokeMainThreadMethod(void* param); - - WebKit::WebWorkerClient* webworkerclient_delegate_; - WebKit::WebWorker* webworker_impl_; - TestWebWorkerHelper* webworker_helper_; - std::vector<string16> queued_messages_; - DISALLOW_COPY_AND_ASSIGN(TestWebWorker); }; #endif -#endif // CHROME_TEST_WORKER_TEST_WEBWORKER_H_ +#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEB_WORKER_H_ diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 131e7cd..af0d5f8 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -52,7 +52,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" +#include "webkit/tools/test_shell/test_web_worker.h" #if defined(OS_WIN) // TODO(port): make these files work everywhere. @@ -567,7 +567,7 @@ WebPlugin* TestWebViewDelegate::createPlugin( WebWorker* TestWebViewDelegate::createWorker( WebFrame* frame, WebWorkerClient* client) { #if ENABLE(WORKERS) - return TestWebWorkerHelper::CreateWebWorker(client); + return new TestWebWorker(); #else return NULL; #endif diff --git a/webkit/tools/test_shell/test_webworker_helper.cc b/webkit/tools/test_shell/test_webworker_helper.cc deleted file mode 100644 index 9620c1e..0000000 --- a/webkit/tools/test_shell/test_webworker_helper.cc +++ /dev/null @@ -1,122 +0,0 @@ -// 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" - -#if defined(OS_MACOSX) -#include <dlfcn.h> -#endif - -#include "base/logging.h" -#include "base/file_util.h" -#include "base/path_service.h" -#include "webkit/api/public/WebKit.h" -#include "webkit/api/public/WebKitClient.h" - -using WebKit::WebWorker; -using WebKit::WebWorkerClient; - -static TestWebWorkerHelper* g_helper; - -WebWorker* TestWebWorkerHelper::CreateWebWorker(WebWorkerClient* client) { - if (!g_helper) - g_helper = new TestWebWorkerHelper(); - g_helper->worker_count_++; - return g_helper->CreateWebWorker_(client, g_helper); -} - -TestWebWorkerHelper::TestWebWorkerHelper() : -#if defined(OS_WIN) - module_(NULL), -#endif - CreateWebWorker_(NULL), - worker_count_(0) { - Load(); -} - -TestWebWorkerHelper::~TestWebWorkerHelper() { -} - -void TestWebWorkerHelper::DispatchToMainThread(void (*func)()) { - WebKit::webKitClient()->callOnMainThread(func); -} - -void TestWebWorkerHelper::Load() { - FilePath path; - PathService::Get(base::DIR_EXE, &path); - -#if defined(OS_WIN) - path = path.AppendASCII("test_worker.dll"); - - module_ = LoadLibrary(path.value().c_str()); - if (module_ == 0) - return; - - CreateWebWorker_ = reinterpret_cast<CreateWebWorkerFunc> - (GetProcAddress(module_, "CreateWebWorker")); - if (!CreateWebWorker_) { - FreeLibrary(module_); - module_ = 0; - } -#elif defined(OS_MACOSX) - path = path.AppendASCII("test_worker.dylib"); - - module_ = dlopen(path.value().c_str(), RTLD_NOW | RTLD_LOCAL); - if (!module_) - return; - - CreateWebWorker_ = reinterpret_cast<CreateWebWorkerFunc> - (dlsym(module_, "CreateWebWorker")); - if (!CreateWebWorker_) { - dlclose(module_); - module_ = 0; - } -#else - NOTIMPLEMENTED(); -#endif -} - -void TestWebWorkerHelper::Unload() { - DCHECK(worker_count_); - worker_count_--; - // Since this is called from DLL, delay the unloading until it can be - // invoked from EXE. - return WTF::callOnMainThread(UnloadHelper, this); -} - -WebKit::WebString TestWebWorkerHelper::DuplicateString( - const WebKit::WebString& string) { - return WebKit::WebString(string.data(), string.length()); -} - -void TestWebWorkerHelper::UnloadHelper(void* param) { - TestWebWorkerHelper* this_ptr = static_cast<TestWebWorkerHelper*>(param); - if (this_ptr->worker_count_) - return; - -#if defined(OS_WIN) - if (this_ptr->module_) { - FreeLibrary(this_ptr->module_); - this_ptr->module_ = 0; - } -#elif defined(OS_MACOSX) - if (this_ptr->module_) { - dlclose(this_ptr->module_); - this_ptr->module_ = 0; - this_ptr->CreateWebWorker_ = 0; - } -#else - NOTIMPLEMENTED(); -#endif - - delete this_ptr; - g_helper = NULL; -} diff --git a/webkit/tools/test_shell/test_webworker_helper.h b/webkit/tools/test_shell/test_webworker_helper.h deleted file mode 100644 index 62a9efa..0000000 --- a/webkit/tools/test_shell/test_webworker_helper.h +++ /dev/null @@ -1,61 +0,0 @@ -// 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 "webkit/api/public/WebString.h" - -#include <wtf/MainThread.h> - -class TestWebWorkerHelper; - -namespace WebKit { -class WebKitClient; -class WebWorker; -class WebWorkerClient; -} - -// Function to call in test_worker DLL. -typedef WebKit::WebWorker* (API_CALL *CreateWebWorkerFunc)( - WebKit::WebWorkerClient* webworker_client, - TestWebWorkerHelper* webworker_helper);; - -class TestWebWorkerHelper { - public: - static WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client); - - TestWebWorkerHelper(); - - virtual void DispatchToMainThread(void (*func)()); - virtual void Unload(); - - virtual WebKit::WebString DuplicateString(const WebKit::WebString& string); - - private: - ~TestWebWorkerHelper(); - void Load(); - static void UnloadHelper(void* param); - -#if defined(OS_WIN) - // TODO(port): Remove ifdefs when we have portable replacement for HMODULE. - HMODULE module_; -#elif defined(OS_MACOSX) - void* module_; -#endif - - CreateWebWorkerFunc CreateWebWorker_; - int worker_count_; - - DISALLOW_COPY_AND_ASSIGN(TestWebWorkerHelper); -}; - -#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBWORKER_HELPER_H__ diff --git a/webkit/tools/test_shell/test_worker/test_webworker.cc b/webkit/tools/test_shell/test_worker/test_webworker.cc deleted file mode 100644 index 7becc88..0000000 --- a/webkit/tools/test_shell/test_worker/test_webworker.cc +++ /dev/null @@ -1,124 +0,0 @@ -// 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" - -#if ENABLE(WORKERS) - -#include "webkit/tools/test_shell/test_worker/test_webworker.h" - -#include "base/compiler_specific.h" -#include "base/task.h" -#undef LOG -#include "webkit/glue/webworker_impl.h" -#include "webkit/tools/test_shell/test_webworker_helper.h" - -using WebKit::WebString; -using WebKit::WebURL; -using WebKit::WebWorker; -using WebKit::WebWorkerClient; - -TestWebWorker::TestWebWorker(WebWorkerClient* client, - TestWebWorkerHelper* webworker_helper) - : webworkerclient_delegate_(client), - webworker_impl_(NULL), - webworker_helper_(webworker_helper) { - AddRef(); // Adds the reference held for worker object. - AddRef(); // Adds the reference held for worker context object. -} - -TestWebWorker::~TestWebWorker() { - if (webworker_helper_) - webworker_helper_->Unload(); -} - -void TestWebWorker::startWorkerContext(const WebURL& script_url, - const WebString& user_agent, - const WebString& source_code) { - webworker_impl_ = new WebWorkerImpl(this); - - webworker_impl_->startWorkerContext(script_url, user_agent, source_code); - - WebKit::WebMessagePortChannelArray emptyArray; - for (size_t i = 0; i < queued_messages_.size(); ++i) - webworker_impl_->postMessageToWorkerContext(queued_messages_[i], emptyArray); - queued_messages_.clear(); -} - -void TestWebWorker::terminateWorkerContext() { - if (webworker_impl_) - webworker_impl_->terminateWorkerContext(); -} - -void TestWebWorker::postMessageToWorkerContext( - const WebString& message, - const WebKit::WebMessagePortChannelArray& channels) { - if (webworker_impl_) - webworker_impl_->postMessageToWorkerContext(message, channels); - else - queued_messages_.push_back(message); -} - -void TestWebWorker::workerObjectDestroyed() { - if (webworker_impl_) - webworker_impl_->workerObjectDestroyed(); - - webworkerclient_delegate_ = NULL; - Release(); // Releases the reference held for worker object. -} - -void TestWebWorker::postMessageToWorkerObject( - const WebString& message, - const WebKit::WebMessagePortChannelArray& channels) { - if (!webworkerclient_delegate_) - return; - // The string was created in the dll's memory space as a result of a postTask. - // If we pass it to test shell's memory space, it'll cause problems when GC - // occurs. So duplicate it from the test shell's memory space first. - webworkerclient_delegate_->postMessageToWorkerObject( - webworker_helper_->DuplicateString(message), channels); -} - -void TestWebWorker::postExceptionToWorkerObject(const WebString& error_message, - int line_number, - const WebString& source_url) { - if (webworkerclient_delegate_) - webworkerclient_delegate_->postExceptionToWorkerObject(error_message, - line_number, - source_url); -} - -void TestWebWorker::postConsoleMessageToWorkerObject( - int destination_id, - int source_id, - int message_type, - int message_level, - const WebString& message, - int line_number, - const WebString& source_url) { - if (webworkerclient_delegate_) - webworkerclient_delegate_->postConsoleMessageToWorkerObject( - destination_id, source_id, message_type, message_level, - message, line_number, source_url); -} - -void TestWebWorker::confirmMessageFromWorkerObject(bool has_pending_activity) { - if (webworkerclient_delegate_) - webworkerclient_delegate_->confirmMessageFromWorkerObject( - has_pending_activity); -} - -void TestWebWorker::reportPendingActivity(bool has_pending_activity) { - if (webworkerclient_delegate_) - webworkerclient_delegate_->reportPendingActivity(has_pending_activity); -} - -void TestWebWorker::workerContextDestroyed() { - webworker_impl_ = NULL; - if (webworkerclient_delegate_) - webworkerclient_delegate_->workerContextDestroyed(); - Release(); // Releases the reference held for worker context object. -} - -#endif diff --git a/webkit/tools/test_shell/test_worker/test_worker.def b/webkit/tools/test_shell/test_worker/test_worker.def deleted file mode 100644 index 7f6db18..0000000 --- a/webkit/tools/test_shell/test_worker/test_worker.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - CreateWebWorker @1 diff --git a/webkit/tools/test_shell/test_worker/test_worker.exp b/webkit/tools/test_shell/test_worker/test_worker.exp deleted file mode 100644 index 88f6ee1..0000000 --- a/webkit/tools/test_shell/test_worker/test_worker.exp +++ /dev/null @@ -1,2 +0,0 @@ -_CreateWebWorker - diff --git a/webkit/tools/test_shell/test_worker/test_worker_main.cc b/webkit/tools/test_shell/test_worker/test_worker_main.cc deleted file mode 100644 index 94c966d..0000000 --- a/webkit/tools/test_shell/test_worker/test_worker_main.cc +++ /dev/null @@ -1,252 +0,0 @@ -// 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" - -#undef LOG - -#include "base/at_exit.h" -#include "base/gfx/native_widget_types.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/scoped_ptr.h" -#include "base/string_util.h" -#include "googleurl/src/gurl.h" -#include "webkit/api/public/WebKit.h" -#include "webkit/api/public/WebString.h" -#include "webkit/glue/resource_loader_bridge.h" -#include "webkit/glue/webkit_glue.h" -#include "webkit/glue/webkitclient_impl.h" -#include "webkit/tools/test_shell/test_webworker_helper.h" -#include "webkit/tools/test_shell/test_worker/test_webworker.h" - -using WebKit::WebWorker; -using WebKit::WebWorkerClient; - -// Create a global AtExitManager so that our code can use code from base that -// uses Singletons, for example. We don't care about static constructors here. -static base::AtExitManager global_at_exit_manager; - -// Stub WebKit Client. -class WorkerWebKitClientImpl : public webkit_glue::WebKitClientImpl { - public: - explicit WorkerWebKitClientImpl(TestWebWorkerHelper* helper) - : helper_(helper) { } - - // WebKitClient methods: - virtual WebKit::WebClipboard* clipboard() { - NOTREACHED(); - return NULL; - } - - virtual WebKit::WebMimeRegistry* mimeRegistry() { - NOTREACHED(); - return NULL; - } - - virtual WebKit::WebSandboxSupport* sandboxSupport() { - NOTREACHED(); - return NULL; - } - - virtual bool sandboxEnabled() { - return true; - } - - virtual unsigned long long visitedLinkHash(const char* canonicalURL, - size_t length) { - NOTREACHED(); - return 0; - } - - virtual bool isLinkVisited(unsigned long long linkHash) { - NOTREACHED(); - return false; - } - - virtual WebKit::WebMessagePortChannel* createMessagePortChannel() { - return NULL; - } - - virtual void setCookies(const WebKit::WebURL& url, - const WebKit::WebURL& first_party_for_cookies, - const WebKit::WebString& value) { - NOTREACHED(); - } - - virtual WebKit::WebString cookies( - const WebKit::WebURL& url, - const WebKit::WebURL& first_party_for_cookies) { - NOTREACHED(); - return WebKit::WebString(); - } - - virtual void prefetchHostName(const WebKit::WebString&) { - NOTREACHED(); - } - - virtual bool getFileSize(const WebKit::WebString& path, long long& result) { - NOTREACHED(); - return false; - } - - virtual WebKit::WebString defaultLocale() { - NOTREACHED(); - return WebKit::WebString(); - } - - virtual void callOnMainThread(void (*func)()) { - helper_->DispatchToMainThread(func); - } - - virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( - const WebKit::WebString& path) { - NOTREACHED(); - return 0; - } - - virtual WebKit::WebStorageNamespace* createSessionStorageNamespace() { - NOTREACHED(); - return 0; - } - - private: - TestWebWorkerHelper* helper_; -}; - -// WebKit client used in DLL. -static scoped_ptr<WorkerWebKitClientImpl> webkit_client; - -#if defined(COMPILER_GCC) -#pragma GCC visibility push(default) -#endif -extern "C" { -// DLL entry points -WebWorker* API_CALL CreateWebWorker(WebWorkerClient* webworker_client, - TestWebWorkerHelper* webworker_helper) { - if (!WebKit::webKitClient()) { - webkit_client.reset(new WorkerWebKitClientImpl(webworker_helper)); - WebKit::initialize(webkit_client.get()); - } - -#if ENABLE(WORKERS) - return new TestWebWorker(webworker_client, webworker_helper); -#else - return NULL; -#endif -} -} // extern "C" - -// WebKit glue stub functions. -namespace webkit_glue { - -#if defined(COMPILER_GCC) -// GCC hides the class methods like this by default, even in the scope -// of the "#pragma visibility". Need the attribute. -__attribute__((visibility("default"))) -#endif -ResourceLoaderBridge* ResourceLoaderBridge::Create( - const std::string& method, - const GURL& url, - const GURL& first_party_for_cookies, - const GURL& referrer, - const std::string& frame_origin, - const std::string& main_frame_origin, - const std::string& headers, - int load_flags, - int requestor_pid, - ResourceType::Type request_type, - int appcache_host_id, - int routing_id) { - return NULL; -} - -string16 GetLocalizedString(int message_id) { - return EmptyString16(); -} - -base::StringPiece GetDataResource(int resource_id) { - return base::StringPiece(); -} - -void SetMediaPlayerAvailable(bool value) { -} - -bool IsMediaPlayerAvailable() { - return false; -} - -void PrecacheUrl(const char16* url, int url_length) { -} - -void AppendToLog(const char* file, int line, const char* msg) { - logging::LogMessage(file, line).stream() << msg; -} - -bool GetApplicationDirectory(FilePath* path) { - return PathService::Get(base::DIR_EXE, path); -} - -GURL GetInspectorURL() { - return GURL("test-shell-resource://inspector/inspector.html"); -} - -std::string GetUIResourceProtocol() { - return "test-shell-resource"; -} - -bool GetExeDirectory(FilePath* path) { - return PathService::Get(base::DIR_EXE, path); -} - -bool SpellCheckWord(const wchar_t* word, int word_len, - int* misspelling_start, int* misspelling_len) { - // Report all words being correctly spelled. - *misspelling_start = 0; - *misspelling_len = 0; - return true; -} - -void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { -} - -bool IsPluginRunningInRendererProcess() { - return false; -} - -bool GetPluginFinderURL(std::string* plugin_finder_url) { - return false; -} - -bool IsDefaultPluginEnabled() { - return false; -} - -bool FindProxyForUrl(const GURL& url, std::string* proxy_list) { - return false; -} - -std::wstring GetWebKitLocale() { - return L"en-US"; -} - -#if defined(OS_WIN) -HCURSOR LoadCursor(int cursor_id) { - return NULL; -} - -bool EnsureFontLoaded(HFONT font) { - return true; -} - -bool DownloadUrl(const std::string& url, HWND caller_window) { - return false; -} -#endif - -} // namespace webkit_glue - -#if defined(COMPILER_GCC) -#pragma GCC visibility pop -#endif |