diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-02 16:25:15 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-02 16:25:15 +0000 |
commit | f56eed44ee5f199604fdf32cfab3d4abe183182a (patch) | |
tree | 0036230729aaf09d2f9c8fc057df006c91064505 /webkit/tools/test_shell/layout_test_controller.cc | |
parent | 789fbb7cd36822230870c3beff00fa30b532d14e (diff) | |
download | chromium_src-f56eed44ee5f199604fdf32cfab3d4abe183182a.zip chromium_src-f56eed44ee5f199604fdf32cfab3d4abe183182a.tar.gz chromium_src-f56eed44ee5f199604fdf32cfab3d4abe183182a.tar.bz2 |
Fix tests that depend on setCustomPolicyDelegate and waitForPolicyDelegate.
Changes:
1- Need to support a second parameter to setCustomPolicyDelegate that
controls whether subsequent loads are permitted or not. Previously,
we would always deny any subsequent loads.
2- Need to change the string that we produce when writing out the URL
that is impacted by a custom policy delegate. We need to write out only
the filename part of the URL. (We need to do this only for file:// URLs.)
3- Add LayoutTestController::waitForPolicyDelegate and corresponding
method on TestWebViewDelegate.
4- Improve the way we reset the TestWebViewDelegate. Now, instead of
having support for reseting individual fields, we just reallocate the
delegate. This requires adding a SetDelegate method to WebView.
BUG=9582
R=dglazkov
Review URL: http://codereview.chromium.org/56169
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/layout_test_controller.cc')
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 114fc3c..a7a4d25 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -113,6 +113,8 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("pauseTransitionAtTimeOnElementWithId", &LayoutTestController::pauseTransitionAtTimeOnElementWithId); BindMethod("elementDoesAutoCompleteForElementWithId", &LayoutTestController::elementDoesAutoCompleteForElementWithId); BindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAnimations); + BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDelegate); + BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelegate); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -130,7 +132,6 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebViews); BindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrowsingEnabled); BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDashboardCompatibilityMode); - BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDelegate); // This typo (missing 'i') is intentional as it matches the typo in the layout test // see: LayoutTests/fast/canvas/fill-stroke-clip-reset-path.html. @@ -454,6 +455,15 @@ void LayoutTestController::LocationChangeDone() { work_queue_.ProcessWorkSoon(); } +void LayoutTestController::PolicyDelegateDone() { + if (!shell_->layout_test_mode()) + return; + + DCHECK(wait_until_done_); + shell_->TestFinished(); + wait_until_done_ = false; +} + void LayoutTestController::setCanOpenWindows( const CppArgumentList& args, CppVariant* result) { can_open_windows_ = true; @@ -560,12 +570,23 @@ void LayoutTestController::setUseDashboardCompatibilityMode( void LayoutTestController::setCustomPolicyDelegate( const CppArgumentList& args, CppVariant* result) { if (args.size() > 0 && args[0].isBool()) { - shell_->delegate()->SetCustomPolicyDelegate(args[0].value.boolValue); + bool enable = args[0].value.boolValue; + bool permissive = false; + if (args.size() > 1 && args[1].isBool()) + permissive = args[1].value.boolValue; + shell_->delegate()->SetCustomPolicyDelegate(enable, permissive); } result->SetNull(); } +void LayoutTestController::waitForPolicyDelegate( + const CppArgumentList& args, CppVariant* result) { + shell_->delegate()->WaitForPolicyDelegate(); + wait_until_done_ = true; + result->SetNull(); +} + void LayoutTestController::pathToLocalResource( const CppArgumentList& args, CppVariant* result) { result->SetNull(); |