OLD | NEW |
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_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const char* exptected_content_incognito_window) { | 151 const char* exptected_content_incognito_window) { |
152 ResultCatcher catcher; | 152 ResultCatcher catcher; |
153 catcher.RestrictToProfile(browser()->profile()); | 153 catcher.RestrictToProfile(browser()->profile()); |
154 ResultCatcher catcher_incognito; | 154 ResultCatcher catcher_incognito; |
155 catcher_incognito.RestrictToProfile( | 155 catcher_incognito.RestrictToProfile( |
156 browser()->profile()->GetOffTheRecordProfile()); | 156 browser()->profile()->GetOffTheRecordProfile()); |
157 | 157 |
158 ExtensionTestMessageListener listener("done", true); | 158 ExtensionTestMessageListener listener("done", true); |
159 ExtensionTestMessageListener listener_incognito("done_incognito", true); | 159 ExtensionTestMessageListener listener_incognito("done_incognito", true); |
160 | 160 |
161 ASSERT_TRUE(LoadExtensionWithOptions( | 161 int load_extension_flags = kFlagNone; |
| 162 if (load_extension_with_incognito_permission) |
| 163 load_extension_flags |= kFlagEnableIncognito; |
| 164 ASSERT_TRUE(LoadExtensionWithFlags( |
162 test_data_dir_.AppendASCII("webrequest_permissions") | 165 test_data_dir_.AppendASCII("webrequest_permissions") |
163 .AppendASCII(extension_directory), | 166 .AppendASCII(extension_directory), |
164 load_extension_with_incognito_permission, | 167 load_extension_flags)); |
165 false)); | |
166 | 168 |
167 // Test that navigation in regular window is properly redirected. | 169 // Test that navigation in regular window is properly redirected. |
168 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 170 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
169 | 171 |
170 // This navigation should be redirected. | 172 // This navigation should be redirected. |
171 ui_test_utils::NavigateToURL( | 173 ui_test_utils::NavigateToURL( |
172 browser(), | 174 browser(), |
173 test_server()->GetURL("files/extensions/test_file.html")); | 175 test_server()->GetURL("files/extensions/test_file.html")); |
174 | 176 |
175 std::string body; | 177 std::string body; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 WebRequestDeclarativePermissionSplit1) { | 221 WebRequestDeclarativePermissionSplit1) { |
220 // Test split with incognito permission. | 222 // Test split with incognito permission. |
221 RunPermissionTest("split", true, true, "redirected1", "redirected2"); | 223 RunPermissionTest("split", true, true, "redirected1", "redirected2"); |
222 } | 224 } |
223 | 225 |
224 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, | 226 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, |
225 WebRequestDeclarativePermissionSplit2) { | 227 WebRequestDeclarativePermissionSplit2) { |
226 // Test split without incognito permission. | 228 // Test split without incognito permission. |
227 RunPermissionTest("split", false, false, "redirected1", ""); | 229 RunPermissionTest("split", false, false, "redirected1", ""); |
228 } | 230 } |
OLD | NEW |