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

Side by Side Diff: ui/views/animation/ink_drop_host_view_unittest.cc

Issue 2096003002: Fix crash when InkDropHostView::SetHasInkDrop() is called multiple times (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/animation/ink_drop_host_view.h" 5 #include "ui/views/animation/ink_drop_host_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 host_view_.SetSize(gfx::Size(20, 20)); 50 host_view_.SetSize(gfx::Size(20, 20));
51 51
52 ui::MouseEvent located_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 6), 52 ui::MouseEvent located_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 6),
53 gfx::Point(5, 6), ui::EventTimeForNow(), 53 gfx::Point(5, 6), ui::EventTimeForNow(),
54 ui::EF_LEFT_MOUSE_BUTTON, 0); 54 ui::EF_LEFT_MOUSE_BUTTON, 0);
55 55
56 test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &located_event); 56 test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &located_event);
57 EXPECT_EQ(gfx::Point(5, 6), test_api_.GetInkDropCenterBasedOnLastEvent()); 57 EXPECT_EQ(gfx::Point(5, 6), test_api_.GetInkDropCenterBasedOnLastEvent());
58 } 58 }
59 59
60 // Verifies that SetHasInkDrop() sets up gesture handling properly.
61 TEST_F(InkDropHostViewTest, SetHasInkDropGestureHandler) {
62 EXPECT_FALSE(test_api_.HasGestureHandler());
63
64 test_api_.SetHasInkDrop(true);
65 EXPECT_TRUE(test_api_.HasGestureHandler());
66
67 test_api_.SetHasInkDrop(true);
68 EXPECT_TRUE(test_api_.HasGestureHandler());
69
70 test_api_.SetHasInkDrop(false);
71 EXPECT_FALSE(test_api_.HasGestureHandler());
72 }
73
60 } // namespace test 74 } // namespace test
61 } // namespace views 75 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_host_view.cc ('k') | ui/views/animation/test/ink_drop_host_view_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698