| 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/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 }; | 401 }; |
| 402 | 402 |
| 403 // Test that we can launch a platform app and get a running item. | 403 // Test that we can launch a platform app and get a running item. |
| 404 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) { | 404 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) { |
| 405 int item_count = shelf_model()->item_count(); | 405 int item_count = shelf_model()->item_count(); |
| 406 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); | 406 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 407 AppWindow* window = CreateAppWindow(browser()->profile(), extension); | 407 AppWindow* window = CreateAppWindow(browser()->profile(), extension); |
| 408 ++item_count; | 408 ++item_count; |
| 409 ASSERT_EQ(item_count, shelf_model()->item_count()); | 409 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 410 const ash::ShelfItem& item = GetLastLauncherItem(); | 410 const ash::ShelfItem& item = GetLastLauncherItem(); |
| 411 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item.type); | 411 EXPECT_EQ(ash::TYPE_APP, item.type); |
| 412 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 412 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 413 CloseAppWindow(window); | 413 CloseAppWindow(window); |
| 414 --item_count; | 414 --item_count; |
| 415 EXPECT_EQ(item_count, shelf_model()->item_count()); | 415 EXPECT_EQ(item_count, shelf_model()->item_count()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 // Test that we can launch a platform app that already has a shortcut. | 418 // Test that we can launch a platform app that already has a shortcut. |
| 419 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) { | 419 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) { |
| 420 int item_count = shelf_model()->item_count(); | 420 int item_count = shelf_model()->item_count(); |
| 421 | 421 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 450 | 450 |
| 451 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) { | 451 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) { |
| 452 // Run. | 452 // Run. |
| 453 int item_count = shelf_model()->item_count(); | 453 int item_count = shelf_model()->item_count(); |
| 454 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); | 454 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 455 AppWindow* window = CreateAppWindow(browser()->profile(), extension); | 455 AppWindow* window = CreateAppWindow(browser()->profile(), extension); |
| 456 ++item_count; | 456 ++item_count; |
| 457 ASSERT_EQ(item_count, shelf_model()->item_count()); | 457 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 458 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 458 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 459 ash::ShelfID id = item1.id; | 459 ash::ShelfID id = item1.id; |
| 460 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 460 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 461 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 461 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 462 | 462 |
| 463 // Create a shortcut. The app item should be after it. | 463 // Create a shortcut. The app item should be after it. |
| 464 ash::ShelfID foo_id = | 464 ash::ShelfID foo_id = |
| 465 CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId("foo")); | 465 CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId("foo")); |
| 466 ++item_count; | 466 ++item_count; |
| 467 ASSERT_EQ(item_count, shelf_model()->item_count()); | 467 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 468 EXPECT_LT(shelf_model()->ItemIndexByID(foo_id), | 468 EXPECT_LT(shelf_model()->ItemIndexByID(foo_id), |
| 469 shelf_model()->ItemIndexByID(id)); | 469 shelf_model()->ItemIndexByID(id)); |
| 470 | 470 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 ash::wm::ActivateWindow(window->GetNativeWindow()); | 518 ash::wm::ActivateWindow(window->GetNativeWindow()); |
| 519 ASSERT_EQ(item_count, shelf_model()->item_count()); | 519 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 520 item = *shelf_model()->ItemByID(shortcut_id); | 520 item = *shelf_model()->ItemByID(shortcut_id); |
| 521 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); | 521 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); |
| 522 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 522 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 523 | 523 |
| 524 // Unpin the app. The item should remain. | 524 // Unpin the app. The item should remain. |
| 525 controller_->Unpin(shortcut_id); | 525 controller_->Unpin(shortcut_id); |
| 526 ASSERT_EQ(item_count, shelf_model()->item_count()); | 526 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 527 item = *shelf_model()->ItemByID(shortcut_id); | 527 item = *shelf_model()->ItemByID(shortcut_id); |
| 528 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item.type); | 528 EXPECT_EQ(ash::TYPE_APP, item.type); |
| 529 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 529 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 530 // The item should have moved after the other shortcuts. | 530 // The item should have moved after the other shortcuts. |
| 531 EXPECT_GT(shelf_model()->ItemIndexByID(shortcut_id), | 531 EXPECT_GT(shelf_model()->ItemIndexByID(shortcut_id), |
| 532 shelf_model()->ItemIndexByID(foo_id)); | 532 shelf_model()->ItemIndexByID(foo_id)); |
| 533 | 533 |
| 534 // Then close it, make sure the item's gone. | 534 // Then close it, make sure the item's gone. |
| 535 CloseAppWindow(window); | 535 CloseAppWindow(window); |
| 536 --item_count; | 536 --item_count; |
| 537 ASSERT_EQ(item_count, shelf_model()->item_count()); | 537 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 538 } | 538 } |
| 539 | 539 |
| 540 // Test that we can launch a platform app with more than one window. | 540 // Test that we can launch a platform app with more than one window. |
| 541 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) { | 541 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) { |
| 542 int item_count = shelf_model()->item_count(); | 542 int item_count = shelf_model()->item_count(); |
| 543 | 543 |
| 544 // First run app. | 544 // First run app. |
| 545 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); | 545 const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 546 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension); | 546 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension); |
| 547 ++item_count; | 547 ++item_count; |
| 548 ASSERT_EQ(item_count, shelf_model()->item_count()); | 548 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 549 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 549 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 550 ash::ShelfID item_id = item1.id; | 550 ash::ShelfID item_id = item1.id; |
| 551 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 551 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 552 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 552 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 553 EXPECT_EQ(2, GetNumApplicationMenuItems(item1)); // Title + 1 window | 553 EXPECT_EQ(2, GetNumApplicationMenuItems(item1)); // Title + 1 window |
| 554 | 554 |
| 555 // Add second window. | 555 // Add second window. |
| 556 AppWindow* window2 = CreateAppWindow(browser()->profile(), extension); | 556 AppWindow* window2 = CreateAppWindow(browser()->profile(), extension); |
| 557 // Confirm item stays. | 557 // Confirm item stays. |
| 558 ASSERT_EQ(item_count, shelf_model()->item_count()); | 558 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 559 const ash::ShelfItem& item2 = *shelf_model()->ItemByID(item_id); | 559 const ash::ShelfItem& item2 = *shelf_model()->ItemByID(item_id); |
| 560 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); | 560 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); |
| 561 EXPECT_EQ(3, GetNumApplicationMenuItems(item2)); // Title + 2 windows | 561 EXPECT_EQ(3, GetNumApplicationMenuItems(item2)); // Title + 2 windows |
| (...skipping 16 matching lines...) Expand all Loading... |
| 578 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) { | 578 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) { |
| 579 int item_count = shelf_model()->item_count(); | 579 int item_count = shelf_model()->item_count(); |
| 580 | 580 |
| 581 // First run app. | 581 // First run app. |
| 582 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 582 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 583 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); | 583 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); |
| 584 ++item_count; | 584 ++item_count; |
| 585 ASSERT_EQ(item_count, shelf_model()->item_count()); | 585 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 586 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 586 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 587 ash::ShelfID item_id1 = item1.id; | 587 ash::ShelfID item_id1 = item1.id; |
| 588 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 588 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 589 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 589 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 590 | 590 |
| 591 // Then run second app. | 591 // Then run second app. |
| 592 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", | 592 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", |
| 593 "Launched"); | 593 "Launched"); |
| 594 AppWindow* window2 = CreateAppWindow(browser()->profile(), extension2); | 594 AppWindow* window2 = CreateAppWindow(browser()->profile(), extension2); |
| 595 ++item_count; | 595 ++item_count; |
| 596 ASSERT_EQ(item_count, shelf_model()->item_count()); | 596 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 597 const ash::ShelfItem& item2 = GetLastLauncherItem(); | 597 const ash::ShelfItem& item2 = GetLastLauncherItem(); |
| 598 ash::ShelfID item_id2 = item2.id; | 598 ash::ShelfID item_id2 = item2.id; |
| 599 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item2.type); | 599 EXPECT_EQ(ash::TYPE_APP, item2.type); |
| 600 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); | 600 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); |
| 601 | 601 |
| 602 EXPECT_NE(item_id1, item_id2); | 602 EXPECT_NE(item_id1, item_id2); |
| 603 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 603 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
| 604 | 604 |
| 605 // Close second app. | 605 // Close second app. |
| 606 CloseAppWindow(window2); | 606 CloseAppWindow(window2); |
| 607 --item_count; | 607 --item_count; |
| 608 ASSERT_EQ(item_count, shelf_model()->item_count()); | 608 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 609 // First app should be active again. | 609 // First app should be active again. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 620 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) { | 620 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) { |
| 621 int item_count = shelf_model()->item_count(); | 621 int item_count = shelf_model()->item_count(); |
| 622 | 622 |
| 623 // First run app. | 623 // First run app. |
| 624 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 624 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 625 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); | 625 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); |
| 626 ++item_count; | 626 ++item_count; |
| 627 ASSERT_EQ(item_count, shelf_model()->item_count()); | 627 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 628 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 628 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 629 ash::ShelfID item_id1 = item1.id; | 629 ash::ShelfID item_id1 = item1.id; |
| 630 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 630 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 631 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 631 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 632 | 632 |
| 633 // Then run second app. | 633 // Then run second app. |
| 634 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", | 634 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", |
| 635 "Launched"); | 635 "Launched"); |
| 636 AppWindow* window2 = CreateAppWindow(browser()->profile(), extension2); | 636 AppWindow* window2 = CreateAppWindow(browser()->profile(), extension2); |
| 637 ++item_count; | 637 ++item_count; |
| 638 ASSERT_EQ(item_count, shelf_model()->item_count()); | 638 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 639 const ash::ShelfItem& item2 = GetLastLauncherItem(); | 639 const ash::ShelfItem& item2 = GetLastLauncherItem(); |
| 640 ash::ShelfID item_id2 = item2.id; | 640 ash::ShelfID item_id2 = item2.id; |
| 641 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item2.type); | 641 EXPECT_EQ(ash::TYPE_APP, item2.type); |
| 642 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); | 642 EXPECT_EQ(ash::STATUS_ACTIVE, item2.status); |
| 643 | 643 |
| 644 EXPECT_NE(item_id1, item_id2); | 644 EXPECT_NE(item_id1, item_id2); |
| 645 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 645 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
| 646 | 646 |
| 647 // Activate first one. | 647 // Activate first one. |
| 648 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); | 648 WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); |
| 649 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); | 649 EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); |
| 650 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); | 650 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); |
| 651 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 651 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 PackagedAppClickBehaviorInMinimizeMode) { | 703 PackagedAppClickBehaviorInMinimizeMode) { |
| 704 // Launch one platform app and create a window for it. | 704 // Launch one platform app and create a window for it. |
| 705 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 705 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 706 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); | 706 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); |
| 707 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 707 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 708 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 708 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 709 | 709 |
| 710 // Confirm that a controller item was created and is the correct state. | 710 // Confirm that a controller item was created and is the correct state. |
| 711 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 711 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 712 LauncherItemController* item1_controller = GetItemController(item1.id); | 712 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 713 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 713 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 714 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 714 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 715 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); | 715 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); |
| 716 // Since it is already active, clicking it should minimize. | 716 // Since it is already active, clicking it should minimize. |
| 717 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 717 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 718 item1_controller->ItemSelected(click_event); | 718 item1_controller->ItemSelected(click_event); |
| 719 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); | 719 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); |
| 720 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); | 720 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); |
| 721 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); | 721 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); |
| 722 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 722 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 723 // Clicking the item again should activate the window again. | 723 // Clicking the item again should activate the window again. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { | 840 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { |
| 841 int item_count = shelf_model()->item_count(); | 841 int item_count = shelf_model()->item_count(); |
| 842 | 842 |
| 843 // First run app. | 843 // First run app. |
| 844 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 844 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 845 CreateAppWindow(browser()->profile(), extension1); | 845 CreateAppWindow(browser()->profile(), extension1); |
| 846 ++item_count; | 846 ++item_count; |
| 847 ASSERT_EQ(item_count, shelf_model()->item_count()); | 847 ASSERT_EQ(item_count, shelf_model()->item_count()); |
| 848 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 848 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 849 ash::ShelfID item_id1 = item1.id; | 849 ash::ShelfID item_id1 = item1.id; |
| 850 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 850 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 851 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 851 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 852 | 852 |
| 853 ash::wm::ActivateWindow(browser()->window()->GetNativeWindow()); | 853 ash::wm::ActivateWindow(browser()->window()->GetNativeWindow()); |
| 854 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 854 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
| 855 } | 855 } |
| 856 | 856 |
| 857 // Test that opening an app sets the correct icon | 857 // Test that opening an app sets the correct icon |
| 858 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) { | 858 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) { |
| 859 TestAppWindowRegistryObserver test_observer(browser()->profile()); | 859 TestAppWindowRegistryObserver test_observer(browser()->profile()); |
| 860 | 860 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, | 1419 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, |
| 1420 AltNumberAppsTabbing) { | 1420 AltNumberAppsTabbing) { |
| 1421 // First run app. | 1421 // First run app. |
| 1422 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 1422 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 1423 ui::BaseWindow* window1 = | 1423 ui::BaseWindow* window1 = |
| 1424 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); | 1424 CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); |
| 1425 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 1425 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 1426 ash::ShelfID app_id = item1.id; | 1426 ash::ShelfID app_id = item1.id; |
| 1427 int app_index = shelf_model()->ItemIndexByID(app_id); | 1427 int app_index = shelf_model()->ItemIndexByID(app_id); |
| 1428 | 1428 |
| 1429 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 1429 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 1430 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 1430 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 1431 | 1431 |
| 1432 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", | 1432 const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2", |
| 1433 "Launched"); | 1433 "Launched"); |
| 1434 ui::BaseWindow* window2 = | 1434 ui::BaseWindow* window2 = |
| 1435 CreateAppWindow(browser()->profile(), extension2)->GetBaseWindow(); | 1435 CreateAppWindow(browser()->profile(), extension2)->GetBaseWindow(); |
| 1436 | 1436 |
| 1437 // By now the browser should be active. Issue Alt keystrokes several times to | 1437 // By now the browser should be active. Issue Alt keystrokes several times to |
| 1438 // see that we stay on that application. | 1438 // see that we stay on that application. |
| 1439 EXPECT_TRUE(window2->IsActive()); | 1439 EXPECT_TRUE(window2->IsActive()); |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2418 | 2418 |
| 2419 // Close all windows via the menu item. | 2419 // Close all windows via the menu item. |
| 2420 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2420 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2421 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2421 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2422 | 2422 |
| 2423 // Check if "Close" is removed from the context menu. | 2423 // Check if "Close" is removed from the context menu. |
| 2424 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2424 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2425 ASSERT_FALSE( | 2425 ASSERT_FALSE( |
| 2426 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2426 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2427 } | 2427 } |
| OLD | NEW |