diff options
author | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 22:17:18 +0000 |
---|---|---|
committer | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 22:17:18 +0000 |
commit | 471082e03e5a20b39035b0d0315a6a830f24f9c6 (patch) | |
tree | 55c9eae2a68a42ec9b46b55443e343c884bc4bea /webkit/support | |
parent | 6e0a21c22b2e195832ce189af3d0715d3d7fc01d (diff) | |
download | chromium_src-471082e03e5a20b39035b0d0315a6a830f24f9c6.zip chromium_src-471082e03e5a20b39035b0d0315a6a830f24f9c6.tar.gz chromium_src-471082e03e5a20b39035b0d0315a6a830f24f9c6.tar.bz2 |
Revert 83584 - Adding a way to run deferred tasks in WebKit unit-tests.
The MockURLLoader does not work with sub-resources as their
load is deferred. This CL makes it possible to run deferred
tasks so that such sub-resources can be loaded in the
unit-tests.
BUG=None
TEST=Make sure webkit unit-tests and DumpRenderTree still work.
Review URL: http://codereview.chromium.org/6882064
TBR=kbr@chromium.org
Review URL: http://codereview.chromium.org/6902176
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r-- | webkit/support/test_webkit_client.cc | 43 | ||||
-rw-r--r-- | webkit/support/test_webkit_client.h | 18 |
2 files changed, 2 insertions, 59 deletions
diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index bf80fed..48f3cef 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -6,7 +6,6 @@ #include "base/file_util.h" #include "base/memory/scoped_temp_dir.h" -#include "base/message_loop.h" #include "base/path_service.h" #include "base/metrics/stats_counters.h" #include "base/string_util.h" @@ -41,7 +40,6 @@ #include "webkit/glue/webkitclient_impl.h" #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" #include "webkit/support/simple_database_system.h" -#include "webkit/support/webkit_support.h" #include "webkit/support/weburl_loader_mock_factory.h" #include "webkit/tools/test_shell/mock_webclipboard_impl.h" #include "webkit/tools/test_shell/simple_appcache_system.h" @@ -63,18 +61,8 @@ using WebKit::WebScriptController; -class TestWebKitClient::FireTimerTask : public Task { - public: - virtual void Run() { - TestWebKitClient* client = - static_cast<TestWebKitClient*>(webkit_support::GetWebKitClient()); - client->fireSharedTimer(); - } -}; - TestWebKitClient::TestWebKitClient(bool unit_test_mode) - : unit_test_mode_(unit_test_mode), - timer_function_(NULL) { + : unit_test_mode_(unit_test_mode) { v8::V8::SetCounterFunction(base::StatsTable::FindLocation); WebKit::initialize(this); @@ -365,32 +353,3 @@ WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() { WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() { return new webkit::gpu::WebGraphicsContext3DInProcessImpl(); } - -void TestWebKitClient::setSharedTimerFiredFunction( - SharedTimerFunction timer_function) { - timer_function_ = timer_function; -} - -void TestWebKitClient::setSharedTimerFireTime(double fire_time) { - if (!timer_function_) - return; - - // Copied from webkitclient_impl.cc. - int64 interval = static_cast<int64>( - ceil((fire_time - currentTime()) * base::Time::kMicrosecondsPerSecond)); - if (interval < 0) - interval = 0; - - MessageLoop::current()->PostDelayedTask( - FROM_HERE, new FireTimerTask(), interval); -} - -void TestWebKitClient::stopSharedTimer() { - // TODO(jcivelli): somehow use the code from webkitclient_impl so we can stop - // the shared timer. -} - -void TestWebKitClient::fireSharedTimer() { - if (timer_function_) - (*timer_function_)(); -} diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h index 9d71fe5..8867864 100644 --- a/webkit/support/test_webkit_client.h +++ b/webkit/support/test_webkit_client.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -78,14 +78,6 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { #endif virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); - - // Note that we provide only minimal support for the shared timer, notably - // stopShareTimer does nothing. - virtual void setSharedTimerFiredFunction( - WebKit::WebKitClient::SharedTimerFunction timer_function); - virtual void setSharedTimerFireTime(double fire_time); - virtual void stopSharedTimer(); - virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(); WebURLLoaderMockFactory* url_loader_factory() { @@ -97,13 +89,6 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { } private: - class FireTimerTask; - friend class FireTimerTask; - - // This is called by the FireTimeTask to notify WebKit that their timer should - // fire. - void fireSharedTimer(); - TestShellWebMimeRegistryImpl mime_registry_; MockWebClipboardImpl mock_clipboard_; webkit_glue::WebFileUtilitiesImpl file_utilities_; @@ -116,7 +101,6 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { ScopedTempDir file_system_root_; WebURLLoaderMockFactory url_loader_factory_; bool unit_test_mode_; - WebKit::WebKitClient::SharedTimerFunction timer_function_; #if defined(OS_WIN) || defined(OS_MACOSX) WebKit::WebThemeEngine* active_theme_engine_; |