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

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

Issue 670623002: Change base::TickClock to a ref counted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_redesign
Patch Set: y Created 6 years, 2 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 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 <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "ui/events/event_constants.h" 16 #include "ui/events/event_constants.h"
16 #include "ui/events/keycodes/keyboard_codes.h" 17 #include "ui/events/keycodes/keyboard_codes.h"
17 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/point.h" 19 #include "ui/gfx/point.h"
19 20
20 namespace base { 21 namespace base {
21 class TickClock; 22 class TickClock;
22 } 23 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 void ReleaseKey(KeyboardCode key_code, int flags); 332 void ReleaseKey(KeyboardCode key_code, int flags);
332 333
333 // Dispatch the event to the WindowEventDispatcher. 334 // Dispatch the event to the WindowEventDispatcher.
334 void Dispatch(Event* event); 335 void Dispatch(Event* event);
335 336
336 void set_current_target(EventTarget* target) { 337 void set_current_target(EventTarget* target) {
337 current_target_ = target; 338 current_target_ = target;
338 } 339 }
339 340
340 // Specify an alternative tick clock to be used for simulating time in tests. 341 // Specify an alternative tick clock to be used for simulating time in tests.
341 void SetTickClock(scoped_ptr<base::TickClock> tick_clock); 342 void SetTickClock(const scoped_refptr<base::TickClock>& tick_clock);
342 343
343 // Get the current time from the tick clock. 344 // Get the current time from the tick clock.
344 base::TimeDelta Now(); 345 base::TimeDelta Now();
345 346
346 // Default delegate set by a platform-specific GeneratorDelegate singleton. 347 // Default delegate set by a platform-specific GeneratorDelegate singleton.
347 static EventGeneratorDelegate* default_delegate; 348 static EventGeneratorDelegate* default_delegate;
348 349
349 private: 350 private:
350 // Set up the test context using the delegate. 351 // Set up the test context using the delegate.
351 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context); 352 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context);
(...skipping 15 matching lines...) Expand all
367 EventGeneratorDelegate* delegate(); 368 EventGeneratorDelegate* delegate();
368 369
369 scoped_ptr<EventGeneratorDelegate> delegate_; 370 scoped_ptr<EventGeneratorDelegate> delegate_;
370 gfx::Point current_location_; 371 gfx::Point current_location_;
371 EventTarget* current_target_; 372 EventTarget* current_target_;
372 int flags_; 373 int flags_;
373 bool grab_; 374 bool grab_;
374 std::list<Event*> pending_events_; 375 std::list<Event*> pending_events_;
375 // Set to true to cause events to be posted asynchronously. 376 // Set to true to cause events to be posted asynchronously.
376 bool async_; 377 bool async_;
377 scoped_ptr<base::TickClock> tick_clock_; 378 scoped_refptr<base::TickClock> tick_clock_;
378 379
379 DISALLOW_COPY_AND_ASSIGN(EventGenerator); 380 DISALLOW_COPY_AND_ASSIGN(EventGenerator);
380 }; 381 };
381 382
382 } // namespace test 383 } // namespace test
383 } // namespace ui 384 } // namespace ui
384 385
385 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ 386 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_
OLDNEW
« no previous file with comments | « ui/display/chromeos/x11/native_display_event_dispatcher_x11.cc ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698