| 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/home/home_card_constants.h" | 8 #include "athena/home/home_card_constants.h" |
| 9 #include "athena/home/home_card_impl.h" | 9 #include "athena/home/home_card_impl.h" |
| 10 #include "athena/home/home_card_view.h" | 10 #include "athena/home/home_card_view.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // Swipe down slightly; nothing has to be changed. | 219 // Swipe down slightly; nothing has to be changed. |
| 220 generator.GestureScrollSequence(gfx::Point(x, bottom - 300), | 220 generator.GestureScrollSequence(gfx::Point(x, bottom - 300), |
| 221 gfx::Point(x, bottom - 250), | 221 gfx::Point(x, bottom - 250), |
| 222 base::TimeDelta::FromSeconds(1), | 222 base::TimeDelta::FromSeconds(1), |
| 223 10); | 223 10); |
| 224 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 224 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
| 225 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); | 225 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); |
| 226 | 226 |
| 227 // Swipe down to the bottom state. | 227 // Swipe down to the bottom state. |
| 228 generator.GestureScrollSequence(gfx::Point(x, 10), | 228 generator.GestureScrollSequence(gfx::Point(x, 50), |
| 229 gfx::Point(x, bottom - 120), | 229 gfx::Point(x, bottom - 120), |
| 230 base::TimeDelta::FromSeconds(1), | 230 base::TimeDelta::FromSeconds(1), 10); |
| 231 10); | |
| 232 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 231 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
| 233 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); | 232 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); |
| 234 | 233 |
| 235 generator.GestureScrollSequence(gfx::Point(x, bottom - 40), | 234 generator.GestureScrollSequence(gfx::Point(x, bottom - 40), |
| 236 gfx::Point(x, bottom - 300), | 235 gfx::Point(x, bottom - 300), |
| 237 base::TimeDelta::FromSeconds(1), | 236 base::TimeDelta::FromSeconds(1), |
| 238 10); | 237 10); |
| 239 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); | 238 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); |
| 240 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); | 239 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); |
| 241 | 240 |
| 242 // Swipe down to the minimized state. | 241 // Swipe down to the minimized state. |
| 243 generator.GestureScrollSequence(gfx::Point(x, 10), | 242 generator.GestureScrollSequence(gfx::Point(x, 50), gfx::Point(x, bottom - 1), |
| 244 gfx::Point(x, bottom - 1), | 243 base::TimeDelta::FromSeconds(1), 10); |
| 245 base::TimeDelta::FromSeconds(1), | |
| 246 10); | |
| 247 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 244 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
| 248 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive()); | 245 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive()); |
| 249 } | 246 } |
| 250 | 247 |
| 251 TEST_F(HomeCardTest, GesturesToFullDirectly) { | 248 TEST_F(HomeCardTest, GesturesToFullDirectly) { |
| 252 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); | 249 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); |
| 253 ui::test::EventGenerator generator(root_window()); | 250 ui::test::EventGenerator generator(root_window()); |
| 254 gfx::Rect screen_rect(root_window()->bounds()); | 251 gfx::Rect screen_rect(root_window()->bounds()); |
| 255 | 252 |
| 256 const int bottom = screen_rect.bottom(); | 253 const int bottom = screen_rect.bottom(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 contents_view->SetActivePage( | 310 contents_view->SetActivePage( |
| 314 contents_view->GetPageIndexForState(app_list::AppListModel::STATE_APPS)); | 311 contents_view->GetPageIndexForState(app_list::AppListModel::STATE_APPS)); |
| 315 EXPECT_EQ(app_list::AppListModel::STATE_APPS, model->state()); | 312 EXPECT_EQ(app_list::AppListModel::STATE_APPS, model->state()); |
| 316 WindowManager::Get()->ExitOverview(); | 313 WindowManager::Get()->ExitOverview(); |
| 317 WindowManager::Get()->EnterOverview(); | 314 WindowManager::Get()->EnterOverview(); |
| 318 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); | 315 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); |
| 319 EXPECT_EQ(app_list::AppListModel::STATE_START, model->state()); | 316 EXPECT_EQ(app_list::AppListModel::STATE_START, model->state()); |
| 320 } | 317 } |
| 321 | 318 |
| 322 } // namespace athena | 319 } // namespace athena |
| OLD | NEW |