| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/home/public/home_card.h" | 5 #include "athena/home/public/home_card.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
| 9 #include "athena/test/athena_test_base.h" | 9 #include "athena/test/athena_test_base.h" |
| 10 #include "athena/wm/public/window_manager.h" | 10 #include "athena/wm/public/window_manager.h" |
| 11 #include "ui/aura/window.h" |
| 11 #include "ui/events/test/event_generator.h" | 12 #include "ui/events/test/event_generator.h" |
| 12 | 13 |
| 13 namespace athena { | 14 namespace athena { |
| 14 | 15 |
| 15 typedef test::AthenaTestBase HomeCardTest; | 16 typedef test::AthenaTestBase HomeCardTest; |
| 16 | 17 |
| 17 TEST_F(HomeCardTest, BasicTransition) { | 18 TEST_F(HomeCardTest, BasicTransition) { |
| 18 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 19 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
| 19 | 20 |
| 20 WindowManager::GetInstance()->ToggleOverview(); | 21 WindowManager::GetInstance()->ToggleOverview(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); | 76 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); |
| 76 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 77 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
| 77 | 78 |
| 78 // Do nothing if the centered state is a temporary state. | 79 // Do nothing if the centered state is a temporary state. |
| 79 HomeCard::Get()->UpdateVirtualKeyboardBounds(gfx::Rect(0, 0, 100, 100)); | 80 HomeCard::Get()->UpdateVirtualKeyboardBounds(gfx::Rect(0, 0, 100, 100)); |
| 80 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 81 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
| 81 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); | 82 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); |
| 82 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 83 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
| 83 } | 84 } |
| 84 | 85 |
| 86 TEST_F(HomeCardTest, MouseClick) { |
| 87 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
| 88 |
| 89 // Mouse click at the bottom of the screen should invokes overview mode and |
| 90 // changes the state to BOTTOM. |
| 91 ui::test::EventGenerator generator(root_window()); |
| 92 gfx::Rect screen_rect(root_window()->bounds()); |
| 93 generator.MoveMouseTo(gfx::Point( |
| 94 screen_rect.x() + screen_rect.width() / 2, screen_rect.bottom() - 1)); |
| 95 generator.ClickLeftButton(); |
| 96 |
| 97 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
| 98 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); |
| 99 |
| 100 // Further clicks are simply ignored. |
| 101 generator.ClickLeftButton(); |
| 102 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
| 103 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); |
| 104 } |
| 105 |
| 85 } // namespace athena | 106 } // namespace athena |
| OLD | NEW |