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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/public/cpp/shelf_item_delegate.h" | 9 #include "ash/public/cpp/shelf_item_delegate.h" |
10 #include "ash/public/cpp/window_properties.h" | 10 #include "ash/public/cpp/window_properties.h" |
11 #include "ash/shelf/app_list_button.h" | 11 #include "ash/shelf/app_list_button.h" |
| 12 #include "ash/shelf/shelf.h" |
12 #include "ash/shelf/shelf_button.h" | 13 #include "ash/shelf/shelf_button.h" |
13 #include "ash/shelf/shelf_constants.h" | 14 #include "ash/shelf/shelf_constants.h" |
14 #include "ash/shelf/shelf_model.h" | 15 #include "ash/shelf/shelf_model.h" |
15 #include "ash/shelf/shelf_view.h" | 16 #include "ash/shelf/shelf_view.h" |
16 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
17 #include "ash/shelf/wm_shelf.h" | |
18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
19 #include "ash/shell_port.h" | 19 #include "ash/shell_port.h" |
20 #include "ash/test/shelf_view_test_api.h" | 20 #include "ash/test/shelf_view_test_api.h" |
21 #include "ash/wm/window_state.h" | 21 #include "ash/wm/window_state.h" |
22 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
23 #include "ash/wm_window.h" | 23 #include "ash/wm_window.h" |
24 #include "base/macros.h" | 24 #include "base/macros.h" |
25 #include "base/run_loop.h" | 25 #include "base/run_loop.h" |
26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
27 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/display/test/display_manager_test_api.h" | 80 #include "ui/display/test/display_manager_test_api.h" |
81 #include "ui/events/base_event_utils.h" | 81 #include "ui/events/base_event_utils.h" |
82 #include "ui/events/event.h" | 82 #include "ui/events/event.h" |
83 #include "ui/events/event_constants.h" | 83 #include "ui/events/event_constants.h" |
84 #include "ui/events/test/event_generator.h" | 84 #include "ui/events/test/event_generator.h" |
85 | 85 |
86 using ash::WmShelf; | 86 using ash::Shelf; |
87 using extensions::AppWindow; | 87 using extensions::AppWindow; |
88 using extensions::Extension; | 88 using extensions::Extension; |
89 using content::WebContents; | 89 using content::WebContents; |
90 | 90 |
91 namespace { | 91 namespace { |
92 | 92 |
93 // A callback that records the action taken when a shelf item is selected. | 93 // A callback that records the action taken when a shelf item is selected. |
94 void SelectItemCallback(ash::ShelfAction* action_taken, | 94 void SelectItemCallback(ash::ShelfAction* action_taken, |
95 base::RunLoop* run_loop, | 95 base::RunLoop* run_loop, |
96 ash::ShelfAction action, | 96 ash::ShelfAction action, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 class ShelfAppBrowserTest : public ExtensionBrowserTest { | 271 class ShelfAppBrowserTest : public ExtensionBrowserTest { |
272 protected: | 272 protected: |
273 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) {} | 273 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) {} |
274 | 274 |
275 ~ShelfAppBrowserTest() override {} | 275 ~ShelfAppBrowserTest() override {} |
276 | 276 |
277 void SetUpOnMainThread() override { | 277 void SetUpOnMainThread() override { |
278 // Ensure ash starts the session and creates the shelf and controller. | 278 // Ensure ash starts the session and creates the shelf and controller. |
279 SessionControllerClient::FlushForTesting(); | 279 SessionControllerClient::FlushForTesting(); |
280 | 280 |
281 shelf_ = ash::WmShelf::ForWindow(ash::Shell::GetPrimaryRootWindow()); | 281 shelf_ = Shelf::ForWindow(ash::Shell::GetPrimaryRootWindow()); |
282 model_ = ash::Shell::Get()->shelf_model(); | 282 model_ = ash::Shell::Get()->shelf_model(); |
283 controller_ = ChromeLauncherController::instance(); | 283 controller_ = ChromeLauncherController::instance(); |
284 ASSERT_TRUE(controller_); | 284 ASSERT_TRUE(controller_); |
285 ExtensionBrowserTest::SetUpOnMainThread(); | 285 ExtensionBrowserTest::SetUpOnMainThread(); |
286 } | 286 } |
287 | 287 |
288 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { | 288 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { |
289 ash::ShelfItemDelegate* item_controller = | 289 ash::ShelfItemDelegate* item_controller = |
290 controller_->GetBrowserShortcutLauncherItemController(); | 290 controller_->GetBrowserShortcutLauncherItemController(); |
291 return item_controller | 291 return item_controller |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 base::RunLoop().RunUntilIdle(); | 368 base::RunLoop().RunUntilIdle(); |
369 test->RunMessageLoopUntilAnimationsDone(); | 369 test->RunMessageLoopUntilAnimationsDone(); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 // Creates a context menu for the existing browser shortcut item. | 373 // Creates a context menu for the existing browser shortcut item. |
374 std::unique_ptr<LauncherContextMenu> CreateBrowserItemContextMenu() { | 374 std::unique_ptr<LauncherContextMenu> CreateBrowserItemContextMenu() { |
375 int index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); | 375 int index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); |
376 DCHECK_GE(index, 0); | 376 DCHECK_GE(index, 0); |
377 ash::ShelfItem item = model_->items()[index]; | 377 ash::ShelfItem item = model_->items()[index]; |
378 ash::WmShelf* shelf = ash::WmShelf::ForWindow(CurrentContext()); | 378 Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); |
379 std::unique_ptr<LauncherContextMenu> menu( | 379 std::unique_ptr<LauncherContextMenu> menu( |
380 LauncherContextMenu::Create(controller_, &item, shelf)); | 380 LauncherContextMenu::Create(controller_, &item, shelf)); |
381 return menu; | 381 return menu; |
382 } | 382 } |
383 | 383 |
384 aura::Window* CurrentContext() { | 384 aura::Window* CurrentContext() { |
385 aura::Window* root_window = ash::Shell::GetRootWindowForNewWindows(); | 385 aura::Window* root_window = ash::Shell::GetRootWindowForNewWindows(); |
386 DCHECK(root_window); | 386 DCHECK(root_window); |
387 return root_window; | 387 return root_window; |
388 } | 388 } |
389 | 389 |
390 bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { | 390 bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { |
391 return menu->GetIndexOfCommandId(command_id) != -1; | 391 return menu->GetIndexOfCommandId(command_id) != -1; |
392 } | 392 } |
393 | 393 |
394 ash::WmShelf* shelf_; | 394 Shelf* shelf_; |
395 ash::ShelfModel* model_; | 395 ash::ShelfModel* model_; |
396 ChromeLauncherController* controller_; | 396 ChromeLauncherController* controller_; |
397 | 397 |
398 private: | 398 private: |
399 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTest); | 399 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTest); |
400 }; | 400 }; |
401 | 401 |
402 class ShelfAppBrowserTestNoDefaultBrowser : public ShelfAppBrowserTest { | 402 class ShelfAppBrowserTestNoDefaultBrowser : public ShelfAppBrowserTest { |
403 protected: | 403 protected: |
404 ShelfAppBrowserTestNoDefaultBrowser() {} | 404 ShelfAppBrowserTestNoDefaultBrowser() {} |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 ASSERT_EQ(item_count, shelf_model()->item_count()); | 646 ASSERT_EQ(item_count, shelf_model()->item_count()); |
647 const ash::ShelfItem& item2 = GetLastLauncherItem(); | 647 const ash::ShelfItem& item2 = GetLastLauncherItem(); |
648 ash::ShelfID item_id2 = item2.id; | 648 ash::ShelfID item_id2 = item2.id; |
649 EXPECT_EQ(ash::TYPE_APP, item2.type); | 649 EXPECT_EQ(ash::TYPE_APP, item2.type); |
650 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); | 650 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); |
651 | 651 |
652 EXPECT_NE(item_id1, item_id2); | 652 EXPECT_NE(item_id1, item_id2); |
653 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 653 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
654 | 654 |
655 // Activate first one. | 655 // Activate first one. |
656 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 656 Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
657 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); | 657 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); |
658 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); | 658 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); |
659 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 659 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
660 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 660 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
661 | 661 |
662 // Activate second one. | 662 // Activate second one. |
663 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); | 663 Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); |
664 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 664 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
665 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id2)->status); | 665 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id2)->status); |
666 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 666 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
667 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 667 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
668 | 668 |
669 // Add window for app1. This will activate it. | 669 // Add window for app1. This will activate it. |
670 AppWindow* window1b = CreateAppWindow(browser()->profile(), extension1); | 670 AppWindow* window1b = CreateAppWindow(browser()->profile(), extension1); |
671 ash::wm::ActivateWindow(window1b->GetNativeWindow()); | 671 ash::wm::ActivateWindow(window1b->GetNativeWindow()); |
672 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 672 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
673 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 673 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
674 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 674 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
675 | 675 |
676 // Activate launcher item for app1, this will activate the first app window. | 676 // Activate launcher item for app1, this will activate the first app window. |
677 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 677 Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
678 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 678 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
679 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 679 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
680 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 680 Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
681 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 681 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
682 | 682 |
683 // Activate the second app again | 683 // Activate the second app again |
684 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); | 684 Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); |
685 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 685 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
686 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 686 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
687 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 687 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
688 | 688 |
689 // Activate the first app again | 689 // Activate the first app again |
690 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 690 Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
691 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 691 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
692 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 692 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
693 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 693 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
694 | 694 |
695 // Close second app. | 695 // Close second app. |
696 CloseAppWindow(window2); | 696 CloseAppWindow(window2); |
697 --item_count; | 697 --item_count; |
698 EXPECT_EQ(item_count, shelf_model()->item_count()); | 698 EXPECT_EQ(item_count, shelf_model()->item_count()); |
699 // First app should be active again. | 699 // First app should be active again. |
700 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); | 700 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 app_custom_icon_item.image.height()); | 906 app_custom_icon_item.image.height()); |
907 EXPECT_EQ(64, panel_item.image.height()); | 907 EXPECT_EQ(64, panel_item.image.height()); |
908 } | 908 } |
909 | 909 |
910 // Test that we can launch an app with a shortcut. | 910 // Test that we can launch an app with a shortcut. |
911 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) { | 911 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) { |
912 TabStripModel* tab_strip = browser()->tab_strip_model(); | 912 TabStripModel* tab_strip = browser()->tab_strip_model(); |
913 int tab_count = tab_strip->count(); | 913 int tab_count = tab_strip->count(); |
914 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 914 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
915 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 915 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
916 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 916 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
917 EXPECT_EQ(++tab_count, tab_strip->count()); | 917 EXPECT_EQ(++tab_count, tab_strip->count()); |
918 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 918 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
919 WebContents* tab = tab_strip->GetActiveWebContents(); | 919 WebContents* tab = tab_strip->GetActiveWebContents(); |
920 content::WebContentsDestroyedWatcher destroyed_watcher(tab); | 920 content::WebContentsDestroyedWatcher destroyed_watcher(tab); |
921 browser()->tab_strip_model()->CloseSelectedTabs(); | 921 browser()->tab_strip_model()->CloseSelectedTabs(); |
922 destroyed_watcher.Wait(); | 922 destroyed_watcher.Wait(); |
923 EXPECT_EQ(--tab_count, tab_strip->count()); | 923 EXPECT_EQ(--tab_count, tab_strip->count()); |
924 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 924 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
925 } | 925 } |
926 | 926 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 content::NotificationService::AllSources()); | 964 content::NotificationService::AllSources()); |
965 chrome::NewEmptyWindow(browser()->profile()); | 965 chrome::NewEmptyWindow(browser()->profile()); |
966 open_observer.Wait(); | 966 open_observer.Wait(); |
967 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); | 967 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); |
968 aura::Window* window2 = browser2->window()->GetNativeWindow(); | 968 aura::Window* window2 = browser2->window()->GetNativeWindow(); |
969 TabStripModel* tab_strip = browser2->tab_strip_model(); | 969 TabStripModel* tab_strip = browser2->tab_strip_model(); |
970 int tab_count = tab_strip->count(); | 970 int tab_count = tab_strip->count(); |
971 ash::wm::GetWindowState(window2)->Maximize(); | 971 ash::wm::GetWindowState(window2)->Maximize(); |
972 | 972 |
973 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 973 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
974 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 974 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
975 EXPECT_EQ(++tab_count, tab_strip->count()); | 975 EXPECT_EQ(++tab_count, tab_strip->count()); |
976 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 976 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
977 | 977 |
978 window1->Show(); | 978 window1->Show(); |
979 window1_state->Activate(); | 979 window1_state->Activate(); |
980 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status); | 980 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status); |
981 | 981 |
982 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 982 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
983 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 983 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
984 } | 984 } |
985 | 985 |
986 // Activating the same app multiple times should launch only a single copy. | 986 // Activating the same app multiple times should launch only a single copy. |
987 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateApp) { | 987 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateApp) { |
988 TabStripModel* tab_strip = browser()->tab_strip_model(); | 988 TabStripModel* tab_strip = browser()->tab_strip_model(); |
989 int tab_count = tab_strip->count(); | 989 int tab_count = tab_strip->count(); |
990 const Extension* extension = | 990 const Extension* extension = |
991 LoadExtension(test_data_dir_.AppendASCII("app1")); | 991 LoadExtension(test_data_dir_.AppendASCII("app1")); |
992 | 992 |
(...skipping 18 matching lines...) Expand all Loading... |
1011 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { | 1011 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { |
1012 int item_count = model_->item_count(); | 1012 int item_count = model_->item_count(); |
1013 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1013 TabStripModel* tab_strip = browser()->tab_strip_model(); |
1014 int tab_count = tab_strip->count(); | 1014 int tab_count = tab_strip->count(); |
1015 ash::ShelfID shortcut1 = CreateShortcut("app1"); | 1015 ash::ShelfID shortcut1 = CreateShortcut("app1"); |
1016 EXPECT_EQ(++item_count, model_->item_count()); | 1016 EXPECT_EQ(++item_count, model_->item_count()); |
1017 ash::ShelfID shortcut2 = CreateShortcut("app2"); | 1017 ash::ShelfID shortcut2 = CreateShortcut("app2"); |
1018 EXPECT_EQ(++item_count, model_->item_count()); | 1018 EXPECT_EQ(++item_count, model_->item_count()); |
1019 | 1019 |
1020 // Launch first app. | 1020 // Launch first app. |
1021 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); | 1021 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); |
1022 EXPECT_EQ(++tab_count, tab_strip->count()); | 1022 EXPECT_EQ(++tab_count, tab_strip->count()); |
1023 WebContents* tab1 = tab_strip->GetActiveWebContents(); | 1023 WebContents* tab1 = tab_strip->GetActiveWebContents(); |
1024 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); | 1024 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); |
1025 | 1025 |
1026 // Launch second app. | 1026 // Launch second app. |
1027 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2)); | 1027 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2)); |
1028 EXPECT_EQ(++tab_count, tab_strip->count()); | 1028 EXPECT_EQ(++tab_count, tab_strip->count()); |
1029 WebContents* tab2 = tab_strip->GetActiveWebContents(); | 1029 WebContents* tab2 = tab_strip->GetActiveWebContents(); |
1030 ASSERT_NE(tab1, tab2); | 1030 ASSERT_NE(tab1, tab2); |
1031 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); | 1031 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); |
1032 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); | 1032 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); |
1033 | 1033 |
1034 // Reactivate first app. | 1034 // Reactivate first app. |
1035 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); | 1035 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); |
1036 EXPECT_EQ(tab_count, tab_strip->count()); | 1036 EXPECT_EQ(tab_count, tab_strip->count()); |
1037 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); | 1037 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); |
1038 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); | 1038 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); |
1039 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); | 1039 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); |
1040 | 1040 |
1041 // Open second tab for second app. This should activate it. | 1041 // Open second tab for second app. This should activate it. |
1042 ui_test_utils::NavigateToURLWithDisposition( | 1042 ui_test_utils::NavigateToURLWithDisposition( |
1043 browser(), GURL("http://www.example.com/path3/foo.html"), | 1043 browser(), GURL("http://www.example.com/path3/foo.html"), |
1044 WindowOpenDisposition::NEW_FOREGROUND_TAB, 0); | 1044 WindowOpenDisposition::NEW_FOREGROUND_TAB, 0); |
1045 EXPECT_EQ(++tab_count, tab_strip->count()); | 1045 EXPECT_EQ(++tab_count, tab_strip->count()); |
1046 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); | 1046 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); |
1047 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); | 1047 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); |
1048 | 1048 |
1049 // Reactivate first app. | 1049 // Reactivate first app. |
1050 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); | 1050 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1)); |
1051 EXPECT_EQ(tab_count, tab_strip->count()); | 1051 EXPECT_EQ(tab_count, tab_strip->count()); |
1052 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); | 1052 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1); |
1053 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); | 1053 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status); |
1054 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); | 1054 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status); |
1055 | 1055 |
1056 // And second again. This time the second tab should become active. | 1056 // And second again. This time the second tab should become active. |
1057 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2)); | 1057 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2)); |
1058 EXPECT_EQ(tab_count, tab_strip->count()); | 1058 EXPECT_EQ(tab_count, tab_strip->count()); |
1059 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab2); | 1059 EXPECT_EQ(tab_strip->GetActiveWebContents(), tab2); |
1060 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); | 1060 EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status); |
1061 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); | 1061 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status); |
1062 } | 1062 } |
1063 | 1063 |
1064 // Confirm that a page can be navigated from and to while maintaining the | 1064 // Confirm that a page can be navigated from and to while maintaining the |
1065 // correct running state. | 1065 // correct running state. |
1066 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) { | 1066 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) { |
1067 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1067 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
1068 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 1068 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
1069 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1069 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1070 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1070 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
1071 | 1071 |
1072 // Navigate away. | 1072 // Navigate away. |
1073 ui_test_utils::NavigateToURL(browser(), | 1073 ui_test_utils::NavigateToURL(browser(), |
1074 GURL("http://www.example.com/path0/bar.html")); | 1074 GURL("http://www.example.com/path0/bar.html")); |
1075 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 1075 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
1076 | 1076 |
1077 // Navigate back. | 1077 // Navigate back. |
1078 ui_test_utils::NavigateToURL(browser(), | 1078 ui_test_utils::NavigateToURL(browser(), |
1079 GURL("http://www.example.com/path1/foo.html")); | 1079 GURL("http://www.example.com/path1/foo.html")); |
1080 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1080 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
1081 } | 1081 } |
1082 | 1082 |
1083 // Confirm that a tab can be moved between browsers while maintaining the | 1083 // Confirm that a tab can be moved between browsers while maintaining the |
1084 // correct running state. | 1084 // correct running state. |
1085 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabDragAndDrop) { | 1085 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabDragAndDrop) { |
1086 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1086 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
1087 TabStripModel* tab_strip_model1 = browser()->tab_strip_model(); | 1087 TabStripModel* tab_strip_model1 = browser()->tab_strip_model(); |
1088 EXPECT_EQ(1, tab_strip_model1->count()); | 1088 EXPECT_EQ(1, tab_strip_model1->count()); |
1089 const int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); | 1089 const int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); |
1090 EXPECT_GE(browser_index, 0); | 1090 EXPECT_GE(browser_index, 0); |
1091 | 1091 |
1092 // Create a shortcut for app1. | 1092 // Create a shortcut for app1. |
1093 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1093 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
1094 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); | 1094 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); |
1095 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); | 1095 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); |
1096 | 1096 |
1097 // Activate app1 and check its item status. | 1097 // Activate app1 and check its item status. |
1098 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1098 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1099 EXPECT_EQ(2, tab_strip_model1->count()); | 1099 EXPECT_EQ(2, tab_strip_model1->count()); |
1100 EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status); | 1100 EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status); |
1101 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1101 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
1102 | 1102 |
1103 // Create a new browser with blank tab. | 1103 // Create a new browser with blank tab. |
1104 Browser* browser2 = CreateBrowser(profile()); | 1104 Browser* browser2 = CreateBrowser(profile()); |
1105 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1105 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
1106 TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); | 1106 TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); |
1107 EXPECT_EQ(1, tab_strip_model2->count()); | 1107 EXPECT_EQ(1, tab_strip_model2->count()); |
1108 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); | 1108 EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); |
(...skipping 10 matching lines...) Expand all Loading... |
1119 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); | 1119 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); |
1120 | 1120 |
1121 tab_strip_model1->CloseAllTabs(); | 1121 tab_strip_model1->CloseAllTabs(); |
1122 tab_strip_model2->CloseAllTabs(); | 1122 tab_strip_model2->CloseAllTabs(); |
1123 } | 1123 } |
1124 | 1124 |
1125 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) { | 1125 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) { |
1126 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1126 TabStripModel* tab_strip = browser()->tab_strip_model(); |
1127 int tab_count = tab_strip->count(); | 1127 int tab_count = tab_strip->count(); |
1128 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1128 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
1129 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1129 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1130 EXPECT_EQ(++tab_count, tab_strip->count()); | 1130 EXPECT_EQ(++tab_count, tab_strip->count()); |
1131 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1131 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1132 WebContents* first_tab = tab_strip->GetActiveWebContents(); | 1132 WebContents* first_tab = tab_strip->GetActiveWebContents(); |
1133 | 1133 |
1134 // Create new tab owned by app. | 1134 // Create new tab owned by app. |
1135 ui_test_utils::NavigateToURLWithDisposition( | 1135 ui_test_utils::NavigateToURLWithDisposition( |
1136 browser(), GURL("http://www.example.com/path2/bar.html"), | 1136 browser(), GURL("http://www.example.com/path2/bar.html"), |
1137 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1137 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
1138 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1138 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1139 EXPECT_EQ(++tab_count, tab_strip->count()); | 1139 EXPECT_EQ(++tab_count, tab_strip->count()); |
1140 // Confirm app is still active. | 1140 // Confirm app is still active. |
1141 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1141 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1142 | 1142 |
1143 // Create new tab not owned by app. | 1143 // Create new tab not owned by app. |
1144 ui_test_utils::NavigateToURLWithDisposition( | 1144 ui_test_utils::NavigateToURLWithDisposition( |
1145 browser(), GURL("http://www.example.com/path3/foo.html"), | 1145 browser(), GURL("http://www.example.com/path3/foo.html"), |
1146 WindowOpenDisposition::NEW_FOREGROUND_TAB, 0); | 1146 WindowOpenDisposition::NEW_FOREGROUND_TAB, 0); |
1147 EXPECT_EQ(++tab_count, tab_strip->count()); | 1147 EXPECT_EQ(++tab_count, tab_strip->count()); |
1148 // No longer active. | 1148 // No longer active. |
1149 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); | 1149 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); |
1150 | 1150 |
1151 // Activating app makes first tab active again. | 1151 // Activating app makes first tab active again. |
1152 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1152 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1153 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1153 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1154 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); | 1154 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); |
1155 } | 1155 } |
1156 | 1156 |
1157 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) { | 1157 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) { |
1158 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1158 TabStripModel* tab_strip = browser()->tab_strip_model(); |
1159 int tab_count = tab_strip->count(); | 1159 int tab_count = tab_strip->count(); |
1160 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1160 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
1161 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1161 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1162 EXPECT_EQ(++tab_count, tab_strip->count()); | 1162 EXPECT_EQ(++tab_count, tab_strip->count()); |
1163 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1163 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1164 WebContents* first_tab = tab_strip->GetActiveWebContents(); | 1164 WebContents* first_tab = tab_strip->GetActiveWebContents(); |
1165 | 1165 |
1166 controller_->SetRefocusURLPatternForTest( | 1166 controller_->SetRefocusURLPatternForTest( |
1167 shortcut_id, GURL("http://www.example.com/path1/*")); | 1167 shortcut_id, GURL("http://www.example.com/path1/*")); |
1168 // Create new tab owned by app. | 1168 // Create new tab owned by app. |
1169 ui_test_utils::NavigateToURLWithDisposition( | 1169 ui_test_utils::NavigateToURLWithDisposition( |
1170 browser(), GURL("http://www.example.com/path2/bar.html"), | 1170 browser(), GURL("http://www.example.com/path2/bar.html"), |
1171 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1171 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
1172 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1172 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1173 EXPECT_EQ(++tab_count, tab_strip->count()); | 1173 EXPECT_EQ(++tab_count, tab_strip->count()); |
1174 // Confirm app is still active. | 1174 // Confirm app is still active. |
1175 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1175 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1176 | 1176 |
1177 // Create new tab not owned by app. | 1177 // Create new tab not owned by app. |
1178 ui_test_utils::NavigateToURLWithDisposition( | 1178 ui_test_utils::NavigateToURLWithDisposition( |
1179 browser(), GURL("http://www.example.com/path3/foo.html"), | 1179 browser(), GURL("http://www.example.com/path3/foo.html"), |
1180 WindowOpenDisposition::NEW_FOREGROUND_TAB, 0); | 1180 WindowOpenDisposition::NEW_FOREGROUND_TAB, 0); |
1181 EXPECT_EQ(++tab_count, tab_strip->count()); | 1181 EXPECT_EQ(++tab_count, tab_strip->count()); |
1182 // No longer active. | 1182 // No longer active. |
1183 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); | 1183 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status); |
1184 | 1184 |
1185 // Activating app makes first tab active again, because second tab isn't | 1185 // Activating app makes first tab active again, because second tab isn't |
1186 // in its refocus url path. | 1186 // in its refocus url path. |
1187 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1187 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1188 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1188 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1189 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); | 1189 EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab); |
1190 } | 1190 } |
1191 | 1191 |
1192 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilterLaunch) { | 1192 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilterLaunch) { |
1193 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1193 TabStripModel* tab_strip = browser()->tab_strip_model(); |
1194 int tab_count = tab_strip->count(); | 1194 int tab_count = tab_strip->count(); |
1195 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1195 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
1196 controller_->SetRefocusURLPatternForTest( | 1196 controller_->SetRefocusURLPatternForTest( |
1197 shortcut_id, GURL("http://www.example.com/path1/*")); | 1197 shortcut_id, GURL("http://www.example.com/path1/*")); |
1198 | 1198 |
1199 // Create new tab. | 1199 // Create new tab. |
1200 ui_test_utils::NavigateToURLWithDisposition( | 1200 ui_test_utils::NavigateToURLWithDisposition( |
1201 browser(), GURL("http://www.example2.com/path2/bar.html"), | 1201 browser(), GURL("http://www.example2.com/path2/bar.html"), |
1202 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1202 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
1203 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1203 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1204 EXPECT_EQ(++tab_count, tab_strip->count()); | 1204 EXPECT_EQ(++tab_count, tab_strip->count()); |
1205 WebContents* first_tab = tab_strip->GetActiveWebContents(); | 1205 WebContents* first_tab = tab_strip->GetActiveWebContents(); |
1206 // Confirm app is not active. | 1206 // Confirm app is not active. |
1207 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(shortcut_id)->status); | 1207 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(shortcut_id)->status); |
1208 | 1208 |
1209 // Activating app should launch new tab, because second tab isn't | 1209 // Activating app should launch new tab, because second tab isn't |
1210 // in its refocus url path. | 1210 // in its refocus url path. |
1211 WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 1211 Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
1212 EXPECT_EQ(++tab_count, tab_strip->count()); | 1212 EXPECT_EQ(++tab_count, tab_strip->count()); |
1213 WebContents* second_tab = tab_strip->GetActiveWebContents(); | 1213 WebContents* second_tab = tab_strip->GetActiveWebContents(); |
1214 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); | 1214 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); |
1215 EXPECT_NE(first_tab, second_tab); | 1215 EXPECT_NE(first_tab, second_tab); |
1216 EXPECT_EQ(tab_strip->GetActiveWebContents(), second_tab); | 1216 EXPECT_EQ(tab_strip->GetActiveWebContents(), second_tab); |
1217 } | 1217 } |
1218 | 1218 |
1219 // Check the launcher activation state for applications and browser. | 1219 // Check the launcher activation state for applications and browser. |
1220 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, DISABLED_ActivationStateCheck) { | 1220 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, DISABLED_ActivationStateCheck) { |
1221 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1221 TabStripModel* tab_strip = browser()->tab_strip_model(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1398 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
1399 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1399 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1400 content::WebContents* content1a = tab_strip->GetActiveWebContents(); | 1400 content::WebContents* content1a = tab_strip->GetActiveWebContents(); |
1401 | 1401 |
1402 // Make sure that the active tab is now our handled tab. | 1402 // Make sure that the active tab is now our handled tab. |
1403 EXPECT_NE(content1a, content1); | 1403 EXPECT_NE(content1a, content1); |
1404 | 1404 |
1405 // The active tab should still be the unnamed tab. Then we switch and reach | 1405 // The active tab should still be the unnamed tab. Then we switch and reach |
1406 // the first app and stay there. | 1406 // the first app and stay there. |
1407 EXPECT_EQ(content1a, tab_strip->GetActiveWebContents()); | 1407 EXPECT_EQ(content1a, tab_strip->GetActiveWebContents()); |
1408 WmShelf::ActivateShelfItem(shortcut_index); | 1408 Shelf::ActivateShelfItem(shortcut_index); |
1409 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); | 1409 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); |
1410 WmShelf::ActivateShelfItem(shortcut_index); | 1410 Shelf::ActivateShelfItem(shortcut_index); |
1411 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); | 1411 EXPECT_EQ(content1, tab_strip->GetActiveWebContents()); |
1412 | 1412 |
1413 ui_test_utils::NavigateToURLWithDisposition( | 1413 ui_test_utils::NavigateToURLWithDisposition( |
1414 browser(), GURL(url), WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1414 browser(), GURL(url), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
1415 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1415 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1416 content::WebContents* content2 = tab_strip->GetActiveWebContents(); | 1416 content::WebContents* content2 = tab_strip->GetActiveWebContents(); |
1417 | 1417 |
1418 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); | 1418 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); |
1419 WmShelf::ActivateShelfItem(shortcut_index); | 1419 Shelf::ActivateShelfItem(shortcut_index); |
1420 EXPECT_EQ(content1, browser()->tab_strip_model()->GetActiveWebContents()); | 1420 EXPECT_EQ(content1, browser()->tab_strip_model()->GetActiveWebContents()); |
1421 WmShelf::ActivateShelfItem(shortcut_index); | 1421 Shelf::ActivateShelfItem(shortcut_index); |
1422 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); | 1422 EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents()); |
1423 } | 1423 } |
1424 | 1424 |
1425 // Check that the keyboard activation of a launcher item tabs properly through | 1425 // Check that the keyboard activation of a launcher item tabs properly through |
1426 // the items at hand. | 1426 // the items at hand. |
1427 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AltNumberAppsTabbing) { | 1427 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AltNumberAppsTabbing) { |
1428 // First run app. | 1428 // First run app. |
1429 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 1429 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
1430 ui::BaseWindow* window1 = | 1430 ui::BaseWindow* window1 = |
1431 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); | 1431 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); |
1432 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 1432 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
1433 ash::ShelfID app_id = item1.id; | 1433 ash::ShelfID app_id = item1.id; |
1434 int app_index = shelf_model()->ItemIndexByID(app_id); | 1434 int app_index = shelf_model()->ItemIndexByID(app_id); |
1435 | 1435 |
1436 EXPECT_EQ(ash::TYPE_APP, item1.type); | 1436 EXPECT_EQ(ash::TYPE_APP, item1.type); |
1437 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 1437 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
1438 | 1438 |
1439 const Extension* extension2 = | 1439 const Extension* extension2 = |
1440 LoadAndLaunchPlatformApp("launch_2", "Launched"); | 1440 LoadAndLaunchPlatformApp("launch_2", "Launched"); |
1441 ui::BaseWindow* window2 = | 1441 ui::BaseWindow* window2 = |
1442 CreateAppWindow(browser()->profile(), extension2)->GetBaseWindow(); | 1442 CreateAppWindow(browser()->profile(), extension2)->GetBaseWindow(); |
1443 | 1443 |
1444 // By now the browser should be active. Issue Alt keystrokes several times to | 1444 // By now the browser should be active. Issue Alt keystrokes several times to |
1445 // see that we stay on that application. | 1445 // see that we stay on that application. |
1446 EXPECT_TRUE(window2->IsActive()); | 1446 EXPECT_TRUE(window2->IsActive()); |
1447 WmShelf::ActivateShelfItem(app_index); | 1447 Shelf::ActivateShelfItem(app_index); |
1448 EXPECT_TRUE(window1->IsActive()); | 1448 EXPECT_TRUE(window1->IsActive()); |
1449 WmShelf::ActivateShelfItem(app_index); | 1449 Shelf::ActivateShelfItem(app_index); |
1450 EXPECT_TRUE(window1->IsActive()); | 1450 EXPECT_TRUE(window1->IsActive()); |
1451 | 1451 |
1452 ui::BaseWindow* window1a = | 1452 ui::BaseWindow* window1a = |
1453 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); | 1453 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); |
1454 | 1454 |
1455 EXPECT_TRUE(window1a->IsActive()); | 1455 EXPECT_TRUE(window1a->IsActive()); |
1456 EXPECT_FALSE(window1->IsActive()); | 1456 EXPECT_FALSE(window1->IsActive()); |
1457 WmShelf::ActivateShelfItem(app_index); | 1457 Shelf::ActivateShelfItem(app_index); |
1458 EXPECT_TRUE(window1->IsActive()); | 1458 EXPECT_TRUE(window1->IsActive()); |
1459 WmShelf::ActivateShelfItem(app_index); | 1459 Shelf::ActivateShelfItem(app_index); |
1460 EXPECT_TRUE(window1a->IsActive()); | 1460 EXPECT_TRUE(window1a->IsActive()); |
1461 } | 1461 } |
1462 | 1462 |
1463 // Test that we can launch a platform app panel and get a running item. | 1463 // Test that we can launch a platform app panel and get a running item. |
1464 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) { | 1464 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) { |
1465 int item_count = shelf_model()->item_count(); | 1465 int item_count = shelf_model()->item_count(); |
1466 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); | 1466 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); |
1467 AppWindow::CreateParams params; | 1467 AppWindow::CreateParams params; |
1468 params.window_type = AppWindow::WINDOW_TYPE_PANEL; | 1468 params.window_type = AppWindow::WINDOW_TYPE_PANEL; |
1469 params.focused = false; | 1469 params.focused = false; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 // would decrease | 1662 // would decrease |
1663 EXPECT_EQ(item_count, shelf_model->item_count()); | 1663 EXPECT_EQ(item_count, shelf_model->item_count()); |
1664 } | 1664 } |
1665 | 1665 |
1666 // Checks that the browser Alt "tabbing" is properly done. | 1666 // Checks that the browser Alt "tabbing" is properly done. |
1667 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser, | 1667 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser, |
1668 AltNumberBrowserTabbing) { | 1668 AltNumberBrowserTabbing) { |
1669 // Get the number of items in the browser menu. | 1669 // Get the number of items in the browser menu. |
1670 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); | 1670 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); |
1671 // The first activation should create a browser at index 1 (App List @ 0). | 1671 // The first activation should create a browser at index 1 (App List @ 0). |
1672 WmShelf::ActivateShelfItem(1); | 1672 Shelf::ActivateShelfItem(1); |
1673 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1673 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
1674 // A second activation should not create a new instance. | 1674 // A second activation should not create a new instance. |
1675 WmShelf::ActivateShelfItem(1); | 1675 Shelf::ActivateShelfItem(1); |
1676 Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); | 1676 Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); |
1677 EXPECT_TRUE(browser1); | 1677 EXPECT_TRUE(browser1); |
1678 aura::Window* window1 = browser1->window()->GetNativeWindow(); | 1678 aura::Window* window1 = browser1->window()->GetNativeWindow(); |
1679 Browser* browser2 = CreateBrowser(profile()); | 1679 Browser* browser2 = CreateBrowser(profile()); |
1680 aura::Window* window2 = browser2->window()->GetNativeWindow(); | 1680 aura::Window* window2 = browser2->window()->GetNativeWindow(); |
1681 | 1681 |
1682 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1682 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
1683 EXPECT_NE(window1, window2); | 1683 EXPECT_NE(window1, window2); |
1684 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); | 1684 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); |
1685 | 1685 |
1686 // Activate multiple times the switcher to see that the windows get activated. | 1686 // Activate multiple times the switcher to see that the windows get activated. |
1687 WmShelf::ActivateShelfItem(1); | 1687 Shelf::ActivateShelfItem(1); |
1688 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1688 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
1689 WmShelf::ActivateShelfItem(1); | 1689 Shelf::ActivateShelfItem(1); |
1690 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); | 1690 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); |
1691 | 1691 |
1692 // Create a third browser - make sure that we do not toggle simply between | 1692 // Create a third browser - make sure that we do not toggle simply between |
1693 // two windows. | 1693 // two windows. |
1694 Browser* browser3 = CreateBrowser(profile()); | 1694 Browser* browser3 = CreateBrowser(profile()); |
1695 aura::Window* window3 = browser3->window()->GetNativeWindow(); | 1695 aura::Window* window3 = browser3->window()->GetNativeWindow(); |
1696 | 1696 |
1697 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); | 1697 EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); |
1698 EXPECT_NE(window1, window3); | 1698 EXPECT_NE(window1, window3); |
1699 EXPECT_NE(window2, window3); | 1699 EXPECT_NE(window2, window3); |
1700 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); | 1700 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); |
1701 | 1701 |
1702 WmShelf::ActivateShelfItem(1); | 1702 Shelf::ActivateShelfItem(1); |
1703 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1703 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
1704 WmShelf::ActivateShelfItem(1); | 1704 Shelf::ActivateShelfItem(1); |
1705 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); | 1705 EXPECT_EQ(window2, ash::wm::GetActiveWindow()); |
1706 WmShelf::ActivateShelfItem(1); | 1706 Shelf::ActivateShelfItem(1); |
1707 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); | 1707 EXPECT_EQ(window3, ash::wm::GetActiveWindow()); |
1708 WmShelf::ActivateShelfItem(1); | 1708 Shelf::ActivateShelfItem(1); |
1709 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1709 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
1710 | 1710 |
1711 // Create anther app and make sure that none of our browsers is active. | 1711 // Create anther app and make sure that none of our browsers is active. |
1712 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, | 1712 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, |
1713 WindowOpenDisposition::NEW_WINDOW); | 1713 WindowOpenDisposition::NEW_WINDOW); |
1714 EXPECT_NE(window1, ash::wm::GetActiveWindow()); | 1714 EXPECT_NE(window1, ash::wm::GetActiveWindow()); |
1715 EXPECT_NE(window2, ash::wm::GetActiveWindow()); | 1715 EXPECT_NE(window2, ash::wm::GetActiveWindow()); |
1716 | 1716 |
1717 // After activation our browser should be active again. | 1717 // After activation our browser should be active again. |
1718 WmShelf::ActivateShelfItem(1); | 1718 Shelf::ActivateShelfItem(1); |
1719 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); | 1719 EXPECT_EQ(window1, ash::wm::GetActiveWindow()); |
1720 } | 1720 } |
1721 | 1721 |
1722 // Checks that after a session restore, we do not start applications on an | 1722 // Checks that after a session restore, we do not start applications on an |
1723 // activation. | 1723 // activation. |
1724 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) { | 1724 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) { |
1725 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1725 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
1726 | 1726 |
1727 // Create a known application. | 1727 // Create a known application. |
1728 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1728 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 // Do basic drag and drop interaction tests between the application list and | 1893 // Do basic drag and drop interaction tests between the application list and |
1894 // the launcher in the secondary monitor. | 1894 // the launcher in the secondary monitor. |
1895 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultiDisplayBasicDragAndDrop) { | 1895 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultiDisplayBasicDragAndDrop) { |
1896 // Update the display configuration to add a secondary display. | 1896 // Update the display configuration to add a secondary display. |
1897 display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) | 1897 display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) |
1898 .UpdateDisplay("800x800,801+0-800x800"); | 1898 .UpdateDisplay("800x800,801+0-800x800"); |
1899 | 1899 |
1900 // Get a number of interfaces we need. | 1900 // Get a number of interfaces we need. |
1901 DCHECK_EQ(ash::Shell::GetAllRootWindows().size(), 2U); | 1901 DCHECK_EQ(ash::Shell::GetAllRootWindows().size(), 2U); |
1902 aura::Window* secondary_root_window = ash::Shell::GetAllRootWindows()[1]; | 1902 aura::Window* secondary_root_window = ash::Shell::GetAllRootWindows()[1]; |
1903 ash::WmShelf* secondary_shelf = | 1903 ash::Shelf* secondary_shelf = ash::Shelf::ForWindow(secondary_root_window); |
1904 ash::WmShelf::ForWindow(secondary_root_window); | |
1905 | 1904 |
1906 ui::test::EventGenerator generator(secondary_root_window, gfx::Point()); | 1905 ui::test::EventGenerator generator(secondary_root_window, gfx::Point()); |
1907 ash::test::ShelfViewTestAPI test(secondary_shelf->GetShelfViewForTesting()); | 1906 ash::test::ShelfViewTestAPI test(secondary_shelf->GetShelfViewForTesting()); |
1908 AppListService* service = AppListService::Get(); | 1907 AppListService* service = AppListService::Get(); |
1909 | 1908 |
1910 // There should be two items in our shelf by this time. | 1909 // There should be two items in our shelf by this time. |
1911 EXPECT_EQ(2, model_->item_count()); | 1910 EXPECT_EQ(2, model_->item_count()); |
1912 EXPECT_FALSE(service->IsAppListVisible()); | 1911 EXPECT_FALSE(service->IsAppListVisible()); |
1913 | 1912 |
1914 // Open the app list menu and check that the drag and drop host was set. | 1913 // Open the app list menu and check that the drag and drop host was set. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); | 2168 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); |
2170 ash::ShelfID browser_id = model_->items()[browser_index].id; | 2169 ash::ShelfID browser_id = model_->items()[browser_index].id; |
2171 ash::ShelfID id = | 2170 ash::ShelfID id = |
2172 ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); | 2171 ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); |
2173 EXPECT_EQ(browser_id, id); | 2172 EXPECT_EQ(browser_id, id); |
2174 | 2173 |
2175 ash::ShelfID app_id = CreateShortcut("app1"); | 2174 ash::ShelfID app_id = CreateShortcut("app1"); |
2176 EXPECT_EQ(3, model_->item_count()); | 2175 EXPECT_EQ(3, model_->item_count()); |
2177 | 2176 |
2178 // Create and activate a new tab for "app1" and expect an application ShelfID. | 2177 // Create and activate a new tab for "app1" and expect an application ShelfID. |
2179 WmShelf::ActivateShelfItem(model_->ItemIndexByID(app_id)); | 2178 Shelf::ActivateShelfItem(model_->ItemIndexByID(app_id)); |
2180 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 2179 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
2181 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 2180 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
2182 id = ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); | 2181 id = ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); |
2183 EXPECT_EQ(app_id, id); | 2182 EXPECT_EQ(app_id, id); |
2184 | 2183 |
2185 // Activate the tab at index 0 (NTP) and expect a browser ShelfID. | 2184 // Activate the tab at index 0 (NTP) and expect a browser ShelfID. |
2186 browser()->tab_strip_model()->ActivateTabAt(0, false); | 2185 browser()->tab_strip_model()->ActivateTabAt(0, false); |
2187 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 2186 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
2188 id = ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); | 2187 id = ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); |
2189 EXPECT_EQ(browser_id, id); | 2188 EXPECT_EQ(browser_id, id); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2402 | 2401 |
2403 // Close all windows via the menu item. | 2402 // Close all windows via the menu item. |
2404 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2403 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
2405 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2404 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
2406 | 2405 |
2407 // Check if "Close" is removed from the context menu. | 2406 // Check if "Close" is removed from the context menu. |
2408 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2407 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
2409 ASSERT_FALSE( | 2408 ASSERT_FALSE( |
2410 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2409 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
2411 } | 2410 } |
OLD | NEW |