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

Side by Side Diff: ui/events/gesture_detection/filtered_gesture_provider_unittest.cc

Issue 2849603003: Use ScopedTaskEnvironment instead of MessageLoopForUI in ui tests. (Closed)
Patch Set: CR-add-newline-after-include Created 3 years, 7 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 "base/message_loop/message_loop.h" 5 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
sadrul 2017/04/28 15:36:03 newline after
6 #include "base/test/scoped_task_environment.h"
6 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
8 #include "ui/events/test/motion_event_test_utils.h" 8 #include "ui/events/test/motion_event_test_utils.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 class FilteredGestureProviderTest : public GestureProviderClient, 12 class FilteredGestureProviderTest : public GestureProviderClient,
13 public testing::Test { 13 public testing::Test {
14 public: 14 public:
15 FilteredGestureProviderTest() {} 15 FilteredGestureProviderTest()
16 : scoped_task_environment_(
17 base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
16 ~FilteredGestureProviderTest() override {} 18 ~FilteredGestureProviderTest() override {}
17 19
18 // GestureProviderClient implementation. 20 // GestureProviderClient implementation.
19 void OnGestureEvent(const GestureEventData&) override {} 21 void OnGestureEvent(const GestureEventData&) override {}
20 22
21 private: 23 private:
22 base::MessageLoopForUI message_loop_; 24 base::test::ScopedTaskEnvironment scoped_task_environment_;
23 }; 25 };
24 26
25 // Single touch drag test: After touch-start, the moved_beyond_slop_region bit 27 // Single touch drag test: After touch-start, the moved_beyond_slop_region bit
26 // should stay unset as long as the touch movement is confined to the slop 28 // should stay unset as long as the touch movement is confined to the slop
27 // region. Once the touch moves beyond the slop region, the bit should remain 29 // region. Once the touch moves beyond the slop region, the bit should remain
28 // set until (incl) touch-end. 30 // set until (incl) touch-end.
29 TEST_F(FilteredGestureProviderTest, TouchMovedBeyondSlopRegion_SingleTouch) { 31 TEST_F(FilteredGestureProviderTest, TouchMovedBeyondSlopRegion_SingleTouch) {
30 GestureProvider::Config config; 32 GestureProvider::Config config;
31 FilteredGestureProvider provider(config, this); 33 FilteredGestureProvider provider(config, this);
32 34
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 147
146 for(int i = 0; i < 3; i++) { 148 for(int i = 0; i < 3; i++) {
147 event.ReleasePoint(); 149 event.ReleasePoint();
148 result = provider.OnTouchEvent(event); 150 result = provider.OnTouchEvent(event);
149 EXPECT_TRUE(result.succeeded); 151 EXPECT_TRUE(result.succeeded);
150 EXPECT_TRUE(result.moved_beyond_slop_region); 152 EXPECT_TRUE(result.moved_beyond_slop_region);
151 } 153 }
152 } 154 }
153 155
154 } // namespace ui 156 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_x11_unittest.cc ('k') | ui/events/gesture_detection/gesture_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698