| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 void Dispatch(Event* event); | 365 void Dispatch(Event* event); |
| 366 | 366 |
| 367 void set_current_target(EventTarget* target) { | 367 void set_current_target(EventTarget* target) { |
| 368 current_target_ = target; | 368 current_target_ = target; |
| 369 } | 369 } |
| 370 | 370 |
| 371 // Specify an alternative tick clock to be used for simulating time in tests. | 371 // Specify an alternative tick clock to be used for simulating time in tests. |
| 372 void SetTickClock(std::unique_ptr<base::TickClock> tick_clock); | 372 void SetTickClock(std::unique_ptr<base::TickClock> tick_clock); |
| 373 | 373 |
| 374 // Get the current time from the tick clock. | 374 // Get the current time from the tick clock. |
| 375 base::TimeDelta Now(); | 375 base::TimeTicks Now(); |
| 376 | 376 |
| 377 // Default delegate set by a platform-specific GeneratorDelegate singleton. | 377 // Default delegate set by a platform-specific GeneratorDelegate singleton. |
| 378 static EventGeneratorDelegate* default_delegate; | 378 static EventGeneratorDelegate* default_delegate; |
| 379 | 379 |
| 380 private: | 380 private: |
| 381 // Set up the test context using the delegate. | 381 // Set up the test context using the delegate. |
| 382 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context); | 382 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context); |
| 383 | 383 |
| 384 // Dispatch a key event to the WindowEventDispatcher. | 384 // Dispatch a key event to the WindowEventDispatcher. |
| 385 void DispatchKeyEvent(bool is_press, KeyboardCode key_code, int flags); | 385 void DispatchKeyEvent(bool is_press, KeyboardCode key_code, int flags); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 408 bool targeting_application_; | 408 bool targeting_application_; |
| 409 std::unique_ptr<base::TickClock> tick_clock_; | 409 std::unique_ptr<base::TickClock> tick_clock_; |
| 410 | 410 |
| 411 DISALLOW_COPY_AND_ASSIGN(EventGenerator); | 411 DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 } // namespace test | 414 } // namespace test |
| 415 } // namespace ui | 415 } // namespace ui |
| 416 | 416 |
| 417 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ | 417 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ |
| OLD | NEW |