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_WHISPERNET_CLIENT_H_ | |
6 #define COMPONENTS_AUDIO_MODEM_TEST_STUB_WHISPERNET_CLIENT_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "components/audio_modem/public/whispernet_client.h" | |
15 #include "media/base/audio_bus.h" | |
16 | |
17 namespace audio_modem { | |
18 | |
19 // A simple WhispernetClient for testing. | |
20 class StubWhispernetClient final : public WhispernetClient { | |
21 public: | |
22 // Constructor. |samples| and |tokens|, if specified, | |
23 // will be returned for any encoding and decoding requests. | |
24 StubWhispernetClient( | |
25 scoped_refptr<media::AudioBusRefCounted> samples = | |
26 scoped_refptr<media::AudioBusRefCounted>(), | |
27 const std::vector<AudioToken>& tokens = std::vector<AudioToken>()); | |
28 | |
29 ~StubWhispernetClient() override; | |
30 | |
31 void Initialize(const SuccessCallback& init_callback) override; | |
32 | |
33 void EncodeToken(const std::string& token, | |
34 AudioType type, | |
35 const TokenParameters token_params[2]) override; | |
36 void DecodeSamples(AudioType type, | |
37 const std::string& samples, | |
38 const TokenParameters token_params[2]) override; | |
39 | |
40 void RegisterTokensCallback(const TokensCallback& tokens_cb) override; | |
41 void RegisterSamplesCallback(const SamplesCallback& samples_cb) override; | |
42 | |
43 TokensCallback GetTokensCallback() override; | |
44 SamplesCallback GetSamplesCallback() override; | |
45 SuccessCallback GetInitializedCallback() override; | |
46 | |
47 private: | |
48 TokensCallback tokens_cb_; | |
49 SamplesCallback samples_cb_; | |
50 scoped_refptr<media::AudioBusRefCounted> samples_; | |
51 std::vector<AudioToken> tokens_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(StubWhispernetClient); | |
54 }; | |
55 | |
56 } // namespace audio_modem | |
57 | |
58 #endif // COMPONENTS_AUDIO_MODEM_TEST_STUB_WHISPERNET_CLIENT_H_ | |
OLD | NEW |