| OLD | NEW |
| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "ash/common/shelf/shelf_application_menu_model.h" |
| 17 #include "ash/common/shelf/shelf_constants.h" | 18 #include "ash/common/shelf/shelf_constants.h" |
| 18 #include "ash/common/shelf/shelf_controller.h" | 19 #include "ash/common/shelf/shelf_controller.h" |
| 19 #include "ash/common/shelf/shelf_item_types.h" | 20 #include "ash/common/shelf/shelf_item_types.h" |
| 20 #include "ash/common/shelf/shelf_model.h" | 21 #include "ash/common/shelf/shelf_model.h" |
| 21 #include "ash/common/shelf/shelf_model_observer.h" | 22 #include "ash/common/shelf/shelf_model_observer.h" |
| 22 #include "ash/common/test/test_session_state_delegate.h" | 23 #include "ash/common/test/test_session_state_delegate.h" |
| 23 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 24 #include "ash/common/wm_shell.h" | 25 #include "ash/common/wm_shell.h" |
| 25 #include "ash/display/screen_orientation_controller_chromeos.h" | 26 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 26 #include "ash/shell.h" | 27 #include "ash/shell.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 52 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" | 53 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" |
| 53 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 54 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 54 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" | 55 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" |
| 55 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 56 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
| 56 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 57 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" | 58 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
| 58 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 59 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
| 59 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 60 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
| 60 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 61 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 61 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" | 62 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" |
| 62 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | |
| 63 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 63 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 64 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 64 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 65 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 65 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 67 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 67 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 68 #include "chrome/browser/ui/browser.h" | 68 #include "chrome/browser/ui/browser.h" |
| 69 #include "chrome/browser/ui/browser_commands.h" | 69 #include "chrome/browser/ui/browser_commands.h" |
| 70 #include "chrome/browser/ui/browser_finder.h" | 70 #include "chrome/browser/ui/browser_finder.h" |
| 71 #include "chrome/browser/ui/browser_list.h" | 71 #include "chrome/browser/ui/browser_list.h" |
| 72 #include "chrome/browser/ui/browser_tabstrip.h" | 72 #include "chrome/browser/ui/browser_tabstrip.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 TabToStringMap tab_id_map_; | 248 TabToStringMap tab_id_map_; |
| 249 | 249 |
| 250 DISALLOW_COPY_AND_ASSIGN(TestLauncherControllerHelper); | 250 DISALLOW_COPY_AND_ASSIGN(TestLauncherControllerHelper); |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 // Test implementation of a V2 app launcher item controller. | 253 // Test implementation of a V2 app launcher item controller. |
| 254 class TestV2AppLauncherItemController : public LauncherItemController { | 254 class TestV2AppLauncherItemController : public LauncherItemController { |
| 255 public: | 255 public: |
| 256 TestV2AppLauncherItemController(const std::string& app_id, | 256 TestV2AppLauncherItemController(const std::string& app_id, |
| 257 ChromeLauncherController* controller) | 257 ChromeLauncherController* controller) |
| 258 : LauncherItemController(app_id, "", controller) {} | 258 : LauncherItemController(app_id, std::string(), controller) {} |
| 259 | 259 |
| 260 ~TestV2AppLauncherItemController() override {} | 260 ~TestV2AppLauncherItemController() override {} |
| 261 | 261 |
| 262 // Override for LauncherItemController: | 262 // Override for LauncherItemController: |
| 263 void Launch(ash::LaunchSource source, int event_flags) override {} | 263 void Launch(ash::LaunchSource source, int event_flags) override {} |
| 264 ash::ShelfItemDelegate::PerformedAction Activate( | 264 ash::ShelfItemDelegate::PerformedAction Activate( |
| 265 ash::LaunchSource source) override { | 265 ash::LaunchSource source) override { |
| 266 return kExistingWindowActivated; | 266 return kExistingWindowActivated; |
| 267 } | 267 } |
| 268 void Close() override {} | |
| 269 ash::ShelfItemDelegate::PerformedAction ItemSelected( | 268 ash::ShelfItemDelegate::PerformedAction ItemSelected( |
| 270 const ui::Event& event) override { | 269 const ui::Event& event) override { |
| 271 return kExistingWindowActivated; | 270 return kExistingWindowActivated; |
| 272 } | 271 } |
| 273 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override { | 272 ash::ShelfAppMenuItemList GetAppMenuItems(int event_flags) override { |
| 274 ChromeLauncherAppMenuItems items; | 273 ash::ShelfAppMenuItemList items; |
| 275 items.push_back(base::MakeUnique<ChromeLauncherAppMenuItem>( | 274 items.push_back( |
| 276 base::string16(), nullptr, false)); | 275 base::MakeUnique<ash::ShelfApplicationMenuItem>(base::string16())); |
| 277 items.push_back(base::MakeUnique<ChromeLauncherAppMenuItem>( | 276 items.push_back( |
| 278 base::string16(), nullptr, false)); | 277 base::MakeUnique<ash::ShelfApplicationMenuItem>(base::string16())); |
| 279 return items; | 278 return items; |
| 280 } | 279 } |
| 281 ui::SimpleMenuModel* CreateApplicationMenu(int event_flags) override { | 280 void Close() override {} |
| 282 return NULL; | |
| 283 } | |
| 284 | 281 |
| 285 private: | 282 private: |
| 286 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); | 283 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); |
| 287 }; | 284 }; |
| 288 | 285 |
| 289 } // namespace | 286 } // namespace |
| 290 | 287 |
| 291 class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest { | 288 class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest { |
| 292 protected: | 289 protected: |
| 293 ChromeLauncherControllerImplTest() | 290 ChromeLauncherControllerImplTest() |
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 GetAppLaunchers(launcher_controller_.get(), &actual_launchers); | 2766 GetAppLaunchers(launcher_controller_.get(), &actual_launchers); |
| 2770 EXPECT_EQ(expected_launchers, actual_launchers); | 2767 EXPECT_EQ(expected_launchers, actual_launchers); |
| 2771 | 2768 |
| 2772 // Install |extension2| and verify it shows up between the other two. | 2769 // Install |extension2| and verify it shows up between the other two. |
| 2773 extension_service_->AddExtension(extension2_.get()); | 2770 extension_service_->AddExtension(extension2_.get()); |
| 2774 expected_launchers.insert(expected_launchers.begin() + 1, extension2_->id()); | 2771 expected_launchers.insert(expected_launchers.begin() + 1, extension2_->id()); |
| 2775 GetAppLaunchers(launcher_controller_.get(), &actual_launchers); | 2772 GetAppLaunchers(launcher_controller_.get(), &actual_launchers); |
| 2776 EXPECT_EQ(expected_launchers, actual_launchers); | 2773 EXPECT_EQ(expected_launchers, actual_launchers); |
| 2777 } | 2774 } |
| 2778 | 2775 |
| 2779 // Checks the created menus and menu lists for correctness. It uses the given | 2776 // Ensure |controller| creates the expected menu items for the given shelf item. |
| 2780 // |controller| to create the objects for the given |item| and checks the | 2777 void CheckAppMenu(ChromeLauncherControllerImpl* controller, |
| 2781 // found item count against the |expected_items|. The |title| list contains the | 2778 const ash::ShelfItem& item, |
| 2782 // menu titles in the order of their appearance in the menu (not including the | 2779 size_t expected_item_count, |
| 2783 // application name). | 2780 base::string16 expected_item_titles[]) { |
| 2784 bool CheckMenuCreation(ChromeLauncherControllerImpl* controller, | 2781 ash::ShelfAppMenuItemList items = controller->GetAppMenuItems(item, 0); |
| 2785 const ash::ShelfItem& item, | 2782 ASSERT_EQ(expected_item_count, items.size()); |
| 2786 size_t expected_items, | 2783 for (size_t i = 0; i < expected_item_count; i++) |
| 2787 base::string16 title[], | 2784 EXPECT_EQ(expected_item_titles[i], items[i]->title()); |
| 2788 bool is_browser) { | |
| 2789 ChromeLauncherAppMenuItems items = controller->GetApplicationList(item, 0); | |
| 2790 // A new behavior has been added: Only show menus if there is at least one | |
| 2791 // item available. | |
| 2792 if (expected_items < 1 && is_browser) { | |
| 2793 EXPECT_EQ(0u, items.size()); | |
| 2794 return items.size() == 0; | |
| 2795 } | |
| 2796 // There should be one item in there: The title. | |
| 2797 EXPECT_EQ(expected_items + 1, items.size()); | |
| 2798 EXPECT_FALSE(items[0]->IsEnabled()); | |
| 2799 for (size_t i = 0; i < expected_items; i++) { | |
| 2800 EXPECT_EQ(title[i], items[1 + i]->title()); | |
| 2801 // Check that the first real item has a leading separator. | |
| 2802 if (i == 1) | |
| 2803 EXPECT_TRUE(items[i]->HasLeadingSeparator()); | |
| 2804 else | |
| 2805 EXPECT_FALSE(items[i]->HasLeadingSeparator()); | |
| 2806 } | |
| 2807 | |
| 2808 std::unique_ptr<ui::SimpleMenuModel> menu( | |
| 2809 new LauncherApplicationMenuItemModel( | |
| 2810 controller->GetApplicationList(item, 0))); | |
| 2811 // The first element in the menu is a spacing separator. On some systems | |
| 2812 // (e.g. Windows) such things do not exist. As such we check the existence | |
| 2813 // and adjust dynamically. | |
| 2814 int first_item = menu->GetTypeAt(0) == ui::MenuModel::TYPE_SEPARATOR ? 1 : 0; | |
| 2815 int expected_menu_items = first_item + | |
| 2816 (expected_items ? (expected_items + 3) : 2); | |
| 2817 EXPECT_EQ(expected_menu_items, menu->GetItemCount()); | |
| 2818 EXPECT_FALSE(menu->IsEnabledAt(first_item)); | |
| 2819 if (expected_items) { | |
| 2820 EXPECT_EQ(ui::MenuModel::TYPE_SEPARATOR, | |
| 2821 menu->GetTypeAt(first_item + 1)); | |
| 2822 } | |
| 2823 return items.size() == expected_items + 1; | |
| 2824 } | 2785 } |
| 2825 | 2786 |
| 2826 // Check that browsers get reflected correctly in the launcher menu. | 2787 // Check that browsers get reflected correctly in the launcher menu. |
| 2827 TEST_F(ChromeLauncherControllerImplTest, BrowserMenuGeneration) { | 2788 TEST_F(ChromeLauncherControllerImplTest, BrowserMenuGeneration) { |
| 2828 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); | 2789 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); |
| 2829 chrome::NewTab(browser()); | 2790 chrome::NewTab(browser()); |
| 2830 | 2791 |
| 2831 InitLauncherController(); | 2792 InitLauncherController(); |
| 2832 | 2793 |
| 2833 // Check that the browser list is empty at this time. | 2794 // Check that the browser list is empty at this time. |
| 2834 ash::ShelfItem item_browser; | 2795 ash::ShelfItem item_browser; |
| 2835 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; | 2796 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; |
| 2836 item_browser.id = | 2797 item_browser.id = |
| 2837 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); | 2798 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); |
| 2838 EXPECT_TRUE(CheckMenuCreation( | 2799 CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); |
| 2839 launcher_controller_.get(), item_browser, 0, NULL, true)); | |
| 2840 | 2800 |
| 2841 // Now make the created browser() visible by showing its browser window. | 2801 // Now make the created browser() visible by showing its browser window. |
| 2842 browser()->window()->Show(); | 2802 browser()->window()->Show(); |
| 2843 base::string16 title1 = ASCIIToUTF16("Test1"); | 2803 base::string16 title1 = ASCIIToUTF16("Test1"); |
| 2844 NavigateAndCommitActiveTabWithTitle(browser(), GURL("http://test1"), title1); | 2804 NavigateAndCommitActiveTabWithTitle(browser(), GURL("http://test1"), title1); |
| 2845 base::string16 one_menu_item[] = { title1 }; | 2805 base::string16 one_menu_item[] = { title1 }; |
| 2846 | 2806 |
| 2847 EXPECT_TRUE(CheckMenuCreation( | 2807 CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item); |
| 2848 launcher_controller_.get(), item_browser, 1, one_menu_item, true)); | |
| 2849 | 2808 |
| 2850 // Create one more browser/window and check that one more was added. | 2809 // Create one more browser/window and check that one more was added. |
| 2851 std::unique_ptr<Browser> browser2( | 2810 std::unique_ptr<Browser> browser2( |
| 2852 CreateBrowserWithTestWindowForProfile(profile())); | 2811 CreateBrowserWithTestWindowForProfile(profile())); |
| 2853 chrome::NewTab(browser2.get()); | 2812 chrome::NewTab(browser2.get()); |
| 2854 browser2->window()->Show(); | 2813 browser2->window()->Show(); |
| 2855 base::string16 title2 = ASCIIToUTF16("Test2"); | 2814 base::string16 title2 = ASCIIToUTF16("Test2"); |
| 2856 NavigateAndCommitActiveTabWithTitle(browser2.get(), GURL("http://test2"), | 2815 NavigateAndCommitActiveTabWithTitle(browser2.get(), GURL("http://test2"), |
| 2857 title2); | 2816 title2); |
| 2858 | 2817 |
| 2859 // Check that the list contains now two entries - make furthermore sure that | 2818 // Check that the list contains now two entries - make furthermore sure that |
| 2860 // the active item is the first entry. | 2819 // the active item is the first entry. |
| 2861 base::string16 two_menu_items[] = {title1, title2}; | 2820 base::string16 two_menu_items[] = {title1, title2}; |
| 2862 EXPECT_TRUE(CheckMenuCreation( | 2821 CheckAppMenu(launcher_controller_.get(), item_browser, 2, two_menu_items); |
| 2863 launcher_controller_.get(), item_browser, 2, two_menu_items, true)); | |
| 2864 | 2822 |
| 2865 // Apparently we have to close all tabs we have. | 2823 // Apparently we have to close all tabs we have. |
| 2866 chrome::CloseTab(browser2.get()); | 2824 chrome::CloseTab(browser2.get()); |
| 2867 } | 2825 } |
| 2868 | 2826 |
| 2869 // Check the multi profile case where only user related browsers should show | 2827 // Check the multi profile case where only user related browsers should show |
| 2870 // up. | 2828 // up. |
| 2871 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerImplTest, | 2829 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerImplTest, |
| 2872 BrowserMenuGenerationTwoUsers) { | 2830 BrowserMenuGenerationTwoUsers) { |
| 2873 // Create a browser item in the LauncherController. | 2831 // Create a browser item in the LauncherController. |
| 2874 InitLauncherController(); | 2832 InitLauncherController(); |
| 2875 | 2833 |
| 2876 ash::ShelfItem item_browser; | 2834 ash::ShelfItem item_browser; |
| 2877 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; | 2835 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; |
| 2878 item_browser.id = | 2836 item_browser.id = |
| 2879 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); | 2837 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); |
| 2880 | 2838 |
| 2881 // Check that the menu is empty. | 2839 // Check that the menu is empty. |
| 2882 chrome::NewTab(browser()); | 2840 chrome::NewTab(browser()); |
| 2883 EXPECT_TRUE(CheckMenuCreation( | 2841 CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); |
| 2884 launcher_controller_.get(), item_browser, 0, NULL, true)); | |
| 2885 | 2842 |
| 2886 // Show the created |browser()| by showing its window. | 2843 // Show the created |browser()| by showing its window. |
| 2887 browser()->window()->Show(); | 2844 browser()->window()->Show(); |
| 2888 base::string16 title1 = ASCIIToUTF16("Test1"); | 2845 base::string16 title1 = ASCIIToUTF16("Test1"); |
| 2889 NavigateAndCommitActiveTabWithTitle(browser(), GURL("http://test1"), title1); | 2846 NavigateAndCommitActiveTabWithTitle(browser(), GURL("http://test1"), title1); |
| 2890 base::string16 one_menu_item1[] = { title1 }; | 2847 base::string16 one_menu_item1[] = { title1 }; |
| 2891 EXPECT_TRUE(CheckMenuCreation( | 2848 CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item1); |
| 2892 launcher_controller_.get(), item_browser, 1, one_menu_item1, true)); | |
| 2893 | 2849 |
| 2894 // Create a browser for another user and check that it is not included in the | 2850 // Create a browser for another user and check that it is not included in the |
| 2895 // users running browser list. | 2851 // users running browser list. |
| 2896 std::string user2 = "user2"; | 2852 std::string user2 = "user2"; |
| 2897 TestingProfile* profile2 = CreateMultiUserProfile(user2); | 2853 TestingProfile* profile2 = CreateMultiUserProfile(user2); |
| 2898 const AccountId account_id2( | 2854 const AccountId account_id2( |
| 2899 multi_user_util::GetAccountIdFromProfile(profile2)); | 2855 multi_user_util::GetAccountIdFromProfile(profile2)); |
| 2900 std::unique_ptr<Browser> browser2( | 2856 std::unique_ptr<Browser> browser2( |
| 2901 CreateBrowserAndTabWithProfile(profile2, user2, "http://test2")); | 2857 CreateBrowserAndTabWithProfile(profile2, user2, "http://test2")); |
| 2902 base::string16 one_menu_item2[] = { ASCIIToUTF16(user2) }; | 2858 base::string16 one_menu_item2[] = { ASCIIToUTF16(user2) }; |
| 2903 EXPECT_TRUE(CheckMenuCreation( | 2859 CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item1); |
| 2904 launcher_controller_.get(), item_browser, 1, one_menu_item1, true)); | |
| 2905 | 2860 |
| 2906 // Switch to the other user and make sure that only that browser window gets | 2861 // Switch to the other user and make sure that only that browser window gets |
| 2907 // shown. | 2862 // shown. |
| 2908 SwitchActiveUser(account_id2); | 2863 SwitchActiveUser(account_id2); |
| 2909 EXPECT_TRUE(CheckMenuCreation( | 2864 CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item2); |
| 2910 launcher_controller_.get(), item_browser, 1, one_menu_item2, true)); | |
| 2911 | 2865 |
| 2912 // Transferred browsers of other users should not show up in the list. | 2866 // Transferred browsers of other users should not show up in the list. |
| 2913 chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser( | 2867 chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser( |
| 2914 browser()->window()->GetNativeWindow(), account_id2); | 2868 browser()->window()->GetNativeWindow(), account_id2); |
| 2915 EXPECT_TRUE(CheckMenuCreation( | 2869 CheckAppMenu(launcher_controller_.get(), item_browser, 1, one_menu_item2); |
| 2916 launcher_controller_.get(), item_browser, 1, one_menu_item2, true)); | |
| 2917 | 2870 |
| 2918 chrome::CloseTab(browser2.get()); | 2871 chrome::CloseTab(browser2.get()); |
| 2919 } | 2872 } |
| 2920 | 2873 |
| 2921 // Check that V1 apps are correctly reflected in the launcher menu using the | 2874 // Check that V1 apps are correctly reflected in the launcher menu using the |
| 2922 // refocus logic. | 2875 // refocus logic. |
| 2923 // Note that the extension matching logic is tested by the extension system | 2876 // Note that the extension matching logic is tested by the extension system |
| 2924 // and does not need a separate test here. | 2877 // and does not need a separate test here. |
| 2925 TEST_F(ChromeLauncherControllerImplTest, V1AppMenuGeneration) { | 2878 TEST_F(ChromeLauncherControllerImplTest, V1AppMenuGeneration) { |
| 2926 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); | 2879 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2943 | 2896 |
| 2944 // Check the menu content. | 2897 // Check the menu content. |
| 2945 ash::ShelfItem item_browser; | 2898 ash::ShelfItem item_browser; |
| 2946 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; | 2899 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; |
| 2947 item_browser.id = | 2900 item_browser.id = |
| 2948 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); | 2901 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); |
| 2949 | 2902 |
| 2950 ash::ShelfItem item_gmail; | 2903 ash::ShelfItem item_gmail; |
| 2951 item_gmail.type = ash::TYPE_APP_SHORTCUT; | 2904 item_gmail.type = ash::TYPE_APP_SHORTCUT; |
| 2952 item_gmail.id = gmail_id; | 2905 item_gmail.id = gmail_id; |
| 2953 EXPECT_TRUE(CheckMenuCreation( | 2906 CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); |
| 2954 launcher_controller_.get(), item_gmail, 0, NULL, false)); | |
| 2955 | 2907 |
| 2956 // Set the gmail URL to a new tab. | 2908 // Set the gmail URL to a new tab. |
| 2957 base::string16 title1 = ASCIIToUTF16("Test1"); | 2909 base::string16 title1 = ASCIIToUTF16("Test1"); |
| 2958 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); | 2910 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); |
| 2959 | 2911 |
| 2960 base::string16 one_menu_item[] = { title1 }; | 2912 base::string16 one_menu_item[] = { title1 }; |
| 2961 EXPECT_TRUE(CheckMenuCreation( | 2913 CheckAppMenu(launcher_controller_.get(), item_gmail, 1, one_menu_item); |
| 2962 launcher_controller_.get(), item_gmail, 1, one_menu_item, false)); | |
| 2963 | 2914 |
| 2964 // Create one empty tab. | 2915 // Create one empty tab. |
| 2965 chrome::NewTab(browser()); | 2916 chrome::NewTab(browser()); |
| 2966 base::string16 title2 = ASCIIToUTF16("Test2"); | 2917 base::string16 title2 = ASCIIToUTF16("Test2"); |
| 2967 NavigateAndCommitActiveTabWithTitle( | 2918 NavigateAndCommitActiveTabWithTitle( |
| 2968 browser(), | 2919 browser(), |
| 2969 GURL("https://bla"), | 2920 GURL("https://bla"), |
| 2970 title2); | 2921 title2); |
| 2971 | 2922 |
| 2972 // and another one with another gmail instance. | 2923 // and another one with another gmail instance. |
| 2973 chrome::NewTab(browser()); | 2924 chrome::NewTab(browser()); |
| 2974 base::string16 title3 = ASCIIToUTF16("Test3"); | 2925 base::string16 title3 = ASCIIToUTF16("Test3"); |
| 2975 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title3); | 2926 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title3); |
| 2976 base::string16 two_menu_items[] = {title1, title3}; | 2927 base::string16 two_menu_items[] = {title1, title3}; |
| 2977 EXPECT_TRUE(CheckMenuCreation( | 2928 CheckAppMenu(launcher_controller_.get(), item_gmail, 2, two_menu_items); |
| 2978 launcher_controller_.get(), item_gmail, 2, two_menu_items, false)); | |
| 2979 | 2929 |
| 2980 // Even though the item is in the V1 app list, it should also be in the | 2930 // Even though the item is in the V1 app list, it should also be in the |
| 2981 // browser list. | 2931 // browser list. |
| 2982 base::string16 browser_menu_item[] = {title3}; | 2932 base::string16 browser_menu_item[] = {title3}; |
| 2983 EXPECT_TRUE(CheckMenuCreation( | 2933 CheckAppMenu(launcher_controller_.get(), item_browser, 1, browser_menu_item); |
| 2984 launcher_controller_.get(), item_browser, 1, browser_menu_item, false)); | |
| 2985 | 2934 |
| 2986 // Test that closing of (all) the item(s) does work (and all menus get | 2935 // Test that closing of (all) the item(s) does work (and all menus get |
| 2987 // updated properly). | 2936 // updated properly). |
| 2988 launcher_controller_->Close(item_gmail.id); | 2937 launcher_controller_->Close(item_gmail.id); |
| 2989 | 2938 |
| 2990 EXPECT_TRUE(CheckMenuCreation( | 2939 CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); |
| 2991 launcher_controller_.get(), item_gmail, 0, NULL, false)); | |
| 2992 base::string16 browser_menu_item2[] = { title2 }; | 2940 base::string16 browser_menu_item2[] = { title2 }; |
| 2993 EXPECT_TRUE(CheckMenuCreation( | 2941 CheckAppMenu(launcher_controller_.get(), item_browser, 1, browser_menu_item2); |
| 2994 launcher_controller_.get(), item_browser, 1, browser_menu_item2, false)); | |
| 2995 } | 2942 } |
| 2996 | 2943 |
| 2997 // Check the multi profile case where only user related apps should show up. | 2944 // Check the multi profile case where only user related apps should show up. |
| 2998 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerImplTest, | 2945 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerImplTest, |
| 2999 V1AppMenuGenerationTwoUsers) { | 2946 V1AppMenuGenerationTwoUsers) { |
| 3000 // Create a browser item in the LauncherController. | 2947 // Create a browser item in the LauncherController. |
| 3001 InitLauncherController(); | 2948 InitLauncherController(); |
| 3002 chrome::NewTab(browser()); | 2949 chrome::NewTab(browser()); |
| 3003 | 2950 |
| 3004 // Installing |extension3_| adds it to the launcher. | 2951 // Installing |extension3_| adds it to the launcher. |
| 3005 ash::ShelfID gmail_id = model_->next_id(); | 2952 ash::ShelfID gmail_id = model_->next_id(); |
| 3006 extension_service_->AddExtension(extension3_.get()); | 2953 extension_service_->AddExtension(extension3_.get()); |
| 3007 EXPECT_EQ(3, model_->item_count()); | 2954 EXPECT_EQ(3, model_->item_count()); |
| 3008 int gmail_index = model_->ItemIndexByID(gmail_id); | 2955 int gmail_index = model_->ItemIndexByID(gmail_id); |
| 3009 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[gmail_index].type); | 2956 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[gmail_index].type); |
| 3010 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); | 2957 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); |
| 3011 launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(gmail_url)); | 2958 launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(gmail_url)); |
| 3012 | 2959 |
| 3013 // Check the menu content. | 2960 // Check the menu content. |
| 3014 ash::ShelfItem item_browser; | 2961 ash::ShelfItem item_browser; |
| 3015 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; | 2962 item_browser.type = ash::TYPE_BROWSER_SHORTCUT; |
| 3016 item_browser.id = | 2963 item_browser.id = |
| 3017 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); | 2964 launcher_controller_->GetShelfIDForAppID(extension_misc::kChromeAppId); |
| 3018 | 2965 |
| 3019 ash::ShelfItem item_gmail; | 2966 ash::ShelfItem item_gmail; |
| 3020 item_gmail.type = ash::TYPE_APP_SHORTCUT; | 2967 item_gmail.type = ash::TYPE_APP_SHORTCUT; |
| 3021 item_gmail.id = gmail_id; | 2968 item_gmail.id = gmail_id; |
| 3022 EXPECT_TRUE(CheckMenuCreation( | 2969 CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); |
| 3023 launcher_controller_.get(), item_gmail, 0, NULL, false)); | |
| 3024 | 2970 |
| 3025 // Set the gmail URL to a new tab. | 2971 // Set the gmail URL to a new tab. |
| 3026 base::string16 title1 = ASCIIToUTF16("Test1"); | 2972 base::string16 title1 = ASCIIToUTF16("Test1"); |
| 3027 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); | 2973 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); |
| 3028 | 2974 |
| 3029 base::string16 one_menu_item[] = { title1 }; | 2975 base::string16 one_menu_item[] = { title1 }; |
| 3030 EXPECT_TRUE(CheckMenuCreation( | 2976 CheckAppMenu(launcher_controller_.get(), item_gmail, 1, one_menu_item); |
| 3031 launcher_controller_.get(), item_gmail, 1, one_menu_item, false)); | |
| 3032 | 2977 |
| 3033 // Create a second profile and switch to that user. | 2978 // Create a second profile and switch to that user. |
| 3034 std::string user2 = "user2"; | 2979 std::string user2 = "user2"; |
| 3035 TestingProfile* profile2 = CreateMultiUserProfile(user2); | 2980 TestingProfile* profile2 = CreateMultiUserProfile(user2); |
| 3036 const AccountId account_id2( | 2981 const AccountId account_id2( |
| 3037 multi_user_util::GetAccountIdFromProfile(profile2)); | 2982 multi_user_util::GetAccountIdFromProfile(profile2)); |
| 3038 SwitchActiveUser(account_id2); | 2983 SwitchActiveUser(account_id2); |
| 3039 | 2984 |
| 3040 // No item should have content yet. | 2985 // No item should have content yet. |
| 3041 EXPECT_TRUE(CheckMenuCreation( | 2986 CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); |
| 3042 launcher_controller_.get(), item_browser, 0, NULL, true)); | 2987 CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); |
| 3043 EXPECT_TRUE(CheckMenuCreation( | |
| 3044 launcher_controller_.get(), item_gmail, 0, NULL, false)); | |
| 3045 | 2988 |
| 3046 // Transfer the browser of the first user - it should still not show up. | 2989 // Transfer the browser of the first user - it should still not show up. |
| 3047 chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser( | 2990 chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser( |
| 3048 browser()->window()->GetNativeWindow(), account_id2); | 2991 browser()->window()->GetNativeWindow(), account_id2); |
| 3049 | 2992 |
| 3050 EXPECT_TRUE(CheckMenuCreation( | 2993 CheckAppMenu(launcher_controller_.get(), item_browser, 0, nullptr); |
| 3051 launcher_controller_.get(), item_browser, 0, NULL, true)); | 2994 CheckAppMenu(launcher_controller_.get(), item_gmail, 0, nullptr); |
| 3052 EXPECT_TRUE(CheckMenuCreation( | |
| 3053 launcher_controller_.get(), item_gmail, 0, NULL, false)); | |
| 3054 } | 2995 } |
| 3055 | 2996 |
| 3056 // Check that V2 applications are creating items properly in the launcher when | 2997 // Check that V2 applications are creating items properly in the launcher when |
| 3057 // instantiated by the current user. | 2998 // instantiated by the current user. |
| 3058 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerImplTest, | 2999 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerImplTest, |
| 3059 V2AppHandlingTwoUsers) { | 3000 V2AppHandlingTwoUsers) { |
| 3060 InitLauncherController(); | 3001 InitLauncherController(); |
| 3061 // Create a profile for our second user (will be destroyed by the framework). | 3002 // Create a profile for our second user (will be destroyed by the framework). |
| 3062 TestingProfile* profile2 = CreateMultiUserProfile("user2"); | 3003 TestingProfile* profile2 = CreateMultiUserProfile("user2"); |
| 3063 const AccountId account_id( | 3004 const AccountId account_id( |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3277 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); | 3218 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); |
| 3278 chrome::NewTab(browser()); | 3219 chrome::NewTab(browser()); |
| 3279 base::string16 title2 = ASCIIToUTF16("Test2"); | 3220 base::string16 title2 = ASCIIToUTF16("Test2"); |
| 3280 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title2); | 3221 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title2); |
| 3281 | 3222 |
| 3282 // Check that the menu is properly set. | 3223 // Check that the menu is properly set. |
| 3283 ash::ShelfItem item_gmail; | 3224 ash::ShelfItem item_gmail; |
| 3284 item_gmail.type = ash::TYPE_APP_SHORTCUT; | 3225 item_gmail.type = ash::TYPE_APP_SHORTCUT; |
| 3285 item_gmail.id = gmail_id; | 3226 item_gmail.id = gmail_id; |
| 3286 base::string16 two_menu_items[] = {title1, title2}; | 3227 base::string16 two_menu_items[] = {title1, title2}; |
| 3287 EXPECT_TRUE(CheckMenuCreation( | 3228 CheckAppMenu(launcher_controller_.get(), item_gmail, 2, two_menu_items); |
| 3288 launcher_controller_.get(), item_gmail, 2, two_menu_items, false)); | |
| 3289 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 3229 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
| 3290 // Execute the second item in the list (which shouldn't do anything since that | 3230 // Execute the second item in the menu, after the title and two separators, |
| 3291 // item is per definition already the active tab). | 3231 // this shouldn't do anything since that item is already the active tab. |
| 3292 { | 3232 { |
| 3293 std::unique_ptr<ui::SimpleMenuModel> menu( | 3233 ash::ShelfApplicationMenuModel menu( |
| 3294 new LauncherApplicationMenuItemModel( | 3234 base::string16(), launcher_controller_->GetAppMenuItems(item_gmail, 0)); |
| 3295 launcher_controller_->GetApplicationList(item_gmail, 0))); | 3235 menu.ActivatedAt(4); |
| 3296 // The first element in the menu is a spacing separator. On some systems | |
| 3297 // (e.g. Windows) such things do not exist. As such we check the existence | |
| 3298 // and adjust dynamically. | |
| 3299 int first_item = | |
| 3300 (menu->GetTypeAt(0) == ui::MenuModel::TYPE_SEPARATOR) ? 1 : 0; | |
| 3301 menu->ActivatedAt(first_item + 3); | |
| 3302 } | 3236 } |
| 3303 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 3237 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
| 3304 | 3238 |
| 3305 // Execute the first item. | 3239 // Execute the first item in the menu, after the title and two separators, |
| 3240 // this should activate the other tab. |
| 3306 { | 3241 { |
| 3307 std::unique_ptr<ui::SimpleMenuModel> menu( | 3242 ash::ShelfApplicationMenuModel menu( |
| 3308 new LauncherApplicationMenuItemModel( | 3243 base::string16(), launcher_controller_->GetAppMenuItems(item_gmail, 0)); |
| 3309 launcher_controller_->GetApplicationList(item_gmail, 0))); | 3244 menu.ActivatedAt(3); |
| 3310 int first_item = | |
| 3311 (menu->GetTypeAt(0) == ui::MenuModel::TYPE_SEPARATOR) ? 1 : 0; | |
| 3312 menu->ActivatedAt(first_item + 2); | |
| 3313 } | 3245 } |
| 3314 // Now the active tab should be the second item. | |
| 3315 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 3246 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 3316 } | 3247 } |
| 3317 | 3248 |
| 3318 // Checks that the generated menu list properly deletes items. | 3249 // Checks that the generated menu list properly deletes items. |
| 3319 TEST_F(ChromeLauncherControllerImplTest, V1AppMenuDeletionExecution) { | 3250 TEST_F(ChromeLauncherControllerImplTest, V1AppMenuDeletionExecution) { |
| 3320 InitLauncherControllerWithBrowser(); | 3251 InitLauncherControllerWithBrowser(); |
| 3321 | 3252 |
| 3322 // Add |extension3_| to the launcher and add two items. | 3253 // Add |extension3_| to the launcher and add two items. |
| 3323 GURL gmail = GURL("https://mail.google.com/mail/u"); | 3254 GURL gmail = GURL("https://mail.google.com/mail/u"); |
| 3324 ash::ShelfID gmail_id = model_->next_id(); | 3255 ash::ShelfID gmail_id = model_->next_id(); |
| 3325 extension_service_->AddExtension(extension3_.get()); | 3256 extension_service_->AddExtension(extension3_.get()); |
| 3326 launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(gmail_url)); | 3257 launcher_controller_->SetRefocusURLPatternForTest(gmail_id, GURL(gmail_url)); |
| 3327 base::string16 title1 = ASCIIToUTF16("Test1"); | 3258 base::string16 title1 = ASCIIToUTF16("Test1"); |
| 3328 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); | 3259 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); |
| 3329 chrome::NewTab(browser()); | 3260 chrome::NewTab(browser()); |
| 3330 base::string16 title2 = ASCIIToUTF16("Test2"); | 3261 base::string16 title2 = ASCIIToUTF16("Test2"); |
| 3331 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title2); | 3262 NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title2); |
| 3332 | 3263 |
| 3333 // Check that the menu is properly set. | 3264 // Check that the menu is properly set. |
| 3334 ash::ShelfItem item_gmail; | 3265 ash::ShelfItem item_gmail; |
| 3335 item_gmail.type = ash::TYPE_APP_SHORTCUT; | 3266 item_gmail.type = ash::TYPE_APP_SHORTCUT; |
| 3336 item_gmail.id = gmail_id; | 3267 item_gmail.id = gmail_id; |
| 3337 base::string16 two_menu_items[] = {title1, title2}; | 3268 base::string16 two_menu_items[] = {title1, title2}; |
| 3338 EXPECT_TRUE(CheckMenuCreation( | 3269 CheckAppMenu(launcher_controller_.get(), item_gmail, 2, two_menu_items); |
| 3339 launcher_controller_.get(), item_gmail, 2, two_menu_items, false)); | |
| 3340 | 3270 |
| 3341 int tabs = browser()->tab_strip_model()->count(); | 3271 int tabs = browser()->tab_strip_model()->count(); |
| 3342 // Activate the proper tab through the menu item. | 3272 // Activate the proper tab through the menu item. |
| 3343 { | 3273 { |
| 3344 ChromeLauncherAppMenuItems items = | 3274 ash::ShelfAppMenuItemList items = |
| 3345 launcher_controller_->GetApplicationList(item_gmail, 0); | 3275 launcher_controller_->GetAppMenuItems(item_gmail, 0); |
| 3346 items[1]->Execute(0); | 3276 items[1]->Execute(0); |
| 3347 EXPECT_EQ(tabs, browser()->tab_strip_model()->count()); | 3277 EXPECT_EQ(tabs, browser()->tab_strip_model()->count()); |
| 3348 } | 3278 } |
| 3349 | 3279 |
| 3350 // Delete one tab through the menu item. | 3280 // Delete one tab through the menu item. |
| 3351 { | 3281 { |
| 3352 ChromeLauncherAppMenuItems items = | 3282 ash::ShelfAppMenuItemList items = |
| 3353 launcher_controller_->GetApplicationList(item_gmail, 0); | 3283 launcher_controller_->GetAppMenuItems(item_gmail, 0); |
| 3354 items[1]->Execute(ui::EF_SHIFT_DOWN); | 3284 items[1]->Execute(ui::EF_SHIFT_DOWN); |
| 3355 EXPECT_EQ(--tabs, browser()->tab_strip_model()->count()); | 3285 EXPECT_EQ(--tabs, browser()->tab_strip_model()->count()); |
| 3356 } | 3286 } |
| 3357 } | 3287 } |
| 3358 | 3288 |
| 3359 // Tests that panels create launcher items correctly | 3289 // Tests that panels create launcher items correctly |
| 3360 TEST_F(ChromeLauncherControllerImplTest, AppPanels) { | 3290 TEST_F(ChromeLauncherControllerImplTest, AppPanels) { |
| 3361 InitLauncherController(); | 3291 InitLauncherController(); |
| 3362 model_observer_->clear_counts(); | 3292 model_observer_->clear_counts(); |
| 3363 const std::string app_id = extension1_->id(); | 3293 const std::string app_id = extension1_->id(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3422 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[gmail_index].type); | 3352 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[gmail_index].type); |
| 3423 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); | 3353 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); |
| 3424 | 3354 |
| 3425 // Check that it is now handled. | 3355 // Check that it is now handled. |
| 3426 EXPECT_TRUE(launcher_controller_->ContentCanBeHandledByGmailApp(content)); | 3356 EXPECT_TRUE(launcher_controller_->ContentCanBeHandledByGmailApp(content)); |
| 3427 | 3357 |
| 3428 // Check also that the app has detected that properly. | 3358 // Check also that the app has detected that properly. |
| 3429 ash::ShelfItem item_gmail; | 3359 ash::ShelfItem item_gmail; |
| 3430 item_gmail.type = ash::TYPE_APP_SHORTCUT; | 3360 item_gmail.type = ash::TYPE_APP_SHORTCUT; |
| 3431 item_gmail.id = gmail_id; | 3361 item_gmail.id = gmail_id; |
| 3432 EXPECT_EQ(2U, launcher_controller_->GetApplicationList(item_gmail, 0).size()); | 3362 EXPECT_EQ(1U, launcher_controller_->GetAppMenuItems(item_gmail, 0).size()); |
| 3433 } | 3363 } |
| 3434 | 3364 |
| 3435 // Tests that the Gmail extension does not match the offline verison. | 3365 // Tests that the Gmail extension does not match the offline verison. |
| 3436 TEST_F(ChromeLauncherControllerImplTest, GmailOfflineMatching) { | 3366 TEST_F(ChromeLauncherControllerImplTest, GmailOfflineMatching) { |
| 3437 InitLauncherControllerWithBrowser(); | 3367 InitLauncherControllerWithBrowser(); |
| 3438 | 3368 |
| 3439 // Create a Gmail browser tab. | 3369 // Create a Gmail browser tab. |
| 3440 chrome::NewTab(browser()); | 3370 chrome::NewTab(browser()); |
| 3441 base::string16 title = ASCIIToUTF16("Test"); | 3371 base::string16 title = ASCIIToUTF16("Test"); |
| 3442 NavigateAndCommitActiveTabWithTitle(browser(), | 3372 NavigateAndCommitActiveTabWithTitle(browser(), |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4284 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 4214 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 4285 shelf_controller->auto_hide()); | 4215 shelf_controller->auto_hide()); |
| 4286 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); | 4216 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); |
| 4287 | 4217 |
| 4288 PrefService* prefs = profile()->GetTestingPrefService(); | 4218 PrefService* prefs = profile()->GetTestingPrefService(); |
| 4289 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); | 4219 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); |
| 4290 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); | 4220 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); |
| 4291 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); | 4221 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); |
| 4292 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); | 4222 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); |
| 4293 } | 4223 } |
| OLD | NEW |