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

Side by Side Diff: components/exo/pointer_unittest.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/shell.h" 5 #include "ash/shell.h"
6 #include "components/exo/buffer.h" 6 #include "components/exo/buffer.h"
7 #include "components/exo/pointer.h" 7 #include "components/exo/pointer.h"
8 #include "components/exo/pointer_delegate.h" 8 #include "components/exo/pointer_delegate.h"
9 #include "components/exo/shell_surface.h" 9 #include "components/exo/shell_surface.h"
10 #include "components/exo/surface.h" 10 #include "components/exo/surface.h"
(...skipping 10 matching lines...) Expand all
21 21
22 class MockPointerDelegate : public PointerDelegate { 22 class MockPointerDelegate : public PointerDelegate {
23 public: 23 public:
24 MockPointerDelegate() {} 24 MockPointerDelegate() {}
25 25
26 // Overridden from PointerDelegate: 26 // Overridden from PointerDelegate:
27 MOCK_METHOD1(OnPointerDestroying, void(Pointer*)); 27 MOCK_METHOD1(OnPointerDestroying, void(Pointer*));
28 MOCK_CONST_METHOD1(CanAcceptPointerEventsForSurface, bool(Surface*)); 28 MOCK_CONST_METHOD1(CanAcceptPointerEventsForSurface, bool(Surface*));
29 MOCK_METHOD3(OnPointerEnter, void(Surface*, const gfx::PointF&, int)); 29 MOCK_METHOD3(OnPointerEnter, void(Surface*, const gfx::PointF&, int));
30 MOCK_METHOD1(OnPointerLeave, void(Surface*)); 30 MOCK_METHOD1(OnPointerLeave, void(Surface*));
31 MOCK_METHOD2(OnPointerMotion, void(base::TimeDelta, const gfx::PointF&)); 31 MOCK_METHOD2(OnPointerMotion, void(base::TimeTicks, const gfx::PointF&));
32 MOCK_METHOD3(OnPointerButton, void(base::TimeDelta, int, bool)); 32 MOCK_METHOD3(OnPointerButton, void(base::TimeTicks, int, bool));
33 MOCK_METHOD3(OnPointerScroll, 33 MOCK_METHOD3(OnPointerScroll,
34 void(base::TimeDelta, const gfx::Vector2dF&, bool)); 34 void(base::TimeTicks, const gfx::Vector2dF&, bool));
35 MOCK_METHOD1(OnPointerScrollCancel, void(base::TimeDelta)); 35 MOCK_METHOD1(OnPointerScrollCancel, void(base::TimeTicks));
36 MOCK_METHOD1(OnPointerScrollStop, void(base::TimeDelta)); 36 MOCK_METHOD1(OnPointerScrollStop, void(base::TimeTicks));
37 MOCK_METHOD0(OnPointerFrame, void()); 37 MOCK_METHOD0(OnPointerFrame, void());
38 }; 38 };
39 39
40 TEST_F(PointerTest, SetCursor) { 40 TEST_F(PointerTest, SetCursor) {
41 std::unique_ptr<Surface> surface(new Surface); 41 std::unique_ptr<Surface> surface(new Surface);
42 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 42 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
43 gfx::Size buffer_size(10, 10); 43 gfx::Size buffer_size(10, 10);
44 std::unique_ptr<Buffer> buffer( 44 std::unique_ptr<Buffer> buffer(
45 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 45 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
46 surface->Attach(buffer.get()); 46 surface->Attach(buffer.get());
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 { 247 {
248 // Expect fling stop followed by scroll and scroll stop. 248 // Expect fling stop followed by scroll and scroll stop.
249 testing::InSequence sequence; 249 testing::InSequence sequence;
250 250
251 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_)); 251 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_));
252 EXPECT_CALL(delegate, 252 EXPECT_CALL(delegate,
253 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); 253 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false));
254 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); 254 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_));
255 } 255 }
256 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); 256 generator.ScrollSequence(location, base::TimeTicks(), 1, 1, 1, 1);
257 257
258 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); 258 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get()));
259 pointer.reset(); 259 pointer.reset();
260 } 260 }
261 261
262 TEST_F(PointerTest, OnPointerScrollDiscrete) { 262 TEST_F(PointerTest, OnPointerScrollDiscrete) {
263 std::unique_ptr<Surface> surface(new Surface); 263 std::unique_ptr<Surface> surface(new Surface);
264 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 264 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
265 gfx::Size buffer_size(10, 10); 265 gfx::Size buffer_size(10, 10);
266 std::unique_ptr<Buffer> buffer( 266 std::unique_ptr<Buffer> buffer(
(...skipping 15 matching lines...) Expand all
282 EXPECT_CALL(delegate, 282 EXPECT_CALL(delegate,
283 OnPointerScroll(testing::_, gfx::Vector2dF(1, 1), true)); 283 OnPointerScroll(testing::_, gfx::Vector2dF(1, 1), true));
284 generator.MoveMouseWheel(1, 1); 284 generator.MoveMouseWheel(1, 1);
285 285
286 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); 286 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get()));
287 pointer.reset(); 287 pointer.reset();
288 } 288 }
289 289
290 } // namespace 290 } // namespace
291 } // namespace exo 291 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698