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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc

Issue 298303002: Add option to install an ephemeral app to ChromeOS shelf context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tapted's review comments Created 6 years, 7 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/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..bd0df8c75f501e9e1ee28f74228ed6cde6621532 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);
+
+ // 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.

Powered by Google App Engine
This is Rietveld 408576698