| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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/copresence/test/stub_whispernet_client.h" | |
| 6 | |
| 7 namespace copresence { | |
| 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 if (!samples_cb_.is_null()) | |
| 23 samples_cb_.Run(type, token, samples_); | |
| 24 } | |
| 25 | |
| 26 void StubWhispernetClient::DecodeSamples(AudioType type, | |
| 27 const std::string& samples, | |
| 28 const size_t token_length[2]) { | |
| 29 if (!tokens_cb_.is_null()) | |
| 30 tokens_cb_.Run(tokens_); | |
| 31 } | |
| 32 | |
| 33 void StubWhispernetClient::RegisterTokensCallback( | |
| 34 const TokensCallback& tokens_cb) { | |
| 35 tokens_cb_ = tokens_cb; | |
| 36 } | |
| 37 | |
| 38 void StubWhispernetClient::RegisterSamplesCallback( | |
| 39 const SamplesCallback& samples_cb) { | |
| 40 samples_cb_ = samples_cb; | |
| 41 } | |
| 42 | |
| 43 TokensCallback StubWhispernetClient::GetTokensCallback() { | |
| 44 return tokens_cb_; | |
| 45 } | |
| 46 | |
| 47 SamplesCallback StubWhispernetClient::GetSamplesCallback() { | |
| 48 return samples_cb_; | |
| 49 } | |
| 50 | |
| 51 SuccessCallback StubWhispernetClient::GetDetectBroadcastCallback() { | |
| 52 return SuccessCallback(); | |
| 53 } | |
| 54 | |
| 55 SuccessCallback StubWhispernetClient::GetInitializedCallback() { | |
| 56 return SuccessCallback(); | |
| 57 } | |
| 58 | |
| 59 } // namespace copresence | |
| OLD | NEW |