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" | |
9 #include "athena/home/home_card_constants.h" | 8 #include "athena/home/home_card_constants.h" |
10 #include "athena/home/home_card_impl.h" | 9 #include "athena/home/home_card_impl.h" |
11 #include "athena/test/athena_test_base.h" | 10 #include "athena/test/athena_test_base.h" |
12 #include "athena/wm/public/window_manager.h" | 11 #include "athena/wm/public/window_manager.h" |
13 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
14 #include "ui/events/test/event_generator.h" | 13 #include "ui/events/test/event_generator.h" |
15 #include "ui/gfx/display.h" | 14 #include "ui/gfx/display.h" |
16 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
17 #include "ui/views/controls/textfield/textfield.h" | 16 #include "ui/views/controls/textfield/textfield.h" |
18 #include "ui/views/focus/focus_manager.h" | 17 #include "ui/views/focus/focus_manager.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_TRUE(wm::IsActiveWindow(home_card)); | 99 EXPECT_TRUE(wm::IsActiveWindow(home_card)); |
101 } | 100 } |
102 | 101 |
103 // Verify if the home card is correctly minimized after app launch. | 102 // Verify if the home card is correctly minimized after app launch. |
104 TEST_F(HomeCardTest, AppSelection) { | 103 TEST_F(HomeCardTest, AppSelection) { |
105 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 104 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
106 | 105 |
107 WindowManager::GetInstance()->ToggleOverview(); | 106 WindowManager::GetInstance()->ToggleOverview(); |
108 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 107 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
109 | 108 |
110 athena::ActivityManager::Get()->AddActivity( | 109 athena::ActivityFactory::Get()->CreateWebActivity( |
111 athena::ActivityFactory::Get()->CreateWebActivity( | 110 NULL, base::string16(), GURL("http://www.google.com/")); |
112 NULL, base::string16(), GURL("http://www.google.com/"))); | |
113 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 111 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
114 } | 112 } |
115 | 113 |
116 TEST_F(HomeCardTest, Accelerators) { | 114 TEST_F(HomeCardTest, Accelerators) { |
117 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 115 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
118 | 116 |
119 ui::test::EventGenerator generator(root_window()); | 117 ui::test::EventGenerator generator(root_window()); |
120 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); | 118 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); |
121 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 119 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
122 | 120 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 272 |
275 generator.GestureScrollSequence(gfx::Point(x, 10), | 273 generator.GestureScrollSequence(gfx::Point(x, 10), |
276 gfx::Point(x, bottom - 100), | 274 gfx::Point(x, bottom - 100), |
277 base::TimeDelta::FromSeconds(1), | 275 base::TimeDelta::FromSeconds(1), |
278 10); | 276 10); |
279 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 277 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
280 EXPECT_FALSE(IsSearchBoxFocused(home_card)); | 278 EXPECT_FALSE(IsSearchBoxFocused(home_card)); |
281 } | 279 } |
282 | 280 |
283 } // namespace athena | 281 } // namespace athena |
OLD | NEW |