OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
6 #include "chrome/browser/browser_list.h" | 6 #include "chrome/browser/browser_list.h" |
7 #include "chrome/browser/browser_window.h" | 7 #include "chrome/browser/browser_window.h" |
8 #include "chrome/browser/extensions/browser_action_test_util.h" | 8 #include "chrome/browser/extensions/browser_action_test_util.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // Tests that an extension which is enabled for incognito mode doesn't | 85 // Tests that an extension which is enabled for incognito mode doesn't |
86 // accidentially create and incognito profile. | 86 // accidentially create and incognito profile. |
87 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DontCreateIncognitoProfile) { | 87 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DontCreateIncognitoProfile) { |
88 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile()); | 88 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile()); |
89 ASSERT_TRUE( | 89 ASSERT_TRUE( |
90 RunExtensionTestIncognito("incognito/enumerate_tabs")) << message_; | 90 RunExtensionTestIncognito("incognito/enumerate_tabs")) << message_; |
91 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile()); | 91 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile()); |
92 } | 92 } |
93 | 93 |
| 94 // TODO(kochi): Flaky at r65757 and after on buildbot for ChromiumOS. |
| 95 // http://crosbug.com/9049 |
| 96 #if defined(OS_CHROMEOS) |
| 97 #define MAYBE_Incognito FLAKY_Incognito |
| 98 #else |
| 99 #define MAYBE_Incognito Incognito |
| 100 #endif |
| 101 |
94 // Tests that the APIs in an incognito-enabled extension work properly. | 102 // Tests that the APIs in an incognito-enabled extension work properly. |
95 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Incognito) { | 103 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Incognito) { |
96 host_resolver()->AddRule("*", "127.0.0.1"); | 104 host_resolver()->AddRule("*", "127.0.0.1"); |
97 ASSERT_TRUE(StartTestServer()); | 105 ASSERT_TRUE(StartTestServer()); |
98 | 106 |
99 ResultCatcher catcher; | 107 ResultCatcher catcher; |
100 | 108 |
101 // Open incognito window and navigate to test page. | 109 // Open incognito window and navigate to test page. |
102 ui_test_utils::OpenURLOffTheRecord( | 110 ui_test_utils::OpenURLOffTheRecord( |
103 browser()->profile(), | 111 browser()->profile(), |
104 test_server()->GetURL("files/extensions/test_file.html")); | 112 test_server()->GetURL("files/extensions/test_file.html")); |
105 | 113 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 194 |
187 Browser* incognito_browser = BrowserList::FindBrowserWithType( | 195 Browser* incognito_browser = BrowserList::FindBrowserWithType( |
188 browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL, | 196 browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL, |
189 false); | 197 false); |
190 | 198 |
191 // Simulate the incognito's browser action being clicked. | 199 // Simulate the incognito's browser action being clicked. |
192 BrowserActionTestUtil(incognito_browser).Press(0); | 200 BrowserActionTestUtil(incognito_browser).Press(0); |
193 | 201 |
194 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 202 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
195 } | 203 } |
OLD | NEW |