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

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

Issue 21183002: Adding key press detection in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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 #ifndef MEDIA_AUDIO_TEST_AUDIO_INPUT_CONTROLLER_FACTORY_H_ 5 #ifndef MEDIA_AUDIO_TEST_AUDIO_INPUT_CONTROLLER_FACTORY_H_
6 #define MEDIA_AUDIO_TEST_AUDIO_INPUT_CONTROLLER_FACTORY_H_ 6 #define MEDIA_AUDIO_TEST_AUDIO_INPUT_CONTROLLER_FACTORY_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "media/audio/audio_input_controller.h" 9 #include "media/audio/audio_input_controller.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 class KeyPressMonitor;
13 class TestAudioInputControllerFactory; 14 class TestAudioInputControllerFactory;
14 15
15 // TestAudioInputController and TestAudioInputControllerFactory are used for 16 // TestAudioInputController and TestAudioInputControllerFactory are used for
16 // testing consumers of AudioInputController. TestAudioInputControllerFactory 17 // testing consumers of AudioInputController. TestAudioInputControllerFactory
17 // is a AudioInputController::Factory that creates TestAudioInputControllers. 18 // is a AudioInputController::Factory that creates TestAudioInputControllers.
18 // 19 //
19 // TestAudioInputController::Record and Close are overriden to do nothing. It is 20 // TestAudioInputController::Record and Close are overriden to do nothing. It is
20 // expected that you'll grab the EventHandler from the TestAudioInputController 21 // expected that you'll grab the EventHandler from the TestAudioInputController
21 // and invoke the callback methods when appropriate. In this way it's easy to 22 // and invoke the callback methods when appropriate. In this way it's easy to
22 // mock a AudioInputController. 23 // mock a AudioInputController.
(...skipping 26 matching lines...) Expand all
49 virtual void TestAudioControllerOpened( 50 virtual void TestAudioControllerOpened(
50 TestAudioInputController* controller) = 0; 51 TestAudioInputController* controller) = 0;
51 virtual void TestAudioControllerClosed( 52 virtual void TestAudioControllerClosed(
52 TestAudioInputController* controller) = 0; 53 TestAudioInputController* controller) = 0;
53 }; 54 };
54 55
55 TestAudioInputController(TestAudioInputControllerFactory* factory, 56 TestAudioInputController(TestAudioInputControllerFactory* factory,
56 AudioManager* audio_manager, 57 AudioManager* audio_manager,
57 const AudioParameters& audio_parameters, 58 const AudioParameters& audio_parameters,
58 EventHandler* event_handler, 59 EventHandler* event_handler,
59 SyncWriter* sync_writer); 60 SyncWriter* sync_writer,
61 KeyPressMonitor* key_press_monitor);
60 62
61 // Returns the event handler installed on the AudioInputController. 63 // Returns the event handler installed on the AudioInputController.
62 EventHandler* event_handler() const { return event_handler_; } 64 EventHandler* event_handler() const { return event_handler_; }
63 65
64 // Notifies the TestAudioControllerOpened() event to the delegate (if any). 66 // Notifies the TestAudioControllerOpened() event to the delegate (if any).
65 virtual void Record() OVERRIDE; 67 virtual void Record() OVERRIDE;
66 68
67 // Ensure that the closure is run on the audio-manager thread. 69 // Ensure that the closure is run on the audio-manager thread.
68 virtual void Close(const base::Closure& closed_task) OVERRIDE; 70 virtual void Close(const base::Closure& closed_task) OVERRIDE;
69 71
(...skipping 17 matching lines...) Expand all
87 // TestAudioInputControllers. 89 // TestAudioInputControllers.
88 class TestAudioInputControllerFactory : public AudioInputController::Factory { 90 class TestAudioInputControllerFactory : public AudioInputController::Factory {
89 public: 91 public:
90 TestAudioInputControllerFactory(); 92 TestAudioInputControllerFactory();
91 virtual ~TestAudioInputControllerFactory(); 93 virtual ~TestAudioInputControllerFactory();
92 94
93 // AudioInputController::Factory methods. 95 // AudioInputController::Factory methods.
94 virtual AudioInputController* Create( 96 virtual AudioInputController* Create(
95 AudioManager* audio_manager, 97 AudioManager* audio_manager,
96 AudioInputController::EventHandler* event_handler, 98 AudioInputController::EventHandler* event_handler,
97 AudioParameters params) OVERRIDE; 99 AudioParameters params,
100 KeyPressMonitor* key_press_monitor) OVERRIDE;
98 101
99 void SetDelegateForTests(TestAudioInputControllerDelegate* delegate); 102 void SetDelegateForTests(TestAudioInputControllerDelegate* delegate);
100 103
101 TestAudioInputController* controller() const { return controller_; } 104 TestAudioInputController* controller() const { return controller_; }
102 105
103 private: 106 private:
104 friend class TestAudioInputController; 107 friend class TestAudioInputController;
105 108
106 // Invoked by a TestAudioInputController when it gets destroyed. 109 // Invoked by a TestAudioInputController when it gets destroyed.
107 void OnTestAudioInputControllerDestroyed( 110 void OnTestAudioInputControllerDestroyed(
108 TestAudioInputController* controller); 111 TestAudioInputController* controller);
109 112
110 // The caller of Create owns this object. 113 // The caller of Create owns this object.
111 TestAudioInputController* controller_; 114 TestAudioInputController* controller_;
112 115
113 // The delegate for tests for receiving audio controller events. 116 // The delegate for tests for receiving audio controller events.
114 TestAudioInputControllerDelegate* delegate_; 117 TestAudioInputControllerDelegate* delegate_;
115 118
116 DISALLOW_COPY_AND_ASSIGN(TestAudioInputControllerFactory); 119 DISALLOW_COPY_AND_ASSIGN(TestAudioInputControllerFactory);
117 }; 120 };
118 121
119 } // namespace media 122 } // namespace media
120 123
121 #endif // MEDIA_AUDIO_TEST_AUDIO_INPUT_CONTROLLER_FACTORY_H_ 124 #endif // MEDIA_AUDIO_TEST_AUDIO_INPUT_CONTROLLER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698