diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-22 07:21:56 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-22 07:21:56 +0000 |
commit | 96fff3826f64c18c291435158bbe42f566b5269a (patch) | |
tree | 1c136f66d866cf4346b0804e16621a632fd96f8b /webkit | |
parent | b16ca0218156d4b3a60f1d179813f946eeec2c34 (diff) | |
download | chromium_src-96fff3826f64c18c291435158bbe42f566b5269a.zip chromium_src-96fff3826f64c18c291435158bbe42f566b5269a.tar.gz chromium_src-96fff3826f64c18c291435158bbe42f566b5269a.tar.bz2 |
Implement layoutTestController.setWillSendRequestReturnsNull
BUG=32305
TEST=fast/loader/onload-willSendRequest-null-for-frame.html
Review URL: http://codereview.chromium.org/552009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/layout_tests/test_expectations.txt | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 9 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 10 |
5 files changed, 31 insertions, 4 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt index 131f048..bac80eb 100644 --- a/webkit/tools/layout_tests/test_expectations.txt +++ b/webkit/tools/layout_tests/test_expectations.txt @@ -2996,14 +2996,12 @@ BUG32396 LINUX : storage/transaction-error-callback.html = TEXT PASS BUG32398 MAC : svg/custom/resource-invalidate-on-target-update.svg = IMAGE PASS // Bugs from rolling from 53275:53289 -BUG32305 : fast/loader/onload-willSendRequest-null-for-frame.html = TEXT BUG32307 WIN : fast/css/non-standard-checkbox-size.html = IMAGE+TEXT BUG32308 DEBUG : fast/frames/cached-frame-counter.html = TIMEOUT // WebKit roll: 53290:53313 BUG32339 LINUX : fast/dom/Window/window-lookup-precedence.html = TEXT PASS -BUG32305 : fast/loader/onload-willSendRequest-null-for-script.html = TEXT // New flakyness ? BUG32306 MAC DEBUG: svg/hixie/error/004.xml = CRASH PASS diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 9e36ada..3c94a91 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -119,6 +119,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) : BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDelegate); BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelegate); BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::setWillSendRequestReturnsNullOnRedirect); + BindMethod("setWillSendRequestReturnsNull", &LayoutTestController::setWillSendRequestReturnsNull); BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccessFromOrigin); BindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases); BindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale); @@ -636,6 +637,14 @@ void LayoutTestController::setWillSendRequestReturnsNullOnRedirect( result->SetNull(); } +void LayoutTestController::setWillSendRequestReturnsNull( + const CppArgumentList& args, CppVariant* result) { + if (args.size() > 0 && args[0].isBool()) + shell_->delegate()->set_request_return_null(args[0].value.boolValue); + + result->SetNull(); +} + void LayoutTestController::pathToLocalResource( const CppArgumentList& args, CppVariant* result) { result->SetNull(); @@ -1054,4 +1063,3 @@ void LayoutTestController::evaluateInWebInspector(const CppArgumentList& args, shell_->dev_tools_agent()->evaluateInWebInspector(args[0].ToInt32(), args[1].ToString()); } - diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 398a8e6..67026867 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -121,6 +121,10 @@ class LayoutTestController : public CppBoundClass { void setWillSendRequestReturnsNullOnRedirect(const CppArgumentList& args, CppVariant* result); + // Causes WillSendRequest to return an empty request. + void setWillSendRequestReturnsNull(const CppArgumentList& args, + CppVariant* result); + // Converts a URL starting with file:///tmp/ to the local mapping. void pathToLocalResource(const CppArgumentList& args, CppVariant* result); diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 84b4394..64fc528 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -907,6 +907,12 @@ void TestWebViewDelegate::willSendRequest( return; } + if (request_return_null_) { + // To block the request, we set its URL to an empty one. + request.setURL(WebURL()); + return; + } + std::string host = url.host(); if (TestShell::layout_test_mode() && !host.empty() && (url.SchemeIs("http") || url.SchemeIs("https")) && @@ -991,7 +997,8 @@ TestWebViewDelegate::TestWebViewDelegate(TestShell* shell) #else select_trailing_whitespace_enabled_(false), #endif - block_redirects_(false) { + block_redirects_(false), + request_return_null_(false) { } TestWebViewDelegate::~TestWebViewDelegate() { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index e939471..e62fab2 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -261,6 +261,13 @@ class TestWebViewDelegate : public WebKit::WebViewClient, return block_redirects_; } + void set_request_return_null(bool request_return_null) { + request_return_null_ = request_return_null; + } + bool request_return_null() const { + return request_return_null_; + } + void SetEditCommand(const std::string& name, const std::string& value) { edit_command_name_ = name; edit_command_value_ = value; @@ -378,6 +385,9 @@ class TestWebViewDelegate : public WebKit::WebViewClient, // true if we should block any redirects bool block_redirects_; + // true if we should block (set an empty request for) any requests + bool request_return_null_; + // Edit command associated to the current keyboard event. std::string edit_command_name_; std::string edit_command_value_; |