Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: webkit/support/test_webkit_platform_support.cc

Issue 12220091: Add implementations of WebKit::Platform testing APIs to TestWebKitPlatformSupport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/support/test_webkit_platform_support.cc
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index 750b32b4886e71a82250f797b75d801b95f6d346..c158edb532154fb0c2288ab0d9f8f49ca2af3f93 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -611,3 +611,52 @@ WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve(
// Caller will retain and release.
return new WebGestureCurveMock(velocity, cumulative_scroll);
}
+
+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::getWebKitRootDir() {
darin (slow to review) 2013/02/10 05:07:03 this looks like a copy of GetWebKitRootDirFilePath
+ base::FilePath basePath;
+ PathService::Get(base::DIR_SOURCE_ROOT, &basePath);
+ if (file_util::PathExists(
+ basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) {
+ // We're in a WebKit-in-chrome checkout.
+ basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit"));
+ } else if (file_util::PathExists(
+ basePath.Append(FILE_PATH_LITERAL("chromium")))) {
+ // We're in a WebKit-only checkout on Windows.
+ basePath = basePath.Append(FILE_PATH_LITERAL("../.."));
+ } else if (file_util::PathExists(
+ basePath.Append(FILE_PATH_LITERAL("webkit/support")))) {
+ // We're in a WebKit-only/xcodebuild checkout on Mac
+ basePath = basePath.Append(FILE_PATH_LITERAL("../../.."));
+ }
+ CHECK(file_util::AbsolutePath(&basePath));
+ std::string path_ascii = basePath.MaybeAsASCII();
+ CHECK(!path_ascii.empty());
+ return WebKit::WebString::fromUTF8(path_ascii.c_str());
+}
+

Powered by Google App Engine
This is Rietveld 408576698