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

Unified Diff: content/browser/media/audio_stream_monitor_unittest.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/media/audio_stream_monitor.cc ('k') | content/renderer/media/render_media_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/audio_stream_monitor_unittest.cc
diff --git a/content/browser/media/audio_stream_monitor_unittest.cc b/content/browser/media/audio_stream_monitor_unittest.cc
index 8b55d8c8a99caf49d3ab2715b12f97a88a722c3c..e0758f4ac2929708b4369417324f0d37b6fca8a3 100644
--- a/content/browser/media/audio_stream_monitor_unittest.cc
+++ b/content/browser/media/audio_stream_monitor_unittest.cc
@@ -41,9 +41,10 @@ class MockWebContentsDelegate : public WebContentsDelegate {
class AudioStreamMonitorTest : public RenderViewHostTestHarness {
public:
- AudioStreamMonitorTest() {
+ AudioStreamMonitorTest()
+ : monitor_(NULL), clock_(new base::SimpleTestTickClock()) {
// Start |clock_| at non-zero.
- clock_.Advance(base::TimeDelta::FromSeconds(1000000));
+ clock_->Advance(base::TimeDelta::FromSeconds(1000000));
}
virtual void SetUp() override {
@@ -53,12 +54,12 @@ class AudioStreamMonitorTest : public RenderViewHostTestHarness {
RenderViewHostTestHarness::web_contents());
web_contents->SetDelegate(&mock_web_contents_delegate_);
monitor_ = web_contents->audio_stream_monitor();
- const_cast<base::TickClock*&>(monitor_->clock_) = &clock_;
+ monitor_->set_clock_for_testing(clock_);
}
- base::TimeTicks GetTestClockTime() { return clock_.NowTicks(); }
+ base::TimeTicks GetTestClockTime() { return clock_->NowTicks(); }
- void AdvanceClock(const base::TimeDelta& delta) { clock_.Advance(delta); }
+ void AdvanceClock(const base::TimeDelta& delta) { clock_->Advance(delta); }
AudioStreamMonitor::ReadPowerAndClipCallback CreatePollCallback(
int stream_id) {
@@ -143,7 +144,7 @@ class AudioStreamMonitorTest : public RenderViewHostTestHarness {
}
MockWebContentsDelegate mock_web_contents_delegate_;
- base::SimpleTestTickClock clock_;
+ scoped_refptr<base::SimpleTestTickClock> clock_;
std::map<int, float> current_power_;
DISALLOW_COPY_AND_ASSIGN(AudioStreamMonitorTest);
« no previous file with comments | « content/browser/media/audio_stream_monitor.cc ('k') | content/renderer/media/render_media_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698