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

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

Issue 11594006: [content shell] if a layout test runs notifyDone() before it has finished loading, wait for the pag… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_controller.h ('k') | no next file » | 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_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/file_util.h" 10 #include "base/file_util.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 printer_->PrintTextFooter(); 180 printer_->PrintTextFooter();
181 printer_->PrintImageFooter(); 181 printer_->PrintImageFooter();
182 enable_pixel_dumping_ = false; 182 enable_pixel_dumping_ = false;
183 expected_pixel_hash_.clear(); 183 expected_pixel_hash_.clear();
184 captured_dump_ = false; 184 captured_dump_ = false;
185 dump_as_text_ = false; 185 dump_as_text_ = false;
186 dump_child_frames_ = false; 186 dump_child_frames_ = false;
187 is_printing_ = false; 187 is_printing_ = false;
188 should_stay_on_page_after_handling_before_unload_ = false; 188 should_stay_on_page_after_handling_before_unload_ = false;
189 wait_until_done_ = false; 189 wait_until_done_ = false;
190 did_finish_load_ = false;
190 prefs_.reset(new ShellWebPreferences); 191 prefs_.reset(new ShellWebPreferences);
191 { 192 {
192 base::AutoLock lock(lock_); 193 base::AutoLock lock(lock_);
193 can_open_windows_ = false; 194 can_open_windows_ = false;
194 } 195 }
195 watchdog_.Cancel(); 196 watchdog_.Cancel();
196 if (main_window_) { 197 if (main_window_) {
197 Observe(NULL); 198 Observe(NULL);
198 main_window_ = NULL; 199 main_window_ = NULL;
199 } 200 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 290 }
290 } 291 }
291 292
292 void WebKitTestController::TimeoutHandler() { 293 void WebKitTestController::TimeoutHandler() {
293 DCHECK(CalledOnValidThread()); 294 DCHECK(CalledOnValidThread());
294 printer_->AddErrorMessage( 295 printer_->AddErrorMessage(
295 "FAIL: Timed out waiting for notifyDone to be called"); 296 "FAIL: Timed out waiting for notifyDone to be called");
296 } 297 }
297 298
298 void WebKitTestController::OnDidFinishLoad() { 299 void WebKitTestController::OnDidFinishLoad() {
300 did_finish_load_ = true;
299 if (wait_until_done_) 301 if (wait_until_done_)
300 return; 302 return;
301 CaptureDump(); 303 CaptureDump();
302 } 304 }
303 305
304 void WebKitTestController::OnImageDump( 306 void WebKitTestController::OnImageDump(
305 const std::string& actual_pixel_hash, 307 const std::string& actual_pixel_hash,
306 const SkBitmap& image) { 308 const SkBitmap& image) {
307 SkAutoLockPixels image_lock(image); 309 SkAutoLockPixels image_lock(image);
308 310
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 364
363 void WebKitTestController::OnOverridePreferences( 365 void WebKitTestController::OnOverridePreferences(
364 const ShellWebPreferences& prefs) { 366 const ShellWebPreferences& prefs) {
365 *prefs_.get() = prefs; 367 *prefs_.get() = prefs;
366 } 368 }
367 369
368 void WebKitTestController::OnNotifyDone() { 370 void WebKitTestController::OnNotifyDone() {
369 if (!wait_until_done_) 371 if (!wait_until_done_)
370 return; 372 return;
371 watchdog_.Cancel(); 373 watchdog_.Cancel();
374 if (!did_finish_load_) {
375 wait_until_done_ = false;
376 return;
377 }
372 CaptureDump(); 378 CaptureDump();
373 } 379 }
374 380
375 void WebKitTestController::OnDumpAsText() { 381 void WebKitTestController::OnDumpAsText() {
376 dump_as_text_ = true; 382 dump_as_text_ = true;
377 } 383 }
378 384
379 void WebKitTestController::OnSetPrinting() { 385 void WebKitTestController::OnSetPrinting() {
380 is_printing_ = true; 386 is_printing_ = true;
381 } 387 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 434
429 void WebKitTestController::OnNotImplemented( 435 void WebKitTestController::OnNotImplemented(
430 const std::string& object_name, 436 const std::string& object_name,
431 const std::string& property_name) { 437 const std::string& property_name) {
432 printer_->AddErrorMessage( 438 printer_->AddErrorMessage(
433 std::string("FAIL: NOT IMPLEMENTED: ") + 439 std::string("FAIL: NOT IMPLEMENTED: ") +
434 object_name + "." + property_name); 440 object_name + "." + property_name);
435 } 441 }
436 442
437 } // namespace content 443 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/webkit_test_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698