| OLD | NEW |
| 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" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 track_2->AddSink(sink.get()); | 397 track_2->AddSink(sink.get()); |
| 398 EXPECT_CALL(*sink, FormatIsSet()).Times(0); | 398 EXPECT_CALL(*sink, FormatIsSet()).Times(0); |
| 399 | 399 |
| 400 // Stop the capturer again will not trigger stopping the source of the | 400 // Stop the capturer again will not trigger stopping the source of the |
| 401 // capturer again.. | 401 // capturer again.. |
| 402 event.Reset(); | 402 event.Reset(); |
| 403 EXPECT_CALL(*capturer_source_.get(), OnStop()).Times(0); | 403 EXPECT_CALL(*capturer_source_.get(), OnStop()).Times(0); |
| 404 capturer_->Stop(); | 404 capturer_->Stop(); |
| 405 } | 405 } |
| 406 | 406 |
| 407 // Contains data races reported by tsan: crbug.com/404133 |
| 408 #if defined(THREAD_SANITIZER) |
| 409 #define DISABLE_ON_TSAN(function) DISABLED_##function |
| 410 #else |
| 411 #define DISABLE_ON_TSAN(function) function |
| 412 #endif |
| 413 |
| 407 // Create a new capturer with new source, connect it to a new audio track. | 414 // Create a new capturer with new source, connect it to a new audio track. |
| 408 TEST_F(WebRtcLocalAudioTrackTest, ConnectTracksToDifferentCapturers) { | 415 TEST_F(WebRtcLocalAudioTrackTest, |
| 416 DISABLE_ON_TSAN(ConnectTracksToDifferentCapturers)) { |
| 409 // Setup the first audio track and start it. | 417 // Setup the first audio track and start it. |
| 410 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1( | 418 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_1( |
| 411 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); | 419 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); |
| 412 scoped_ptr<WebRtcLocalAudioTrack> track_1( | 420 scoped_ptr<WebRtcLocalAudioTrack> track_1( |
| 413 new WebRtcLocalAudioTrack(adapter_1, capturer_, NULL)); | 421 new WebRtcLocalAudioTrack(adapter_1, capturer_, NULL)); |
| 414 track_1->Start(); | 422 track_1->Start(); |
| 415 | 423 |
| 416 // Verify the data flow by connecting the |sink_1| to |track_1|. | 424 // Verify the data flow by connecting the |sink_1| to |track_1|. |
| 417 scoped_ptr<MockMediaStreamAudioSink> sink_1(new MockMediaStreamAudioSink()); | 425 scoped_ptr<MockMediaStreamAudioSink> sink_1(new MockMediaStreamAudioSink()); |
| 418 EXPECT_CALL(*sink_1.get(), CaptureData(0, 0, 0, _, false)) | 426 EXPECT_CALL(*sink_1.get(), CaptureData(0, 0, 0, _, false)) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // Stopping the new source will stop the second track. | 528 // Stopping the new source will stop the second track. |
| 521 EXPECT_CALL(*source, OnStop()).Times(1); | 529 EXPECT_CALL(*source, OnStop()).Times(1); |
| 522 capturer->Stop(); | 530 capturer->Stop(); |
| 523 | 531 |
| 524 // Even though this test don't use |capturer_source_| it will be stopped | 532 // Even though this test don't use |capturer_source_| it will be stopped |
| 525 // during teardown of the test harness. | 533 // during teardown of the test harness. |
| 526 EXPECT_CALL(*capturer_source_.get(), OnStop()); | 534 EXPECT_CALL(*capturer_source_.get(), OnStop()); |
| 527 } | 535 } |
| 528 | 536 |
| 529 } // namespace content | 537 } // namespace content |
| OLD | NEW |