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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "content/public/browser/resource_request_info.h" | 18 #include "content/public/browser/resource_request_info.h" |
19 #include "content/public/common/browser_side_navigation_policy.h" | 19 #include "content/public/common/browser_side_navigation_policy.h" |
20 #include "content/public/common/previews_state.h" | |
20 #include "content/public/test/mock_resource_context.h" | 21 #include "content/public/test/mock_resource_context.h" |
21 #include "content/public/test/test_browser_thread_bundle.h" | 22 #include "content/public/test/test_browser_thread_bundle.h" |
22 #include "extensions/browser/extension_protocols.h" | 23 #include "extensions/browser/extension_protocols.h" |
23 #include "extensions/browser/info_map.h" | 24 #include "extensions/browser/info_map.h" |
24 #include "extensions/common/constants.h" | 25 #include "extensions/common/constants.h" |
25 #include "extensions/common/extension.h" | 26 #include "extensions/common/extension.h" |
26 #include "extensions/common/file_util.h" | 27 #include "extensions/common/file_util.h" |
27 #include "net/base/request_priority.h" | 28 #include "net/base/request_priority.h" |
28 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
29 #include "net/url_request/url_request_job_factory_impl.h" | 30 #include "net/url_request/url_request_job_factory_impl.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 request, | 140 request, |
140 resource_type, | 141 resource_type, |
141 &resource_context_, | 142 &resource_context_, |
142 -1, // render_process_id | 143 -1, // render_process_id |
143 -1, // render_view_id | 144 -1, // render_view_id |
144 -1, // render_frame_id | 145 -1, // render_frame_id |
145 resource_type == content::RESOURCE_TYPE_MAIN_FRAME, // is_main_frame | 146 resource_type == content::RESOURCE_TYPE_MAIN_FRAME, // is_main_frame |
146 false, // parent_is_main_frame | 147 false, // parent_is_main_frame |
147 true, // allow_download | 148 true, // allow_download |
148 false, // is_async | 149 false, // is_async |
149 false); // is_using_lofi | 150 content::PREVIEWS_OFF); // previews_state |
Nico
2017/01/09 22:35:03
ditto
megjablon
2017/01/10 22:30:01
Done.
| |
150 request->Start(); | 151 request->Start(); |
151 base::RunLoop().Run(); | 152 base::RunLoop().Run(); |
152 } | 153 } |
153 | 154 |
154 // Helper method to create a URLRequest, call StartRequest on it, and return | 155 // Helper method to create a URLRequest, call StartRequest on it, and return |
155 // the result. If |extension| hasn't already been added to | 156 // the result. If |extension| hasn't already been added to |
156 // |extension_info_map_|, this will add it. | 157 // |extension_info_map_|, this will add it. |
157 int DoRequest(const Extension& extension, const std::string& relative_path) { | 158 int DoRequest(const Extension& extension, const std::string& relative_path) { |
158 if (!extension_info_map_->extensions().Contains(extension.id())) { | 159 if (!extension_info_map_->extensions().Contains(extension.id())) { |
159 extension_info_map_->AddExtension(&extension, | 160 extension_info_map_->AddExtension(&extension, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 DoRequest(*extension, relative_path.AsUTF8Unsafe())); | 411 DoRequest(*extension, relative_path.AsUTF8Unsafe())); |
411 | 412 |
412 // Loading "/_metadata/a.txt" should also fail. | 413 // Loading "/_metadata/a.txt" should also fail. |
413 relative_path = base::FilePath(kMetadataFolder).AppendASCII("a.txt"); | 414 relative_path = base::FilePath(kMetadataFolder).AppendASCII("a.txt"); |
414 EXPECT_TRUE(base::PathExists(extension_dir.Append(relative_path))); | 415 EXPECT_TRUE(base::PathExists(extension_dir.Append(relative_path))); |
415 EXPECT_EQ(net::ERR_FAILED, | 416 EXPECT_EQ(net::ERR_FAILED, |
416 DoRequest(*extension, relative_path.AsUTF8Unsafe())); | 417 DoRequest(*extension, relative_path.AsUTF8Unsafe())); |
417 } | 418 } |
418 | 419 |
419 } // namespace extensions | 420 } // namespace extensions |
OLD | NEW |