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

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

Issue 1811523002: Enhance chrome.app.window API with better shelf integration Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [WIP] Rebase + browser tests. Added a new map that holds all the showInShelf windows. Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cc357013e0c8dace1fc1e915f62f6e0f7a6db203..162ffeace785ab0fe5ef17b4611231a2f8274612 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -1491,6 +1491,88 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowAttentionStatus) {
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
}
+IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, ShowInShelfWindows) {
+ ash::ShelfModel* shelf_model = ash::Shell::GetInstance()->shelf_model();
+
+ // Test 1
+ int item_count = shelf_model->item_count();
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
+ AppWindow::CreateParams params;
+ params.show_in_shelf = true;
+ AppWindow* window1 =
+ CreateAppWindowFromParams(browser()->profile(), extension, params);
+ // There should be only 1 item added to the shelf.
+ item_count++;
+ EXPECT_EQ(item_count, shelf_model->item_count());
+ CloseAppWindow(window1);
+
+ // Test 2
+ item_count = shelf_model->item_count();
+ extension = LoadAndLaunchPlatformApp("launch", "Launched");
+
+ params.show_in_shelf = false;
+ window1 = CreateAppWindowFromParams(browser()->profile(), extension, params);
+ params.show_in_shelf = true;
+ AppWindow* window2 =
+ CreateAppWindowFromParams(browser()->profile(), extension, params);
+ // There should be 2 items added to the shelf: although window1 has
+ // show_in_shelf set to false, it's the first window created so its icon must
+ // show up in shelf.
+ item_count += 2;
+ EXPECT_EQ(item_count, shelf_model->item_count());
+ CloseAppWindow(window1);
+ CloseAppWindow(window2);
+
+ // Test 3
+ item_count = shelf_model->item_count();
+ extension = LoadAndLaunchPlatformApp("launch", "Launched");
+
+ params.show_in_shelf = false;
+ window1 = CreateAppWindowFromParams(browser()->profile(), extension, params);
+ // There should be 1 item added to the shelf: although show_in_shelf is false,
+ // this is the first window created.
+ item_count++;
+ EXPECT_EQ(item_count, shelf_model->item_count());
+ CloseAppWindow(window1);
+
+ // Test 4
+ item_count = shelf_model->item_count();
+
+ extension = LoadAndLaunchPlatformApp("launch", "Launched");
+
+ params.show_in_shelf = true;
+ window1 = CreateAppWindowFromParams(browser()->profile(), extension, params);
+ params.show_in_shelf = false;
+ window2 = CreateAppWindowFromParams(browser()->profile(), extension, params);
+ // There should be 1 item added to the shelf.
+ item_count += 1;
+ EXPECT_EQ(item_count, shelf_model->item_count());
+ CloseAppWindow(window1);
+ CloseAppWindow(window2);
+
+ // Test 5
+ item_count = shelf_model->item_count();
+
+ extension = LoadAndLaunchPlatformApp("launch", "Launched");
+ params.show_in_shelf = false;
+ window1 = CreateAppWindowFromParams(browser()->profile(), extension, params);
+ params.show_in_shelf = false;
+ window2 = CreateAppWindowFromParams(browser()->profile(), extension, params);
+ params.show_in_shelf = true;
+ AppWindow* window3 =
+ CreateAppWindowFromParams(browser()->profile(), extension, params);
+ params.show_in_shelf = true;
+ AppWindow* window4 =
+ CreateAppWindowFromParams(browser()->profile(), extension, params);
+ // There should be 3 item added to the shelf.
+ item_count += 3;
+ EXPECT_EQ(item_count, shelf_model->item_count());
+ CloseAppWindow(window1);
+ CloseAppWindow(window2);
+ CloseAppWindow(window3);
+ CloseAppWindow(window4);
+}
+
// Checks that the browser Alt "tabbing" is properly done.
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
AltNumberBrowserTabbing) {
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698