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

Side by Side Diff: ash/laser/laser_pointer_controller_unittest.cc

Issue 2815043002: Removes ShellPort::IsRunningInMash() (Closed)
Patch Set: dont set instance_ in constructor Created 3 years, 8 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 "ash/laser/laser_pointer_controller.h" 5 #include "ash/laser/laser_pointer_controller.h"
6 6
7 #include "ash/laser/laser_pointer_controller_test_api.h" 7 #include "ash/laser/laser_pointer_controller_test_api.h"
8 #include "ash/laser/laser_pointer_view.h" 8 #include "ash/laser/laser_pointer_view.h"
9 #include "ash/public/cpp/config.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/shell_port.h"
11 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
12 #include "ui/events/test/event_generator.h" 12 #include "ui/events/test/event_generator.h"
13 13
14 namespace ash { 14 namespace ash {
15 namespace { 15 namespace {
16 16
17 class LaserPointerControllerTest : public test::AshTestBase { 17 class LaserPointerControllerTest : public test::AshTestBase {
18 public: 18 public:
19 LaserPointerControllerTest() {} 19 LaserPointerControllerTest() {}
20 ~LaserPointerControllerTest() override {} 20 ~LaserPointerControllerTest() override {}
(...skipping 16 matching lines...) Expand all
37 private: 37 private:
38 DISALLOW_COPY_AND_ASSIGN(LaserPointerControllerTest); 38 DISALLOW_COPY_AND_ASSIGN(LaserPointerControllerTest);
39 }; 39 };
40 40
41 } // namespace 41 } // namespace
42 42
43 // Test to ensure the class responsible for drawing the laser pointer receives 43 // Test to ensure the class responsible for drawing the laser pointer receives
44 // points from stylus movements as expected. 44 // points from stylus movements as expected.
45 TEST_F(LaserPointerControllerTest, LaserPointerRenderer) { 45 TEST_F(LaserPointerControllerTest, LaserPointerRenderer) {
46 // Crashes in mash mode: crbug.com/702657 46 // Crashes in mash mode: crbug.com/702657
47 if (ShellPort::Get()->IsRunningInMash()) 47 if (Shell::GetAshConfig() == Config::MASH)
48 return; 48 return;
49 LaserPointerControllerTestApi controller_test_api_(controller_.get()); 49 LaserPointerControllerTestApi controller_test_api_(controller_.get());
50 50
51 // The laser pointer mode only works with stylus. 51 // The laser pointer mode only works with stylus.
52 GetEventGenerator().EnterPenPointerMode(); 52 GetEventGenerator().EnterPenPointerMode();
53 53
54 // When disabled the laser pointer should not be showing. 54 // When disabled the laser pointer should not be showing.
55 GetEventGenerator().MoveTouch(gfx::Point(1, 1)); 55 GetEventGenerator().MoveTouch(gfx::Point(1, 1));
56 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 56 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer());
57 57
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 GetEventGenerator().MoveTouch(gfx::Point(10, 10)); 114 GetEventGenerator().MoveTouch(gfx::Point(10, 10));
115 GetEventGenerator().MoveTouch(gfx::Point(11, 11)); 115 GetEventGenerator().MoveTouch(gfx::Point(11, 11));
116 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 116 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer());
117 GetEventGenerator().ReleaseTouch(); 117 GetEventGenerator().ReleaseTouch();
118 } 118 }
119 119
120 // Test to ensure the class responsible for drawing the laser pointer handles 120 // Test to ensure the class responsible for drawing the laser pointer handles
121 // prediction as expected when it receives points from stylus movements. 121 // prediction as expected when it receives points from stylus movements.
122 TEST_F(LaserPointerControllerTest, LaserPointerPrediction) { 122 TEST_F(LaserPointerControllerTest, LaserPointerPrediction) {
123 // Crashes in mash mode: crbug.com/702657 123 // Crashes in mash mode: crbug.com/702657
124 if (ShellPort::Get()->IsRunningInMash()) 124 if (Shell::GetAshConfig() == Config::MASH)
125 return; 125 return;
126 LaserPointerControllerTestApi controller_test_api_(controller_.get()); 126 LaserPointerControllerTestApi controller_test_api_(controller_.get());
127 127
128 controller_test_api_.SetEnabled(true); 128 controller_test_api_.SetEnabled(true);
129 // The laser pointer mode only works with stylus. 129 // The laser pointer mode only works with stylus.
130 GetEventGenerator().EnterPenPointerMode(); 130 GetEventGenerator().EnterPenPointerMode();
131 GetEventGenerator().PressTouch(); 131 GetEventGenerator().PressTouch();
132 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer()); 132 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer());
133 133
134 EXPECT_EQ(1, controller_test_api_.laser_points().GetNumberOfPoints()); 134 EXPECT_EQ(1, controller_test_api_.laser_points().GetNumberOfPoints());
(...skipping 17 matching lines...) Expand all
152 152
153 // Verify releasing the stylus removes predicted points. 153 // Verify releasing the stylus removes predicted points.
154 GetEventGenerator().ReleaseTouch(); 154 GetEventGenerator().ReleaseTouch();
155 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer()); 155 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer());
156 EXPECT_TRUE(controller_test_api_.IsFadingAway()); 156 EXPECT_TRUE(controller_test_api_.IsFadingAway());
157 EXPECT_EQ(0, 157 EXPECT_EQ(0,
158 controller_test_api_.predicted_laser_points().GetNumberOfPoints()); 158 controller_test_api_.predicted_laser_points().GetNumberOfPoints());
159 } 159 }
160 160
161 } // namespace ash 161 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_configuration_controller_unittest.cc ('k') | ash/metrics/desktop_task_switch_metric_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698