| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 blink_audio_track_.reset(); | 93 blink_audio_track_.reset(); |
| 94 blink_audio_source_.reset(); | 94 blink_audio_source_.reset(); |
| 95 blink::WebHeap::collectAllGarbageForTesting(); | 95 blink::WebHeap::collectAllGarbageForTesting(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void CreateProcessedLocalAudioSource( | 98 void CreateProcessedLocalAudioSource( |
| 99 const blink::WebMediaConstraints& constraints) { | 99 const blink::WebMediaConstraints& constraints) { |
| 100 ProcessedLocalAudioSource* const source = new ProcessedLocalAudioSource( | 100 ProcessedLocalAudioSource* const source = new ProcessedLocalAudioSource( |
| 101 -1 /* consumer_render_frame_id is N/A for non-browser tests */, | 101 -1 /* consumer_render_frame_id is N/A for non-browser tests */, |
| 102 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock audio device", | 102 StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock audio device", |
| 103 "mock_audio_device_id", "mock_group_id", kSampleRate, | 103 "mock_audio_device_id", kSampleRate, kChannelLayout, |
| 104 kChannelLayout, kRequestedBufferSize), | 104 kRequestedBufferSize), |
| 105 &mock_dependency_factory_); | 105 &mock_dependency_factory_); |
| 106 source->SetAllowInvalidRenderFrameIdForTesting(true); | 106 source->SetAllowInvalidRenderFrameIdForTesting(true); |
| 107 source->SetSourceConstraints(constraints); | 107 source->SetSourceConstraints(constraints); |
| 108 blink_audio_source_.setExtraData(source); // Takes ownership. | 108 blink_audio_source_.setExtraData(source); // Takes ownership. |
| 109 } | 109 } |
| 110 | 110 |
| 111 void CheckSourceFormatMatches(const media::AudioParameters& params) { | 111 void CheckSourceFormatMatches(const media::AudioParameters& params) { |
| 112 EXPECT_EQ(kSampleRate, params.sample_rate()); | 112 EXPECT_EQ(kSampleRate, params.sample_rate()); |
| 113 EXPECT_EQ(kChannelLayout, params.channel_layout()); | 113 EXPECT_EQ(kChannelLayout, params.channel_layout()); |
| 114 EXPECT_EQ(kExpectedSourceBufferSize, params.frames_per_buffer()); | 114 EXPECT_EQ(kExpectedSourceBufferSize, params.frames_per_buffer()); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // Even though ConnectToTrack() failed, there should still have been a new | 222 // Even though ConnectToTrack() failed, there should still have been a new |
| 223 // MediaStreamAudioTrack instance created, owned by the | 223 // MediaStreamAudioTrack instance created, owned by the |
| 224 // blink::WebMediaStreamTrack. | 224 // blink::WebMediaStreamTrack. |
| 225 EXPECT_TRUE(MediaStreamAudioTrack::From(blink_audio_track())); | 225 EXPECT_TRUE(MediaStreamAudioTrack::From(blink_audio_track())); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // TODO(miu): There's a lot of logic in ProcessedLocalAudioSource around | 228 // TODO(miu): There's a lot of logic in ProcessedLocalAudioSource around |
| 229 // constraints processing and validation that should have unit testing. | 229 // constraints processing and validation that should have unit testing. |
| 230 | 230 |
| 231 } // namespace content | 231 } // namespace content |
| OLD | NEW |