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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/copresence/test/stub_whispernet_client.cc
diff --git a/components/copresence/test/stub_whispernet_client.cc b/components/copresence/test/stub_whispernet_client.cc
index 9ecc34bae5262fde7ea6b76887a8556acf6b8b3a..945233d0f2fe129a15270ebef10d92d10816253c 100644
--- a/components/copresence/test/stub_whispernet_client.cc
+++ b/components/copresence/test/stub_whispernet_client.cc
@@ -4,23 +4,56 @@
#include "components/copresence/test/stub_whispernet_client.h"
+#include "components/copresence/test/audio_test_support.h"
+#include "media/base/audio_bus.h"
+
namespace copresence {
-WhispernetClient::TokensCallback StubWhispernetClient::GetTokensCallback() {
- return TokensCallback();
+StubWhispernetClient::StubWhispernetClient() {
+}
+
+StubWhispernetClient::~StubWhispernetClient() {
+}
+
+void StubWhispernetClient::EncodeToken(const std::string& token,
+ AudioType type) {
+ if (!samples_cb_.is_null())
+ samples_cb_.Run(type, token, CreateRandomAudioRefCounted(0x123, 1, 0x321));
Charlie 2014/11/06 17:28:22 These samples can get passed into the constructor,
rkc 2014/11/06 19:58:24 Done.
+}
+
+void StubWhispernetClient::DecodeSamples(AudioType type,
+ const std::string& samples) {
+ if (!tokens_cb_.is_null()) {
+ std::vector<AudioToken> tokens;
Charlie 2014/11/06 17:28:22 Pass these into the constructor instead of hardcod
rkc 2014/11/06 19:58:24 Done.
+ tokens.push_back(AudioToken("abcdef", true));
+ tokens.push_back(AudioToken("123456", false));
+ tokens_cb_.Run(tokens);
+ }
+}
+
+void StubWhispernetClient::RegisterTokensCallback(
+ const TokensCallback& tokens_cb) {
+ tokens_cb_ = tokens_cb;
+}
+
+void StubWhispernetClient::RegisterSamplesCallback(
+ const SamplesCallback& samples_cb) {
+ samples_cb_ = samples_cb;
+}
+
+TokensCallback StubWhispernetClient::GetTokensCallback() {
+ return tokens_cb_;
}
-WhispernetClient::SamplesCallback StubWhispernetClient::GetSamplesCallback() {
- return SamplesCallback();
+SamplesCallback StubWhispernetClient::GetSamplesCallback() {
+ return samples_cb_;
}
-WhispernetClient::SuccessCallback
-StubWhispernetClient::GetDetectBroadcastCallback() {
+SuccessCallback StubWhispernetClient::GetDetectBroadcastCallback() {
return SuccessCallback();
}
-WhispernetClient::SuccessCallback
-StubWhispernetClient::GetInitializedCallback() {
+SuccessCallback StubWhispernetClient::GetInitializedCallback() {
return SuccessCallback();
}

Powered by Google App Engine
This is Rietveld 408576698