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

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

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
« no previous file with comments | « ui/events/test/event_generator.h ('k') | no next file » | 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 #include "ui/events/test/event_generator.h" 5 #include "ui/events/test/event_generator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 476 }
477 477
478 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { 478 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) {
479 DispatchKeyEvent(false, key_code, flags); 479 DispatchKeyEvent(false, key_code, flags);
480 } 480 }
481 481
482 void EventGenerator::Dispatch(ui::Event* event) { 482 void EventGenerator::Dispatch(ui::Event* event) {
483 DoDispatchEvent(event, async_); 483 DoDispatchEvent(event, async_);
484 } 484 }
485 485
486 void EventGenerator::SetTickClock(scoped_ptr<base::TickClock> tick_clock) { 486 void EventGenerator::SetTickClock(
487 tick_clock_ = tick_clock.Pass(); 487 const scoped_refptr<base::TickClock>& tick_clock) {
488 tick_clock_ = tick_clock;
488 } 489 }
489 490
490 base::TimeDelta EventGenerator::Now() { 491 base::TimeDelta EventGenerator::Now() {
491 // This is the same as what EventTimeForNow() does, but here we do it 492 // This is the same as what EventTimeForNow() does, but here we do it
492 // with a tick clock that can be replaced with a simulated clock for tests. 493 // with a tick clock that can be replaced with a simulated clock for tests.
493 return base::TimeDelta::FromInternalValue( 494 return base::TimeDelta::FromInternalValue(
494 tick_clock_->NowTicks().ToInternalValue()); 495 tick_clock_->NowTicks().ToInternalValue());
495 } 496 }
496 497
497 void EventGenerator::Init(gfx::NativeWindow root_window, 498 void EventGenerator::Init(gfx::NativeWindow root_window,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 return default_delegate; 624 return default_delegate;
624 } 625 }
625 626
626 EventGeneratorDelegate* EventGenerator::delegate() { 627 EventGeneratorDelegate* EventGenerator::delegate() {
627 return const_cast<EventGeneratorDelegate*>( 628 return const_cast<EventGeneratorDelegate*>(
628 const_cast<const EventGenerator*>(this)->delegate()); 629 const_cast<const EventGenerator*>(this)->delegate());
629 } 630 }
630 631
631 } // namespace test 632 } // namespace test
632 } // namespace ui 633 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/test/event_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698