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

Side by Side Diff: components/audio_modem/test/stub_whispernet_client.h

Issue 865483005: Creating the audio_modem component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging again Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_ 5 #ifndef COMPONENTS_AUDIO_MODEM_TEST_STUB_WHISPERNET_CLIENT_H_
6 #define COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_ 6 #define COMPONENTS_AUDIO_MODEM_TEST_STUB_WHISPERNET_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "components/copresence/public/whispernet_client.h" 14 #include "components/audio_modem/public/whispernet_client.h"
15 #include "components/copresence/tokens.h"
16 #include "media/base/audio_bus.h" 15 #include "media/base/audio_bus.h"
17 16
18 namespace copresence { 17 namespace audio_modem {
19 18
20 // A simple WhispernetClient for testing. 19 // A simple WhispernetClient for testing.
21 class StubWhispernetClient final : public WhispernetClient { 20 class StubWhispernetClient final : public WhispernetClient {
22 public: 21 public:
23 // Constructor. |samples| and |tokens|, if specified, 22 // Constructor. |samples| and |tokens|, if specified,
24 // will be returned for any encoding and decoding requests. 23 // will be returned for any encoding and decoding requests.
25 StubWhispernetClient( 24 StubWhispernetClient(
26 scoped_refptr<media::AudioBusRefCounted> samples = 25 scoped_refptr<media::AudioBusRefCounted> samples =
27 scoped_refptr<media::AudioBusRefCounted>(), 26 scoped_refptr<media::AudioBusRefCounted>(),
28 const std::vector<AudioToken>& tokens = std::vector<AudioToken>()); 27 const std::vector<AudioToken>& tokens = std::vector<AudioToken>());
29 28
30 ~StubWhispernetClient() override; 29 ~StubWhispernetClient() override;
31 30
32 void Initialize(const SuccessCallback& init_callback) override; 31 void Initialize(const SuccessCallback& init_callback) override;
33 void Shutdown() override {}
34 32
35 void EncodeToken(const std::string& token, AudioType type) override; 33 void EncodeToken(const std::string& token, AudioType type) override;
36 void DecodeSamples(AudioType type, 34 void DecodeSamples(AudioType type,
37 const std::string& samples, 35 const std::string& samples,
38 const size_t token_length[2]) override; 36 const size_t token_length[2]) override;
39 void DetectBroadcast() override {} 37 void DetectBroadcast() override {}
40 38
41 void RegisterTokensCallback(const TokensCallback& tokens_cb) override; 39 void RegisterTokensCallback(const TokensCallback& tokens_cb) override;
42 void RegisterSamplesCallback(const SamplesCallback& samples_cb) override; 40 void RegisterSamplesCallback(const SamplesCallback& samples_cb) override;
43 void RegisterDetectBroadcastCallback( 41 void RegisterDetectBroadcastCallback(
44 const SuccessCallback& /* db_cb */) override {} 42 const SuccessCallback& /* db_cb */) override {}
45 43
46 TokensCallback GetTokensCallback() override; 44 TokensCallback GetTokensCallback() override;
47 SamplesCallback GetSamplesCallback() override; 45 SamplesCallback GetSamplesCallback() override;
48 SuccessCallback GetDetectBroadcastCallback() override; 46 SuccessCallback GetDetectBroadcastCallback() override;
49 SuccessCallback GetInitializedCallback() override; 47 SuccessCallback GetInitializedCallback() override;
50 48
51 private: 49 private:
52 TokensCallback tokens_cb_; 50 TokensCallback tokens_cb_;
53 SamplesCallback samples_cb_; 51 SamplesCallback samples_cb_;
54 scoped_refptr<media::AudioBusRefCounted> samples_; 52 scoped_refptr<media::AudioBusRefCounted> samples_;
55 std::vector<AudioToken> tokens_; 53 std::vector<AudioToken> tokens_;
56 54
57 DISALLOW_COPY_AND_ASSIGN(StubWhispernetClient); 55 DISALLOW_COPY_AND_ASSIGN(StubWhispernetClient);
58 }; 56 };
59 57
60 } // namespace copresence 58 } // namespace audio_modem
61 59
62 #endif // COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_ 60 #endif // COMPONENTS_AUDIO_MODEM_TEST_STUB_WHISPERNET_CLIENT_H_
OLDNEW
« no previous file with comments | « components/audio_modem/test/random_samples.cc ('k') | components/audio_modem/test/stub_whispernet_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698