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/webkit_test_controller.h" | 5 #include "content/shell/webkit_test_controller.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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 return true; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 bool WebKitTestController::ResetAfterLayoutTest() { | 261 bool WebKitTestController::ResetAfterLayoutTest() { |
262 DCHECK(CalledOnValidThread()); | 262 DCHECK(CalledOnValidThread()); |
263 printer_->PrintTextFooter(); | 263 printer_->PrintTextFooter(); |
264 printer_->PrintImageFooter(); | 264 printer_->PrintImageFooter(); |
265 send_configuration_to_next_host_ = false; | 265 send_configuration_to_next_host_ = false; |
266 is_running_test_ = false; | 266 is_running_test_ = false; |
| 267 is_cleaning_up_ = false; |
267 is_compositing_test_ = false; | 268 is_compositing_test_ = false; |
268 enable_pixel_dumping_ = false; | 269 enable_pixel_dumping_ = false; |
269 expected_pixel_hash_.clear(); | 270 expected_pixel_hash_.clear(); |
270 test_url_ = GURL(); | 271 test_url_ = GURL(); |
271 prefs_ = WebPreferences(); | 272 prefs_ = WebPreferences(); |
272 should_override_prefs_ = false; | 273 should_override_prefs_ = false; |
273 watchdog_.Cancel(); | 274 watchdog_.Cancel(); |
274 return true; | 275 return true; |
275 } | 276 } |
276 | 277 |
(...skipping 15 matching lines...) Expand all Loading... |
292 CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 293 CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
293 if (!command_line.HasSwitch(switches::kEnableSoftwareCompositing)) | 294 if (!command_line.HasSwitch(switches::kEnableSoftwareCompositing)) |
294 prefs->accelerated_2d_canvas_enabled = true; | 295 prefs->accelerated_2d_canvas_enabled = true; |
295 prefs->accelerated_compositing_for_video_enabled = true; | 296 prefs->accelerated_compositing_for_video_enabled = true; |
296 prefs->mock_scrollbars_enabled = true; | 297 prefs->mock_scrollbars_enabled = true; |
297 } | 298 } |
298 } | 299 } |
299 } | 300 } |
300 | 301 |
301 void WebKitTestController::OpenURL(const GURL& url) { | 302 void WebKitTestController::OpenURL(const GURL& url) { |
| 303 if (is_cleaning_up_) |
| 304 return; |
| 305 |
302 Shell::CreateNewWindow(main_window_->web_contents()->GetBrowserContext(), | 306 Shell::CreateNewWindow(main_window_->web_contents()->GetBrowserContext(), |
303 url, | 307 url, |
304 main_window_->web_contents()->GetSiteInstance(), | 308 main_window_->web_contents()->GetSiteInstance(), |
305 MSG_ROUTING_NONE, | 309 MSG_ROUTING_NONE, |
306 gfx::Size()); | 310 gfx::Size()); |
307 } | 311 } |
308 | 312 |
309 void WebKitTestController::TestFinishedInSecondaryWindow() { | 313 void WebKitTestController::TestFinishedInSecondaryWindow() { |
310 RenderViewHost* render_view_host = | 314 RenderViewHost* render_view_host = |
311 main_window_->web_contents()->GetRenderViewHost(); | 315 main_window_->web_contents()->GetRenderViewHost(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 params.allow_external_pages = CommandLine::ForCurrentProcess()->HasSwitch( | 454 params.allow_external_pages = CommandLine::ForCurrentProcess()->HasSwitch( |
451 switches::kAllowExternalPages); | 455 switches::kAllowExternalPages); |
452 params.expected_pixel_hash = expected_pixel_hash_; | 456 params.expected_pixel_hash = expected_pixel_hash_; |
453 params.initial_size = initial_size_; | 457 params.initial_size = initial_size_; |
454 render_view_host->Send(new ShellViewMsg_SetTestConfiguration( | 458 render_view_host->Send(new ShellViewMsg_SetTestConfiguration( |
455 render_view_host->GetRoutingID(), params)); | 459 render_view_host->GetRoutingID(), params)); |
456 } | 460 } |
457 | 461 |
458 void WebKitTestController::OnTestFinished(bool did_timeout) { | 462 void WebKitTestController::OnTestFinished(bool did_timeout) { |
459 watchdog_.Cancel(); | 463 watchdog_.Cancel(); |
| 464 is_cleaning_up_ = true; |
460 if (did_timeout) { | 465 if (did_timeout) { |
461 printer_->AddErrorMessage( | 466 printer_->AddErrorMessage( |
462 "FAIL: Timed out waiting for notifyDone to be called"); | 467 "FAIL: Timed out waiting for notifyDone to be called"); |
463 DiscardMainWindow(); | 468 DiscardMainWindow(); |
464 return; | 469 return; |
465 } | 470 } |
466 if (!printer_->output_finished()) | 471 if (!printer_->output_finished()) |
467 printer_->PrintImageFooter(); | 472 printer_->PrintImageFooter(); |
468 RenderViewHost* render_view_host = | 473 RenderViewHost* render_view_host = |
469 main_window_->web_contents()->GetRenderViewHost(); | 474 main_window_->web_contents()->GetRenderViewHost(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 } | 619 } |
615 base::MessageLoop::current()->RunUntilIdle(); | 620 base::MessageLoop::current()->RunUntilIdle(); |
616 } | 621 } |
617 | 622 |
618 void WebKitTestController::OnResetDone() { | 623 void WebKitTestController::OnResetDone() { |
619 base::MessageLoop::current()->PostTask(FROM_HERE, | 624 base::MessageLoop::current()->PostTask(FROM_HERE, |
620 base::MessageLoop::QuitClosure()); | 625 base::MessageLoop::QuitClosure()); |
621 } | 626 } |
622 | 627 |
623 } // namespace content | 628 } // namespace content |
OLD | NEW |