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

Side by Side Diff: components/copresence/test/stub_whispernet_client.cc

Issue 704923002: Add polling and audio check to copresence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « components/copresence/test/stub_whispernet_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include "components/copresence/test/stub_whispernet_client.h" 5 #include "components/copresence/test/stub_whispernet_client.h"
6 6
7 #include "components/copresence/test/audio_test_support.h"
8 #include "media/base/audio_bus.h"
9
7 namespace copresence { 10 namespace copresence {
8 11
9 WhispernetClient::TokensCallback StubWhispernetClient::GetTokensCallback() { 12 StubWhispernetClient::StubWhispernetClient() {
10 return TokensCallback(); 13 tokens_.push_back(AudioToken("abcdef", true));
Charlie 2014/11/06 21:53:14 The test should pass these into a separate 2-argum
rkc 2014/11/06 21:58:34 This is a stub class. This is a test. I am not sur
14 tokens_.push_back(AudioToken("123456", false));
15 samples_ = CreateRandomAudioRefCounted(0x123, 1, 0x321);
11 } 16 }
12 17
13 WhispernetClient::SamplesCallback StubWhispernetClient::GetSamplesCallback() { 18 StubWhispernetClient::~StubWhispernetClient() {
14 return SamplesCallback();
15 } 19 }
16 20
17 WhispernetClient::SuccessCallback 21 void StubWhispernetClient::EncodeToken(const std::string& token,
18 StubWhispernetClient::GetDetectBroadcastCallback() { 22 AudioType type) {
23 if (!samples_cb_.is_null())
24 samples_cb_.Run(type, token, samples_);
25 }
26
27 void StubWhispernetClient::DecodeSamples(AudioType type,
28 const std::string& samples) {
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() {
19 return SuccessCallback(); 52 return SuccessCallback();
20 } 53 }
21 54
22 WhispernetClient::SuccessCallback 55 SuccessCallback StubWhispernetClient::GetInitializedCallback() {
23 StubWhispernetClient::GetInitializedCallback() {
24 return SuccessCallback(); 56 return SuccessCallback();
25 } 57 }
26 58
27 } // namespace copresence 59 } // namespace copresence
OLDNEW
« no previous file with comments | « components/copresence/test/stub_whispernet_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698