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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc

Issue 2813073002: [Merge M58] arc: Restore Chrome badging for apps that have peer in Android apps. (Closed)
Patch Set: fix merge conflict Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/common/shelf/app_list_button.h" 9 #include "ash/common/shelf/app_list_button.h"
10 #include "ash/common/shelf/shelf_button.h" 10 #include "ash/common/shelf/shelf_button.h"
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) { 852 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) {
853 TestAppWindowRegistryObserver test_observer(browser()->profile()); 853 TestAppWindowRegistryObserver test_observer(browser()->profile());
854 854
855 // Enable experimental APIs to allow panel creation. 855 // Enable experimental APIs to allow panel creation.
856 base::CommandLine::ForCurrentProcess()->AppendSwitch( 856 base::CommandLine::ForCurrentProcess()->AppendSwitch(
857 extensions::switches::kEnableExperimentalExtensionApis); 857 extensions::switches::kEnableExperimentalExtensionApis);
858 858
859 int base_shelf_item_count = shelf_model()->item_count(); 859 int base_shelf_item_count = shelf_model()->item_count();
860 ExtensionTestMessageListener completed_listener("Completed", false); 860 ExtensionTestMessageListener completed_listener("Completed", false);
861 LoadAndLaunchPlatformApp("app_icon", "Launched"); 861 LoadAndLaunchPlatformApp("app_icon", "Launched");
862
862 ASSERT_TRUE(completed_listener.WaitUntilSatisfied()); 863 ASSERT_TRUE(completed_listener.WaitUntilSatisfied());
863 864
864 // Now wait until the WebContent has decoded the icons and chrome has 865 // Now wait until the WebContent has decoded the icons and chrome has
865 // processed it. This needs to be in a loop since the renderer runs in a 866 // processed it. This needs to be in a loop since the renderer runs in a
866 // different process. 867 // different process.
867 while (test_observer.icon_updates() < 3) { 868 while (test_observer.icon_updates() < 4) {
868 base::RunLoop run_loop; 869 base::RunLoop run_loop;
869 run_loop.RunUntilIdle(); 870 run_loop.RunUntilIdle();
870 } 871 }
871 872
872 // This test creates one app window and one panel window. 873 // This test creates one app window, one app window with custom icon and one
874 // panel window.
873 int shelf_item_count = shelf_model()->item_count(); 875 int shelf_item_count = shelf_model()->item_count();
874 ASSERT_EQ(base_shelf_item_count + 2, shelf_item_count); 876 ASSERT_EQ(base_shelf_item_count + 3, shelf_item_count);
875 // The Panel will be the last item, the app second-to-last. 877 // The Panel will be the last item, the app second-to-last.
876 const ash::ShelfItem& app_item = 878 const ash::ShelfItem& app_item = shelf_model()->items()[shelf_item_count - 3];
879 const ash::ShelfItem& app_custom_icon_item =
877 shelf_model()->items()[shelf_item_count - 2]; 880 shelf_model()->items()[shelf_item_count - 2];
878 const ash::ShelfItem& panel_item = 881 const ash::ShelfItem& panel_item =
879 shelf_model()->items()[shelf_item_count - 1]; 882 shelf_model()->items()[shelf_item_count - 1];
883
880 // Icons for Apps are set by the AppWindowLauncherController, so 884 // Icons for Apps are set by the AppWindowLauncherController, so
881 // image_set_by_controller() should be set. 885 // image_set_by_controller() should be set.
882 const LauncherItemController* app_item_controller = 886 const LauncherItemController* app_item_delegate =
883 GetItemController(app_item.id); 887 GetItemController(app_item.id);
884 EXPECT_TRUE(app_item_controller->image_set_by_controller()); 888 ASSERT_TRUE(app_item_delegate);
889 EXPECT_FALSE(app_item_delegate->image_set_by_controller());
890
891 const LauncherItemController* app_custom_icon_item_delegate =
892 GetItemController(app_custom_icon_item.id);
893 ASSERT_TRUE(app_custom_icon_item_delegate);
894 EXPECT_TRUE(app_custom_icon_item_delegate->image_set_by_controller());
895
885 // Panels are handled by ShelfWindowWatcher, not ChromeLauncherController. 896 // Panels are handled by ShelfWindowWatcher, not ChromeLauncherController.
886 EXPECT_EQ(nullptr, GetItemController(panel_item.id)); 897 EXPECT_EQ(nullptr, GetItemController(panel_item.id));
887 // Ensure icon heights are correct (see test.js in app_icon/ test directory) 898 // Ensure icon heights are correct (see test.js in app_icon/ test directory)
888 EXPECT_EQ(ash::GetShelfConstant(ash::SHELF_SIZE), app_item.image.height()); 899 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALL, app_item.image.height());
900 EXPECT_EQ(extension_misc::EXTENSION_ICON_LARGE,
901 app_custom_icon_item.image.height());
889 EXPECT_EQ(64, panel_item.image.height()); 902 EXPECT_EQ(64, panel_item.image.height());
890 } 903 }
891 904
892 // Test that we can launch an app with a shortcut. 905 // Test that we can launch an app with a shortcut.
893 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) { 906 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) {
894 TabStripModel* tab_strip = browser()->tab_strip_model(); 907 TabStripModel* tab_strip = browser()->tab_strip_model();
895 int tab_count = tab_strip->count(); 908 int tab_count = tab_strip->count();
896 ash::ShelfID shortcut_id = CreateShortcut("app1"); 909 ash::ShelfID shortcut_id = CreateShortcut("app1");
897 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); 910 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
898 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); 911 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 2405
2393 // Close all windows via the menu item. 2406 // Close all windows via the menu item.
2394 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); 2407 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE);
2395 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); 2408 EXPECT_EQ(0u, BrowserList::GetInstance()->size());
2396 2409
2397 // Check if "Close" is removed from the context menu. 2410 // Check if "Close" is removed from the context menu.
2398 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); 2411 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu();
2399 ASSERT_FALSE( 2412 ASSERT_FALSE(
2400 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); 2413 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE));
2401 } 2414 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698