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/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 std::string body; | 210 std::string body; |
211 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 211 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
212 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 212 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
213 tab, | 213 tab, |
214 "window.domAutomationController.send(document.body.textContent)", | 214 "window.domAutomationController.send(document.body.textContent)", |
215 &body)); | 215 &body)); |
216 EXPECT_EQ(expected_content_regular_window, body); | 216 EXPECT_EQ(expected_content_regular_window, body); |
217 | 217 |
218 // Test that navigation in OTR window is properly redirected. | 218 // Test that navigation in OTR window is properly redirected. |
219 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( | 219 Browser* otr_browser = |
220 browser()->profile(), GURL("about:blank")); | 220 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); |
221 | 221 |
222 if (wait_for_extension_loaded_in_incognito) | 222 if (wait_for_extension_loaded_in_incognito) |
223 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); | 223 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); |
224 | 224 |
225 // This navigation should be redirected if | 225 // This navigation should be redirected if |
226 // load_extension_with_incognito_permission is true. | 226 // load_extension_with_incognito_permission is true. |
227 ui_test_utils::NavigateToURL( | 227 ui_test_utils::NavigateToURL( |
228 otr_browser, | 228 otr_browser, |
229 embedded_test_server()->GetURL("/extensions/test_file.html")); | 229 embedded_test_server()->GetURL("/extensions/test_file.html")); |
230 | 230 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, IncognitoSplitModeReload) { | 300 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, IncognitoSplitModeReload) { |
301 ASSERT_TRUE(StartEmbeddedTestServer()); | 301 ASSERT_TRUE(StartEmbeddedTestServer()); |
302 // Wait for rules to be set up. | 302 // Wait for rules to be set up. |
303 ExtensionTestMessageListener listener("done", true); | 303 ExtensionTestMessageListener listener("done", true); |
304 ExtensionTestMessageListener listener_incognito("done_incognito", true); | 304 ExtensionTestMessageListener listener_incognito("done_incognito", true); |
305 | 305 |
306 const extensions::Extension* extension = LoadExtensionWithFlags( | 306 const extensions::Extension* extension = LoadExtensionWithFlags( |
307 test_data_dir_.AppendASCII("webrequest_reload"), | 307 test_data_dir_.AppendASCII("webrequest_reload"), |
308 kFlagEnableIncognito); | 308 kFlagEnableIncognito); |
309 ASSERT_TRUE(extension); | 309 ASSERT_TRUE(extension); |
310 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); | 310 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); |
311 | 311 |
312 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 312 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
313 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); | 313 EXPECT_TRUE(listener_incognito.WaitUntilSatisfied()); |
314 | 314 |
315 // Reload extension and wait for rules to be set up again. This should not | 315 // Reload extension and wait for rules to be set up again. This should not |
316 // crash the browser. | 316 // crash the browser. |
317 ExtensionTestMessageListener listener2("done", true); | 317 ExtensionTestMessageListener listener2("done", true); |
318 ExtensionTestMessageListener listener_incognito2("done_incognito", true); | 318 ExtensionTestMessageListener listener_incognito2("done_incognito", true); |
319 | 319 |
320 ReloadExtension(extension->id()); | 320 ReloadExtension(extension->id()); |
321 | 321 |
322 EXPECT_TRUE(listener2.WaitUntilSatisfied()); | 322 EXPECT_TRUE(listener2.WaitUntilSatisfied()); |
323 EXPECT_TRUE(listener_incognito2.WaitUntilSatisfied()); | 323 EXPECT_TRUE(listener_incognito2.WaitUntilSatisfied()); |
324 } | 324 } |
OLD | NEW |