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

Side by Side Diff: content/renderer/media/webrtc_local_audio_track_unittest.cc

Issue 549153002: MediaStream tests need to call WebHeap::collectGarbage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « content/renderer/media/user_media_client_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 #include "base/test/test_timeouts.h" 6 #include "base/test/test_timeouts.h"
7 #include "content/renderer/media/media_stream_audio_source.h" 7 #include "content/renderer/media/media_stream_audio_source.h"
8 #include "content/renderer/media/mock_media_constraint_factory.h" 8 #include "content/renderer/media/mock_media_constraint_factory.h"
9 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 9 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
10 #include "content/renderer/media/webrtc_audio_capturer.h" 10 #include "content/renderer/media/webrtc_audio_capturer.h"
11 #include "content/renderer/media/webrtc_audio_device_impl.h" 11 #include "content/renderer/media/webrtc_audio_device_impl.h"
12 #include "content/renderer/media/webrtc_local_audio_track.h" 12 #include "content/renderer/media/webrtc_local_audio_track.h"
13 #include "media/audio/audio_parameters.h" 13 #include "media/audio/audio_parameters.h"
14 #include "media/base/audio_bus.h" 14 #include "media/base/audio_bus.h"
15 #include "media/base/audio_capturer_source.h" 15 #include "media/base/audio_capturer_source.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 18 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
19 #include "third_party/WebKit/public/web/WebHeap.h"
19 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" 20 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
20 21
21 using ::testing::_; 22 using ::testing::_;
22 using ::testing::AnyNumber; 23 using ::testing::AnyNumber;
23 using ::testing::AtLeast; 24 using ::testing::AtLeast;
24 using ::testing::Return; 25 using ::testing::Return;
25 26
26 namespace content { 27 namespace content {
27 28
28 namespace { 29 namespace {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 audio_source); 184 audio_source);
184 audio_source->SetAudioCapturer(capturer_.get()); 185 audio_source->SetAudioCapturer(capturer_.get());
185 capturer_source_ = new MockCapturerSource(capturer_.get()); 186 capturer_source_ = new MockCapturerSource(capturer_.get());
186 EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1)) 187 EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1))
187 .WillOnce(Return()); 188 .WillOnce(Return());
188 EXPECT_CALL(*capturer_source_.get(), SetAutomaticGainControl(true)); 189 EXPECT_CALL(*capturer_source_.get(), SetAutomaticGainControl(true));
189 EXPECT_CALL(*capturer_source_.get(), OnStart()); 190 EXPECT_CALL(*capturer_source_.get(), OnStart());
190 capturer_->SetCapturerSourceForTesting(capturer_source_, params_); 191 capturer_->SetCapturerSourceForTesting(capturer_source_, params_);
191 } 192 }
192 193
194 virtual void TearDown() OVERRIDE {
195 blink_source_.reset();
haraken 2014/09/09 04:51:16 The reason we need to reset blink_source_ here is
196 blink::WebHeap::collectAllGarbage();
197 }
198
193 media::AudioParameters params_; 199 media::AudioParameters params_;
194 blink::WebMediaStreamSource blink_source_; 200 blink::WebMediaStreamSource blink_source_;
195 scoped_refptr<MockCapturerSource> capturer_source_; 201 scoped_refptr<MockCapturerSource> capturer_source_;
196 scoped_refptr<WebRtcAudioCapturer> capturer_; 202 scoped_refptr<WebRtcAudioCapturer> capturer_;
197 }; 203 };
198 204
199 // Creates a capturer and audio track, fakes its audio thread, and 205 // Creates a capturer and audio track, fakes its audio thread, and
200 // connect/disconnect the sink to the audio track on the fly, the sink should 206 // connect/disconnect the sink to the audio track on the fly, the sink should
201 // get data callback when the track is connected to the capturer but not when 207 // get data callback when the track is connected to the capturer but not when
202 // the track is disconnected from the capturer. 208 // the track is disconnected from the capturer.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // Stopping the new source will stop the second track. 534 // Stopping the new source will stop the second track.
529 EXPECT_CALL(*source.get(), OnStop()).Times(1); 535 EXPECT_CALL(*source.get(), OnStop()).Times(1);
530 capturer->Stop(); 536 capturer->Stop();
531 537
532 // Even though this test don't use |capturer_source_| it will be stopped 538 // Even though this test don't use |capturer_source_| it will be stopped
533 // during teardown of the test harness. 539 // during teardown of the test harness.
534 EXPECT_CALL(*capturer_source_.get(), OnStop()); 540 EXPECT_CALL(*capturer_source_.get(), OnStop());
535 } 541 }
536 542
537 } // namespace content 543 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/user_media_client_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698