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

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: merge master Created 4 years, 6 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/common/shell_window_ids.h" 5 #include "ash/common/shell_window_ids.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "components/exo/buffer.h" 7 #include "components/exo/buffer.h"
8 #include "components/exo/pointer.h" 8 #include "components/exo/pointer.h"
9 #include "components/exo/pointer_delegate.h" 9 #include "components/exo/pointer_delegate.h"
10 #include "components/exo/shell_surface.h" 10 #include "components/exo/shell_surface.h"
(...skipping 11 matching lines...) Expand all
22 22
23 class MockPointerDelegate : public PointerDelegate { 23 class MockPointerDelegate : public PointerDelegate {
24 public: 24 public:
25 MockPointerDelegate() {} 25 MockPointerDelegate() {}
26 26
27 // Overridden from PointerDelegate: 27 // Overridden from PointerDelegate:
28 MOCK_METHOD1(OnPointerDestroying, void(Pointer*)); 28 MOCK_METHOD1(OnPointerDestroying, void(Pointer*));
29 MOCK_CONST_METHOD1(CanAcceptPointerEventsForSurface, bool(Surface*)); 29 MOCK_CONST_METHOD1(CanAcceptPointerEventsForSurface, bool(Surface*));
30 MOCK_METHOD3(OnPointerEnter, void(Surface*, const gfx::PointF&, int)); 30 MOCK_METHOD3(OnPointerEnter, void(Surface*, const gfx::PointF&, int));
31 MOCK_METHOD1(OnPointerLeave, void(Surface*)); 31 MOCK_METHOD1(OnPointerLeave, void(Surface*));
32 MOCK_METHOD2(OnPointerMotion, void(base::TimeDelta, const gfx::PointF&)); 32 MOCK_METHOD2(OnPointerMotion, void(base::TimeTicks, const gfx::PointF&));
33 MOCK_METHOD3(OnPointerButton, void(base::TimeDelta, int, bool)); 33 MOCK_METHOD3(OnPointerButton, void(base::TimeTicks, int, bool));
34 MOCK_METHOD3(OnPointerScroll, 34 MOCK_METHOD3(OnPointerScroll,
35 void(base::TimeDelta, const gfx::Vector2dF&, bool)); 35 void(base::TimeTicks, const gfx::Vector2dF&, bool));
36 MOCK_METHOD1(OnPointerScrollCancel, void(base::TimeDelta)); 36 MOCK_METHOD1(OnPointerScrollCancel, void(base::TimeTicks));
37 MOCK_METHOD1(OnPointerScrollStop, void(base::TimeDelta)); 37 MOCK_METHOD1(OnPointerScrollStop, void(base::TimeTicks));
38 MOCK_METHOD0(OnPointerFrame, void()); 38 MOCK_METHOD0(OnPointerFrame, void());
39 }; 39 };
40 40
41 TEST_F(PointerTest, SetCursor) { 41 TEST_F(PointerTest, SetCursor) {
42 std::unique_ptr<Surface> surface(new Surface); 42 std::unique_ptr<Surface> surface(new Surface);
43 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 43 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
44 gfx::Size buffer_size(10, 10); 44 gfx::Size buffer_size(10, 10);
45 std::unique_ptr<Buffer> buffer( 45 std::unique_ptr<Buffer> buffer(
46 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 46 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
47 surface->Attach(buffer.get()); 47 surface->Attach(buffer.get());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 { 249 {
250 // Expect fling stop followed by scroll and scroll stop. 250 // Expect fling stop followed by scroll and scroll stop.
251 testing::InSequence sequence; 251 testing::InSequence sequence;
252 252
253 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_)); 253 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_));
254 EXPECT_CALL(delegate, 254 EXPECT_CALL(delegate,
255 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); 255 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false));
256 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); 256 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_));
257 } 257 }
258 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); 258 generator.ScrollSequence(location, base::TimeTicks(), 1, 1, 1, 1);
259 259
260 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); 260 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get()));
261 pointer.reset(); 261 pointer.reset();
262 } 262 }
263 263
264 TEST_F(PointerTest, OnPointerScrollDiscrete) { 264 TEST_F(PointerTest, OnPointerScrollDiscrete) {
265 std::unique_ptr<Surface> surface(new Surface); 265 std::unique_ptr<Surface> surface(new Surface);
266 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 266 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
267 gfx::Size buffer_size(10, 10); 267 gfx::Size buffer_size(10, 10);
268 std::unique_ptr<Buffer> buffer( 268 std::unique_ptr<Buffer> buffer(
(...skipping 15 matching lines...) Expand all
284 EXPECT_CALL(delegate, 284 EXPECT_CALL(delegate,
285 OnPointerScroll(testing::_, gfx::Vector2dF(1, 1), true)); 285 OnPointerScroll(testing::_, gfx::Vector2dF(1, 1), true));
286 generator.MoveMouseWheel(1, 1); 286 generator.MoveMouseWheel(1, 1);
287 287
288 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); 288 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get()));
289 pointer.reset(); 289 pointer.reset();
290 } 290 }
291 291
292 } // namespace 292 } // namespace
293 } // namespace exo 293 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698