OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |