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

Side by Side Diff: content/shell/browser/layout_test/layout_test_browser_main.cc

Issue 1128633002: content: Rename WebKitTestController to BlinkTestController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang-format Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/layout_test/layout_test_browser_main.h" 5 #include "content/shell/browser/layout_test/layout_test_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/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "content/public/browser/browser_main_runner.h" 19 #include "content/public/browser/browser_main_runner.h"
20 #include "content/public/common/url_constants.h" 20 #include "content/public/common/url_constants.h"
21 #include "content/shell/browser/blink_test_controller.h"
21 #include "content/shell/browser/shell.h" 22 #include "content/shell/browser/shell.h"
22 #include "content/shell/browser/webkit_test_controller.h"
23 #include "content/shell/common/shell_switches.h" 23 #include "content/shell/common/shell_switches.h"
24 #include "content/shell/common/webkit_test_helpers.h" 24 #include "content/shell/common/webkit_test_helpers.h"
25 #include "net/base/filename_util.h" 25 #include "net/base/filename_util.h"
26 26
27 #if defined(OS_ANDROID) 27 #if defined(OS_ANDROID)
28 #include "base/run_loop.h" 28 #include "base/run_loop.h"
29 #include "content/shell/browser/layout_test/layout_test_android.h" 29 #include "content/shell/browser/layout_test/layout_test_android.h"
30 #endif 30 #endif
31 31
32 namespace { 32 namespace {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (test_string.empty()) 113 if (test_string.empty())
114 return true; 114 return true;
115 if (test_string == "QUIT") 115 if (test_string == "QUIT")
116 return false; 116 return false;
117 117
118 bool enable_pixel_dumps; 118 bool enable_pixel_dumps;
119 std::string pixel_hash; 119 std::string pixel_hash;
120 base::FilePath cwd; 120 base::FilePath cwd;
121 GURL test_url = 121 GURL test_url =
122 GetURLForLayoutTest(test_string, &cwd, &enable_pixel_dumps, &pixel_hash); 122 GetURLForLayoutTest(test_string, &cwd, &enable_pixel_dumps, &pixel_hash);
123 if (!content::WebKitTestController::Get()->PrepareForLayoutTest( 123 if (!content::BlinkTestController::Get()->PrepareForLayoutTest(
124 test_url, cwd, enable_pixel_dumps, pixel_hash)) { 124 test_url, cwd, enable_pixel_dumps, pixel_hash)) {
125 return false; 125 return false;
126 } 126 }
127 127
128 *ran_at_least_once = true; 128 *ran_at_least_once = true;
129 #if defined(OS_ANDROID) 129 #if defined(OS_ANDROID)
130 // The message loop on Android is provided by the system, and does not 130 // The message loop on Android is provided by the system, and does not
131 // offer a blocking Run() method. For layout tests, use a nested loop 131 // offer a blocking Run() method. For layout tests, use a nested loop
132 // together with a base::RunLoop so it can block until a QuitClosure. 132 // together with a base::RunLoop so it can block until a QuitClosure.
133 base::RunLoop run_loop; 133 base::RunLoop run_loop;
134 run_loop.Run(); 134 run_loop.Run();
135 #else 135 #else
136 main_runner->Run(); 136 main_runner->Run();
137 #endif 137 #endif
138 138
139 if (!content::WebKitTestController::Get()->ResetAfterLayoutTest()) 139 if (!content::BlinkTestController::Get()->ResetAfterLayoutTest())
140 return false; 140 return false;
141 141
142 #if defined(OS_ANDROID) 142 #if defined(OS_ANDROID)
143 // There will be left-over tasks in the queue for Android because the 143 // There will be left-over tasks in the queue for Android because the
144 // main window is being destroyed. Run them before starting the next test. 144 // main window is being destroyed. Run them before starting the next test.
145 base::MessageLoop::current()->RunUntilIdle(); 145 base::MessageLoop::current()->RunUntilIdle();
146 #endif 146 #endif
147 return true; 147 return true;
148 } 148 }
149 149
150 int RunTests(const scoped_ptr<content::BrowserMainRunner>& main_runner) { 150 int RunTests(const scoped_ptr<content::BrowserMainRunner>& main_runner) {
151 content::WebKitTestController test_controller; 151 content::BlinkTestController test_controller;
152 { 152 {
153 // We're outside of the message loop here, and this is a test. 153 // We're outside of the message loop here, and this is a test.
154 base::ThreadRestrictions::ScopedAllowIO allow_io; 154 base::ThreadRestrictions::ScopedAllowIO allow_io;
155 base::FilePath temp_path; 155 base::FilePath temp_path;
156 base::GetTempDir(&temp_path); 156 base::GetTempDir(&temp_path);
157 test_controller.SetTempPath(temp_path); 157 test_controller.SetTempPath(temp_path);
158 } 158 }
159 std::string test_string; 159 std::string test_string;
160 base::CommandLine::StringVector args = 160 base::CommandLine::StringVector args =
161 base::CommandLine::ForCurrentProcess()->GetArgs(); 161 base::CommandLine::ForCurrentProcess()->GetArgs();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 exit_code = RunTests(main_runner); 223 exit_code = RunTests(main_runner);
224 224
225 #if !defined(OS_ANDROID) 225 #if !defined(OS_ANDROID)
226 main_runner->Shutdown(); 226 main_runner->Shutdown();
227 #endif 227 #endif
228 228
229 return exit_code; 229 return exit_code;
230 } 230 }
OLDNEW
« no previous file with comments | « content/shell/browser/blink_test_controller.cc ('k') | content/shell/browser/layout_test/layout_test_devtools_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698