Chromium Code Reviews| 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; |