OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 COMPONENTS_AUDIO_MODEM_TEST_STUB_MODEM_H_ | |
6 #define COMPONENTS_AUDIO_MODEM_TEST_STUB_MODEM_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/macros.h" | |
13 #include "components/audio_modem/public/modem.h" | |
14 | |
15 namespace audio_modem { | |
16 | |
17 class StubModem final : public Modem { | |
18 public: | |
19 StubModem(); | |
20 ~StubModem() override; | |
21 | |
22 // AudioManager overrides: | |
23 void Initialize(WhispernetClient* whispernet_client, | |
24 const TokensCallback& tokens_cb) override; | |
25 void StartPlaying(AudioType type) override; | |
26 void StopPlaying(AudioType type) override; | |
27 void StartRecording(AudioType type) override; | |
28 void StopRecording(AudioType type) override; | |
29 void SetToken(AudioType type, const std::string& url_unsafe_token) override {} | |
30 const std::string GetToken(AudioType type) const override; | |
31 bool IsPlayingTokenHeard(AudioType type) const override; | |
32 void SetTokenParams(AudioType type, const TokenParameters& params) override {} | |
33 | |
34 bool IsRecording(AudioType type) const; | |
35 bool IsPlaying(AudioType type) const; | |
36 | |
37 // Encodes tokens as base64 and then delivers them. | |
38 void DeliverTokens(const std::vector<AudioToken>& tokens); | |
39 | |
40 private: | |
41 // Indexed using enum AudioType. | |
42 bool playing_[2]; | |
43 bool recording_[2]; | |
44 | |
45 TokensCallback tokens_callback_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(StubModem); | |
48 }; | |
49 | |
50 } // namespace audio_modem | |
51 | |
52 #endif // COMPONENTS_AUDIO_MODEM_TEST_STUB_MODEM_H_ | |
OLD | NEW |