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

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

Issue 6628020: Cleaning up src/media to be consistent with static versus anonymous namespaces. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fix namespaces Created 9 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/threading/platform_thread.h" 6 #include "base/threading/platform_thread.h"
7 #include "media/audio/audio_io.h" 7 #include "media/audio/audio_io.h"
8 #include "media/audio/audio_manager.h" 8 #include "media/audio/audio_manager.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 using ::testing::_; 12 using ::testing::_;
13 using ::testing::AtLeast; 13 using ::testing::AtLeast;
14 using ::testing::Exactly; 14 using ::testing::Exactly;
15 using ::testing::NotNull; 15 using ::testing::NotNull;
16 16
17 namespace {
18
19 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { 17 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
20 public: 18 public:
21 MockAudioInputCallback() {} 19 MockAudioInputCallback() {}
22 20
23 MOCK_METHOD1(OnClose, void(AudioInputStream* stream)); 21 MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
24 MOCK_METHOD2(OnError, void(AudioInputStream* stream, int error_code)); 22 MOCK_METHOD2(OnError, void(AudioInputStream* stream, int error_code));
25 MOCK_METHOD3(OnData, void(AudioInputStream* stream, const uint8* src, 23 MOCK_METHOD3(OnData, void(AudioInputStream* stream, const uint8* src,
26 uint32 size)); 24 uint32 size));
27 private: 25 private:
28 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); 26 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback);
29 }; 27 };
30 28
31 }
32
33 // ============================================================================ 29 // ============================================================================
34 // Validate that the AudioManager::AUDIO_MOCK callbacks work. 30 // Validate that the AudioManager::AUDIO_MOCK callbacks work.
35 // Crashes, http://crbug.com/49497. 31 // Crashes, http://crbug.com/49497.
36 TEST(FakeAudioInputTest, DISABLED_BasicCallbacks) { 32 TEST(FakeAudioInputTest, DISABLED_BasicCallbacks) {
37 MockAudioInputCallback callback; 33 MockAudioInputCallback callback;
38 EXPECT_CALL(callback, OnData(NotNull(), _, _)).Times(AtLeast(5)); 34 EXPECT_CALL(callback, OnData(NotNull(), _, _)).Times(AtLeast(5));
39 EXPECT_CALL(callback, OnError(NotNull(), _)).Times(Exactly(0)); 35 EXPECT_CALL(callback, OnError(NotNull(), _)).Times(Exactly(0));
40 36
41 AudioManager* audio_man = AudioManager::GetAudioManager(); 37 AudioManager* audio_man = AudioManager::GetAudioManager();
42 ASSERT_TRUE(NULL != audio_man); 38 ASSERT_TRUE(NULL != audio_man);
43 // Ask for one recorded packet every 50ms. 39 // Ask for one recorded packet every 50ms.
44 AudioInputStream* stream = audio_man->MakeAudioInputStream( 40 AudioInputStream* stream = audio_man->MakeAudioInputStream(
45 AudioParameters(AudioParameters::AUDIO_MOCK, 2, 8000, 8, 400)); 41 AudioParameters(AudioParameters::AUDIO_MOCK, 2, 8000, 8, 400));
46 ASSERT_TRUE(NULL != stream); 42 ASSERT_TRUE(NULL != stream);
47 EXPECT_TRUE(stream->Open()); 43 EXPECT_TRUE(stream->Open());
48 stream->Start(&callback); 44 stream->Start(&callback);
49 45
50 // Give sufficient time to receive 5 / 6 packets. 46 // Give sufficient time to receive 5 / 6 packets.
51 base::PlatformThread::Sleep(340); 47 base::PlatformThread::Sleep(340);
52 stream->Stop(); 48 stream->Stop();
53 stream->Close(); 49 stream->Close();
54 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698