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 #include "components/audio_modem/test/stub_whispernet_client.h" | |
6 | |
7 namespace audio_modem { | |
8 | |
9 StubWhispernetClient::StubWhispernetClient( | |
10 scoped_refptr<media::AudioBusRefCounted> samples, | |
11 const std::vector<AudioToken>& tokens) | |
12 : samples_(samples), | |
13 tokens_(tokens) { | |
14 } | |
15 | |
16 StubWhispernetClient::~StubWhispernetClient() {} | |
17 | |
18 void StubWhispernetClient::Initialize(const SuccessCallback& init_callback) {} | |
19 | |
20 void StubWhispernetClient::EncodeToken(const std::string& token, | |
21 AudioType type, | |
22 const TokenParameters token_params[2]) { | |
23 if (!samples_cb_.is_null()) | |
24 samples_cb_.Run(type, token, samples_); | |
25 } | |
26 | |
27 void StubWhispernetClient::DecodeSamples( | |
28 AudioType type, | |
29 const std::string& samples, | |
30 const TokenParameters token_params[2]) { | |
31 if (!tokens_cb_.is_null()) | |
32 tokens_cb_.Run(tokens_); | |
33 } | |
34 | |
35 void StubWhispernetClient::RegisterTokensCallback( | |
36 const TokensCallback& tokens_cb) { | |
37 tokens_cb_ = tokens_cb; | |
38 } | |
39 | |
40 void StubWhispernetClient::RegisterSamplesCallback( | |
41 const SamplesCallback& samples_cb) { | |
42 samples_cb_ = samples_cb; | |
43 } | |
44 | |
45 TokensCallback StubWhispernetClient::GetTokensCallback() { | |
46 return tokens_cb_; | |
47 } | |
48 | |
49 SamplesCallback StubWhispernetClient::GetSamplesCallback() { | |
50 return samples_cb_; | |
51 } | |
52 | |
53 SuccessCallback StubWhispernetClient::GetInitializedCallback() { | |
54 return SuccessCallback(); | |
55 } | |
56 | |
57 } // namespace audio_modem | |
OLD | NEW |