| 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 #include "content/browser/media/audio_stream_monitor.h" | 5 #include "content/browser/media/audio_stream_monitor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class MockWebContentsDelegate : public WebContentsDelegate { | 35 class MockWebContentsDelegate : public WebContentsDelegate { |
| 36 public: | 36 public: |
| 37 MOCK_METHOD2(NavigationStateChanged, | 37 MOCK_METHOD2(NavigationStateChanged, |
| 38 void(WebContents* source, InvalidateTypes changed_flags)); | 38 void(WebContents* source, InvalidateTypes changed_flags)); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 class AudioStreamMonitorTest : public RenderViewHostTestHarness { | 43 class AudioStreamMonitorTest : public RenderViewHostTestHarness { |
| 44 public: | 44 public: |
| 45 AudioStreamMonitorTest() { | 45 AudioStreamMonitorTest() |
| 46 // Start |clock_| at non-zero. | 46 : // Start |clock_| at non-zero. |
| 47 clock_.Advance(base::TimeDelta::FromSeconds(1000000)); | 47 clock_(base::TimeTicks() + base::TimeDelta::FromSeconds(1000000)) {} |
| 48 } | |
| 49 | 48 |
| 50 void SetUp() override { | 49 void SetUp() override { |
| 51 RenderViewHostTestHarness::SetUp(); | 50 RenderViewHostTestHarness::SetUp(); |
| 52 | 51 |
| 53 WebContentsImpl* web_contents = reinterpret_cast<WebContentsImpl*>( | 52 WebContentsImpl* web_contents = reinterpret_cast<WebContentsImpl*>( |
| 54 RenderViewHostTestHarness::web_contents()); | 53 RenderViewHostTestHarness::web_contents()); |
| 55 web_contents->SetDelegate(&mock_web_contents_delegate_); | 54 web_contents->SetDelegate(&mock_web_contents_delegate_); |
| 56 | 55 |
| 57 monitor_ = web_contents->audio_stream_monitor(); | 56 monitor_ = web_contents->audio_stream_monitor(); |
| 58 const_cast<base::TickClock*&>(monitor_->clock_) = &clock_; | 57 const_cast<base::TickClock*&>(monitor_->clock_) = &clock_; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 StartMonitoring( | 289 StartMonitoring( |
| 291 kAnotherRenderProcessId, kStreamId, CreatePollCallback(kStreamId)); | 290 kAnotherRenderProcessId, kStreamId, CreatePollCallback(kStreamId)); |
| 292 ExpectIsPolling(kRenderProcessId, kStreamId, true); | 291 ExpectIsPolling(kRenderProcessId, kStreamId, true); |
| 293 ExpectIsPolling(kAnotherRenderProcessId, kStreamId, true); | 292 ExpectIsPolling(kAnotherRenderProcessId, kStreamId, true); |
| 294 StopMonitoring(kAnotherRenderProcessId, kStreamId); | 293 StopMonitoring(kAnotherRenderProcessId, kStreamId); |
| 295 ExpectIsPolling(kRenderProcessId, kStreamId, true); | 294 ExpectIsPolling(kRenderProcessId, kStreamId, true); |
| 296 ExpectIsPolling(kAnotherRenderProcessId, kStreamId, false); | 295 ExpectIsPolling(kAnotherRenderProcessId, kStreamId, false); |
| 297 } | 296 } |
| 298 | 297 |
| 299 } // namespace content | 298 } // namespace content |
| OLD | NEW |