OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/shell_browser_main.h" | 5 #include "content/shell/shell_browser_main.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/sys_string_conversions.h" |
14 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
15 #include "content/public/browser/browser_main_runner.h" | 16 #include "content/public/browser/browser_main_runner.h" |
16 #include "content/shell/shell_switches.h" | 17 #include "content/shell/shell_switches.h" |
17 #include "content/shell/webkit_test_runner_host.h" | 18 #include "content/shell/webkit_test_runner_host.h" |
18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
19 #include "webkit/support/webkit_support.h" | 20 #include "webkit/support/webkit_support.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 GURL GetURLForLayoutTest(const char* test_name, | 24 GURL GetURLForLayoutTest(const char* test_name, |
(...skipping 13 matching lines...) Expand all Loading... |
37 pixel_hash = pixel_switch.substr(separator_position + 1); | 38 pixel_hash = pixel_switch.substr(separator_position + 1); |
38 pixel_switch.erase(separator_position); | 39 pixel_switch.erase(separator_position); |
39 } | 40 } |
40 if (enable_pixel_dumping) { | 41 if (enable_pixel_dumping) { |
41 *enable_pixel_dumping = | 42 *enable_pixel_dumping = |
42 (pixel_switch == "--pixel-test" || pixel_switch == "-p"); | 43 (pixel_switch == "--pixel-test" || pixel_switch == "-p"); |
43 } | 44 } |
44 if (expected_pixel_hash) | 45 if (expected_pixel_hash) |
45 *expected_pixel_hash = pixel_hash; | 46 *expected_pixel_hash = pixel_hash; |
46 GURL test_url(path_or_url); | 47 GURL test_url(path_or_url); |
47 if (!(test_url.is_valid() && test_url.has_scheme())) | 48 if (!(test_url.is_valid() && test_url.has_scheme())) { |
| 49 #if defined(OS_WIN) |
| 50 std::wstring wide_path_or_url = |
| 51 base::SysNativeMBToWide(path_or_url); |
48 test_url = net::FilePathToFileURL(FilePath(path_or_url)); | 52 test_url = net::FilePathToFileURL(FilePath(path_or_url)); |
| 53 #else |
| 54 test_url = net::FilePathToFileURL(FilePath(path_or_url)); |
| 55 #endif |
| 56 } |
49 FilePath local_path; | 57 FilePath local_path; |
50 if (net::FileURLToFilePath(test_url, &local_path)) { | 58 if (net::FileURLToFilePath(test_url, &local_path)) { |
51 // We're outside of the message loop here, and this is a test. | 59 // We're outside of the message loop here, and this is a test. |
52 base::ThreadRestrictions::ScopedAllowIO allow_io; | 60 base::ThreadRestrictions::ScopedAllowIO allow_io; |
53 file_util::SetCurrentDirectory(local_path.DirName()); | 61 file_util::SetCurrentDirectory(local_path.DirName()); |
54 } | 62 } |
55 return test_url; | 63 return test_url; |
56 } | 64 } |
57 | 65 |
58 } // namespace | 66 } // namespace |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 117 } |
110 exit_code = 0; | 118 exit_code = 0; |
111 } else { | 119 } else { |
112 exit_code = main_runner_->Run(); | 120 exit_code = main_runner_->Run(); |
113 } | 121 } |
114 | 122 |
115 main_runner_->Shutdown(); | 123 main_runner_->Shutdown(); |
116 | 124 |
117 return exit_code; | 125 return exit_code; |
118 } | 126 } |
OLD | NEW |