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

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
« no previous file with comments | « components/copresence/test/stub_whispernet_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..955f6b9740090b1d7c02df4a20c814c94734b186 100644
--- a/components/copresence/test/stub_whispernet_client.cc
+++ b/components/copresence/test/stub_whispernet_client.cc
@@ -4,23 +4,55 @@
#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() {
+ 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
+ tokens_.push_back(AudioToken("123456", false));
+ samples_ = CreateRandomAudioRefCounted(0x123, 1, 0x321);
+}
+
+StubWhispernetClient::~StubWhispernetClient() {
+}
+
+void StubWhispernetClient::EncodeToken(const std::string& token,
+ AudioType type) {
+ if (!samples_cb_.is_null())
+ samples_cb_.Run(type, token, samples_);
+}
+
+void StubWhispernetClient::DecodeSamples(AudioType type,
+ const std::string& samples) {
+ if (!tokens_cb_.is_null())
+ 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();
}
« 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