Chromium Code Reviews| 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..d1e9a073a778194625739925534fd25670edf23b 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" |
| @@ -12,20 +16,18 @@ |
| using testing::ElementsAre; |
| using testing::IsEmpty; |
| -namespace { |
|
xiyuan
2014/12/18 18:10:52
nit: keep the anonymous namespace?
Charlie
2014/12/19 03:53:33
Done.
|
| - |
| const int64 kMaxUnlabeledTtl = 60000; // 1 minute |
| const int64 kExcessiveUnlabeledTtl = 120000; // 2 minutes |
| const int64 kDefaultTtl = 600000; // 10 minutes |
| -} // namespace |
| - |
| 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 +42,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 +55,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 +99,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: |