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

Side by Side Diff: content/shell/webkit_test_runner_host.cc

Issue 11416177: [content shell] change how the main render view is picked for layout tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « content/shell/webkit_test_runner_host.h ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/webkit_test_runner_host.h" 5 #include "content/shell/webkit_test_runner_host.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_util.h" 10 #include "base/file_util.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 printer_->PrintTextHeader(); 157 printer_->PrintTextHeader();
158 content::ShellBrowserContext* browser_context = 158 content::ShellBrowserContext* browser_context =
159 static_cast<content::ShellContentBrowserClient*>( 159 static_cast<content::ShellContentBrowserClient*>(
160 content::GetContentClient()->browser())->browser_context(); 160 content::GetContentClient()->browser())->browser_context();
161 main_window_ = content::Shell::CreateNewWindow( 161 main_window_ = content::Shell::CreateNewWindow(
162 browser_context, 162 browser_context,
163 test_url, 163 test_url,
164 NULL, 164 NULL,
165 MSG_ROUTING_NONE, 165 MSG_ROUTING_NONE,
166 NULL); 166 NULL);
167 did_set_as_main_window_ = false;
168 Observe(main_window_->web_contents()); 167 Observe(main_window_->web_contents());
169 return true; 168 return true;
170 } 169 }
171 170
172 bool WebKitTestController::ResetAfterLayoutTest() { 171 bool WebKitTestController::ResetAfterLayoutTest() {
173 DCHECK(CalledOnValidThread()); 172 DCHECK(CalledOnValidThread());
174 printer_->PrintTextFooter(); 173 printer_->PrintTextFooter();
175 printer_->PrintImageFooter(); 174 printer_->PrintImageFooter();
176 enable_pixel_dumping_ = false; 175 enable_pixel_dumping_ = false;
177 expected_pixel_hash_.clear(); 176 expected_pixel_hash_.clear();
178 captured_dump_ = false; 177 captured_dump_ = false;
179 dump_as_text_ = false; 178 dump_as_text_ = false;
180 dump_child_frames_ = false; 179 dump_child_frames_ = false;
181 is_printing_ = false; 180 is_printing_ = false;
182 should_stay_on_page_after_handling_before_unload_ = false; 181 should_stay_on_page_after_handling_before_unload_ = false;
183 wait_until_done_ = false; 182 wait_until_done_ = false;
184 did_set_as_main_window_ = false;
185 watchdog_.Cancel(); 183 watchdog_.Cancel();
186 if (main_window_) { 184 if (main_window_) {
187 Observe(NULL); 185 Observe(NULL);
188 main_window_ = NULL; 186 main_window_ = NULL;
189 } 187 }
190 Shell::CloseAllWindows(); 188 Shell::CloseAllWindows();
191 Send(new ShellViewMsg_ResetAll); 189 Send(new ShellViewMsg_ResetAll);
192 return true; 190 return true;
193 } 191 }
194 192
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 IPC_MESSAGE_UNHANDLED(handled = false) 234 IPC_MESSAGE_UNHANDLED(handled = false)
237 IPC_END_MESSAGE_MAP() 235 IPC_END_MESSAGE_MAP()
238 236
239 return handled; 237 return handled;
240 } 238 }
241 239
242 void WebKitTestController::PluginCrashed(const FilePath& plugin_path) { 240 void WebKitTestController::PluginCrashed(const FilePath& plugin_path) {
243 printer_->AddErrorMessage("#CRASHED - plugin"); 241 printer_->AddErrorMessage("#CRASHED - plugin");
244 } 242 }
245 243
246 void WebKitTestController::RenderViewReady() { 244 void WebKitTestController::RenderViewCreated(RenderViewHost* render_view_host) {
247 RenderViewHost* render_view_host =
248 main_window_->web_contents()->GetRenderViewHost();
249 render_view_host->Send(new ShellViewMsg_SetCurrentWorkingDirectory( 245 render_view_host->Send(new ShellViewMsg_SetCurrentWorkingDirectory(
250 render_view_host->GetRoutingID(), current_working_directory_)); 246 render_view_host->GetRoutingID(), current_working_directory_));
251 if (did_set_as_main_window_)
252 return;
253 render_view_host->Send(new ShellViewMsg_SetIsMainWindow(
254 render_view_host->GetRoutingID()));
255 did_set_as_main_window_ = true;
256 } 247 }
257 248
258 void WebKitTestController::RenderViewGone(base::TerminationStatus status) { 249 void WebKitTestController::RenderViewGone(base::TerminationStatus status) {
259 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED) 250 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
251 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
260 printer_->AddErrorMessage("#CRASHED - renderer"); 252 printer_->AddErrorMessage("#CRASHED - renderer");
253 }
261 } 254 }
262 255
263 void WebKitTestController::WebContentsDestroyed(WebContents* web_contents) { 256 void WebKitTestController::WebContentsDestroyed(WebContents* web_contents) {
264 main_window_ = NULL; 257 main_window_ = NULL;
265 printer_->AddErrorMessage("FAIL: main window was destroyed"); 258 printer_->AddErrorMessage("FAIL: main window was destroyed");
266 } 259 }
267 260
268 void WebKitTestController::CaptureDump() { 261 void WebKitTestController::CaptureDump() {
269 if (captured_dump_ || !main_window_ || !printer_->in_text_block()) 262 if (captured_dump_ || !main_window_ || !printer_->in_text_block())
270 return; 263 return;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 WebKitTestController::Get()->WaitUntilDone(); 405 WebKitTestController::Get()->WaitUntilDone();
413 } 406 }
414 407
415 void WebKitTestRunnerHost::OnNotImplemented( 408 void WebKitTestRunnerHost::OnNotImplemented(
416 const std::string& object_name, 409 const std::string& object_name,
417 const std::string& property_name) { 410 const std::string& property_name) {
418 WebKitTestController::Get()->NotImplemented(object_name, property_name); 411 WebKitTestController::Get()->NotImplemented(object_name, property_name);
419 } 412 }
420 413
421 } // namespace content 414 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/webkit_test_runner_host.h ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698