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

Unified Diff: content/shell/webkit_test_runner.cc

Issue 12282041: [content shell] implement pathToLocalResource (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
« no previous file with comments | « content/shell/webkit_test_runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/webkit_test_runner.cc
diff --git a/content/shell/webkit_test_runner.cc b/content/shell/webkit_test_runner.cc
index 3f988e85182b8dadf80ca51f7104840298ff6414..699d011126716934b2e241bc7ede5e58a86c8c9a 100644
--- a/content/shell/webkit_test_runner.cc
+++ b/content/shell/webkit_test_runner.cc
@@ -4,6 +4,8 @@
#include "content/shell/webkit_test_runner.h"
+#include <algorithm>
+#include <cctype>
#include <clocale>
#include <cmath>
@@ -304,9 +306,26 @@ void WebKitTestRunner::setAcceptAllCookies(bool accept) {
}
std::string WebKitTestRunner::pathToLocalResource(const std::string& resource) {
- Send(new ShellViewHostMsg_NotImplemented(
- routing_id(), "WebKitTestRunner", "pathToLocalResource"));
- return std::string();
+#if defined(OS_WIN)
+ if (resource.find("/tmp/")) {
Nico 2013/02/19 16:02:53 .find("/tmp/") == 0? (or indexof() instead of fin
jochen (gone - plz use gerrit) 2013/02/20 09:06:13 Done.
+ // We want a temp file.
+ const unsigned kTempPrefixLength = 5;
Nico 2013/02/19 16:02:53 strlen("/tmp") instead of 5
jochen (gone - plz use gerrit) 2013/02/20 09:06:13 Done.
+ GURL base_url = net::FilePathToFileURL(temp_path_);
+ return base_url.Resolve(resource.substr(kTempPrefixLength)).spec();
Nico 2013/02/19 15:51:50 Hm, is there code for this somewhere else already?
jochen (gone - plz use gerrit) 2013/02/20 09:06:13 nope
+ }
+#endif
+
+ // Some layout tests use file://// which we resolve as a UNC path. Normalize
+ // them to just file:///.
+ std::string lower_url = resource;
+ std::string result = resource;
+ std::transform(
+ lower_url.begin(), lower_url.end(), lower_url.begin(), tolower);
Nico 2013/02/19 16:02:53 StringToLowerASCII?
+ while (!lower_url.find("file:////")) {
Nico 2013/02/19 16:02:53 Probably simpler if you create a new temporary eac
jochen (gone - plz use gerrit) 2013/02/20 09:06:13 Done.
+ result = result.substr(0, 8) + result.substr(9);
+ lower_url = lower_url.substr(0, 8) + lower_url.substr(9);
+ }
+ return rewriteLayoutTestsURL(result).spec();
}
void WebKitTestRunner::setLocale(const std::string& locale) {
@@ -564,6 +583,7 @@ void WebKitTestRunner::CaptureDump() {
void WebKitTestRunner::OnSetTestConfiguration(
const ShellViewMsg_SetTestConfiguration_Params& params) {
current_working_directory_ = params.current_working_directory;
+ temp_path_ = params.temp_path;
enable_pixel_dumping_ = params.enable_pixel_dumping;
layout_test_timeout_ = params.layout_test_timeout;
allow_external_pages_ = params.allow_external_pages;
« no previous file with comments | « content/shell/webkit_test_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698