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

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

Issue 624073002: Add is_main_frame and parent_is_main_frame to ResourceRequestInfo::AllocateForTesting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile extensions_unittests 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 int site_instance_id = 23; 129 int site_instance_id = 23;
130 int view_id = 17; 130 int view_id = 17;
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); 139 false, // is_main_frame
140 false, // parent_is_main_frame
141 false); // is_async
140 extension_info_map_->RegisterExtensionProcess( 142 extension_info_map_->RegisterExtensionProcess(
141 extensions::kWebStoreAppId, process_id, site_instance_id); 143 extensions::kWebStoreAppId, process_id, site_instance_id);
142 EXPECT_TRUE(WebRequestPermissions::HideRequest( 144 EXPECT_TRUE(WebRequestPermissions::HideRequest(
143 extension_info_map_.get(), sensitive_request.get())); 145 extension_info_map_.get(), sensitive_request.get()));
144 } 146 }
145 // If the process is the signin process, it becomes protected. 147 // If the process is the signin process, it becomes protected.
146 { 148 {
147 int process_id = kSigninProcessId; 149 int process_id = kSigninProcessId;
148 int view_id = 19; 150 int view_id = 19;
149 scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest( 151 scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest(
150 non_sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL)); 152 non_sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL));
151 ResourceRequestInfo::AllocateForTesting(sensitive_request.get(), 153 ResourceRequestInfo::AllocateForTesting(sensitive_request.get(),
152 content::RESOURCE_TYPE_SCRIPT, 154 content::RESOURCE_TYPE_SCRIPT,
153 NULL, 155 NULL,
154 process_id, 156 process_id,
155 view_id, 157 view_id,
156 MSG_ROUTING_NONE, 158 MSG_ROUTING_NONE,
157 false); 159 false, // is_main_frame
160 false, // parent_is_main_frame
161 false); // is_async
158 EXPECT_TRUE(WebRequestPermissions::HideRequest( 162 EXPECT_TRUE(WebRequestPermissions::HideRequest(
159 extension_info_map_.get(), sensitive_request.get())); 163 extension_info_map_.get(), sensitive_request.get()));
160 } 164 }
161 } 165 }
162 166
163 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, 167 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest,
164 TestCanExtensionAccessURL_HostPermissions) { 168 TestCanExtensionAccessURL_HostPermissions) {
165 scoped_ptr<net::URLRequest> request(context.CreateRequest( 169 scoped_ptr<net::URLRequest> request(context.CreateRequest(
166 GURL("http://example.com"), net::DEFAULT_PRIORITY, NULL, NULL)); 170 GURL("http://example.com"), net::DEFAULT_PRIORITY, NULL, NULL));
167 171
(...skipping 15 matching lines...) Expand all
183 request->url(), 187 request->url(),
184 false /*crosses_incognito*/, 188 false /*crosses_incognito*/,
185 WebRequestPermissions::REQUIRE_HOST_PERMISSION)); 189 WebRequestPermissions::REQUIRE_HOST_PERMISSION));
186 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL( 190 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL(
187 extension_info_map_.get(), 191 extension_info_map_.get(),
188 com_extension_->id(), 192 com_extension_->id(),
189 request->url(), 193 request->url(),
190 false /*crosses_incognito*/, 194 false /*crosses_incognito*/,
191 WebRequestPermissions::REQUIRE_ALL_URLS)); 195 WebRequestPermissions::REQUIRE_ALL_URLS));
192 } 196 }
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