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" | |
15 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
16 #include "content/public/browser/browser_main_runner.h" | 15 #include "content/public/browser/browser_main_runner.h" |
17 #include "content/shell/shell_switches.h" | 16 #include "content/shell/shell_switches.h" |
18 #include "content/shell/webkit_test_runner_host.h" | 17 #include "content/shell/webkit_test_runner_host.h" |
19 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
20 #include "webkit/support/webkit_support.h" | 19 #include "webkit/support/webkit_support.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 GURL GetURLForLayoutTest(const char* test_name, | 23 GURL GetURLForLayoutTest(const char* test_name, |
(...skipping 13 matching lines...) Expand all Loading... |
38 pixel_hash = pixel_switch.substr(separator_position + 1); | 37 pixel_hash = pixel_switch.substr(separator_position + 1); |
39 pixel_switch.erase(separator_position); | 38 pixel_switch.erase(separator_position); |
40 } | 39 } |
41 if (enable_pixel_dumping) { | 40 if (enable_pixel_dumping) { |
42 *enable_pixel_dumping = | 41 *enable_pixel_dumping = |
43 (pixel_switch == "--pixel-test" || pixel_switch == "-p"); | 42 (pixel_switch == "--pixel-test" || pixel_switch == "-p"); |
44 } | 43 } |
45 if (expected_pixel_hash) | 44 if (expected_pixel_hash) |
46 *expected_pixel_hash = pixel_hash; | 45 *expected_pixel_hash = pixel_hash; |
47 GURL test_url(path_or_url); | 46 GURL test_url(path_or_url); |
48 if (!(test_url.is_valid() && test_url.has_scheme())) { | 47 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); | |
52 test_url = net::FilePathToFileURL(FilePath(path_or_url)); | 48 test_url = net::FilePathToFileURL(FilePath(path_or_url)); |
53 #else | |
54 test_url = net::FilePathToFileURL(FilePath(path_or_url)); | |
55 #endif | |
56 } | |
57 FilePath local_path; | 49 FilePath local_path; |
58 if (net::FileURLToFilePath(test_url, &local_path)) { | 50 if (net::FileURLToFilePath(test_url, &local_path)) { |
59 // We're outside of the message loop here, and this is a test. | 51 // We're outside of the message loop here, and this is a test. |
60 base::ThreadRestrictions::ScopedAllowIO allow_io; | 52 base::ThreadRestrictions::ScopedAllowIO allow_io; |
61 file_util::SetCurrentDirectory(local_path.DirName()); | 53 file_util::SetCurrentDirectory(local_path.DirName()); |
62 } | 54 } |
63 return test_url; | 55 return test_url; |
64 } | 56 } |
65 | 57 |
66 } // namespace | 58 } // namespace |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 109 } |
118 exit_code = 0; | 110 exit_code = 0; |
119 } else { | 111 } else { |
120 exit_code = main_runner_->Run(); | 112 exit_code = main_runner_->Run(); |
121 } | 113 } |
122 | 114 |
123 main_runner_->Shutdown(); | 115 main_runner_->Shutdown(); |
124 | 116 |
125 return exit_code; | 117 return exit_code; |
126 } | 118 } |
OLD | NEW |