diff options
-rw-r--r-- | webkit/support/test_webkit_platform_support.cc | 37 | ||||
-rw-r--r-- | webkit/support/test_webkit_platform_support.h | 23 |
2 files changed, 60 insertions, 0 deletions
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index d08108b5..37afb4c 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -544,3 +544,40 @@ WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve( // Caller will retain and release. return new WebGestureCurveMock(velocity, cumulative_scroll); } + +#if HAVE_WEBUNITTESTSUPPORT +WebKit::WebUnitTestSupport* TestWebKitPlatformSupport::unitTestSupport() { + return this; +} +#endif + +void TestWebKitPlatformSupport::registerMockedURL( + const WebKit::WebURL& url, + const WebKit::WebURLResponse& response, + const WebKit::WebString& file_path) { + url_loader_factory_.RegisterURL(url, response, file_path); +} + +void TestWebKitPlatformSupport::registerMockedErrorURL( + const WebKit::WebURL& url, + const WebKit::WebURLResponse& response, + const WebKit::WebURLError& error) { + url_loader_factory_.RegisterErrorURL(url, response, error); +} + +void TestWebKitPlatformSupport::unregisterMockedURL(const WebKit::WebURL& url) { + url_loader_factory_.UnregisterURL(url); +} + +void TestWebKitPlatformSupport::unregisterAllMockedURLs() { + url_loader_factory_.UnregisterAllURLs(); +} + +void TestWebKitPlatformSupport::serveAsynchronousMockedRequests() { + url_loader_factory_.ServeAsynchronousRequests(); +} + +WebKit::WebString TestWebKitPlatformSupport::webKitRootDir() { + return webkit_support::GetWebKitRootDir(); +} + diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h index bb92e61..d55a070 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -19,6 +19,10 @@ #include "webkit/tools/test_shell/simple_webcookiejar_impl.h" #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" +#if HAVE_WEBUNITTESTSUPPORT +#include "third_party/WebKit/Source/Platform/chromium/public/WebUnitTestSupport.h" +#endif + class TestShellWebBlobRegistryImpl; namespace WebKit { @@ -29,6 +33,9 @@ typedef struct _HyphenDict HyphenDict; // An implementation of WebKitPlatformSupport for tests. class TestWebKitPlatformSupport : +#if HAVE_WEBUNITTESTSUPPORT + public NON_EXPORTED_BASE(WebKit::WebUnitTestSupport), +#endif public webkit_glue::WebKitPlatformSupportImpl { public: TestWebKitPlatformSupport(bool unit_test_mode, @@ -134,6 +141,22 @@ class TestWebKitPlatformSupport : const WebKit::WebFloatPoint& velocity, const WebKit::WebSize& cumulative_scroll); +#if HAVE_WEBUNITTESTSUPPORT + virtual WebKit::WebUnitTestSupport* unitTestSupport(); +#endif + + // WebUnitTestSupport implementation + virtual void registerMockedURL(const WebKit::WebURL& url, + const WebKit::WebURLResponse& response, + const WebKit::WebString& filePath); + virtual void registerMockedErrorURL(const WebKit::WebURL& url, + const WebKit::WebURLResponse& response, + const WebKit::WebURLError& error); + virtual void unregisterMockedURL(const WebKit::WebURL& url); + virtual void unregisterAllMockedURLs(); + virtual void serveAsynchronousMockedRequests(); + virtual WebKit::WebString webKitRootDir(); + private: TestShellWebMimeRegistryImpl mime_registry_; MockWebClipboardImpl mock_clipboard_; |