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" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 TEST_F(HomeCardTest, Gestures) { | 106 TEST_F(HomeCardTest, Gestures) { |
107 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 107 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
108 ui::test::EventGenerator generator(root_window()); | 108 ui::test::EventGenerator generator(root_window()); |
109 gfx::Rect screen_rect(root_window()->bounds()); | 109 gfx::Rect screen_rect(root_window()->bounds()); |
110 | 110 |
111 const int bottom = screen_rect.bottom(); | 111 const int bottom = screen_rect.bottom(); |
112 const int x = screen_rect.x() + 1; | 112 const int x = screen_rect.x() + 1; |
113 | 113 |
114 generator.GestureScrollSequence(gfx::Point(x, bottom - 1), | 114 generator.GestureScrollSequence(gfx::Point(x, bottom - 1), |
115 gfx::Point(x, bottom - 40), | 115 gfx::Point(x, bottom - 70), |
116 base::TimeDelta::FromSeconds(1), | 116 base::TimeDelta::FromSeconds(1), |
117 10); | 117 10); |
118 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 118 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
119 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); | 119 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); |
120 | 120 |
121 // Too short moves. Nothing has changed. | 121 // Too short moves. Nothing has changed. |
122 generator.GestureScrollSequence(gfx::Point(x, bottom - 40), | 122 generator.GestureScrollSequence(gfx::Point(x, bottom - 40), |
123 gfx::Point(x, bottom - 80), | 123 gfx::Point(x, bottom - 80), |
124 base::TimeDelta::FromSeconds(1), | 124 base::TimeDelta::FromSeconds(1), |
125 10); | 125 10); |
(...skipping 26 matching lines...) Expand all Loading... |
152 // Swipe down slightly; nothing has to be changed. | 152 // Swipe down slightly; nothing has to be changed. |
153 generator.GestureScrollSequence(gfx::Point(x, bottom - 300), | 153 generator.GestureScrollSequence(gfx::Point(x, bottom - 300), |
154 gfx::Point(x, bottom - 250), | 154 gfx::Point(x, bottom - 250), |
155 base::TimeDelta::FromSeconds(1), | 155 base::TimeDelta::FromSeconds(1), |
156 10); | 156 10); |
157 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 157 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
158 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); | 158 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); |
159 | 159 |
160 // Swipe down to the bottom state. | 160 // Swipe down to the bottom state. |
161 generator.GestureScrollSequence(gfx::Point(x, 10), | 161 generator.GestureScrollSequence(gfx::Point(x, 10), |
162 gfx::Point(x, bottom - 40), | 162 gfx::Point(x, bottom - 90), |
163 base::TimeDelta::FromSeconds(1), | 163 base::TimeDelta::FromSeconds(1), |
164 10); | 164 10); |
165 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 165 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
166 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); | 166 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); |
167 | 167 |
168 generator.GestureScrollSequence(gfx::Point(x, bottom - 40), | 168 generator.GestureScrollSequence(gfx::Point(x, bottom - 40), |
169 gfx::Point(x, bottom - 300), | 169 gfx::Point(x, bottom - 300), |
170 base::TimeDelta::FromSeconds(1), | 170 base::TimeDelta::FromSeconds(1), |
171 10); | 171 10); |
172 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 172 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
(...skipping 19 matching lines...) Expand all Loading... |
192 | 192 |
193 generator.GestureScrollSequence(gfx::Point(x, bottom - 1), | 193 generator.GestureScrollSequence(gfx::Point(x, bottom - 1), |
194 gfx::Point(x, 20), | 194 gfx::Point(x, 20), |
195 base::TimeDelta::FromSeconds(1), | 195 base::TimeDelta::FromSeconds(1), |
196 10); | 196 10); |
197 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 197 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
198 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); | 198 EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); |
199 } | 199 } |
200 | 200 |
201 } // namespace athena | 201 } // namespace athena |
OLD | NEW |