Index: ui/app_list/views/app_list_main_view_unittest.cc |
diff --git a/ui/app_list/views/app_list_main_view_unittest.cc b/ui/app_list/views/app_list_main_view_unittest.cc |
index 0091e06f2023d53b93107425062a5e6e6ead484c..a5149973feaff2568c2fbb92c4875b35be12c3fc 100644 |
--- a/ui/app_list/views/app_list_main_view_unittest.cc |
+++ b/ui/app_list/views/app_list_main_view_unittest.cc |
@@ -286,6 +286,39 @@ TEST_F(AppListMainViewTest, DragLastItemFromFolderAndDropAtLastSlot) { |
delegate_->GetTestModel()->FindFolderItem("single_item_folder")); |
} |
+// Tests dragging an item out of a single item folder and dropping it onto the |
+// page switcher. Regression test for http://crbug.com/415530/. |
+TEST_F(AppListMainViewTest, DragReparentItemOntoPageSwitcher) { |
+ AppListItemView* folder_item_view = CreateAndOpenSingleItemFolder(); |
+ const gfx::Rect first_slot_tile = folder_item_view->bounds(); |
+ |
+ const int kInitialApps = 20; |
tapted
2014/09/22 06:47:02
nit: I'd just drop this var and put 20 on the next
calamity
2014/09/23 01:06:22
Done.
|
+ delegate_->GetTestModel()->PopulateApps(kInitialApps); |
+ |
+ EXPECT_EQ(1, FolderViewModel()->view_size()); |
+ EXPECT_EQ(21, RootViewModel()->view_size()); |
+ |
+ AppListItemView* dragged = StartDragForReparent(0); |
+ |
+ gfx::Rect main_view_bounds = main_view_->bounds(); |
+ // Drag the reparent item to the page switcher. |
+ gfx::Point point = |
+ gfx::Point(main_view_bounds.width() / 2, |
+ main_view_bounds.bottom() - first_slot_tile.height()); |
+ SimulateUpdateDrag(FolderGridView(), AppsGridView::MOUSE, dragged, point); |
tapted
2014/09/22 06:47:02
Why two? (comment?). But I'm pretty sure you can d
calamity
2014/09/23 01:06:22
Indeed.
|
+ SimulateUpdateDrag(FolderGridView(), AppsGridView::MOUSE, dragged, point); |
+ base::RunLoop().RunUntilIdle(); |
tapted
2014/09/22 06:47:02
yeah - as discussed - probably don't need these.
calamity
2014/09/23 01:06:22
Done.
|
+ |
+ // Drop it. |
+ FolderGridView()->EndDrag(false); |
+ base::RunLoop().RunUntilIdle(); |
+ |
+ // The folder should be destroyed. |
+ EXPECT_EQ(21, RootViewModel()->view_size()); |
+ EXPECT_EQ(NULL, |
+ delegate_->GetTestModel()->FindFolderItem("single_item_folder")); |
+} |
+ |
// Test that an interrupted drag while reparenting an item from a folder, when |
// canceled via the root grid, correctly forwards the cancelation to the drag |
// ocurring from the folder. |