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

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

Issue 1122393004: Add support for switching the audio output device for HTMLMediaElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to MediaPlayers so that they invoke callbacks in the correct threads. First complete implem… Created 5 years, 6 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
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 <vector> 5 #include <vector>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 MockAudioOutputIPC() {} 45 MockAudioOutputIPC() {}
46 virtual ~MockAudioOutputIPC() {} 46 virtual ~MockAudioOutputIPC() {}
47 47
48 MOCK_METHOD3(CreateStream, void(AudioOutputIPCDelegate* delegate, 48 MOCK_METHOD3(CreateStream, void(AudioOutputIPCDelegate* delegate,
49 const AudioParameters& params, 49 const AudioParameters& params,
50 int session_id)); 50 int session_id));
51 MOCK_METHOD0(PlayStream, void()); 51 MOCK_METHOD0(PlayStream, void());
52 MOCK_METHOD0(PauseStream, void()); 52 MOCK_METHOD0(PauseStream, void());
53 MOCK_METHOD0(CloseStream, void()); 53 MOCK_METHOD0(CloseStream, void());
54 MOCK_METHOD1(SetVolume, void(double volume)); 54 MOCK_METHOD1(SetVolume, void(double volume));
55 MOCK_METHOD4(SwitchDevice,
56 void(const std::string& device_id,
57 const GURL& security_origin,
58 int request_id,
59 const base::Callback<void(int)>& callback));
55 }; 60 };
56 61
57 ACTION_P2(SendPendingBytes, socket, pending_bytes) { 62 ACTION_P2(SendPendingBytes, socket, pending_bytes) {
58 socket->Send(&pending_bytes, sizeof(pending_bytes)); 63 socket->Send(&pending_bytes, sizeof(pending_bytes));
59 } 64 }
60 65
61 // Used to terminate a loop from a different thread than the loop belongs to. 66 // Used to terminate a loop from a different thread than the loop belongs to.
62 // |loop| should be a MessageLoopProxy. 67 // |loop| should be a MessageLoopProxy.
63 ACTION_P(QuitLoop, loop) { 68 ACTION_P(QuitLoop, loop) {
64 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); 69 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 236 }
232 237
233 // Full test with output only. 238 // Full test with output only.
234 TEST_P(AudioOutputDeviceTest, CreateStream) { 239 TEST_P(AudioOutputDeviceTest, CreateStream) {
235 StartAudioDevice(); 240 StartAudioDevice();
236 ExpectRenderCallback(); 241 ExpectRenderCallback();
237 CreateStream(); 242 CreateStream();
238 WaitUntilRenderCallback(); 243 WaitUntilRenderCallback();
239 StopAudioDevice(); 244 StopAudioDevice();
240 } 245 }
241 246
miu 2015/06/03 21:01:01 Please write one or more unit tests to test new fu
242 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false)); 247 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false));
243 248
244 } // namespace media. 249 } // namespace media.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698