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

Unified Diff: chrome/browser/extensions/extension_incognito_apitest.cc

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_incognito_apitest.cc
diff --git a/chrome/browser/extensions/extension_incognito_apitest.cc b/chrome/browser/extensions/extension_incognito_apitest.cc
index dbc9234c51b3b59146dc078716a59e558d7e1d28..8a138b98294bf8610bda34babc40549f00e6fc78 100644
--- a/chrome/browser/extensions/extension_incognito_apitest.cc
+++ b/chrome/browser/extensions/extension_incognito_apitest.cc
@@ -95,6 +95,31 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Incognito) {
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
}
+// Tests that the APIs in an incognito-enabled split-mode extension work
+// properly.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoSplitMode) {
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ // We need 2 ResultCatchers because we'll be running the same test in both
+ // regular and incognito mode.
+ ResultCatcher catcher;
+ catcher.RestrictToProfile(browser()->profile());
+ ResultCatcher catcher_incognito;
+ catcher_incognito.RestrictToProfile(
+ browser()->profile()->GetOffTheRecordProfile());
+
+ // Open incognito window and navigate to test page.
+ ui_test_utils::OpenURLOffTheRecord(browser()->profile(),
+ GURL("http://www.example.com:1337/files/extensions/test_file.html"));
+
+ ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_
+ .AppendASCII("incognito").AppendASCII("split")));
+
+ EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
+ EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message();
+}
+
// Tests that the APIs in an incognito-disabled extension don't see incognito
// events or callbacks.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabled) {
« no previous file with comments | « chrome/browser/extensions/extension_idle_api.cc ('k') | chrome/browser/extensions/extension_menu_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698