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

Side by Side Diff: ui/events/test/event_generator.h

Issue 2100453002: Remove unnecessary mocking of TickClock for events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@614409-confirm-timestamp-timebase
Patch Set: Fix touch_unittests Created 4 years, 5 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
« no previous file with comments | « ui/chromeos/touch_exploration_controller_unittest.cc ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef UI_EVENTS_TEST_EVENT_GENERATOR_H_ 5 #ifndef UI_EVENTS_TEST_EVENT_GENERATOR_H_
6 #define UI_EVENTS_TEST_EVENT_GENERATOR_H_ 6 #define UI_EVENTS_TEST_EVENT_GENERATOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // TODO(yusukes): Support native_event() on all platforms. 360 // TODO(yusukes): Support native_event() on all platforms.
361 void ReleaseKey(KeyboardCode key_code, int flags); 361 void ReleaseKey(KeyboardCode key_code, int flags);
362 362
363 // Dispatch the event to the WindowEventDispatcher. 363 // Dispatch the event to the WindowEventDispatcher.
364 void Dispatch(Event* event); 364 void Dispatch(Event* event);
365 365
366 void set_current_target(EventTarget* target) { 366 void set_current_target(EventTarget* target) {
367 current_target_ = target; 367 current_target_ = target;
368 } 368 }
369 369
370 // Specify an alternative tick clock to be used for simulating time in tests.
371 void SetTickClock(std::unique_ptr<base::TickClock> tick_clock);
372
373 // Get the current time from the tick clock.
374 base::TimeTicks Now();
375
376 // Default delegate set by a platform-specific GeneratorDelegate singleton. 370 // Default delegate set by a platform-specific GeneratorDelegate singleton.
377 static EventGeneratorDelegate* default_delegate; 371 static EventGeneratorDelegate* default_delegate;
378 372
379 private: 373 private:
380 // Set up the test context using the delegate. 374 // Set up the test context using the delegate.
381 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context); 375 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context);
382 376
383 // Dispatch a key event to the WindowEventDispatcher. 377 // Dispatch a key event to the WindowEventDispatcher.
384 void DispatchKeyEvent(bool is_press, KeyboardCode key_code, int flags); 378 void DispatchKeyEvent(bool is_press, KeyboardCode key_code, int flags);
385 379
(...skipping 21 matching lines...) Expand all
407 bool targeting_application_; 401 bool targeting_application_;
408 std::unique_ptr<base::TickClock> tick_clock_; 402 std::unique_ptr<base::TickClock> tick_clock_;
409 403
410 DISALLOW_COPY_AND_ASSIGN(EventGenerator); 404 DISALLOW_COPY_AND_ASSIGN(EventGenerator);
411 }; 405 };
412 406
413 } // namespace test 407 } // namespace test
414 } // namespace ui 408 } // namespace ui
415 409
416 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ 410 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_
OLDNEW
« no previous file with comments | « ui/chromeos/touch_exploration_controller_unittest.cc ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698