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

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

Issue 8427031: First unit tests for WebRTCAudioDevice. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Latest comments addressed Created 9 years, 1 month 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
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/test/test_timeouts.h"
6 #include "content/renderer/media/webrtc_audio_device_impl.h"
7 #include "content/test/webrtc_audio_device_test.h"
8 #include "media/audio/audio_util.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "third_party/webrtc/voice_engine/main/interface/voe_audio_processing.h"
11 #include "third_party/webrtc/voice_engine/main/interface/voe_base.h"
12 #include "third_party/webrtc/voice_engine/main/interface/voe_file.h"
13 #include "third_party/webrtc/voice_engine/main/interface/voe_network.h"
14
15 using testing::_;
16 using testing::InvokeWithoutArgs;
17 using testing::Return;
18 using testing::StrEq;
19
20 namespace {
21
22 ACTION_P(QuitMessageLoop, loop_or_proxy) {
23 loop_or_proxy->PostTask(FROM_HERE, new MessageLoop::QuitTask());
24 }
25
26 class AudioUtil : public AudioUtilInterface {
27 public:
28 virtual double GetAudioHardwareSampleRate() OVERRIDE {
29 return media::GetAudioHardwareSampleRate();
30 }
31 virtual double GetAudioInputHardwareSampleRate() OVERRIDE {
32 return media::GetAudioInputHardwareSampleRate();
33 }
34 };
35
36 } // end namespace
37
38 // Basic test that instantiates and initializes an instance of
39 // WebRtcAudioDeviceImpl.
40 TEST_F(WebRTCAudioDeviceTest, Construct) {
41 AudioUtil audio_util;
42 set_audio_util_callback(&audio_util);
henrika (OOO until Aug 14) 2011/11/04 10:35:12 Where can I find the definition of set_audio_util_
tommi (sloooow) - chröme 2011/11/07 10:27:28 webrtc_audio_device_test.h@130
43 scoped_refptr<WebRtcAudioDeviceImpl> audio_device(
44 new WebRtcAudioDeviceImpl());
45 audio_device->SetSessionId(1);
46
47 WebRTCAutoDelete<webrtc::VoiceEngine> engine(webrtc::VoiceEngine::Create());
henrika (OOO until Aug 14) 2011/11/04 10:35:12 Why not ensure that engine is valid (not NULL) her
tommi (sloooow) - chröme 2011/11/07 10:27:28 Done.
48
49 ScopedWebRTCPtr<webrtc::VoEBase> base(engine.get());
50 int err = base->Init(audio_device);
51 EXPECT_EQ(0, err);
52 }
53
54 // Plays a local file. This test usually takes just under a minute to run
55 // and requires an audio card to work, so disabled by default.
56 TEST_F(WebRTCAudioDeviceTest, DISABLED_PlayLocalFileLong) {
57 AudioUtil audio_util;
58 set_audio_util_callback(&audio_util);
59 PlayLocalFile(0);
henrika (OOO until Aug 14) 2011/11/04 10:35:12 I have never seen this before where a unit test ca
henrika (OOO until Aug 14) 2011/11/04 10:35:12 Add comment about meaning of '0' here.
tommi (sloooow) - chröme 2011/11/07 10:27:28 The reason is because two tests use the same code.
60 }
61
62 TEST_F(WebRTCAudioDeviceTest, PlayLocalFile) {
63 AudioUtil audio_util;
64 set_audio_util_callback(&audio_util);
65 PlayLocalFile(TestTimeouts::action_timeout_ms());
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698