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

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

Issue 2362063002: cros: Laser pointer fades out on release, do not cover palette. (Closed)
Patch Set: Created 4 years, 3 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 #include "ash/laser/laser_pointer_controller_test_api.h" 6 #include "ash/laser/laser_pointer_controller_test_api.h"
7 #include "ash/laser/laser_pointer_points_test_api.h" 7 #include "ash/laser/laser_pointer_points_test_api.h"
8 #include "ash/laser/laser_pointer_view.h" 8 #include "ash/laser/laser_pointer_view.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 controller_test_api_.SetEnabled(true); 152 controller_test_api_.SetEnabled(true);
153 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 153 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer());
154 154
155 // Verify moving the stylus 4 times will not display the laser pointer. 155 // Verify moving the stylus 4 times will not display the laser pointer.
156 GetEventGenerator().MoveMouseToInHost(gfx::Point(2, 2)); 156 GetEventGenerator().MoveMouseToInHost(gfx::Point(2, 2));
157 GetEventGenerator().MoveMouseToInHost(gfx::Point(3, 3)); 157 GetEventGenerator().MoveMouseToInHost(gfx::Point(3, 3));
158 GetEventGenerator().MoveMouseToInHost(gfx::Point(4, 4)); 158 GetEventGenerator().MoveMouseToInHost(gfx::Point(4, 4));
159 GetEventGenerator().MoveMouseToInHost(gfx::Point(5, 5)); 159 GetEventGenerator().MoveMouseToInHost(gfx::Point(5, 5));
160 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 160 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer());
161 161
162 // Verify pressing the stylus will show the laser pointer and add a point. 162 // Verify pressing the stylus will show the laser pointer and add a point but
163 // will not activate fading out.
163 GetEventGenerator().PressLeftButton(); 164 GetEventGenerator().PressLeftButton();
164 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer()); 165 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer());
166 EXPECT_FALSE(controller_test_api_.IsFadingOut());
165 EXPECT_EQ(1, controller_test_api_.laser_points().GetNumberOfPoints()); 167 EXPECT_EQ(1, controller_test_api_.laser_points().GetNumberOfPoints());
166 168
167 // Verify dragging the stylus 2 times will add 2 more points. 169 // Verify dragging the stylus 2 times will add 2 more points.
168 GetEventGenerator().MoveMouseToInHost(gfx::Point(6, 6)); 170 GetEventGenerator().MoveMouseToInHost(gfx::Point(6, 6));
169 GetEventGenerator().MoveMouseToInHost(gfx::Point(7, 7)); 171 GetEventGenerator().MoveMouseToInHost(gfx::Point(7, 7));
170 EXPECT_EQ(3, controller_test_api_.laser_points().GetNumberOfPoints()); 172 EXPECT_EQ(3, controller_test_api_.laser_points().GetNumberOfPoints());
171 173
172 // Verify releasing the stylus hides the laser pointer. 174 // Verify releasing the stylus still shows the laser pointer, which is fading
175 // away.
173 GetEventGenerator().ReleaseLeftButton(); 176 GetEventGenerator().ReleaseLeftButton();
174 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 177 EXPECT_TRUE(controller_test_api_.IsShowingLaserPointer());
178 EXPECT_TRUE(controller_test_api_.IsFadingOut());
175 179
176 // Verify that disabling the mode does not display the laser pointer. 180 // Verify that disabling the mode does not display the laser pointer.
177 controller_test_api_.SetEnabled(false); 181 controller_test_api_.SetEnabled(false);
178 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 182 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer());
179 183
180 // Verify that disabling the mode while laser pointer is displayed does not 184 // Verify that disabling the mode while laser pointer is displayed does not
181 // display the laser pointer. 185 // display the laser pointer.
182 controller_test_api_.SetEnabled(true); 186 controller_test_api_.SetEnabled(true);
183 GetEventGenerator().PressLeftButton(); 187 GetEventGenerator().PressLeftButton();
184 GetEventGenerator().MoveMouseToInHost(gfx::Point(6, 6)); 188 GetEventGenerator().MoveMouseToInHost(gfx::Point(6, 6));
(...skipping 12 matching lines...) Expand all
197 // from the stylus, even when enabled. 201 // from the stylus, even when enabled.
198 GetEventGenerator().ExitPenPointerMode(); 202 GetEventGenerator().ExitPenPointerMode();
199 controller_test_api_.SetEnabled(true); 203 controller_test_api_.SetEnabled(true);
200 GetEventGenerator().PressLeftButton(); 204 GetEventGenerator().PressLeftButton();
201 GetEventGenerator().MoveMouseToInHost(gfx::Point(10, 10)); 205 GetEventGenerator().MoveMouseToInHost(gfx::Point(10, 10));
202 GetEventGenerator().MoveMouseToInHost(gfx::Point(11, 11)); 206 GetEventGenerator().MoveMouseToInHost(gfx::Point(11, 11));
203 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer()); 207 EXPECT_FALSE(controller_test_api_.IsShowingLaserPointer());
204 GetEventGenerator().ReleaseLeftButton(); 208 GetEventGenerator().ReleaseLeftButton();
205 } 209 }
206 } // namespace ash 210 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698