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

Side by Side Diff: media/audio/mock_audio_manager.h

Issue 10704154: Small refactor to media architecture in order to allow end-to-end tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed mock_audio_manager from /content/browser/speech Created 8 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_
6 #define MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_
7 #pragma once
8
9 #include "content/public/browser/browser_thread.h"
10 #include "media/audio/audio_manager.h"
11
12 namespace media {
13 // This class is a simple mock around AudioManager, used exclusively for tests,
14 // which has the following purposes:
15 // 1) Avoids to use the actual (system and platform dependent) AudioManager.
16 // Some bots does not have input devices, thus using the actual AudioManager
17 // would causing failures on classes which expect that.
18 // 2) Allows the mock audio events to be dispatched on an arbitrary thread,
19 // rather than forcing them on the audio thread, easing their handling in
20 // browser tests (Note: sharing a thread can cause deadlocks on production
21 // classes if WaitableEvents or any other form of lock is used for
22 // synchronization purposes).
23 class MockAudioManager : public media::AudioManager {
24 public:
25 MockAudioManager(content::BrowserThread::ID thread_id);
26
27 virtual bool HasAudioOutputDevices() OVERRIDE;
28
29 virtual bool HasAudioInputDevices() OVERRIDE;
30
31 virtual string16 GetAudioInputDeviceModel() OVERRIDE;
32
33 virtual bool CanShowAudioInputSettings() OVERRIDE;
34
35 virtual void ShowAudioInputSettings() OVERRIDE;
36
37 virtual void GetAudioInputDeviceNames(
38 media::AudioDeviceNames* device_names) OVERRIDE;
39
40 virtual media::AudioOutputStream* MakeAudioOutputStream(
41 const media::AudioParameters& params) OVERRIDE;
42
43 virtual media::AudioOutputStream* MakeAudioOutputStreamProxy(
44 const media::AudioParameters& params) OVERRIDE;
45
46 virtual media::AudioInputStream* MakeAudioInputStream(
47 const media::AudioParameters& params,
48 const std::string& device_id) OVERRIDE;
49
50 virtual void MuteAll() OVERRIDE;
51
52 virtual void UnMuteAll() OVERRIDE;
53
54 virtual bool IsRecordingInProcess() OVERRIDE;
55
56 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE;
57
58 virtual void Init() OVERRIDE;
59
60 private:
61 virtual ~MockAudioManager();
62
63 content::BrowserThread::ID thread_id_;
64
65 DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
66 };
67
68 } // namespace media.
69
70 #endif // MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698