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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc

Issue 694773003: Allow URL requests for object/embed tags to be intercepted as streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-guest-view-container-3
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_protocols_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extensions/browser/api/web_request/web_request_permissions.h" 5 #include "extensions/browser/api/web_request/web_request_permissions.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/common/extensions/extension_test_util.h" 9 #include "chrome/common/extensions/extension_test_util.h"
10 #include "content/public/browser/resource_request_info.h" 10 #include "content/public/browser/resource_request_info.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest( 131 scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest(
132 non_sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL)); 132 non_sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL));
133 ResourceRequestInfo::AllocateForTesting(sensitive_request.get(), 133 ResourceRequestInfo::AllocateForTesting(sensitive_request.get(),
134 content::RESOURCE_TYPE_SCRIPT, 134 content::RESOURCE_TYPE_SCRIPT,
135 NULL, 135 NULL,
136 process_id, 136 process_id,
137 view_id, 137 view_id,
138 MSG_ROUTING_NONE, 138 MSG_ROUTING_NONE,
139 false, // is_main_frame 139 false, // is_main_frame
140 false, // parent_is_main_frame 140 false, // parent_is_main_frame
141 true, // allow_download
141 false); // is_async 142 false); // is_async
142 extension_info_map_->RegisterExtensionProcess( 143 extension_info_map_->RegisterExtensionProcess(
143 extensions::kWebStoreAppId, process_id, site_instance_id); 144 extensions::kWebStoreAppId, process_id, site_instance_id);
144 EXPECT_TRUE(WebRequestPermissions::HideRequest( 145 EXPECT_TRUE(WebRequestPermissions::HideRequest(
145 extension_info_map_.get(), sensitive_request.get())); 146 extension_info_map_.get(), sensitive_request.get()));
146 } 147 }
147 // If the process is the signin process, it becomes protected. 148 // If the process is the signin process, it becomes protected.
148 { 149 {
149 int process_id = kSigninProcessId; 150 int process_id = kSigninProcessId;
150 int view_id = 19; 151 int view_id = 19;
151 scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest( 152 scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest(
152 non_sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL)); 153 non_sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL));
153 ResourceRequestInfo::AllocateForTesting(sensitive_request.get(), 154 ResourceRequestInfo::AllocateForTesting(sensitive_request.get(),
154 content::RESOURCE_TYPE_SCRIPT, 155 content::RESOURCE_TYPE_SCRIPT,
155 NULL, 156 NULL,
156 process_id, 157 process_id,
157 view_id, 158 view_id,
158 MSG_ROUTING_NONE, 159 MSG_ROUTING_NONE,
159 false, // is_main_frame 160 false, // is_main_frame
160 false, // parent_is_main_frame 161 false, // parent_is_main_frame
162 true, // allow_download
161 false); // is_async 163 false); // is_async
162 EXPECT_TRUE(WebRequestPermissions::HideRequest( 164 EXPECT_TRUE(WebRequestPermissions::HideRequest(
163 extension_info_map_.get(), sensitive_request.get())); 165 extension_info_map_.get(), sensitive_request.get()));
164 } 166 }
165 } 167 }
166 168
167 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, 169 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest,
168 TestCanExtensionAccessURL_HostPermissions) { 170 TestCanExtensionAccessURL_HostPermissions) {
169 scoped_ptr<net::URLRequest> request(context.CreateRequest( 171 scoped_ptr<net::URLRequest> request(context.CreateRequest(
170 GURL("http://example.com"), net::DEFAULT_PRIORITY, NULL, NULL)); 172 GURL("http://example.com"), net::DEFAULT_PRIORITY, NULL, NULL));
(...skipping 16 matching lines...) Expand all
187 request->url(), 189 request->url(),
188 false /*crosses_incognito*/, 190 false /*crosses_incognito*/,
189 WebRequestPermissions::REQUIRE_HOST_PERMISSION)); 191 WebRequestPermissions::REQUIRE_HOST_PERMISSION));
190 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL( 192 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL(
191 extension_info_map_.get(), 193 extension_info_map_.get(),
192 com_extension_->id(), 194 com_extension_->id(),
193 request->url(), 195 request->url(),
194 false /*crosses_incognito*/, 196 false /*crosses_incognito*/,
195 WebRequestPermissions::REQUIRE_ALL_URLS)); 197 WebRequestPermissions::REQUIRE_ALL_URLS));
196 } 198 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_protocols_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698