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

Side by Side Diff: chrome/browser/extensions/extension_incognito_apitest.cc

Issue 5742011: Do not create an incognito profile if none exists in cookies.getAllCookieStores (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/extensions
Patch Set: Created 10 years 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) 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_list.h" 5 #include "chrome/browser/browser_list.h"
6 #include "chrome/browser/browser_window.h" 6 #include "chrome/browser/browser_window.h"
7 #include "chrome/browser/extensions/browser_action_test_util.h" 7 #include "chrome/browser/extensions/browser_action_test_util.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extensions_service.h" 9 #include "chrome/browser/extensions/extensions_service.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 10 #include "chrome/browser/extensions/extension_test_message_listener.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 tab->render_view_host(), L"", 79 tab->render_view_host(), L"",
80 L"window.domAutomationController.send(document.title == 'modified')", 80 L"window.domAutomationController.send(document.title == 'modified')",
81 &result)); 81 &result));
82 EXPECT_TRUE(result); 82 EXPECT_TRUE(result);
83 } 83 }
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(RunExtensionTestIncognito(
90 RunExtensionTestIncognito("incognito/enumerate_tabs")) << message_; 90 "incognito/dont_create_profile")) << message_;
91 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile()); 91 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile());
92 } 92 }
93 93
94 // Tests that the APIs in an incognito-enabled extension work properly. 94 // Tests that the APIs in an incognito-enabled extension work properly.
95 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Incognito) { 95 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Incognito) {
96 host_resolver()->AddRule("*", "127.0.0.1"); 96 host_resolver()->AddRule("*", "127.0.0.1");
97 ASSERT_TRUE(StartTestServer()); 97 ASSERT_TRUE(StartTestServer());
98 98
99 ResultCatcher catcher; 99 ResultCatcher catcher;
100 100
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 Browser* incognito_browser = BrowserList::FindBrowserWithType( 187 Browser* incognito_browser = BrowserList::FindBrowserWithType(
188 browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL, 188 browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL,
189 false); 189 false);
190 190
191 // Simulate the incognito's browser action being clicked. 191 // Simulate the incognito's browser action being clicked.
192 BrowserActionTestUtil(incognito_browser).Press(0); 192 BrowserActionTestUtil(incognito_browser).Press(0);
193 193
194 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 194 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
195 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698