| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // CopresenceDelegate implementation | 78 // CopresenceDelegate implementation |
| 79 | 79 |
| 80 void HandleMessages(const std::string& app_id, | 80 void HandleMessages(const std::string& app_id, |
| 81 const std::string& subscription_id, | 81 const std::string& subscription_id, |
| 82 const std::vector<Message>& messages) override { | 82 const std::vector<Message>& messages) override { |
| 83 // app_id is unused for now, pending a server fix. | 83 // app_id is unused for now, pending a server fix. |
| 84 messages_by_subscription_[subscription_id] = messages; | 84 messages_by_subscription_[subscription_id] = messages; |
| 85 } | 85 } |
| 86 | 86 |
| 87 net::URLRequestContextGetter* GetRequestContext() const override { | 87 net::URLRequestContextGetter* GetRequestContext() const override { |
| 88 return NULL; | 88 return nullptr; |
| 89 } | 89 } |
| 90 | 90 |
| 91 const std::string GetPlatformVersionString() const override { | 91 const std::string GetPlatformVersionString() const override { |
| 92 return kChromeVersion; | 92 return kChromeVersion; |
| 93 } | 93 } |
| 94 | 94 |
| 95 const std::string GetAPIKey(const std::string& app_id) const override { | 95 const std::string GetAPIKey(const std::string& app_id) const override { |
| 96 return app_id + " API Key"; | 96 return app_id + " API Key"; |
| 97 } | 97 } |
| 98 | 98 |
| 99 const std::string GetAuthToken() const override { | 99 const std::string GetAuthToken() const override { |
| 100 return auth_token_; | 100 return auth_token_; |
| 101 } | 101 } |
| 102 | 102 |
| 103 WhispernetClient* GetWhispernetClient() override { return NULL; } | 103 WhispernetClient* GetWhispernetClient() override { return nullptr; } |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 void InvokeReportResponseHandler(int status_code, | 106 void InvokeReportResponseHandler(int status_code, |
| 107 const std::string& response) { | 107 const std::string& response) { |
| 108 rpc_handler_.ReportResponseHandler( | 108 rpc_handler_.ReportResponseHandler( |
| 109 base::Bind(&RpcHandlerTest::CaptureStatus, base::Unretained(this)), | 109 base::Bind(&RpcHandlerTest::CaptureStatus, base::Unretained(this)), |
| 110 NULL, | 110 nullptr, |
| 111 status_code, | 111 status_code, |
| 112 response); | 112 response); |
| 113 } | 113 } |
| 114 | 114 |
| 115 FakeDirectiveHandler* InstallFakeDirectiveHandler() { | 115 FakeDirectiveHandler* InstallFakeDirectiveHandler() { |
| 116 FakeDirectiveHandler* handler = new FakeDirectiveHandler; | 116 FakeDirectiveHandler* handler = new FakeDirectiveHandler; |
| 117 rpc_handler_.directive_handler_.reset(handler); | 117 rpc_handler_.directive_handler_.reset(handler); |
| 118 return handler; | 118 return handler; |
| 119 } | 119 } |
| 120 | 120 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 messages_by_subscription_["Subscription 2"][1].payload()); | 280 messages_by_subscription_["Subscription 2"][1].payload()); |
| 281 | 281 |
| 282 ASSERT_EQ(2U, directive_handler->added_directives().size()); | 282 ASSERT_EQ(2U, directive_handler->added_directives().size()); |
| 283 EXPECT_EQ("Subscription 1", | 283 EXPECT_EQ("Subscription 1", |
| 284 directive_handler->added_directives()[0].subscription_id()); | 284 directive_handler->added_directives()[0].subscription_id()); |
| 285 EXPECT_EQ("Subscription 2", | 285 EXPECT_EQ("Subscription 2", |
| 286 directive_handler->added_directives()[1].subscription_id()); | 286 directive_handler->added_directives()[1].subscription_id()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace copresence | 289 } // namespace copresence |
| OLD | NEW |