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

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

Issue 243108: Enable WebSocket in test_shell (Closed)
Patch Set: add +net/socket_stream in webkit/DEPS Created 11 years, 2 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "net/base/load_flags.h" 43 #include "net/base/load_flags.h"
44 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
45 #include "net/base/net_util.h" 45 #include "net/base/net_util.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/test_shell_request_context.h" 54 #include "webkit/tools/test_shell/test_shell_request_context.h"
54 55
55 using webkit_glue::ResourceLoaderBridge; 56 using webkit_glue::ResourceLoaderBridge;
56 using net::CookiePolicy; 57 using net::CookiePolicy;
57 using net::HttpResponseHeaders; 58 using net::HttpResponseHeaders;
58 59
59 namespace { 60 namespace {
60 61
61 //----------------------------------------------------------------------------- 62 //-----------------------------------------------------------------------------
62 63
63 URLRequestContext* request_context = NULL; 64 URLRequestContext* request_context = NULL;
64 base::Thread* io_thread = NULL; 65 base::Thread* io_thread = NULL;
65 66
66 class IOThread : public base::Thread { 67 class IOThread : public base::Thread {
67 public: 68 public:
68 IOThread() : base::Thread("IOThread") { 69 IOThread() : base::Thread("IOThread") {
69 } 70 }
70 71
71 ~IOThread() { 72 ~IOThread() {
72 // We cannot rely on our base class to stop the thread since we want our 73 // We cannot rely on our base class to stop the thread since we want our
73 // CleanUp function to run. 74 // CleanUp function to run.
74 Stop(); 75 Stop();
75 } 76 }
76 77
77 virtual void Init() { 78 virtual void Init() {
78 SimpleAppCacheSystem::InitializeOnIOThread(request_context); 79 SimpleAppCacheSystem::InitializeOnIOThread(request_context);
80 SimpleSocketStreamBridge::InitializeOnIOThread(request_context);
79 } 81 }
80 82
81 virtual void CleanUp() { 83 virtual void CleanUp() {
84 SimpleSocketStreamBridge::Cleanup();
82 if (request_context) { 85 if (request_context) {
83 request_context->Release(); 86 request_context->Release();
84 request_context = NULL; 87 request_context = NULL;
85 } 88 }
86 } 89 }
87 }; 90 };
88 91
89 //----------------------------------------------------------------------------- 92 //-----------------------------------------------------------------------------
90 93
91 struct RequestParams { 94 struct RequestParams {
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 options.message_loop_type = MessageLoop::TYPE_IO; 725 options.message_loop_type = MessageLoop::TYPE_IO;
723 return io_thread->StartWithOptions(options); 726 return io_thread->StartWithOptions(options);
724 } 727 }
725 728
726 // static 729 // static
727 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { 730 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) {
728 CookiePolicy::Type policy_type = accept_all_cookies ? 731 CookiePolicy::Type policy_type = accept_all_cookies ?
729 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES; 732 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES;
730 request_context->cookie_policy()->set_type(policy_type); 733 request_context->cookie_policy()->set_type(policy_type);
731 } 734 }
OLDNEW
« no previous file with comments | « webkit/tools/layout_tests/test_expectations.txt ('k') | webkit/tools/test_shell/simple_socket_stream_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698