Chromium Code Reviews| Index: content/browser/renderer_host/media/audio_renderer_host_unittest.cc |
| diff --git a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc |
| index 1fe9f76f8b2b4025693e9e5980bc7d92c5b7878c..0fa66231074d3a05016283c3ed4b2388314a0838 100644 |
| --- a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc |
| +++ b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc |
| @@ -101,13 +101,13 @@ class MockAudioRendererHost : public AudioRendererHost { |
| media::OutputDeviceStatus device_status, |
| const media::AudioParameters& output_params, |
| const std::string& matched_device_id)); |
| - MOCK_METHOD2(OnStreamCreated, void(int stream_id, int length)); |
| - MOCK_METHOD1(OnStreamError, void(int stream_id)); |
| + MOCK_METHOD2(WasNotifiedOfCreation, void(int stream_id, int length)); |
| + MOCK_METHOD1(WasNotifiedOfStreamCreation, void(int stream_id)); |
|
o1ka
2016/10/27 09:52:39
This pair of names looks strange: what's the diffe
Max Morin
2016/10/27 15:04:38
I messed them up, the second one is supposed to be
|
| private: |
| virtual ~MockAudioRendererHost() { |
| // Make sure all audio streams have been deleted. |
| - EXPECT_TRUE(audio_entries_.empty()); |
| + EXPECT_TRUE(delegates_.empty()); |
| } |
| // This method is used to dispatch IPC messages to the renderer. We intercept |
| @@ -162,10 +162,12 @@ class MockAudioRendererHost : public AudioRendererHost { |
| sync_socket_.reset(new base::SyncSocket(sync_socket_handle)); |
| // And then delegate the call to the mock method. |
| - OnStreamCreated(stream_id, length); |
| + WasNotifiedOfCreation(stream_id, length); |
| } |
| - void OnNotifyStreamError(int stream_id) { OnStreamError(stream_id); } |
| + void OnNotifyStreamError(int stream_id) { |
| + WasNotifiedOfStreamCreation(stream_id); |
|
o1ka
2016/10/27 09:52:39
Do not quite get it: why notified of stream creati
Max Morin
2016/10/27 15:04:38
Typo :)
|
| + } |
| std::unique_ptr<base::SharedMemory> shared_memory_; |
| std::unique_ptr<base::SyncSocket> sync_socket_; |
| @@ -225,7 +227,7 @@ class AudioRendererHostTest : public testing::Test { |
| OnDeviceAuthorized(kStreamId, expected_device_status, _, _)); |
| if (expected_device_status == media::OUTPUT_DEVICE_STATUS_OK) { |
| - EXPECT_CALL(*host_.get(), OnStreamCreated(kStreamId, _)); |
| + EXPECT_CALL(*host_.get(), WasNotifiedOfCreation(kStreamId, _)); |
| EXPECT_CALL(mirroring_manager_, |
| AddDiverter(kRenderProcessId, kRenderFrameId, NotNull())) |
| .RetiresOnSaturation(); |
| @@ -275,11 +277,11 @@ class AudioRendererHostTest : public testing::Test { |
| void CreateWithInvalidRenderFrameId() { |
| // When creating a stream with an invalid render frame ID, the host will |
| // reply with a stream error message. |
| - EXPECT_CALL(*host_, OnStreamError(kStreamId)); |
| + EXPECT_CALL(*host_, WasNotifiedOfStreamCreation(kStreamId)); |
| // However, validation does not block stream creation, so these method calls |
| // might be made: |
| - EXPECT_CALL(*host_, OnStreamCreated(kStreamId, _)).Times(AtLeast(0)); |
| + EXPECT_CALL(*host_, WasNotifiedOfCreation(kStreamId, _)).Times(AtLeast(0)); |
| EXPECT_CALL(mirroring_manager_, AddDiverter(_, _, _)).Times(AtLeast(0)); |
| EXPECT_CALL(mirroring_manager_, RemoveDiverter(_)).Times(AtLeast(0)); |
| @@ -317,18 +319,18 @@ class AudioRendererHostTest : public testing::Test { |
| } |
| void SimulateError() { |
| - EXPECT_EQ(1u, host_->audio_entries_.size()) |
| + EXPECT_EQ(1u, host_->delegates_.size()) |
| << "Calls Create() before calling this method"; |
| // Expect an error signal sent through IPC. |
| - EXPECT_CALL(*host_.get(), OnStreamError(kStreamId)); |
| + EXPECT_CALL(*host_.get(), WasNotifiedOfStreamCreation(kStreamId)); |
| // Simulate an error sent from the audio device. |
| - host_->ReportErrorAndClose(kStreamId); |
| + host_->OnStreamError(kStreamId); |
| SyncWithAudioThread(); |
| // Expect the audio stream record is removed. |
| - EXPECT_EQ(0u, host_->audio_entries_.size()); |
| + EXPECT_EQ(0u, host_->delegates_.size()); |
| } |
| // SyncWithAudioThread() waits until all pending tasks on the audio thread |