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

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 556095: Changes to support new cookie policy.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file contains an implementation of the ResourceLoaderBridge class. 5 // This file contains an implementation of the ResourceLoaderBridge class.
6 // The class is implemented using URLRequest, meaning it is a "simple" version 6 // The class is implemented using URLRequest, meaning it is a "simple" version
7 // that directly issues requests. The more complicated one used in the 7 // that directly issues requests. The more complicated one used in the
8 // browser uses IPC. 8 // browser uses IPC.
9 // 9 //
10 // Because URLRequest only provides an asynchronous resource loading API, this 10 // Because URLRequest only provides an asynchronous resource loading API, this
(...skipping 20 matching lines...) Expand all
31 // alternate implementation that defers fetching to another process. 31 // alternate implementation that defers fetching to another process.
32 32
33 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 33 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
34 34
35 #include "base/message_loop.h" 35 #include "base/message_loop.h"
36 #include "base/ref_counted.h" 36 #include "base/ref_counted.h"
37 #include "base/time.h" 37 #include "base/time.h"
38 #include "base/timer.h" 38 #include "base/timer.h"
39 #include "base/thread.h" 39 #include "base/thread.h"
40 #include "base/waitable_event.h" 40 #include "base/waitable_event.h"
41 #include "net/base/cookie_policy.h"
42 #include "net/base/io_buffer.h" 41 #include "net/base/io_buffer.h"
43 #include "net/base/load_flags.h" 42 #include "net/base/load_flags.h"
44 #include "net/base/net_errors.h" 43 #include "net/base/net_errors.h"
45 #include "net/base/net_util.h" 44 #include "net/base/net_util.h"
45 #include "net/base/static_cookie_policy.h"
46 #include "net/base/upload_data.h" 46 #include "net/base/upload_data.h"
47 #include "net/http/http_response_headers.h" 47 #include "net/http/http_response_headers.h"
48 #include "net/proxy/proxy_service.h" 48 #include "net/proxy/proxy_service.h"
49 #include "net/url_request/url_request.h" 49 #include "net/url_request/url_request.h"
50 #include "webkit/appcache/appcache_interfaces.h" 50 #include "webkit/appcache/appcache_interfaces.h"
51 #include "webkit/glue/resource_loader_bridge.h" 51 #include "webkit/glue/resource_loader_bridge.h"
52 #include "webkit/tools/test_shell/simple_appcache_system.h" 52 #include "webkit/tools/test_shell/simple_appcache_system.h"
53 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h" 53 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h"
54 #include "webkit/tools/test_shell/test_shell_request_context.h" 54 #include "webkit/tools/test_shell/test_shell_request_context.h"
55 55
56 using webkit_glue::ResourceLoaderBridge; 56 using webkit_glue::ResourceLoaderBridge;
57 using net::CookiePolicy; 57 using net::StaticCookiePolicy;
58 using net::HttpResponseHeaders; 58 using net::HttpResponseHeaders;
59 59
60 namespace { 60 namespace {
61 61
62 //----------------------------------------------------------------------------- 62 //-----------------------------------------------------------------------------
63 63
64 URLRequestContext* request_context = NULL; 64 URLRequestContext* request_context = NULL;
65 base::Thread* io_thread = NULL; 65 base::Thread* io_thread = NULL;
66 66
67 class IOThread : public base::Thread { 67 class IOThread : public base::Thread {
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 647 }
648 648
649 return rv == net::OK; 649 return rv == net::OK;
650 } 650 }
651 651
652 } // namespace webkit_glue 652 } // namespace webkit_glue
653 653
654 //----------------------------------------------------------------------------- 654 //-----------------------------------------------------------------------------
655 655
656 // static 656 // static
657 void SimpleResourceLoaderBridge::Init(URLRequestContext* context) { 657 void SimpleResourceLoaderBridge::Init(TestShellRequestContext* context) {
658 // Make sure to stop any existing IO thread since it may be using the 658 // Make sure to stop any existing IO thread since it may be using the
659 // current request context. 659 // current request context.
660 Shutdown(); 660 Shutdown();
661 661
662 if (context) { 662 if (context) {
663 request_context = context; 663 request_context = context;
664 } else { 664 } else {
665 request_context = new TestShellRequestContext(); 665 request_context = new TestShellRequestContext();
666 } 666 }
667 request_context->AddRef(); 667 request_context->AddRef();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 SimpleResourceLoaderBridge::Init(NULL); 721 SimpleResourceLoaderBridge::Init(NULL);
722 722
723 io_thread = new IOThread(); 723 io_thread = new IOThread();
724 base::Thread::Options options; 724 base::Thread::Options options;
725 options.message_loop_type = MessageLoop::TYPE_IO; 725 options.message_loop_type = MessageLoop::TYPE_IO;
726 return io_thread->StartWithOptions(options); 726 return io_thread->StartWithOptions(options);
727 } 727 }
728 728
729 // static 729 // static
730 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { 730 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) {
731 CookiePolicy::Type policy_type = accept_all_cookies ? 731 StaticCookiePolicy::Type policy_type = accept_all_cookies ?
732 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES; 732 StaticCookiePolicy::ALLOW_ALL_COOKIES :
733 request_context->cookie_policy()->set_type(policy_type); 733 StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES;
734 static_cast<StaticCookiePolicy*>(request_context->cookie_policy())->
735 set_type(policy_type);
734 } 736 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/simple_resource_loader_bridge.h ('k') | webkit/tools/test_shell/test_shell_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698