Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: ui/app_list/views/app_list_main_view_unittest.cc

Issue 583263004: Fix app list duplication on drag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@start_page_padding
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9de87fdc51eea3c376c779d14c11dede4f43397a 100644
--- a/ui/app_list/views/app_list_main_view_unittest.cc
+++ b/ui/app_list/views/app_list_main_view_unittest.cc
@@ -264,12 +264,9 @@ TEST_F(AppListMainViewTest, DragLastItemFromFolderAndDropAtLastSlot) {
drop_target_tile.Offset(first_slot_tile.width() * 2, 0);
gfx::Point point = drop_target_tile.CenterPoint();
SimulateUpdateDrag(FolderGridView(), AppsGridView::MOUSE, dragged, point);
- SimulateUpdateDrag(FolderGridView(), AppsGridView::MOUSE, dragged, point);
- base::RunLoop().RunUntilIdle();
// Drop it.
FolderGridView()->EndDrag(false);
- base::RunLoop().RunUntilIdle();
// Folder icon view should be gone and there is only one item view.
EXPECT_EQ(1, RootViewModel()->view_size());
@@ -286,6 +283,35 @@ 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();
+
+ delegate_->GetTestModel()->PopulateApps(20);
+
+ 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);
+
+ // Drop it.
+ FolderGridView()->EndDrag(false);
+
+ // 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.
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698