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

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

Issue 10958020: Don't fallback if we've successfully opened a stream previously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert double-stop() change. Created 8 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 | Annotate | Revision Log
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 EXPECT_CALL(manager(), MakeAudioOutputStream(_)) 860 EXPECT_CALL(manager(), MakeAudioOutputStream(_))
861 .Times(2) 861 .Times(2)
862 .WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL))); 862 .WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL)));
863 863
864 AudioOutputProxy* proxy = new AudioOutputProxy(resampler_); 864 AudioOutputProxy* proxy = new AudioOutputProxy(resampler_);
865 EXPECT_FALSE(proxy->Open()); 865 EXPECT_FALSE(proxy->Open());
866 proxy->Close(); 866 proxy->Close();
867 WaitForCloseTimer(kTestCloseDelayMs); 867 WaitForCloseTimer(kTestCloseDelayMs);
868 } 868 }
869 869
870 TEST_F(AudioOutputResamplerTest, LowLatencyOpenEventuallyFails) {
871 MockAudioOutputStream stream1(params_);
872 MockAudioOutputStream stream2(params_);
873 MockAudioOutputStream stream3(params_);
874
875 EXPECT_CALL(manager(), MakeAudioOutputStream(_))
876 .WillOnce(Return(&stream1))
877 .WillOnce(Return(&stream2))
878 .WillOnce(Return(&stream3))
879 .WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL)));
880
881 EXPECT_CALL(stream1, Open())
scherkus (not reviewing) 2012/09/21 01:24:18 can you sprinkle a one-liner comment before each s
DaleCurtis 2012/09/21 02:57:27 Done.
882 .WillOnce(Return(true));
883 EXPECT_CALL(stream1, Close())
884 .Times(1);
885 EXPECT_CALL(stream1, SetVolume(_))
886 .Times(1);
887
888 EXPECT_CALL(stream2, Open())
889 .WillOnce(Return(true));
890 EXPECT_CALL(stream2, Close())
891 .Times(1);
892 EXPECT_CALL(stream2, SetVolume(_))
893 .Times(1);
894
895 EXPECT_CALL(stream3, Open())
896 .WillOnce(Return(false));
897 EXPECT_CALL(stream3, Close())
898 .Times(1);
899
900 AudioOutputProxy* proxy1 = new AudioOutputProxy(resampler_);
901 EXPECT_TRUE(proxy1->Open());
902 proxy1->Start(&callback_);
903 OnStart();
904
905 AudioOutputProxy* proxy2 = new AudioOutputProxy(resampler_);
906 EXPECT_TRUE(proxy2->Open());
907 proxy2->Start(&callback_);
908 OnStart();
909
910 AudioOutputProxy* proxy3 = new AudioOutputProxy(resampler_);
911 EXPECT_FALSE(proxy3->Open());
912
913 proxy3->Stop();
914 proxy3->Close();
915 proxy2->Stop();
916 proxy2->Close();
917 proxy1->Stop();
918 proxy1->Close();
919
920 WaitForCloseTimer(kTestCloseDelayMs);
921 EXPECT_TRUE(stream1.stop_called());
922 EXPECT_TRUE(stream1.start_called());
923 EXPECT_TRUE(stream2.stop_called());
924 EXPECT_TRUE(stream2.start_called());
925 EXPECT_FALSE(stream3.stop_called());
926 EXPECT_FALSE(stream3.start_called());
927 }
928
870 } // namespace media 929 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698