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