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 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 protected: | 181 protected: |
182 // For rpc_handler_.invalid_audio_token_cache_ | 182 // For rpc_handler_.invalid_audio_token_cache_ |
183 base::MessageLoop message_loop_; | 183 base::MessageLoop message_loop_; |
184 | 184 |
185 RpcHandler rpc_handler_; | 185 RpcHandler rpc_handler_; |
186 CopresenceStatus status_; | 186 CopresenceStatus status_; |
187 std::string api_key_; | 187 std::string api_key_; |
188 | 188 |
189 std::string rpc_name_; | 189 std::string rpc_name_; |
190 scoped_ptr<MessageLite> request_proto_; | 190 scoped_ptr<MessageLite> request_proto_; |
191 std::map<std::string, std::vector<Message> > messages_by_subscription_; | 191 std::map<std::string, std::vector<Message>> messages_by_subscription_; |
192 }; | 192 }; |
193 | 193 |
194 TEST_F(RpcHandlerTest, Initialize) { | 194 TEST_F(RpcHandlerTest, Initialize) { |
195 SetDeviceId(""); | 195 SetDeviceId(""); |
196 rpc_handler_.Initialize(RpcHandler::SuccessCallback()); | 196 rpc_handler_.Initialize(RpcHandler::SuccessCallback()); |
197 RegisterDeviceRequest* registration = | 197 RegisterDeviceRequest* registration = |
198 static_cast<RegisterDeviceRequest*>(request_proto_.get()); | 198 static_cast<RegisterDeviceRequest*>(request_proto_.get()); |
199 Identity identity = registration->device_identifiers().registrant(); | 199 Identity identity = registration->device_identifiers().registrant(); |
200 EXPECT_EQ(CHROME, identity.type()); | 200 EXPECT_EQ(CHROME, identity.type()); |
201 EXPECT_FALSE(identity.chrome_id().empty()); | 201 EXPECT_FALSE(identity.chrome_id().empty()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 messages_by_subscription_["Subscription 2"][1].payload()); | 338 messages_by_subscription_["Subscription 2"][1].payload()); |
339 | 339 |
340 ASSERT_EQ(2U, directive_handler->added_directives().size()); | 340 ASSERT_EQ(2U, directive_handler->added_directives().size()); |
341 EXPECT_EQ("Subscription 1", | 341 EXPECT_EQ("Subscription 1", |
342 directive_handler->added_directives()[0].subscription_id()); | 342 directive_handler->added_directives()[0].subscription_id()); |
343 EXPECT_EQ("Subscription 2", | 343 EXPECT_EQ("Subscription 2", |
344 directive_handler->added_directives()[1].subscription_id()); | 344 directive_handler->added_directives()[1].subscription_id()); |
345 } | 345 } |
346 | 346 |
347 } // namespace copresence | 347 } // namespace copresence |
OLD | NEW |