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

Side by Side Diff: media/audio/win/audio_device_listener_win_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 20 matching lines...) Expand all
31 DCHECK(com_init_.succeeded()); 31 DCHECK(com_init_.succeeded());
32 } 32 }
33 33
34 virtual void SetUp() { 34 virtual void SetUp() {
35 if (!CoreAudioUtil::IsSupported()) 35 if (!CoreAudioUtil::IsSupported())
36 return; 36 return;
37 37
38 output_device_listener_.reset(new AudioDeviceListenerWin(base::Bind( 38 output_device_listener_.reset(new AudioDeviceListenerWin(base::Bind(
39 &AudioDeviceListenerWinTest::OnDeviceChange, base::Unretained(this)))); 39 &AudioDeviceListenerWinTest::OnDeviceChange, base::Unretained(this))));
40 40
41 tick_clock_ = new base::SimpleTestTickClock(); 41 tick_clock_ = new base::SimpleTestTickClock(
42 tick_clock_->Advance(base::TimeDelta::FromSeconds(12345)); 42 base::TimeTicks() + base::TimeDelta::FromSeconds(12345));
43 output_device_listener_->tick_clock_.reset(tick_clock_); 43 output_device_listener_->tick_clock_.reset(tick_clock_);
44 } 44 }
45 45
46 void AdvanceLastDeviceChangeTime() { 46 void AdvanceLastDeviceChangeTime() {
47 tick_clock_->Advance(base::TimeDelta::FromMilliseconds( 47 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(
48 AudioDeviceListenerWin::kDeviceChangeLimitMs + 1)); 48 AudioDeviceListenerWin::kDeviceChangeLimitMs + 1));
49 } 49 }
50 50
51 // Simulate a device change where no output devices are available. 51 // Simulate a device change where no output devices are available.
52 bool SimulateNullDefaultOutputDeviceChange() { 52 bool SimulateNullDefaultOutputDeviceChange() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_CALL(*this, OnDeviceChange()).Times(1); 101 EXPECT_CALL(*this, OnDeviceChange()).Times(1);
102 ASSERT_TRUE(SimulateDefaultOutputDeviceChange(kFirstTestDevice)); 102 ASSERT_TRUE(SimulateDefaultOutputDeviceChange(kFirstTestDevice));
103 103
104 testing::Mock::VerifyAndClear(this); 104 testing::Mock::VerifyAndClear(this);
105 AdvanceLastDeviceChangeTime(); 105 AdvanceLastDeviceChangeTime();
106 EXPECT_CALL(*this, OnDeviceChange()).Times(1); 106 EXPECT_CALL(*this, OnDeviceChange()).Times(1);
107 ASSERT_TRUE(SimulateNullDefaultOutputDeviceChange()); 107 ASSERT_TRUE(SimulateNullDefaultOutputDeviceChange());
108 } 108 }
109 109
110 } // namespace media 110 } // namespace media
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/connection_factory_impl_unittest.cc ('k') | media/base/null_video_sink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698