diff options
author | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 20:46:34 +0000 |
---|---|---|
committer | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 20:46:34 +0000 |
commit | 24d346789194a6c0b69fd75838b05f8157d71c7c (patch) | |
tree | 5ad4a802b0d4709a40ce9b8a43120fdd673497f1 /webkit/support/test_webkit_client.h | |
parent | 91d91fac1db8f2f163e4873bd93a65f4fada37ee (diff) | |
download | chromium_src-24d346789194a6c0b69fd75838b05f8157d71c7c.zip chromium_src-24d346789194a6c0b69fd75838b05f8157d71c7c.tar.gz chromium_src-24d346789194a6c0b69fd75838b05f8157d71c7c.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83584 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/test_webkit_client.h')
-rw-r--r-- | webkit/support/test_webkit_client.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h index 8867864..9d71fe5 100644 --- a/webkit/support/test_webkit_client.h +++ b/webkit/support/test_webkit_client.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,6 +78,14 @@ 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() { @@ -89,6 +97,13 @@ 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_; @@ -101,6 +116,7 @@ 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_; |