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

Side by Side Diff: media/audio/audio_output_proxy_unittest.cc

Issue 190553004: Revert "Attempt to fix audio wedges by restarting all streams on OSX." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_output_dispatcher_impl.cc ('k') | media/audio/audio_output_resampler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "media/audio/audio_manager.h" 9 #include "media/audio/audio_manager.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 666
667 proxy1->Stop(); 667 proxy1->Stop();
668 CloseAndWaitForCloseTimer(proxy1, &stream1); 668 CloseAndWaitForCloseTimer(proxy1, &stream1);
669 669
670 EXPECT_TRUE(stream1.stop_called()); 670 EXPECT_TRUE(stream1.stop_called());
671 EXPECT_TRUE(stream1.start_called()); 671 EXPECT_TRUE(stream1.start_called());
672 EXPECT_TRUE(stream2.stop_called()); 672 EXPECT_TRUE(stream2.stop_called());
673 EXPECT_TRUE(stream2.start_called()); 673 EXPECT_TRUE(stream2.start_called());
674 } 674 }
675 675
676 // Ensures the methods used to fix audio output wedges are working correctly.
677 TEST_F(AudioOutputResamplerTest, WedgeFix) {
678 MockAudioOutputStream stream1(&manager_, params_);
679 MockAudioOutputStream stream2(&manager_, params_);
680 MockAudioOutputStream stream3(&manager_, params_);
681
682 // Setup the mock such that all three streams are successfully created.
683 EXPECT_CALL(manager(), MakeAudioOutputStream(_, _))
684 .WillOnce(Return(&stream1))
685 .WillOnce(Return(&stream2))
686 .WillOnce(Return(&stream3));
687
688 // Stream1 should be able to successfully open and start.
689 EXPECT_CALL(stream1, Open())
690 .WillOnce(Return(true));
691 EXPECT_CALL(stream1, SetVolume(_));
692 EXPECT_CALL(stream2, Open())
693 .WillOnce(Return(true));
694 EXPECT_CALL(stream2, SetVolume(_));
695
696 // Open and start the first proxy and stream.
697 AudioOutputProxy* proxy1 = new AudioOutputProxy(resampler_.get());
698 EXPECT_TRUE(proxy1->Open());
699 proxy1->Start(&callback_);
700 OnStart();
701
702 // Open, but do not start the second proxy.
703 AudioOutputProxy* proxy2 = new AudioOutputProxy(resampler_.get());
704 EXPECT_TRUE(proxy2->Open());
705
706 // Open, start and then stop the third proxy.
707 AudioOutputProxy* proxy3 = new AudioOutputProxy(resampler_.get());
708 EXPECT_TRUE(proxy3->Open());
709 proxy3->Start(&callback_);
710 OnStart();
711 proxy3->Stop();
712
713 // Wait for stream to timeout and shutdown.
714 WaitForCloseTimer(&stream2);
715
716 EXPECT_CALL(stream1, Close());
717 resampler_->CloseStreamsForWedgeFix();
718
719 // Don't pump the MessageLoop between CloseStreamsForWedgeFix() and
720 // RestartStreamsForWedgeFix() to simulate intended usage. The OnStart() call
721 // will take care of necessary work.
722
723 // Stream3 should take Stream1's place after RestartStreamsForWedgeFix(). No
724 // additional streams should be opened for proxy2 and proxy3.
725 EXPECT_CALL(stream3, Open())
726 .WillOnce(Return(true));
727 EXPECT_CALL(stream3, SetVolume(_));
728
729 resampler_->RestartStreamsForWedgeFix();
730 OnStart();
731
732 // Perform the required Stop()/Close() shutdown dance for each proxy.
733 proxy3->Close();
734 proxy2->Close();
735 proxy1->Stop();
736 CloseAndWaitForCloseTimer(proxy1, &stream3);
737
738 // Wait for all of the messages to fly and then verify stream behavior.
739 EXPECT_TRUE(stream1.stop_called());
740 EXPECT_TRUE(stream1.start_called());
741 EXPECT_TRUE(stream2.stop_called());
742 EXPECT_TRUE(stream2.start_called());
743 EXPECT_TRUE(stream3.stop_called());
744 EXPECT_TRUE(stream3.start_called());
745 }
746
747 } // namespace media 676 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_dispatcher_impl.cc ('k') | media/audio/audio_output_resampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698