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

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

Issue 14358004: Almost all actions in Declarative Web Request require all_urls host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All URLs -> all hosts; also rebased Created 7 years, 7 months 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 | Annotate | Revision Log
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 6 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 10 #include "chrome/browser/extensions/extension_test_message_listener.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 #define MAYBE_WebRequestDeclarative2 DISABLED_WebRequestDeclarative2 152 #define MAYBE_WebRequestDeclarative2 DISABLED_WebRequestDeclarative2
153 #else 153 #else
154 #define MAYBE_WebRequestDeclarative2 WebRequestDeclarative2 154 #define MAYBE_WebRequestDeclarative2 WebRequestDeclarative2
155 #endif 155 #endif
156 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, 156 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
157 MAYBE_WebRequestDeclarative2) { 157 MAYBE_WebRequestDeclarative2) {
158 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_declarative2.html")) 158 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_declarative2.html"))
159 << message_; 159 << message_;
160 } 160 }
161 161
162 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
163 WebRequestDeclarativePermissions) {
164 ExtensionTestMessageListener listener("rules all registered", false);
165 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(
166 "webrequest/permissionless")));
167 EXPECT_TRUE(listener.WaitUntilSatisfied());
168 ASSERT_TRUE(RunExtensionSubtest(
169 "webrequest", "test_declarative_permissions.html")) <<
170 message_;
171 }
172
173 void ExtensionWebRequestApiTest::RunPermissionTest( 162 void ExtensionWebRequestApiTest::RunPermissionTest(
174 const char* extension_directory, 163 const char* extension_directory,
175 bool load_extension_with_incognito_permission, 164 bool load_extension_with_incognito_permission,
176 bool wait_for_extension_loaded_in_incognito, 165 bool wait_for_extension_loaded_in_incognito,
177 const char* expected_content_regular_window, 166 const char* expected_content_regular_window,
178 const char* exptected_content_incognito_window) { 167 const char* exptected_content_incognito_window) {
179 ResultCatcher catcher; 168 ResultCatcher catcher;
180 catcher.RestrictToProfile(browser()->profile()); 169 catcher.RestrictToProfile(browser()->profile());
181 ResultCatcher catcher_incognito; 170 ResultCatcher catcher_incognito;
182 catcher_incognito.RestrictToProfile( 171 catcher_incognito.RestrictToProfile(
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Reload extension and wait for rules to be set up again. This should not 282 // Reload extension and wait for rules to be set up again. This should not
294 // crash the browser. 283 // crash the browser.
295 ExtensionTestMessageListener listener2("done", true); 284 ExtensionTestMessageListener listener2("done", true);
296 ExtensionTestMessageListener listener_incognito2("done_incognito", true); 285 ExtensionTestMessageListener listener_incognito2("done_incognito", true);
297 286
298 ReloadExtension(extension->id()); 287 ReloadExtension(extension->id());
299 288
300 EXPECT_TRUE(listener2.WaitUntilSatisfied()); 289 EXPECT_TRUE(listener2.WaitUntilSatisfied());
301 EXPECT_TRUE(listener_incognito2.WaitUntilSatisfied()); 290 EXPECT_TRUE(listener_incognito2.WaitUntilSatisfied());
302 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698