diff options
author | jcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 22:16:24 +0000 |
---|---|---|
committer | jcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 22:16:24 +0000 |
commit | bb07d7a8169743e3992e9f5f0baa82a2aa4aa2dc (patch) | |
tree | 3d311e95a01257c5c45974c589ebe3be06a39b1c /webkit/support/test_webkit_client.h | |
parent | 4caa7300f49f5f0d30c8880bacf14a064fed51d5 (diff) | |
download | chromium_src-bb07d7a8169743e3992e9f5f0baa82a2aa4aa2dc.zip chromium_src-bb07d7a8169743e3992e9f5f0baa82a2aa4aa2dc.tar.gz chromium_src-bb07d7a8169743e3992e9f5f0baa82a2aa4aa2dc.tar.bz2 |
Making webkit_support usable in WebKit unit-tests.
Adding a way to generate custom WebURLLoader (so unit-tests can mock resource loading).
BUG=None
TEST=DumpRenderTree should work.
Review URL: http://codereview.chromium.org/2094017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/test_webkit_client.h')
-rw-r--r-- | webkit/support/test_webkit_client.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h index 3e106a9..7a2a052 100644 --- a/webkit/support/test_webkit_client.h +++ b/webkit/support/test_webkit_client.h @@ -13,6 +13,14 @@ #include "webkit/tools/test_shell/simple_webcookiejar_impl.h" #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" +class WebURLLoaderFactory { + public: + virtual WebKit::WebURLLoader* createURLLoader() = 0; + + protected: + virtual ~WebURLLoaderFactory() {} +}; + // An implementation of WebKitClient for tests. class TestWebKitClient : public webkit_glue::WebKitClientImpl { public: @@ -38,6 +46,7 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { virtual bool isLinkVisited(unsigned long long linkHash); virtual WebKit::WebMessagePortChannel* createMessagePortChannel(); virtual void prefetchHostName(const WebKit::WebString&); + virtual WebKit::WebURLLoader* createURLLoader(); virtual WebKit::WebData loadResource(const char* name); virtual WebKit::WebString defaultLocale(); virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( @@ -56,6 +65,13 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository(); virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(); + // Sets the factory used to create WebURLLoader instances. + // The caller owns the WebURLLoaderFactory and is responsible for calling this + // method again with NULL when it's done. + void set_url_loader_factory(WebURLLoaderFactory* url_loader_factory) { + url_loader_factory_ = url_loader_factory; + } + private: TestShellWebMimeRegistryImpl mime_registry_; MockWebClipboardImpl mock_clipboard_; @@ -65,6 +81,11 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl { SimpleDatabaseSystem database_system_; SimpleWebCookieJarImpl cookie_jar_; + // Used to create WebURLLoader. + // If NULL, the class defers to webkit_glue::WebKitClientImpl for creating the + // WebURLLoader. + WebURLLoaderFactory* url_loader_factory_; + #if defined(OS_WIN) WebKit::WebThemeEngine* active_theme_engine_; #endif |