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

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

Issue 901753002: Cleaning up some tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using rand() instead of rand_r() on Windows 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
« 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
10 namespace copresence { 7 namespace copresence {
11 8
12 StubWhispernetClient::StubWhispernetClient(bool complete_initialization) 9 StubWhispernetClient::StubWhispernetClient(
13 : complete_initialization_(complete_initialization) { 10 scoped_refptr<media::AudioBusRefCounted> samples,
14 tokens_.push_back(AudioToken("abcdef", true)); 11 const std::vector<AudioToken>& tokens)
15 tokens_.push_back(AudioToken("123456", false)); 12 : samples_(samples),
16 samples_ = CreateRandomAudioRefCounted(0x123, 1, 0x321); 13 tokens_(tokens) {
17 } 14 }
18 15
19 StubWhispernetClient::~StubWhispernetClient() { 16 StubWhispernetClient::~StubWhispernetClient() {}
20 }
21 17
22 void StubWhispernetClient::Initialize(const SuccessCallback& init_callback) { 18 void StubWhispernetClient::Initialize(const SuccessCallback& init_callback) {}
23 // TODO(ckehoe): Consider updating tests to use this.
24 if (complete_initialization_)
25 init_callback.Run(true);
26 }
27 19
28 void StubWhispernetClient::EncodeToken(const std::string& token, 20 void StubWhispernetClient::EncodeToken(const std::string& token,
29 AudioType type) { 21 AudioType type) {
30 if (!samples_cb_.is_null()) 22 if (!samples_cb_.is_null())
31 samples_cb_.Run(type, token, samples_); 23 samples_cb_.Run(type, token, samples_);
32 } 24 }
33 25
34 void StubWhispernetClient::DecodeSamples(AudioType type, 26 void StubWhispernetClient::DecodeSamples(AudioType type,
35 const std::string& samples, 27 const std::string& samples,
36 const size_t token_length[2]) { 28 const size_t token_length[2]) {
(...skipping 21 matching lines...) Expand all
58 50
59 SuccessCallback StubWhispernetClient::GetDetectBroadcastCallback() { 51 SuccessCallback StubWhispernetClient::GetDetectBroadcastCallback() {
60 return SuccessCallback(); 52 return SuccessCallback();
61 } 53 }
62 54
63 SuccessCallback StubWhispernetClient::GetInitializedCallback() { 55 SuccessCallback StubWhispernetClient::GetInitializedCallback() {
64 return SuccessCallback(); 56 return SuccessCallback();
65 } 57 }
66 58
67 } // 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