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) { |