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

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

Issue 466693002: Fix app list DCHECKs getting hit when model updates occur during dragging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test comment Created 6 years, 4 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 | « ui/app_list/views/apps_grid_view_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/apps_grid_view_unittest.cc
diff --git a/ui/app_list/views/apps_grid_view_unittest.cc b/ui/app_list/views/apps_grid_view_unittest.cc
index a2ea2a0c139088cad2ed08e0380443273fdf56fa..edf5a6a513f4d2c7c9d4cca2ade7bfb188e20954 100644
--- a/ui/app_list/views/apps_grid_view_unittest.cc
+++ b/ui/app_list/views/apps_grid_view_unittest.cc
@@ -307,8 +307,17 @@ TEST_F(AppsGridViewTest, MouseDragWithFolderDisabled) {
// Adding a launcher item cancels the drag and respects the order.
SimulateDrag(AppsGridView::MOUSE, from, to);
+ EXPECT_TRUE(apps_grid_view_->has_dragged_view());
model_->CreateAndAddItem("Extra");
- apps_grid_view_->EndDrag(false);
+ // No need to EndDrag explicitly - adding an item should do this.
+ EXPECT_FALSE(apps_grid_view_->has_dragged_view());
+ // Even though cancelled, mouse move events can still arrive via the item
+ // view. Ensure that behaves sanely, and doesn't start a new drag.
+ ui::MouseEvent drag_event(
+ ui::ET_MOUSE_DRAGGED, gfx::Point(1, 1), gfx::Point(2, 2), 0, 0);
+ apps_grid_view_->UpdateDragFromItem(AppsGridView::MOUSE, drag_event);
+ EXPECT_FALSE(apps_grid_view_->has_dragged_view());
+
EXPECT_EQ(std::string("Item 1,Item 2,Item 3,Extra"),
model_->GetModelContent());
test_api_->LayoutToIdealBounds();
« no previous file with comments | « ui/app_list/views/apps_grid_view_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698