From 3d56c24f0ab43d2b85986c4d6c17543b9a5cfcf2 Mon Sep 17 00:00:00 2001 From: "tkent@google.com" Date: Thu, 1 Jul 2010 06:08:27 +0000 Subject: * Implement WebPluginPageDelete::GetCookieJar() * Do not use WebURLLoaderMock for DRT Unfortunately, r50382 (adding WebURLLoader mock) broke some plugin tests. - WebPluginImpl::InitiateHTTPRequest() stores a mocked WebURLLoader to clients_. - WebURLLoaderMock delegates some operations to its internal WebURLLoader. - WebPluginImpl::GetClientInfoFromLoader(WebURLLoader*) compares the specified pointer (non-mocked) to stored loader pointers (mocked). TEST=Covered by LayoutTests BUG=none Review URL: http://codereview.chromium.org/2834031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51345 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/support/test_webkit_client.cc | 5 ++++- webkit/support/test_webkit_client.h | 3 ++- webkit/support/test_webplugin_page_delegate.h | 4 +++- webkit/support/webkit_support.cc | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'webkit') diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index 0959383..dc93685 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -52,7 +52,8 @@ using WebKit::WebScriptController; -TestWebKitClient::TestWebKitClient() { +TestWebKitClient::TestWebKitClient(bool unit_test_mode) + : unit_test_mode_(unit_test_mode) { v8::V8::SetCounterFunction(StatsTable::FindLocation); WebKit::initialize(this); @@ -194,6 +195,8 @@ void TestWebKitClient::prefetchHostName(const WebKit::WebString&) { } WebKit::WebURLLoader* TestWebKitClient::createURLLoader() { + if (!unit_test_mode_) + return webkit_glue::WebKitClientImpl::createURLLoader(); return url_loader_factory_.CreateURLLoader( webkit_glue::WebKitClientImpl::createURLLoader()); } diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h index c1415ab..6a51ec4 100644 --- a/webkit/support/test_webkit_client.h +++ b/webkit/support/test_webkit_client.h @@ -17,7 +17,7 @@ // An implementation of WebKitClient for tests. class TestWebKitClient : public webkit_glue::WebKitClientImpl { public: - explicit TestWebKitClient(); + explicit TestWebKitClient(bool unit_test_mode); virtual ~TestWebKitClient(); virtual WebKit::WebMimeRegistry* mimeRegistry(); @@ -71,6 +71,7 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { SimpleDatabaseSystem database_system_; SimpleWebCookieJarImpl cookie_jar_; WebURLLoaderMockFactory url_loader_factory_; + bool unit_test_mode_; #if defined(OS_WIN) WebKit::WebThemeEngine* active_theme_engine_; diff --git a/webkit/support/test_webplugin_page_delegate.h b/webkit/support/test_webplugin_page_delegate.h index 05d4728..95f2b4a 100644 --- a/webkit/support/test_webplugin_page_delegate.h +++ b/webkit/support/test_webplugin_page_delegate.h @@ -34,7 +34,9 @@ class TestWebPluginPageDelegate : public webkit_glue::WebPluginPageDelegate { const gfx::Size& size, const std::string& json_arguments, std::string* json_retval) {} - virtual WebKit::WebCookieJar* GetCookieJar() { return NULL; } + virtual WebKit::WebCookieJar* GetCookieJar() { + return WebKit::webKitClient()->cookieJar(); + } }; } // namespace webkit_support diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index f2ff347..d44d390 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -56,7 +56,7 @@ class TestEnvironment { at_exit_manager_.reset(new base::AtExitManager); main_message_loop_.reset(new MessageLoopForUI); // TestWebKitClient must be instantiated after the MessageLoopForUI. - webkit_client_.reset(new TestWebKitClient); + webkit_client_.reset(new TestWebKitClient(unit_test_mode)); } ~TestEnvironment() { -- cgit v1.1