diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 02:09:53 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 02:09:53 +0000 |
commit | 166e53bb1f5c823ef1d3f3b22e36ae9871abb506 (patch) | |
tree | af20daae3d6c6918396399c9f49ee5b807f7071f /webkit/tools | |
parent | 189163ee560220770ed5a119f6cfb9244c50c39d (diff) | |
download | chromium_src-166e53bb1f5c823ef1d3f3b22e36ae9871abb506.zip chromium_src-166e53bb1f5c823ef1d3f3b22e36ae9871abb506.tar.gz chromium_src-166e53bb1f5c823ef1d3f3b22e36ae9871abb506.tar.bz2 |
Fix the http/tests/plugins/third-party-cookie-accept-policy.html layotu test failure by updating the layout test's net::URL::Delegate to the new cookie interface.
TBR=willchan
Review URL: http://codereview.chromium.org/6982017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84912 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/test_shell/simple_resource_loader_bridge.cc | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index c8755d5..1a1cc71 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -89,13 +89,11 @@ struct TestShellRequestContextParams { bool in_no_proxy) : cache_path(in_cache_path), cache_mode(in_cache_mode), - no_proxy(in_no_proxy), - accept_all_cookies(false) {} + no_proxy(in_no_proxy) {} FilePath cache_path; net::HttpCache::Mode cache_mode; bool no_proxy; - bool accept_all_cookies; }; net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, @@ -139,6 +137,7 @@ net::URLRequestJob* FileSystemURLRequestJobFactory(net::URLRequest* request, TestShellRequestContextParams* g_request_context_params = NULL; TestShellRequestContext* g_request_context = NULL; base::Thread* g_cache_thread = NULL; +bool g_accept_all_cookies = false; //----------------------------------------------------------------------------- @@ -159,12 +158,10 @@ class IOThread : public base::Thread { g_request_context_params->cache_path, g_request_context_params->cache_mode, g_request_context_params->no_proxy); - SetAcceptAllCookies(g_request_context_params->accept_all_cookies); delete g_request_context_params; g_request_context_params = NULL; } else { g_request_context = new TestShellRequestContext(); - SetAcceptAllCookies(false); } g_request_context->AddRef(); @@ -192,14 +189,6 @@ class IOThread : public base::Thread { g_request_context = NULL; } } - - void SetAcceptAllCookies(bool accept_all_cookies) { - StaticCookiePolicy::Type policy_type = accept_all_cookies ? - StaticCookiePolicy::ALLOW_ALL_COOKIES : - StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; - static_cast<StaticCookiePolicy*>(g_request_context->cookie_policy())-> - set_type(policy_type); - } }; IOThread* g_io_thread = NULL; @@ -494,6 +483,30 @@ class RequestProxy : public net::URLRequest::Delegate, request->ContinueDespiteLastError(); } + virtual bool CanGetCookies(net::URLRequest* request) { + StaticCookiePolicy::Type policy_type = g_accept_all_cookies ? + StaticCookiePolicy::ALLOW_ALL_COOKIES : + StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; + + net::StaticCookiePolicy policy(policy_type); + int rv = policy.CanGetCookies( + request->url(), request->first_party_for_cookies()); + return rv == net::OK; + } + + virtual bool CanSetCookie(net::URLRequest* request, + const std::string& cookie_line, + net::CookieOptions* options) { + StaticCookiePolicy::Type policy_type = g_accept_all_cookies ? + StaticCookiePolicy::ALLOW_ALL_COOKIES : + StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; + + net::StaticCookiePolicy policy(policy_type); + int rv = policy.CanSetCookie( + request->url(), request->first_party_for_cookies(), cookie_line); + return rv == net::OK; + } + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { if (request->status().is_success() && bytes_read > 0) { OnReceivedData(bytes_read); @@ -931,13 +944,7 @@ bool SimpleResourceLoaderBridge::EnsureIOThread() { // static void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { - if (g_request_context_params) { - g_request_context_params->accept_all_cookies = accept_all_cookies; - DCHECK(!g_request_context); - DCHECK(!g_io_thread); - } else { - g_io_thread->SetAcceptAllCookies(accept_all_cookies); - } + g_accept_all_cookies = accept_all_cookies; } // static |