| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/app_list/views/app_list_main_view.h" | 5 #include "ui/app_list/views/app_list_main_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Tests that mouse hovering over an app item highlights it | 268 // Tests that mouse hovering over an app item highlights it |
| 269 TEST_F(AppListMainViewTest, MouseHoverToHighlight) { | 269 TEST_F(AppListMainViewTest, MouseHoverToHighlight) { |
| 270 delegate_->GetTestModel()->PopulateApps(2); | 270 delegate_->GetTestModel()->PopulateApps(2); |
| 271 main_widget_->Show(); | 271 main_widget_->Show(); |
| 272 | 272 |
| 273 ui::test::EventGenerator generator(GetContext(), | 273 ui::test::EventGenerator generator(GetContext(), |
| 274 main_widget_->GetNativeWindow()); | 274 main_widget_->GetNativeWindow()); |
| 275 AppListItemView* item0 = RootViewModel()->view_at(0); | 275 AppListItemView* item0 = RootViewModel()->view_at(0); |
| 276 AppListItemView* item1 = RootViewModel()->view_at(1); | 276 AppListItemView* item1 = RootViewModel()->view_at(1); |
| 277 | 277 |
| 278 // If experimental launcher, switch to All Apps page | 278 // Switch to All Apps page. |
| 279 if (app_list::switches::IsExperimentalAppListEnabled()) { | 279 GetContentsView()->SetActiveState(AppListModel::STATE_APPS); |
| 280 GetContentsView()->SetActiveState(AppListModel::STATE_APPS); | 280 GetContentsView()->Layout(); |
| 281 GetContentsView()->Layout(); | |
| 282 } | |
| 283 | 281 |
| 284 generator.MoveMouseTo(item0->GetBoundsInScreen().CenterPoint()); | 282 generator.MoveMouseTo(item0->GetBoundsInScreen().CenterPoint()); |
| 285 EXPECT_TRUE(item0->is_highlighted()); | 283 EXPECT_TRUE(item0->is_highlighted()); |
| 286 EXPECT_FALSE(item1->is_highlighted()); | 284 EXPECT_FALSE(item1->is_highlighted()); |
| 287 | 285 |
| 288 generator.MoveMouseTo(item1->GetBoundsInScreen().CenterPoint()); | 286 generator.MoveMouseTo(item1->GetBoundsInScreen().CenterPoint()); |
| 289 EXPECT_FALSE(item0->is_highlighted()); | 287 EXPECT_FALSE(item0->is_highlighted()); |
| 290 EXPECT_TRUE(item1->is_highlighted()); | 288 EXPECT_TRUE(item1->is_highlighted()); |
| 291 | 289 |
| 292 generator.MoveMouseTo(gfx::Point(-1, -1)); | 290 generator.MoveMouseTo(gfx::Point(-1, -1)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 303 | 301 |
| 304 // Tests that tap gesture on app item highlights it | 302 // Tests that tap gesture on app item highlights it |
| 305 TEST_F(AppListMainViewTest, MAYBE_TapGestureToHighlight) { | 303 TEST_F(AppListMainViewTest, MAYBE_TapGestureToHighlight) { |
| 306 delegate_->GetTestModel()->PopulateApps(1); | 304 delegate_->GetTestModel()->PopulateApps(1); |
| 307 main_widget_->Show(); | 305 main_widget_->Show(); |
| 308 | 306 |
| 309 ui::test::EventGenerator generator(GetContext(), | 307 ui::test::EventGenerator generator(GetContext(), |
| 310 main_widget_->GetNativeWindow()); | 308 main_widget_->GetNativeWindow()); |
| 311 AppListItemView* item = RootViewModel()->view_at(0); | 309 AppListItemView* item = RootViewModel()->view_at(0); |
| 312 | 310 |
| 313 // If experimental launcher, switch to All Apps page | 311 // Switch to All Apps page. |
| 314 if (app_list::switches::IsExperimentalAppListEnabled()) { | 312 GetContentsView()->SetActiveState(AppListModel::STATE_APPS); |
| 315 GetContentsView()->SetActiveState(AppListModel::STATE_APPS); | 313 GetContentsView()->Layout(); |
| 316 GetContentsView()->Layout(); | |
| 317 } | |
| 318 | 314 |
| 319 generator.set_current_location(item->GetBoundsInScreen().CenterPoint()); | 315 generator.set_current_location(item->GetBoundsInScreen().CenterPoint()); |
| 320 generator.PressTouch(); | 316 generator.PressTouch(); |
| 321 EXPECT_TRUE(item->is_highlighted()); | 317 EXPECT_TRUE(item->is_highlighted()); |
| 322 | 318 |
| 323 generator.ReleaseTouch(); | 319 generator.ReleaseTouch(); |
| 324 EXPECT_FALSE(item->is_highlighted()); | 320 EXPECT_FALSE(item->is_highlighted()); |
| 325 } | 321 } |
| 326 | 322 |
| 327 // Tests dragging an item out of a single item folder and drop it at the last | 323 // Tests dragging an item out of a single item folder and drop it at the last |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // The app list model should remain unchanged. | 449 // The app list model should remain unchanged. |
| 454 EXPECT_EQ(1, FolderViewModel()->view_size()); | 450 EXPECT_EQ(1, FolderViewModel()->view_size()); |
| 455 EXPECT_EQ(2, RootViewModel()->view_size()); | 451 EXPECT_EQ(2, RootViewModel()->view_size()); |
| 456 EXPECT_EQ(folder_id, RootGridView()->GetItemViewAt(0)->item()->id()); | 452 EXPECT_EQ(folder_id, RootGridView()->GetItemViewAt(0)->item()->id()); |
| 457 EXPECT_NE(nullptr, | 453 EXPECT_NE(nullptr, |
| 458 delegate_->GetTestModel()->FindFolderItem("single_item_folder")); | 454 delegate_->GetTestModel()->FindFolderItem("single_item_folder")); |
| 459 } | 455 } |
| 460 | 456 |
| 461 } // namespace test | 457 } // namespace test |
| 462 } // namespace app_list | 458 } // namespace app_list |
| OLD | NEW |