From 63e78057b6ae2685ed3525d832fed48b7c85ee1e Mon Sep 17 00:00:00 2001 From: "tc@google.com" Date: Tue, 2 Dec 2008 18:44:43 +0000 Subject: Add setStopProvisionalFrameLoads to the test shell layout test controller. This fixes a layout test. BUG=http://crbug.com/2980 Review URL: http://codereview.chromium.org/13038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6224 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/tools/layout_tests/test_lists/win/tests_fixable.txt | 4 ---- webkit/tools/test_shell/layout_test_controller.cc | 9 +++++++++ webkit/tools/test_shell/layout_test_controller.h | 10 ++++++++++ webkit/tools/test_shell/test_webview_delegate.cc | 6 ++++++ 4 files changed, 25 insertions(+), 4 deletions(-) (limited to 'webkit') diff --git a/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt index 1dc0960..d8e7484 100644 --- a/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt @@ -580,10 +580,6 @@ LayoutTests/fast/canvas/canvas-getImageData.html = FAIL // http://code.google.com/p/chromium/issues/detail?id=2972 LayoutTests/fast/canvas/toDataURL-supportedTypes.html = FAIL -// layoutTestController.setStopProvisionalFrameLoads needs implementing -// http://code.google.com/p/chromium/issues/detail?id=2980 -LayoutTests/fast/loader/stop-provisional-loads.html = FAIL - // Our shadows looks wrong. The text not having shadows is to be expected, but // it looks like we're missing a red shadow that Safari has. // http://code.google.com/p/chromium/issues/detail?id=2982 diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 4aa5dcf..70efb9a 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -50,6 +50,7 @@ bool LayoutTestController::wait_until_done_ = false; bool LayoutTestController::can_open_windows_ = false; bool LayoutTestController::close_remaining_windows_ = true; bool LayoutTestController::should_add_file_to_pasteboard_ = false; +bool LayoutTestController::stop_provisional_frame_loads_ = false; LayoutTestController::WorkQueue LayoutTestController::work_queue_; CppVariant LayoutTestController::globalFlag_; @@ -92,6 +93,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteboardOnDrag); BindMethod("execCommand", &LayoutTestController::execCommand); BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled); + BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvisionalFrameLoads); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -362,6 +364,7 @@ void LayoutTestController::Reset() { wait_until_done_ = false; can_open_windows_ = false; should_add_file_to_pasteboard_ = false; + stop_provisional_frame_loads_ = false; globalFlag_.Set(false); if (close_remaining_windows_) { @@ -525,6 +528,12 @@ void LayoutTestController::addFileToPasteboardOnDrag( should_add_file_to_pasteboard_ = true; } +void LayoutTestController::setStopProvisionalFrameLoads( + const CppArgumentList& args, CppVariant* result) { + result->SetNull(); + stop_provisional_frame_loads_ = true; +} + // // Unimplemented stubs // diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 8d2507c..c6a46e2 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -117,6 +117,11 @@ class LayoutTestController : public CppBoundClass { // Set the WebPreference that controls webkit's popup blocking. void setPopupBlockingEnabled(const CppArgumentList& args, CppVariant* result); + // If true, causes provisional frame loads to be stopped for the remainder of + // the test. + void setStopProvisionalFrameLoads(const CppArgumentList& args, + CppVariant* result); + // The following are only stubs. TODO(pamg): Implement any of these that // are needed to pass the layout tests. void dumpAsWebArchive(const CppArgumentList& args, CppVariant* result); @@ -167,6 +172,7 @@ class LayoutTestController : public CppBoundClass { bool AcceptsEditing() { return accepts_editing_; } bool CanOpenWindows() { return can_open_windows_; } bool ShouldAddFileToPasteboard() { return should_add_file_to_pasteboard_; } + bool StopProvisionalFrameLoads() { return stop_provisional_frame_loads_; } // Called by the webview delegate when the toplevel frame load is done. void LocationChangeDone(); @@ -264,6 +270,10 @@ class LayoutTestController : public CppBoundClass { // If true and a drag starts, adds a file to the drag&drop clipboard. static bool should_add_file_to_pasteboard_; + // If true, stops provisional frame loads during the + // DidStartProvisionalLoadForFrame callback. + static bool stop_provisional_frame_loads_; + // If true, don't dump output until notifyDone is called. static bool wait_until_done_; diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 905b9be..3adcf08 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -181,6 +181,12 @@ void TestWebViewDelegate::DidStartProvisionalLoadForFrame( if (!top_loading_frame_) { top_loading_frame_ = frame; } + + if (shell_->layout_test_controller()->StopProvisionalFrameLoads()) { + printf("%S - stopping load in didStartProvisionalLoadForFrame callback\n", + GetFrameDescription(frame).c_str()); + frame->StopLoading(); + } UpdateAddressBar(webview); } -- cgit v1.1