Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc |
| diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc |
| index 12a113349b87328405bf3aaa663104675e86293b..755e5e61c1434a2d4152684372c11012a057d5b8 100644 |
| --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc |
| +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc |
| @@ -631,6 +631,47 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) { |
| EXPECT_EQ(item_count, shelf_model()->item_count()); |
| } |
| +// Verify that ChromeLauncherController::CanInstall() returns true for ephemeral |
| +// apps and false when the app is promoted to a regular installed app. |
| +IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, InstallEphemeralApp) { |
| + int item_count = shelf_model()->item_count(); |
| + |
| + // Sanity check to verify that ChromeLauncherController::CanInstall() returns |
| + // false for apps that are fully installed. |
| + const Extension* app = LoadAndLaunchPlatformApp("launch"); |
| + ASSERT_TRUE(app); |
| + CreateAppWindow(app); |
| + ++item_count; |
| + ASSERT_EQ(item_count, shelf_model()->item_count()); |
| + const ash::ShelfItem& app_item = GetLastLauncherItem(); |
| + ash::ShelfID app_id = app_item.id; |
| + EXPECT_FALSE(controller_->CanInstall(app_id)); |
| + |
| + // Add an ephemeral app. |
| + const Extension* ephemeral_app = InstallEphemeralAppWithSourceAndFlags( |
| + test_data_dir_.AppendASCII("platform_apps").AppendASCII("launch_2"), |
| + 1, |
| + extensions::Manifest::INTERNAL, |
| + Extension::NO_FLAGS); |
| + ASSERT_TRUE(ephemeral_app); |
| + CreateAppWindow(ephemeral_app); |
| + ++item_count; |
| + ASSERT_EQ(item_count, shelf_model()->item_count()); |
| + const ash::ShelfItem& ephemeral_item = GetLastLauncherItem(); |
| + ash::ShelfID ephemeral_id = ephemeral_item.id; |
| + |
| + // Verify that the shelf item for the ephemeral app can be installed. |
| + EXPECT_TRUE(controller_->CanInstall(ephemeral_id)); |
| + |
| + // Promote the ephemeral app to a regular installed app. |
| + ExtensionService* service = extensions::ExtensionSystem::Get(profile()) |
| + ->extension_service(); |
| + service->PromoteEphemeralApp(ephemeral_app, false); |
|
tmdiep
2014/05/28 03:25:42
PromoteEphemeralApp() will be available when this
|
| + |
| + // Verify that the shelf item for the app can no longer be installed. |
| + EXPECT_FALSE(controller_->CanInstall(ephemeral_id)); |
| +} |
| + |
| // Confirm that Click behavior for app windows is correnct. |
| IN_PROC_BROWSER_TEST_F(ShelfAppBrowserNoMinimizeOnClick, AppClickBehavior) { |
| // Launch a platform app and create a window for it. |