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

Unified Diff: components/copresence/handlers/directive_handler_unittest.cc

Issue 764673003: Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/handlers/directive_handler_unittest.cc
diff --git a/components/copresence/handlers/directive_handler_unittest.cc b/components/copresence/handlers/directive_handler_unittest.cc
index 72e44104133e489ec1c8a61f883e8aac0281536f..f65b9cf641358bd225a12b4f864750db1770a116 100644
--- a/components/copresence/handlers/directive_handler_unittest.cc
+++ b/components/copresence/handlers/directive_handler_unittest.cc
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
+#include <vector>
+
+#include "base/bind.h"
#include "base/time/time.h"
#include "components/copresence/handlers/audio/audio_directive_handler.h"
#include "components/copresence/handlers/directive_handler_impl.h"
@@ -22,10 +26,12 @@ const int64 kDefaultTtl = 600000; // 10 minutes
namespace copresence {
-Directive CreateDirective(const std::string& publish_id,
- const std::string& subscribe_id,
- const std::string& token,
- int64 ttl_ms) {
+void IgnoreDirectiveUpdates(const std::vector<Directive>& /* directives */) {}
+
+const Directive CreateDirective(const std::string& publish_id,
+ const std::string& subscribe_id,
+ const std::string& token,
+ int64 ttl_ms) {
Directive directive;
directive.set_instruction_type(TOKEN);
directive.set_published_message_id(publish_id);
@@ -40,9 +46,9 @@ Directive CreateDirective(const std::string& publish_id,
return directive;
}
-Directive CreateDirective(const std::string& publish_id,
- const std::string& subscribe_id,
- const std::string& token) {
+const Directive CreateDirective(const std::string& publish_id,
+ const std::string& subscribe_id,
+ const std::string& token) {
return CreateDirective(publish_id, subscribe_id, token, kDefaultTtl);
}
@@ -53,11 +59,10 @@ class FakeAudioDirectiveHandler final : public AudioDirectiveHandler {
void Initialize(WhispernetClient* /* whispernet_client */,
const TokensCallback& /* tokens_cb */) override {}
- void AddInstruction(const TokenInstruction& instruction,
- const std::string& /* op_id */,
- base::TimeDelta ttl) override {
- added_tokens_.push_back(instruction.token_id());
- added_ttls_.push_back(ttl.InMilliseconds());
+ void AddInstruction(const Directive& directive,
+ const std::string& /* op_id */) override {
+ added_tokens_.push_back(directive.token_instruction().token_id());
+ added_ttls_.push_back(directive.ttl_millis());
}
void RemoveInstructions(const std::string& op_id) override {
@@ -98,6 +103,7 @@ class DirectiveHandlerTest : public testing::Test {
: whispernet_client_(new StubWhispernetClient),
audio_handler_(new FakeAudioDirectiveHandler),
directive_handler_(
+ base::Bind(&IgnoreDirectiveUpdates),
make_scoped_ptr<AudioDirectiveHandler>(audio_handler_)) {}
protected:
« no previous file with comments | « components/copresence/handlers/directive_handler_impl.cc ('k') | components/copresence/public/copresence_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698