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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 resource_context_.GetRequestContext(); | 120 resource_context_.GetRequestContext(); |
121 job_factory_.SetProtocolHandler( | 121 job_factory_.SetProtocolHandler( |
122 kExtensionScheme, | 122 kExtensionScheme, |
123 CreateExtensionProtocolHandler(is_incognito, | 123 CreateExtensionProtocolHandler(is_incognito, |
124 extension_info_map_.get())); | 124 extension_info_map_.get())); |
125 request_context->set_job_factory(&job_factory_); | 125 request_context->set_job_factory(&job_factory_); |
126 } | 126 } |
127 | 127 |
128 void StartRequest(net::URLRequest* request, | 128 void StartRequest(net::URLRequest* request, |
129 ResourceType resource_type) { | 129 ResourceType resource_type) { |
130 content::ResourceRequestInfo::AllocateForTesting(request, | 130 content::ResourceRequestInfo::AllocateForTesting( |
131 resource_type, | 131 request, |
132 &resource_context_, | 132 resource_type, |
133 -1, | 133 &resource_context_, |
134 -1, | 134 -1, // render_process_id |
135 -1, | 135 -1, // render_view_id |
136 false); | 136 -1, // render_frame_id |
| 137 resource_type == content::RESOURCE_TYPE_MAIN_FRAME, // is_main_frame |
| 138 false, // parent_is_main_frame |
| 139 false); // is_async |
137 request->Start(); | 140 request->Start(); |
138 base::MessageLoop::current()->Run(); | 141 base::MessageLoop::current()->Run(); |
139 } | 142 } |
140 | 143 |
141 protected: | 144 protected: |
142 content::TestBrowserThreadBundle thread_bundle_; | 145 content::TestBrowserThreadBundle thread_bundle_; |
143 scoped_refptr<InfoMap> extension_info_map_; | 146 scoped_refptr<InfoMap> extension_info_map_; |
144 net::URLRequestJobFactoryImpl job_factory_; | 147 net::URLRequestJobFactoryImpl job_factory_; |
145 const net::URLRequestJobFactory* old_factory_; | 148 const net::URLRequestJobFactory* old_factory_; |
146 net::TestDelegate test_delegate_; | 149 net::TestDelegate test_delegate_; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 extension->GetResourceURL("test.dat"), | 358 extension->GetResourceURL("test.dat"), |
356 net::DEFAULT_PRIORITY, | 359 net::DEFAULT_PRIORITY, |
357 &test_delegate_, | 360 &test_delegate_, |
358 NULL)); | 361 NULL)); |
359 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); | 362 StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA); |
360 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); | 363 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); |
361 } | 364 } |
362 } | 365 } |
363 | 366 |
364 } // namespace extensions | 367 } // namespace extensions |
OLD | NEW |