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

Side by Side Diff: ui/touch_selection/touch_selection_controller_unittest.cc

Issue 698253004: Reland: Implement Aura side of unified touch text selection for contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased after blink issue fixed: r200194 Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/events/test/motion_event_test_utils.h" 11 #include "ui/events/test/motion_event_test_utils.h"
12 #include "ui/touch_selection/touch_selection_controller_test_api.h"
12 13
13 using testing::ElementsAre; 14 using testing::ElementsAre;
14 using testing::IsEmpty; 15 using testing::IsEmpty;
15 using ui::test::MockMotionEvent; 16 using ui::test::MockMotionEvent;
16 17
17 namespace ui { 18 namespace ui {
18 namespace { 19 namespace {
19 20
20 const int kDefaultTapTimeoutMs = 200; 21 const int kDefaultTapTimeoutMs = 200;
21 const float kDefaulTapSlop = 10.f; 22 const float kDefaulTapSlop = 10.f;
(...skipping 14 matching lines...) Expand all
36 } 37 }
37 38
38 private: 39 private:
39 bool* intersects_rect_; 40 bool* intersects_rect_;
40 41
41 DISALLOW_COPY_AND_ASSIGN(MockTouchHandleDrawable); 42 DISALLOW_COPY_AND_ASSIGN(MockTouchHandleDrawable);
42 }; 43 };
43 44
44 } // namespace 45 } // namespace
45 46
46 class TouchSelectionControllerTestApi {
47 public:
48 explicit TouchSelectionControllerTestApi(TouchSelectionController* controller)
49 : controller_(controller) {}
50 ~TouchSelectionControllerTestApi() {}
51
52 bool GetStartVisible() const { return controller_->GetStartVisible(); }
53 bool GetEndVisible() const { return controller_->GetEndVisible(); }
54
55 private:
56 TouchSelectionController* controller_;
57
58 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerTestApi);
59 };
60
61 class TouchSelectionControllerTest : public testing::Test, 47 class TouchSelectionControllerTest : public testing::Test,
62 public TouchSelectionControllerClient { 48 public TouchSelectionControllerClient {
63 public: 49 public:
64 TouchSelectionControllerTest() 50 TouchSelectionControllerTest()
65 : caret_moved_(false), 51 : caret_moved_(false),
66 selection_moved_(false), 52 selection_moved_(false),
67 selection_points_swapped_(false), 53 selection_points_swapped_(false),
68 needs_animate_(false), 54 needs_animate_(false),
69 animation_enabled_(true), 55 animation_enabled_(true),
70 dragging_enabled_(false) {} 56 dragging_enabled_(false) {}
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 EXPECT_EQ(gfx::RectF(6, 5, 44, 10), controller().GetRectBetweenBounds()); 1276 EXPECT_EQ(gfx::RectF(6, 5, 44, 10), controller().GetRectBetweenBounds());
1291 EXPECT_EQ(GetLastEventBoundsRect(), controller().GetRectBetweenBounds()); 1277 EXPECT_EQ(GetLastEventBoundsRect(), controller().GetRectBetweenBounds());
1292 1278
1293 ClearSelection(); 1279 ClearSelection();
1294 ASSERT_THAT(GetAndResetEvents(), 1280 ASSERT_THAT(GetAndResetEvents(),
1295 ElementsAre(SELECTION_DISSOLVED, SELECTION_HANDLES_CLEARED)); 1281 ElementsAre(SELECTION_DISSOLVED, SELECTION_HANDLES_CLEARED));
1296 EXPECT_EQ(gfx::RectF(), controller().GetRectBetweenBounds()); 1282 EXPECT_EQ(gfx::RectF(), controller().GetRectBetweenBounds());
1297 } 1283 }
1298 1284
1299 } // namespace ui 1285 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller_test_api.cc ('k') | ui/touch_selection/ui_touch_selection.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698