OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 LauncherItem item = GetItemByID(last_added); | 529 LauncherItem item = GetItemByID(last_added); |
530 int index = model_->ItemIndexByID(last_added); | 530 int index = model_->ItemIndexByID(last_added); |
531 internal::LauncherButton* button = GetButtonByID(last_added); | 531 internal::LauncherButton* button = GetButtonByID(last_added); |
532 ASSERT_EQ(internal::LauncherButton::STATE_RUNNING, button->state()); | 532 ASSERT_EQ(internal::LauncherButton::STATE_RUNNING, button->state()); |
533 item.status = ash::STATUS_ACTIVE; | 533 item.status = ash::STATUS_ACTIVE; |
534 model_->Set(index, item); | 534 model_->Set(index, item); |
535 ASSERT_EQ(internal::LauncherButton::STATE_ACTIVE, button->state()); | 535 ASSERT_EQ(internal::LauncherButton::STATE_ACTIVE, button->state()); |
536 item.status = ash::STATUS_ATTENTION; | 536 item.status = ash::STATUS_ATTENTION; |
537 model_->Set(index, item); | 537 model_->Set(index, item); |
538 ASSERT_EQ(internal::LauncherButton::STATE_ATTENTION, button->state()); | 538 ASSERT_EQ(internal::LauncherButton::STATE_ATTENTION, button->state()); |
| 539 item.status = ash::STATUS_IS_PENDING; |
| 540 model_->Set(index, item); |
| 541 ASSERT_EQ(internal::LauncherButton::STATE_PENDING, button->state()); |
539 } | 542 } |
540 | 543 |
541 // Confirm that item status changes are reflected in the buttons | 544 // Confirm that item status changes are reflected in the buttons |
542 // for platform apps. | 545 // for platform apps. |
543 TEST_F(LauncherViewTest, LauncherItemStatusPlatformApp) { | 546 TEST_F(LauncherViewTest, LauncherItemStatusPlatformApp) { |
544 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, | 547 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
545 test_api_->GetButtonCount()); | 548 test_api_->GetButtonCount()); |
546 | 549 |
547 // Add tabbed browser. | 550 // Add tabbed browser. |
548 LauncherID last_added = AddPlatformApp(); | 551 LauncherID last_added = AddPlatformApp(); |
549 LauncherItem item = GetItemByID(last_added); | 552 LauncherItem item = GetItemByID(last_added); |
550 int index = model_->ItemIndexByID(last_added); | 553 int index = model_->ItemIndexByID(last_added); |
551 internal::LauncherButton* button = GetButtonByID(last_added); | 554 internal::LauncherButton* button = GetButtonByID(last_added); |
552 ASSERT_EQ(internal::LauncherButton::STATE_RUNNING, button->state()); | 555 ASSERT_EQ(internal::LauncherButton::STATE_RUNNING, button->state()); |
553 item.status = ash::STATUS_ACTIVE; | 556 item.status = ash::STATUS_ACTIVE; |
554 model_->Set(index, item); | 557 model_->Set(index, item); |
555 ASSERT_EQ(internal::LauncherButton::STATE_ACTIVE, button->state()); | 558 ASSERT_EQ(internal::LauncherButton::STATE_ACTIVE, button->state()); |
556 item.status = ash::STATUS_ATTENTION; | 559 item.status = ash::STATUS_ATTENTION; |
557 model_->Set(index, item); | 560 model_->Set(index, item); |
558 ASSERT_EQ(internal::LauncherButton::STATE_ATTENTION, button->state()); | 561 ASSERT_EQ(internal::LauncherButton::STATE_ATTENTION, button->state()); |
| 562 item.status = ash::STATUS_IS_PENDING; |
| 563 model_->Set(index, item); |
| 564 ASSERT_EQ(internal::LauncherButton::STATE_PENDING, button->state()); |
559 } | 565 } |
560 | 566 |
561 TEST_F(LauncherViewTest, LauncherTooltipTest) { | 567 TEST_F(LauncherViewTest, LauncherTooltipTest) { |
562 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, | 568 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
563 test_api_->GetButtonCount()); | 569 test_api_->GetButtonCount()); |
564 | 570 |
565 // Prepare some items to the launcher. | 571 // Prepare some items to the launcher. |
566 LauncherID app_button_id = AddAppShortcut(); | 572 LauncherID app_button_id = AddAppShortcut(); |
567 LauncherID tab_button_id = AddTabbedBrowser(); | 573 LauncherID tab_button_id = AddTabbedBrowser(); |
568 | 574 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 701 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
696 const gfx::Rect& app_list_ideal_bounds = | 702 const gfx::Rect& app_list_ideal_bounds = |
697 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 703 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
698 const gfx::Rect& app_list_bounds = | 704 const gfx::Rect& app_list_bounds = |
699 test_api_->GetBoundsByIndex(app_list_button_index); | 705 test_api_->GetBoundsByIndex(app_list_button_index); |
700 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); | 706 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); |
701 } | 707 } |
702 | 708 |
703 } // namespace test | 709 } // namespace test |
704 } // namespace ash | 710 } // namespace ash |
OLD | NEW |