diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 20:19:31 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 20:19:31 +0000 |
commit | 688a1731151b61d689a2a8ea1747ee1a30069ace (patch) | |
tree | 5008b9844d15c69a3191d178102ea4de84b8a0cc /chrome/browser/extensions | |
parent | 93b7383559a9df1fc8703887b14d3a1ef73e2177 (diff) | |
download | chromium_src-688a1731151b61d689a2a8ea1747ee1a30069ace.zip chromium_src-688a1731151b61d689a2a8ea1747ee1a30069ace.tar.gz chromium_src-688a1731151b61d689a2a8ea1747ee1a30069ace.tar.bz2 |
Create a ShellWindowRegistry in incognito mode.
This registry is specific to the incognito profile in use. Without this apps cannot be used in incognito mode.
BUG=155130
Review URL: https://chromiumcodereview.appspot.com/11171003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/platform_app_browsertest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/extensions/shell_window_registry.cc | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/shell_window_registry.h | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 2ff93f0..363220a 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -149,6 +149,24 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseShellWindow) { CloseShellWindow(window); } +// Tests that platform apps can be launched in incognito mode without crashing. +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchAppIncognito) { + Browser* browser_incognito = ui_test_utils::OpenURLOffTheRecord( + browser()->profile(), GURL("about:blank")); + + ExtensionTestMessageListener launched_listener("Launched", false); + + const Extension* extension = LoadExtensionIncognito( + test_data_dir_.AppendASCII("platform_apps").AppendASCII("minimal")); + EXPECT_TRUE(extension); + + application_launch::OpenApplication(application_launch::LaunchParams( + browser_incognito->profile(), extension, extension_misc::LAUNCH_NONE, + NEW_WINDOW)); + + ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); +} + // Tests that platform apps received the "launch" event when launched. IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) { ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch")) << message_; diff --git a/chrome/browser/extensions/shell_window_registry.cc b/chrome/browser/extensions/shell_window_registry.cc index a5b72dc..a25bd3d 100644 --- a/chrome/browser/extensions/shell_window_registry.cc +++ b/chrome/browser/extensions/shell_window_registry.cc @@ -112,6 +112,10 @@ ProfileKeyedService* ShellWindowRegistry::Factory::BuildServiceInstanceFor( return new ShellWindowRegistry(); } +bool ShellWindowRegistry::Factory::ServiceHasOwnInstanceInIncognito() const { + return true; +} + bool ShellWindowRegistry::Factory::ServiceIsCreatedWithProfile() const { return true; } diff --git a/chrome/browser/extensions/shell_window_registry.h b/chrome/browser/extensions/shell_window_registry.h index 696c6dc..97ecc3a 100644 --- a/chrome/browser/extensions/shell_window_registry.h +++ b/chrome/browser/extensions/shell_window_registry.h @@ -87,6 +87,7 @@ class ShellWindowRegistry : public ProfileKeyedService { // ProfileKeyedServiceFactory virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; + virtual bool ServiceHasOwnInstanceInIncognito() const OVERRIDE; virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; }; |