OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 void TearDown() override { | 112 void TearDown() override { |
113 net::URLRequestContext* request_context = | 113 net::URLRequestContext* request_context = |
114 resource_context_.GetRequestContext(); | 114 resource_context_.GetRequestContext(); |
115 request_context->set_job_factory(old_factory_); | 115 request_context->set_job_factory(old_factory_); |
116 } | 116 } |
117 | 117 |
118 void SetProtocolHandler(bool is_incognito) { | 118 void SetProtocolHandler(bool is_incognito) { |
119 net::URLRequestContext* request_context = | 119 net::URLRequestContext* request_context = |
120 resource_context_.GetRequestContext(); | 120 resource_context_.GetRequestContext(); |
121 job_factory_.SetProtocolHandler( | 121 job_factory_.SetProtocolHandler( |
122 kExtensionScheme, | 122 kExtensionScheme, make_scoped_ptr(CreateExtensionProtocolHandler( |
123 CreateExtensionProtocolHandler(is_incognito, | 123 is_incognito, extension_info_map_.get()))); |
124 extension_info_map_.get())); | |
125 request_context->set_job_factory(&job_factory_); | 124 request_context->set_job_factory(&job_factory_); |
126 } | 125 } |
127 | 126 |
128 void StartRequest(net::URLRequest* request, | 127 void StartRequest(net::URLRequest* request, |
129 ResourceType resource_type) { | 128 ResourceType resource_type) { |
130 content::ResourceRequestInfo::AllocateForTesting( | 129 content::ResourceRequestInfo::AllocateForTesting( |
131 request, | 130 request, |
132 resource_type, | 131 resource_type, |
133 &resource_context_, | 132 &resource_context_, |
134 -1, // render_process_id | 133 -1, // render_process_id |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 resource_context_.GetRequestContext()->CreateRequest( | 350 resource_context_.GetRequestContext()->CreateRequest( |
352 extension->GetResourceURL("test.dat"), | 351 extension->GetResourceURL("test.dat"), |
353 net::DEFAULT_PRIORITY, | 352 net::DEFAULT_PRIORITY, |
354 &test_delegate_)); | 353 &test_delegate_)); |
355 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); | 354 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); |
356 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); | 355 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); |
357 } | 356 } |
358 } | 357 } |
359 | 358 |
360 } // namespace extensions | 359 } // namespace extensions |
OLD | NEW |