| 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 "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/shelf/app_list_button.h" | 11 #include "ash/common/shelf/app_list_button.h" |
| 12 #include "ash/common/shelf/shelf.h" | |
| 13 #include "ash/common/shelf/shelf_button.h" | 12 #include "ash/common/shelf/shelf_button.h" |
| 14 #include "ash/common/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 15 #include "ash/common/shelf/shelf_model.h" | 14 #include "ash/common/shelf/shelf_model.h" |
| 16 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
| 17 #include "ash/common/shelf/shelf_widget.h" | 16 #include "ash/common/shelf/shelf_widget.h" |
| 17 #include "ash/common/shelf/wm_shelf.h" |
| 18 #include "ash/common/wm/window_state.h" | 18 #include "ash/common/wm/window_state.h" |
| 19 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 20 #include "ash/shelf/shelf_util.h" | 20 #include "ash/shelf/shelf_util.h" |
| 21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 22 #include "ash/test/shelf_test_api.h" | 22 #include "ash/test/shelf_test_api.h" |
| 23 #include "ash/test/shelf_view_test_api.h" | 23 #include "ash/test/shelf_view_test_api.h" |
| 24 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
| 25 #include "ash/wm/window_util.h" | 25 #include "ash/wm/window_util.h" |
| 26 #include "base/macros.h" | 26 #include "base/macros.h" |
| 27 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "ui/app_list/views/apps_grid_view.h" | 74 #include "ui/app_list/views/apps_grid_view.h" |
| 75 #include "ui/app_list/views/start_page_view.h" | 75 #include "ui/app_list/views/start_page_view.h" |
| 76 #include "ui/app_list/views/tile_item_view.h" | 76 #include "ui/app_list/views/tile_item_view.h" |
| 77 #include "ui/aura/client/aura_constants.h" | 77 #include "ui/aura/client/aura_constants.h" |
| 78 #include "ui/aura/window.h" | 78 #include "ui/aura/window.h" |
| 79 #include "ui/base/window_open_disposition.h" | 79 #include "ui/base/window_open_disposition.h" |
| 80 #include "ui/events/event.h" | 80 #include "ui/events/event.h" |
| 81 #include "ui/events/event_constants.h" | 81 #include "ui/events/event_constants.h" |
| 82 #include "ui/events/test/event_generator.h" | 82 #include "ui/events/test/event_generator.h" |
| 83 | 83 |
| 84 using ash::WmShelf; |
| 84 using extensions::AppWindow; | 85 using extensions::AppWindow; |
| 85 using extensions::Extension; | 86 using extensions::Extension; |
| 86 using content::WebContents; | 87 using content::WebContents; |
| 87 | 88 |
| 88 namespace { | 89 namespace { |
| 89 | 90 |
| 90 ChromeLauncherControllerImpl* GetChromeLauncherControllerImpl() { | 91 ChromeLauncherControllerImpl* GetChromeLauncherControllerImpl() { |
| 91 return static_cast<ChromeLauncherControllerImpl*>( | 92 return static_cast<ChromeLauncherControllerImpl*>( |
| 92 ChromeLauncherController::instance()); | 93 ChromeLauncherController::instance()); |
| 93 } | 94 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Note that event_flag is never used inside function ExecuteCommand. | 184 // Note that event_flag is never used inside function ExecuteCommand. |
| 184 menu->ExecuteCommand(close_command, ui::EventFlags::EF_NONE); | 185 menu->ExecuteCommand(close_command, ui::EventFlags::EF_NONE); |
| 185 close_observer.Wait(); | 186 close_observer.Wait(); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace | 189 } // namespace |
| 189 | 190 |
| 190 class LauncherPlatformAppBrowserTest | 191 class LauncherPlatformAppBrowserTest |
| 191 : public extensions::PlatformAppBrowserTest { | 192 : public extensions::PlatformAppBrowserTest { |
| 192 protected: | 193 protected: |
| 193 LauncherPlatformAppBrowserTest() : shelf_(NULL), controller_(NULL) { | 194 LauncherPlatformAppBrowserTest() : controller_(nullptr) {} |
| 194 } | |
| 195 | 195 |
| 196 ~LauncherPlatformAppBrowserTest() override {} | 196 ~LauncherPlatformAppBrowserTest() override {} |
| 197 | 197 |
| 198 void RunTestOnMainThreadLoop() override { | 198 void RunTestOnMainThreadLoop() override { |
| 199 shelf_ = ash::Shelf::ForPrimaryDisplay(); | |
| 200 controller_ = GetChromeLauncherControllerImpl(); | 199 controller_ = GetChromeLauncherControllerImpl(); |
| 201 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); | 200 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); |
| 202 } | 201 } |
| 203 | 202 |
| 204 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } | 203 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } |
| 205 | 204 |
| 206 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& name) { | 205 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& name) { |
| 207 return controller_->CreateAppShortcutLauncherItem( | 206 return controller_->CreateAppShortcutLauncherItem( |
| 208 name, shelf_model()->item_count()); | 207 name, shelf_model()->item_count()); |
| 209 } | 208 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 231 new LauncherApplicationMenuItemModel( | 230 new LauncherApplicationMenuItemModel( |
| 232 controller_->GetApplicationList(item, event_flags))); | 231 controller_->GetApplicationList(item, event_flags))); |
| 233 int num_items = 0; | 232 int num_items = 0; |
| 234 for (int i = 0; i < menu->GetItemCount(); ++i) { | 233 for (int i = 0; i < menu->GetItemCount(); ++i) { |
| 235 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) | 234 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) |
| 236 ++num_items; | 235 ++num_items; |
| 237 } | 236 } |
| 238 return num_items; | 237 return num_items; |
| 239 } | 238 } |
| 240 | 239 |
| 241 // Activate the shelf item with the given |id|. | |
| 242 void ActivateShelfItem(int id) { | |
| 243 shelf_->ActivateShelfItem(id); | |
| 244 } | |
| 245 | |
| 246 ash::Shelf* shelf_; | |
| 247 ChromeLauncherControllerImpl* controller_; | 240 ChromeLauncherControllerImpl* controller_; |
| 248 | 241 |
| 249 private: | 242 private: |
| 250 | |
| 251 DISALLOW_COPY_AND_ASSIGN(LauncherPlatformAppBrowserTest); | 243 DISALLOW_COPY_AND_ASSIGN(LauncherPlatformAppBrowserTest); |
| 252 }; | 244 }; |
| 253 | 245 |
| 254 enum RipOffCommand { | 246 enum RipOffCommand { |
| 255 // Drag the item off the shelf and let the mouse go. | 247 // Drag the item off the shelf and let the mouse go. |
| 256 RIP_OFF_ITEM, | 248 RIP_OFF_ITEM, |
| 257 // Drag the item off the shelf, move the mouse back and then let go. | 249 // Drag the item off the shelf, move the mouse back and then let go. |
| 258 RIP_OFF_ITEM_AND_RETURN, | 250 RIP_OFF_ITEM_AND_RETURN, |
| 259 // Drag the item off the shelf and then issue a cancel command. | 251 // Drag the item off the shelf and then issue a cancel command. |
| 260 RIP_OFF_ITEM_AND_CANCEL, | 252 RIP_OFF_ITEM_AND_CANCEL, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 EXPECT_EQ(++item_count, model_->item_count()); | 313 EXPECT_EQ(++item_count, model_->item_count()); |
| 322 const ash::ShelfItem& item = *model_->ItemByID(shortcut_id); | 314 const ash::ShelfItem& item = *model_->ItemByID(shortcut_id); |
| 323 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); | 315 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); |
| 324 return item.id; | 316 return item.id; |
| 325 } | 317 } |
| 326 | 318 |
| 327 void RemoveShortcut(ash::ShelfID id) { | 319 void RemoveShortcut(ash::ShelfID id) { |
| 328 controller_->Unpin(id); | 320 controller_->Unpin(id); |
| 329 } | 321 } |
| 330 | 322 |
| 331 // Activate the shelf item with the given |id|. | |
| 332 void ActivateShelfItem(int id) { | |
| 333 shelf_->ActivateShelfItem(id); | |
| 334 } | |
| 335 | |
| 336 ash::ShelfID PinFakeApp(const std::string& name) { | 323 ash::ShelfID PinFakeApp(const std::string& name) { |
| 337 return controller_->CreateAppShortcutLauncherItem( | 324 return controller_->CreateAppShortcutLauncherItem( |
| 338 name, model_->item_count()); | 325 name, model_->item_count()); |
| 339 } | 326 } |
| 340 | 327 |
| 341 // Get the index of an item which has the given type. | 328 // Get the index of an item which has the given type. |
| 342 int GetIndexOfShelfItemType(ash::ShelfItemType type) { | 329 int GetIndexOfShelfItemType(ash::ShelfItemType type) { |
| 343 return model_->GetItemIndexForType(type); | 330 return model_->GetItemIndexForType(type); |
| 344 } | 331 } |
| 345 | 332 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 ASSERT_EQ(item_count, shelf_model()->item_count()); | 638 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 652 const ash::ShelfItem& item2 = GetLastLauncherItem(); | 639 const ash::ShelfItem& item2 = GetLastLauncherItem(); |
| 653 ash::ShelfID item_id2 = item2.id; | 640 ash::ShelfID item_id2 = item2.id; |
| 654 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item2.type); | 641 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item2.type); |
| 655 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); | 642 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); |
| 656 | 643 |
| 657 EXPECT_NE(item_id1, item_id2); | 644 EXPECT_NE(item_id1, item_id2); |
| 658 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 645 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
| 659 | 646 |
| 660 // Activate first one. | 647 // Activate first one. |
| 661 ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 648 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
| 662 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); | 649 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); |
| 663 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); | 650 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); |
| 664 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 651 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 665 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 652 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 666 | 653 |
| 667 // Activate second one. | 654 // Activate second one. |
| 668 ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); | 655 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); |
| 669 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 656 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
| 670 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id2)->status); | 657 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id2)->status); |
| 671 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 658 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 672 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 659 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 673 | 660 |
| 674 // Add window for app1. This will activate it. | 661 // Add window for app1. This will activate it. |
| 675 AppWindow* window1b = CreateAppWindow(browser()->profile(), extension1); | 662 AppWindow* window1b = CreateAppWindow(browser()->profile(), extension1); |
| 676 ash::wm::ActivateWindow(window1b->GetNativeWindow()); | 663 ash::wm::ActivateWindow(window1b->GetNativeWindow()); |
| 677 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 664 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 678 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 665 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 679 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 666 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 680 | 667 |
| 681 // Activate launcher item for app1, this will activate the first app window. | 668 // Activate launcher item for app1, this will activate the first app window. |
| 682 ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 669 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
| 683 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 670 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 684 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 671 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 685 ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 672 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
| 686 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 673 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 687 | 674 |
| 688 // Activate the second app again | 675 // Activate the second app again |
| 689 ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); | 676 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); |
| 690 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 677 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 691 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 678 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 692 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 679 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 693 | 680 |
| 694 // Activate the first app again | 681 // Activate the first app again |
| 695 ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 682 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
| 696 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 683 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 697 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 684 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 698 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 685 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 699 | 686 |
| 700 // Close second app. | 687 // Close second app. |
| 701 CloseAppWindow(window2); | 688 CloseAppWindow(window2); |
| 702 --item_count; | 689 --item_count; |
| 703 EXPECT_EQ(item_count, shelf_model()->item_count()); | 690 EXPECT_EQ(item_count, shelf_model()->item_count()); |
| 704 // First app should be active again. | 691 // First app should be active again. |
| 705 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); | 692 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 EXPECT_EQ(ash::GetShelfConstant(ash::SHELF_SIZE), app_item.image.height()); | 851 EXPECT_EQ(ash::GetShelfConstant(ash::SHELF_SIZE), app_item.image.height()); |
| 865 EXPECT_EQ(64, panel_item.image.height()); | 852 EXPECT_EQ(64, panel_item.image.height()); |
| 866 } | 853 } |
| 867 | 854 |
| 868 // Test that we can launch an app with a shortcut. | 855 // Test that we can launch an app with a shortcut. |
| 869 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) { | 856 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) { |
| 870 TabStripModel* tab_strip = browser()->tab_strip_model(); | 857 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 871 int tab_count = tab_strip->count(); | 858 int tab_count = tab_strip->count(); |
| 872 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 859 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 873 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 860 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
| 874 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 861 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 875 EXPECT_EQ(++tab_count, tab_strip->count()); | 862 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 876 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 863 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 877 WebContents* tab = tab_strip->GetActiveWebContents(); | 864 WebContents* tab = tab_strip->GetActiveWebContents(); |
| 878 content::WebContentsDestroyedWatcher destroyed_watcher(tab); | 865 content::WebContentsDestroyedWatcher destroyed_watcher(tab); |
| 879 browser()->tab_strip_model()->CloseSelectedTabs(); | 866 browser()->tab_strip_model()->CloseSelectedTabs(); |
| 880 destroyed_watcher.Wait(); | 867 destroyed_watcher.Wait(); |
| 881 EXPECT_EQ(--tab_count, tab_strip->count()); | 868 EXPECT_EQ(--tab_count, tab_strip->count()); |
| 882 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 869 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
| 883 } | 870 } |
| 884 | 871 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 content::NotificationService::AllSources()); | 910 content::NotificationService::AllSources()); |
| 924 chrome::NewEmptyWindow(browser()->profile()); | 911 chrome::NewEmptyWindow(browser()->profile()); |
| 925 open_observer.Wait(); | 912 open_observer.Wait(); |
| 926 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); | 913 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); |
| 927 aura::Window* window2 = browser2->window()->GetNativeWindow(); | 914 aura::Window* window2 = browser2->window()->GetNativeWindow(); |
| 928 TabStripModel* tab_strip = browser2->tab_strip_model(); | 915 TabStripModel* tab_strip = browser2->tab_strip_model(); |
| 929 int tab_count = tab_strip->count(); | 916 int tab_count = tab_strip->count(); |
| 930 ash::wm::GetWindowState(window2)->Maximize(); | 917 ash::wm::GetWindowState(window2)->Maximize(); |
| 931 | 918 |
| 932 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 919 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 933 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 920 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 934 EXPECT_EQ(++tab_count, tab_strip->count()); | 921 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 935 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 922 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 936 | 923 |
| 937 window1->Show(); | 924 window1->Show(); |
| 938 window1_state->Activate(); | 925 window1_state->Activate(); |
| 939 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status); | 926 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status); |
| 940 | 927 |
| 941 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 928 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 942 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 929 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 943 } | 930 } |
| 944 | 931 |
| 945 // Activating the same app multiple times should launch only a single copy. | 932 // Activating the same app multiple times should launch only a single copy. |
| 946 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateApp) { | 933 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateApp) { |
| 947 TabStripModel* tab_strip = browser()->tab_strip_model(); | 934 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 948 int tab_count = tab_strip->count(); | 935 int tab_count = tab_strip->count(); |
| 949 const Extension* extension = | 936 const Extension* extension = |
| 950 LoadExtension(test_data_dir_.AppendASCII("app1")); | 937 LoadExtension(test_data_dir_.AppendASCII("app1")); |
| 951 | 938 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 980 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { | 967 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { |
| 981 int item_count = model_->item_count(); | 968 int item_count = model_->item_count(); |
| 982 TabStripModel* tab_strip = browser()->tab_strip_model(); | 969 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 983 int tab_count = tab_strip->count(); | 970 int tab_count = tab_strip->count(); |
| 984 ash::ShelfID shortcut1 = CreateShortcut("app1"); | 971 ash::ShelfID shortcut1 = CreateShortcut("app1"); |
| 985 EXPECT_EQ(++item_count, model_->item_count()); | 972 EXPECT_EQ(++item_count, model_->item_count()); |
| 986 ash::ShelfID shortcut2 = CreateShortcut("app2"); | 973 ash::ShelfID shortcut2 = CreateShortcut("app2"); |
| 987 EXPECT_EQ(++item_count, model_->item_count()); | 974 EXPECT_EQ(++item_count, model_->item_count()); |
| 988 | 975 |
| 989 // Launch first app. | 976 // Launch first app. |
| 990 ActivateShelfItem(model_->ItemIndexByID(shortcut1)); | 977 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); |
| 991 EXPECT_EQ(++tab_count, tab_strip->count()); | 978 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 992 WebContents* tab1 = tab_strip->GetActiveWebContents(); | 979 WebContents* tab1 = tab_strip->GetActiveWebContents(); |
| 993 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); | 980 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); |
| 994 | 981 |
| 995 // Launch second app. | 982 // Launch second app. |
| 996 ActivateShelfItem(model_->ItemIndexByID(shortcut2)); | 983 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2)); |
| 997 EXPECT_EQ(++tab_count, tab_strip->count()); | 984 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 998 WebContents* tab2 = tab_strip->GetActiveWebContents(); | 985 WebContents* tab2 = tab_strip->GetActiveWebContents(); |
| 999 ASSERT_NE(tab1, tab2); | 986 ASSERT_NE(tab1, tab2); |
| 1000 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); | 987 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); |
| 1001 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); | 988 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); |
| 1002 | 989 |
| 1003 // Reactivate first app. | 990 // Reactivate first app. |
| 1004 ActivateShelfItem(model_->ItemIndexByID(shortcut1)); | 991 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); |
| 1005 EXPECT_EQ(tab_count, tab_strip->count()); | 992 EXPECT_EQ(tab_count, tab_strip->count()); |
| 1006 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); | 993 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); |
| 1007 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); | 994 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); |
| 1008 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); | 995 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); |
| 1009 | 996 |
| 1010 // Open second tab for second app. This should activate it. | 997 // Open second tab for second app. This should activate it. |
| 1011 ui_test_utils::NavigateToURLWithDisposition( | 998 ui_test_utils::NavigateToURLWithDisposition( |
| 1012 browser(), | 999 browser(), |
| 1013 GURL("http://www.example.com/path3/foo.html"), | 1000 GURL("http://www.example.com/path3/foo.html"), |
| 1014 NEW_FOREGROUND_TAB, | 1001 NEW_FOREGROUND_TAB, |
| 1015 0); | 1002 0); |
| 1016 EXPECT_EQ(++tab_count, tab_strip->count()); | 1003 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1017 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); | 1004 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); |
| 1018 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); | 1005 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); |
| 1019 | 1006 |
| 1020 // Reactivate first app. | 1007 // Reactivate first app. |
| 1021 ActivateShelfItem(model_->ItemIndexByID(shortcut1)); | 1008 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); |
| 1022 EXPECT_EQ(tab_count, tab_strip->count()); | 1009 EXPECT_EQ(tab_count, tab_strip->count()); |
| 1023 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); | 1010 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); |
| 1024 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); | 1011 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); |
| 1025 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); | 1012 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); |
| 1026 | 1013 |
| 1027 // And second again. This time the second tab should become active. | 1014 // And second again. This time the second tab should become active. |
| 1028 ActivateShelfItem(model_->ItemIndexByID(shortcut2)); | 1015 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2)); |
| 1029 EXPECT_EQ(tab_count, tab_strip->count()); | 1016 EXPECT_EQ(tab_count, tab_strip->count()); |
| 1030 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab2); | 1017 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab2); |
| 1031 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); | 1018 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); |
| 1032 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); | 1019 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); |
| 1033 } | 1020 } |
| 1034 | 1021 |
| 1035 // Confirm that a page can be navigated from and to while maintaining the | 1022 // Confirm that a page can be navigated from and to while maintaining the |
| 1036 // correct running state. | 1023 // correct running state. |
| 1037 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) { | 1024 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) { |
| 1038 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1025 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 1039 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 1026 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
| 1040 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1027 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1041 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1028 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 1042 | 1029 |
| 1043 // Navigate away. | 1030 // Navigate away. |
| 1044 ui_test_utils::NavigateToURL( | 1031 ui_test_utils::NavigateToURL( |
| 1045 browser(), GURL("http://www.example.com/path0/bar.html")); | 1032 browser(), GURL("http://www.example.com/path0/bar.html")); |
| 1046 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 1033 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
| 1047 | 1034 |
| 1048 // Navigate back. | 1035 // Navigate back. |
| 1049 ui_test_utils::NavigateToURL( | 1036 ui_test_utils::NavigateToURL( |
| 1050 browser(), GURL("http://www.example.com/path1/foo.html")); | 1037 browser(), GURL("http://www.example.com/path1/foo.html")); |
| 1051 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1038 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 1052 } | 1039 } |
| 1053 | 1040 |
| 1054 // Confirm that a tab can be moved between browsers while maintaining the | 1041 // Confirm that a tab can be moved between browsers while maintaining the |
| 1055 // correct running state. | 1042 // correct running state. |
| 1056 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabDragAndDrop) { | 1043 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabDragAndDrop) { |
| 1057 TabStripModel* tab_strip_model1 = browser()->tab_strip_model(); | 1044 TabStripModel* tab_strip_model1 = browser()->tab_strip_model(); |
| 1058 EXPECT_EQ(1, tab_strip_model1->count()); | 1045 EXPECT_EQ(1, tab_strip_model1->count()); |
| 1059 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); | 1046 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); |
| 1060 EXPECT_TRUE(browser_index >= 0); | 1047 EXPECT_TRUE(browser_index >= 0); |
| 1061 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1048 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 1062 | 1049 |
| 1063 // Create a shortcut for app1. | 1050 // Create a shortcut for app1. |
| 1064 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1051 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 1065 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); | 1052 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); |
| 1066 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 1053 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
| 1067 | 1054 |
| 1068 // Activate app1 and check its item status. | 1055 // Activate app1 and check its item status. |
| 1069 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1056 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1070 EXPECT_EQ(2, tab_strip_model1->count()); | 1057 EXPECT_EQ(2, tab_strip_model1->count()); |
| 1071 EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status); | 1058 EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status); |
| 1072 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1059 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 1073 | 1060 |
| 1074 // Create a new browser with blank tab. | 1061 // Create a new browser with blank tab. |
| 1075 Browser* browser2 = CreateBrowser(profile()); | 1062 Browser* browser2 = CreateBrowser(profile()); |
| 1076 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1063 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 1077 TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); | 1064 TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); |
| 1078 EXPECT_EQ(1, tab_strip_model2->count()); | 1065 EXPECT_EQ(1, tab_strip_model2->count()); |
| 1079 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); | 1066 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1091 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1078 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
| 1092 | 1079 |
| 1093 tab_strip_model1->CloseAllTabs(); | 1080 tab_strip_model1->CloseAllTabs(); |
| 1094 tab_strip_model2->CloseAllTabs(); | 1081 tab_strip_model2->CloseAllTabs(); |
| 1095 } | 1082 } |
| 1096 | 1083 |
| 1097 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) { | 1084 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) { |
| 1098 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1085 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 1099 int tab_count = tab_strip->count(); | 1086 int tab_count = tab_strip->count(); |
| 1100 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1087 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 1101 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1088 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1102 EXPECT_EQ(++tab_count, tab_strip->count()); | 1089 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1103 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1090 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1104 WebContents* first_tab = tab_strip->GetActiveWebContents(); | 1091 WebContents* first_tab = tab_strip->GetActiveWebContents(); |
| 1105 | 1092 |
| 1106 // Create new tab owned by app. | 1093 // Create new tab owned by app. |
| 1107 ui_test_utils::NavigateToURLWithDisposition( | 1094 ui_test_utils::NavigateToURLWithDisposition( |
| 1108 browser(), | 1095 browser(), |
| 1109 GURL("http://www.example.com/path2/bar.html"), | 1096 GURL("http://www.example.com/path2/bar.html"), |
| 1110 NEW_FOREGROUND_TAB, | 1097 NEW_FOREGROUND_TAB, |
| 1111 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1098 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1112 EXPECT_EQ(++tab_count, tab_strip->count()); | 1099 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1113 // Confirm app is still active. | 1100 // Confirm app is still active. |
| 1114 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1101 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1115 | 1102 |
| 1116 // Create new tab not owned by app. | 1103 // Create new tab not owned by app. |
| 1117 ui_test_utils::NavigateToURLWithDisposition( | 1104 ui_test_utils::NavigateToURLWithDisposition( |
| 1118 browser(), | 1105 browser(), |
| 1119 GURL("http://www.example.com/path3/foo.html"), | 1106 GURL("http://www.example.com/path3/foo.html"), |
| 1120 NEW_FOREGROUND_TAB, | 1107 NEW_FOREGROUND_TAB, |
| 1121 0); | 1108 0); |
| 1122 EXPECT_EQ(++tab_count, tab_strip->count()); | 1109 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1123 // No longer active. | 1110 // No longer active. |
| 1124 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); | 1111 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); |
| 1125 | 1112 |
| 1126 // Activating app makes first tab active again. | 1113 // Activating app makes first tab active again. |
| 1127 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1114 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1128 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1115 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1129 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); | 1116 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); |
| 1130 } | 1117 } |
| 1131 | 1118 |
| 1132 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) { | 1119 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) { |
| 1133 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1120 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 1134 int tab_count = tab_strip->count(); | 1121 int tab_count = tab_strip->count(); |
| 1135 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1122 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 1136 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1123 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1137 EXPECT_EQ(++tab_count, tab_strip->count()); | 1124 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1138 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1125 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1139 WebContents* first_tab = tab_strip->GetActiveWebContents(); | 1126 WebContents* first_tab = tab_strip->GetActiveWebContents(); |
| 1140 | 1127 |
| 1141 controller_->SetRefocusURLPatternForTest( | 1128 controller_->SetRefocusURLPatternForTest( |
| 1142 shortcut_id, GURL("http://www.example.com/path1/*")); | 1129 shortcut_id, GURL("http://www.example.com/path1/*")); |
| 1143 // Create new tab owned by app. | 1130 // Create new tab owned by app. |
| 1144 ui_test_utils::NavigateToURLWithDisposition( | 1131 ui_test_utils::NavigateToURLWithDisposition( |
| 1145 browser(), | 1132 browser(), |
| 1146 GURL("http://www.example.com/path2/bar.html"), | 1133 GURL("http://www.example.com/path2/bar.html"), |
| 1147 NEW_FOREGROUND_TAB, | 1134 NEW_FOREGROUND_TAB, |
| 1148 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1135 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1149 EXPECT_EQ(++tab_count, tab_strip->count()); | 1136 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1150 // Confirm app is still active. | 1137 // Confirm app is still active. |
| 1151 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1138 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1152 | 1139 |
| 1153 // Create new tab not owned by app. | 1140 // Create new tab not owned by app. |
| 1154 ui_test_utils::NavigateToURLWithDisposition( | 1141 ui_test_utils::NavigateToURLWithDisposition( |
| 1155 browser(), | 1142 browser(), |
| 1156 GURL("http://www.example.com/path3/foo.html"), | 1143 GURL("http://www.example.com/path3/foo.html"), |
| 1157 NEW_FOREGROUND_TAB, | 1144 NEW_FOREGROUND_TAB, |
| 1158 0); | 1145 0); |
| 1159 EXPECT_EQ(++tab_count, tab_strip->count()); | 1146 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1160 // No longer active. | 1147 // No longer active. |
| 1161 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); | 1148 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); |
| 1162 | 1149 |
| 1163 // Activating app makes first tab active again, because second tab isn't | 1150 // Activating app makes first tab active again, because second tab isn't |
| 1164 // in its refocus url path. | 1151 // in its refocus url path. |
| 1165 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1152 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1166 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1153 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1167 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); | 1154 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); |
| 1168 } | 1155 } |
| 1169 | 1156 |
| 1170 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilterLaunch) { | 1157 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilterLaunch) { |
| 1171 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1158 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 1172 int tab_count = tab_strip->count(); | 1159 int tab_count = tab_strip->count(); |
| 1173 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1160 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 1174 controller_->SetRefocusURLPatternForTest( | 1161 controller_->SetRefocusURLPatternForTest( |
| 1175 shortcut_id, GURL("http://www.example.com/path1/*")); | 1162 shortcut_id, GURL("http://www.example.com/path1/*")); |
| 1176 | 1163 |
| 1177 // Create new tab. | 1164 // Create new tab. |
| 1178 ui_test_utils::NavigateToURLWithDisposition( | 1165 ui_test_utils::NavigateToURLWithDisposition( |
| 1179 browser(), | 1166 browser(), |
| 1180 GURL("http://www.example2.com/path2/bar.html"), | 1167 GURL("http://www.example2.com/path2/bar.html"), |
| 1181 NEW_FOREGROUND_TAB, | 1168 NEW_FOREGROUND_TAB, |
| 1182 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1169 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1183 EXPECT_EQ(++tab_count, tab_strip->count()); | 1170 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1184 WebContents* first_tab = tab_strip->GetActiveWebContents(); | 1171 WebContents* first_tab = tab_strip->GetActiveWebContents(); |
| 1185 // Confirm app is not active. | 1172 // Confirm app is not active. |
| 1186 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(shortcut_id)->status); | 1173 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(shortcut_id)->status); |
| 1187 | 1174 |
| 1188 // Activating app should launch new tab, because second tab isn't | 1175 // Activating app should launch new tab, because second tab isn't |
| 1189 // in its refocus url path. | 1176 // in its refocus url path. |
| 1190 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1177 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 1191 EXPECT_EQ(++tab_count, tab_strip->count()); | 1178 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 1192 WebContents* second_tab = tab_strip->GetActiveWebContents(); | 1179 WebContents* second_tab = tab_strip->GetActiveWebContents(); |
| 1193 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1180 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
| 1194 EXPECT_NE(first_tab, second_tab); | 1181 EXPECT_NE(first_tab, second_tab); |
| 1195 EXPECT_EQ(tab_strip->GetActiveWebContents(), second_tab); | 1182 EXPECT_EQ(tab_strip->GetActiveWebContents(), second_tab); |
| 1196 } | 1183 } |
| 1197 | 1184 |
| 1198 // Check the launcher activation state for applications and browser. | 1185 // Check the launcher activation state for applications and browser. |
| 1199 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivationStateCheck) { | 1186 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivationStateCheck) { |
| 1200 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1187 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 NEW_FOREGROUND_TAB, | 1363 NEW_FOREGROUND_TAB, |
| 1377 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1364 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1378 content::WebContents* content1a = tab_strip->GetActiveWebContents(); | 1365 content::WebContents* content1a = tab_strip->GetActiveWebContents(); |
| 1379 | 1366 |
| 1380 // Make sure that the active tab is now our handled tab. | 1367 // Make sure that the active tab is now our handled tab. |
| 1381 EXPECT_NE(content1a, content1); | 1368 EXPECT_NE(content1a, content1); |
| 1382 | 1369 |
| 1383 // The active tab should still be the unnamed tab. Then we switch and reach | 1370 // The active tab should still be the unnamed tab. Then we switch and reach |
| 1384 // the first app and stay there. | 1371 // the first app and stay there. |
| 1385 EXPECT_EQ(content1a, tab_strip->GetActiveWebContents()); | 1372 EXPECT_EQ(content1a, tab_strip->GetActiveWebContents()); |
| 1386 ActivateShelfItem(shortcut_index); | 1373 WmShelf::ActivateShelfItem(shortcut_index); |
| 1387 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); | 1374 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); |
| 1388 ActivateShelfItem(shortcut_index); | 1375 WmShelf::ActivateShelfItem(shortcut_index); |
| 1389 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); | 1376 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); |
| 1390 | 1377 |
| 1391 ui_test_utils::NavigateToURLWithDisposition( | 1378 ui_test_utils::NavigateToURLWithDisposition( |
| 1392 browser(), | 1379 browser(), |
| 1393 GURL(url), | 1380 GURL(url), |
| 1394 NEW_FOREGROUND_TAB, | 1381 NEW_FOREGROUND_TAB, |
| 1395 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1382 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1396 content::WebContents* content2 = tab_strip->GetActiveWebContents(); | 1383 content::WebContents* content2 = tab_strip->GetActiveWebContents(); |
| 1397 | 1384 |
| 1398 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); | 1385 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); |
| 1399 ActivateShelfItem(shortcut_index); | 1386 WmShelf::ActivateShelfItem(shortcut_index); |
| 1400 EXPECT_EQ(content1, browser()->tab_strip_model()->GetActiveWebContents()); | 1387 EXPECT_EQ(content1, browser()->tab_strip_model()->GetActiveWebContents()); |
| 1401 ActivateShelfItem(shortcut_index); | 1388 WmShelf::ActivateShelfItem(shortcut_index); |
| 1402 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); | 1389 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); |
| 1403 } | 1390 } |
| 1404 | 1391 |
| 1405 // Check that the keyboard activation of a launcher item tabs properly through | 1392 // Check that the keyboard activation of a launcher item tabs properly through |
| 1406 // the items at hand. | 1393 // the items at hand. |
| 1407 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, | 1394 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, |
| 1408 AltNumberAppsTabbing) { | 1395 AltNumberAppsTabbing) { |
| 1409 // First run app. | 1396 // First run app. |
| 1410 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 1397 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 1411 ui::BaseWindow* window1 = | 1398 ui::BaseWindow* window1 = |
| 1412 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); | 1399 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); |
| 1413 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 1400 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 1414 ash::ShelfID app_id = item1.id; | 1401 ash::ShelfID app_id = item1.id; |
| 1415 int app_index = shelf_model()->ItemIndexByID(app_id); | 1402 int app_index = shelf_model()->ItemIndexByID(app_id); |
| 1416 | 1403 |
| 1417 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 1404 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); |
| 1418 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 1405 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 1419 | 1406 |
| 1420 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", | 1407 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", |
| 1421 "Launched"); | 1408 "Launched"); |
| 1422 ui::BaseWindow* window2 = | 1409 ui::BaseWindow* window2 = |
| 1423 CreateAppWindow(browser()->profile(), extension2)->GetBaseWindow(); | 1410 CreateAppWindow(browser()->profile(), extension2)->GetBaseWindow(); |
| 1424 | 1411 |
| 1425 // By now the browser should be active. Issue Alt keystrokes several times to | 1412 // By now the browser should be active. Issue Alt keystrokes several times to |
| 1426 // see that we stay on that application. | 1413 // see that we stay on that application. |
| 1427 EXPECT_TRUE(window2->IsActive()); | 1414 EXPECT_TRUE(window2->IsActive()); |
| 1428 ActivateShelfItem(app_index); | 1415 WmShelf::ActivateShelfItem(app_index); |
| 1429 EXPECT_TRUE(window1->IsActive()); | 1416 EXPECT_TRUE(window1->IsActive()); |
| 1430 ActivateShelfItem(app_index); | 1417 WmShelf::ActivateShelfItem(app_index); |
| 1431 EXPECT_TRUE(window1->IsActive()); | 1418 EXPECT_TRUE(window1->IsActive()); |
| 1432 | 1419 |
| 1433 ui::BaseWindow* window1a = | 1420 ui::BaseWindow* window1a = |
| 1434 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); | 1421 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); |
| 1435 | 1422 |
| 1436 EXPECT_TRUE(window1a->IsActive()); | 1423 EXPECT_TRUE(window1a->IsActive()); |
| 1437 EXPECT_FALSE(window1->IsActive()); | 1424 EXPECT_FALSE(window1->IsActive()); |
| 1438 ActivateShelfItem(app_index); | 1425 WmShelf::ActivateShelfItem(app_index); |
| 1439 EXPECT_TRUE(window1->IsActive()); | 1426 EXPECT_TRUE(window1->IsActive()); |
| 1440 ActivateShelfItem(app_index); | 1427 WmShelf::ActivateShelfItem(app_index); |
| 1441 EXPECT_TRUE(window1a->IsActive()); | 1428 EXPECT_TRUE(window1a->IsActive()); |
| 1442 } | 1429 } |
| 1443 | 1430 |
| 1444 // Test that we can launch a platform app panel and get a running item. | 1431 // Test that we can launch a platform app panel and get a running item. |
| 1445 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) { | 1432 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) { |
| 1446 int item_count = shelf_model()->item_count(); | 1433 int item_count = shelf_model()->item_count(); |
| 1447 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); | 1434 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 1448 AppWindow::CreateParams params; | 1435 AppWindow::CreateParams params; |
| 1449 params.window_type = AppWindow::WINDOW_TYPE_PANEL; | 1436 params.window_type = AppWindow::WINDOW_TYPE_PANEL; |
| 1450 params.focused = false; | 1437 params.focused = false; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 // would decrease | 1630 // would decrease |
| 1644 EXPECT_EQ(item_count, shelf_model->item_count()); | 1631 EXPECT_EQ(item_count, shelf_model->item_count()); |
| 1645 } | 1632 } |
| 1646 | 1633 |
| 1647 // Checks that the browser Alt "tabbing" is properly done. | 1634 // Checks that the browser Alt "tabbing" is properly done. |
| 1648 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser, | 1635 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser, |
| 1649 AltNumberBrowserTabbing) { | 1636 AltNumberBrowserTabbing) { |
| 1650 // Get the number of items in the browser menu. | 1637 // Get the number of items in the browser menu. |
| 1651 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); | 1638 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); |
| 1652 // The first activation should create a browser at index 1 (App List @ 0). | 1639 // The first activation should create a browser at index 1 (App List @ 0). |
| 1653 shelf_->ActivateShelfItem(1); | 1640 WmShelf::ActivateShelfItem(1); |
| 1654 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1641 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 1655 // A second activation should not create a new instance. | 1642 // A second activation should not create a new instance. |
| 1656 shelf_->ActivateShelfItem(1); | 1643 WmShelf::ActivateShelfItem(1); |
| 1657 Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); | 1644 Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); |
| 1658 EXPECT_TRUE(browser1); | 1645 EXPECT_TRUE(browser1); |
| 1659 aura::Window* window1 = browser1->window()->GetNativeWindow(); | 1646 aura::Window* window1 = browser1->window()->GetNativeWindow(); |
| 1660 Browser* browser2 = CreateBrowser(profile()); | 1647 Browser* browser2 = CreateBrowser(profile()); |
| 1661 aura::Window* window2 = browser2->window()->GetNativeWindow(); | 1648 aura::Window* window2 = browser2->window()->GetNativeWindow(); |
| 1662 | 1649 |
| 1663 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1650 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 1664 EXPECT_NE(window1, window2); | 1651 EXPECT_NE(window1, window2); |
| 1665 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); | 1652 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); |
| 1666 | 1653 |
| 1667 // Activate multiple times the switcher to see that the windows get activated. | 1654 // Activate multiple times the switcher to see that the windows get activated. |
| 1668 shelf_->ActivateShelfItem(1); | 1655 WmShelf::ActivateShelfItem(1); |
| 1669 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1656 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
| 1670 shelf_->ActivateShelfItem(1); | 1657 WmShelf::ActivateShelfItem(1); |
| 1671 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); | 1658 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); |
| 1672 | 1659 |
| 1673 // Create a third browser - make sure that we do not toggle simply between | 1660 // Create a third browser - make sure that we do not toggle simply between |
| 1674 // two windows. | 1661 // two windows. |
| 1675 Browser* browser3 = CreateBrowser(profile()); | 1662 Browser* browser3 = CreateBrowser(profile()); |
| 1676 aura::Window* window3 = browser3->window()->GetNativeWindow(); | 1663 aura::Window* window3 = browser3->window()->GetNativeWindow(); |
| 1677 | 1664 |
| 1678 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); | 1665 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); |
| 1679 EXPECT_NE(window1, window3); | 1666 EXPECT_NE(window1, window3); |
| 1680 EXPECT_NE(window2, window3); | 1667 EXPECT_NE(window2, window3); |
| 1681 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); | 1668 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); |
| 1682 | 1669 |
| 1683 shelf_->ActivateShelfItem(1); | 1670 WmShelf::ActivateShelfItem(1); |
| 1684 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1671 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
| 1685 shelf_->ActivateShelfItem(1); | 1672 WmShelf::ActivateShelfItem(1); |
| 1686 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); | 1673 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); |
| 1687 shelf_->ActivateShelfItem(1); | 1674 WmShelf::ActivateShelfItem(1); |
| 1688 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); | 1675 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); |
| 1689 shelf_->ActivateShelfItem(1); | 1676 WmShelf::ActivateShelfItem(1); |
| 1690 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1677 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
| 1691 | 1678 |
| 1692 // Create anther app and make sure that none of our browsers is active. | 1679 // Create anther app and make sure that none of our browsers is active. |
| 1693 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, NEW_WINDOW); | 1680 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, NEW_WINDOW); |
| 1694 EXPECT_NE(window1, ash::wm::GetActiveWindow()); | 1681 EXPECT_NE(window1, ash::wm::GetActiveWindow()); |
| 1695 EXPECT_NE(window2, ash::wm::GetActiveWindow()); | 1682 EXPECT_NE(window2, ash::wm::GetActiveWindow()); |
| 1696 | 1683 |
| 1697 // After activation our browser should be active again. | 1684 // After activation our browser should be active again. |
| 1698 shelf_->ActivateShelfItem(1); | 1685 WmShelf::ActivateShelfItem(1); |
| 1699 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1686 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
| 1700 } | 1687 } |
| 1701 | 1688 |
| 1702 // Checks that after a session restore, we do not start applications on an | 1689 // Checks that after a session restore, we do not start applications on an |
| 1703 // activation. | 1690 // activation. |
| 1704 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) { | 1691 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) { |
| 1705 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1692 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 1706 | 1693 |
| 1707 // Create a known application. | 1694 // Create a known application. |
| 1708 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1695 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 | 2161 |
| 2175 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); | 2162 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); |
| 2176 ash::ShelfID browser_id = model_->items()[browser_index].id; | 2163 ash::ShelfID browser_id = model_->items()[browser_index].id; |
| 2177 EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window)); | 2164 EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window)); |
| 2178 | 2165 |
| 2179 ash::ShelfID app_id = CreateShortcut("app1"); | 2166 ash::ShelfID app_id = CreateShortcut("app1"); |
| 2180 EXPECT_EQ(3, model_->item_count()); | 2167 EXPECT_EQ(3, model_->item_count()); |
| 2181 | 2168 |
| 2182 // Creates a new tab for "app1" and checks that GetShelfIDForWindow() | 2169 // Creates a new tab for "app1" and checks that GetShelfIDForWindow() |
| 2183 // returns |ShelfID| of "app1". | 2170 // returns |ShelfID| of "app1". |
| 2184 ActivateShelfItem(model_->ItemIndexByID(app_id)); | 2171 WmShelf::ActivateShelfItem(model_->ItemIndexByID(app_id)); |
| 2185 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 2172 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 2186 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 2173 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
| 2187 EXPECT_EQ(app_id, ash::GetShelfIDForWindow(window)); | 2174 EXPECT_EQ(app_id, ash::GetShelfIDForWindow(window)); |
| 2188 | 2175 |
| 2189 // Makes tab at index 0(NTP) as an active tab and checks that | 2176 // Makes tab at index 0(NTP) as an active tab and checks that |
| 2190 // GetShelfIDForWindow() returns |ShelfID| of browser shortcut. | 2177 // GetShelfIDForWindow() returns |ShelfID| of browser shortcut. |
| 2191 browser()->tab_strip_model()->ActivateTabAt(0, false); | 2178 browser()->tab_strip_model()->ActivateTabAt(0, false); |
| 2192 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 2179 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 2193 EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window)); | 2180 EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window)); |
| 2194 } | 2181 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2404 | 2391 |
| 2405 // Close all windows via the menu item. | 2392 // Close all windows via the menu item. |
| 2406 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2393 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2407 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2394 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2408 | 2395 |
| 2409 // Check if "Close" is removed from the context menu. | 2396 // Check if "Close" is removed from the context menu. |
| 2410 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2397 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2411 ASSERT_FALSE( | 2398 ASSERT_FALSE( |
| 2412 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2399 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2413 } | 2400 } |
| OLD | NEW |