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

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..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.
« 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