OLD | NEW |
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/rpc/rpc_handler.h" | 5 #include "components/copresence/rpc/rpc_handler.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "components/copresence/handlers/directive_handler.h" | 14 #include "components/copresence/handlers/directive_handler.h" |
| 15 #include "components/copresence/mediums/audio/audio_manager.h" |
15 #include "components/copresence/proto/data.pb.h" | 16 #include "components/copresence/proto/data.pb.h" |
16 #include "components/copresence/proto/enums.pb.h" | 17 #include "components/copresence/proto/enums.pb.h" |
17 #include "components/copresence/proto/rpcs.pb.h" | 18 #include "components/copresence/proto/rpcs.pb.h" |
18 #include "net/http/http_status_code.h" | 19 #include "net/http/http_status_code.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 using google::protobuf::MessageLite; | 22 using google::protobuf::MessageLite; |
22 using google::protobuf::RepeatedPtrField; | 23 using google::protobuf::RepeatedPtrField; |
23 | 24 |
24 namespace copresence { | 25 namespace copresence { |
(...skipping 14 matching lines...) Expand all Loading... |
39 // TODO(ckehoe): Make DirectiveHandler an interface. | 40 // TODO(ckehoe): Make DirectiveHandler an interface. |
40 class FakeDirectiveHandler : public DirectiveHandler { | 41 class FakeDirectiveHandler : public DirectiveHandler { |
41 public: | 42 public: |
42 FakeDirectiveHandler() {} | 43 FakeDirectiveHandler() {} |
43 ~FakeDirectiveHandler() override {} | 44 ~FakeDirectiveHandler() override {} |
44 | 45 |
45 const std::vector<Directive>& added_directives() const { | 46 const std::vector<Directive>& added_directives() const { |
46 return added_directives_; | 47 return added_directives_; |
47 } | 48 } |
48 | 49 |
49 void Initialize( | 50 void Initialize(const AudioManager::DecodeSamplesCallback& decode_cb, |
50 const AudioRecorder::DecodeSamplesCallback& decode_cb, | 51 const AudioManager::EncodeTokenCallback& encode_cb) override { |
51 const AudioDirectiveHandler::EncodeTokenCallback& encode_cb) override {} | 52 } |
52 | 53 |
53 void AddDirective(const Directive& directive) override { | 54 void AddDirective(const Directive& directive) override { |
54 added_directives_.push_back(directive); | 55 added_directives_.push_back(directive); |
55 } | 56 } |
56 | 57 |
57 void RemoveDirectives(const std::string& op_id) override { | 58 void RemoveDirectives(const std::string& op_id) override { |
58 // TODO(ckehoe): Add a parallel implementation when prod has one. | 59 // TODO(ckehoe): Add a parallel implementation when prod has one. |
59 } | 60 } |
60 | 61 |
61 private: | 62 private: |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 messages_by_subscription_["Subscription 2"][1].payload()); | 269 messages_by_subscription_["Subscription 2"][1].payload()); |
269 | 270 |
270 ASSERT_EQ(2U, directive_handler->added_directives().size()); | 271 ASSERT_EQ(2U, directive_handler->added_directives().size()); |
271 EXPECT_EQ("Subscription 1", | 272 EXPECT_EQ("Subscription 1", |
272 directive_handler->added_directives()[0].subscription_id()); | 273 directive_handler->added_directives()[0].subscription_id()); |
273 EXPECT_EQ("Subscription 2", | 274 EXPECT_EQ("Subscription 2", |
274 directive_handler->added_directives()[1].subscription_id()); | 275 directive_handler->added_directives()[1].subscription_id()); |
275 } | 276 } |
276 | 277 |
277 } // namespace copresence | 278 } // namespace copresence |
OLD | NEW |