OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 void HandleStatusUpdate(CopresenceStatus /* status */) override { | 70 void HandleStatusUpdate(CopresenceStatus /* status */) override { |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 } | 72 } |
73 | 73 |
74 net::URLRequestContextGetter* GetRequestContext() const override { | 74 net::URLRequestContextGetter* GetRequestContext() const override { |
75 return nullptr; | 75 return nullptr; |
76 } | 76 } |
77 | 77 |
78 const std::string GetPlatformVersionString() const override { | 78 std::string GetPlatformVersionString() const override { |
79 return kChromeVersion; | 79 return kChromeVersion; |
80 } | 80 } |
81 | 81 |
82 const std::string GetAPIKey(const std::string& app_id) const override { | 82 std::string GetAPIKey(const std::string& app_id) const override { |
83 return app_id + " API Key"; | 83 return app_id + " API Key"; |
84 } | 84 } |
85 | 85 |
86 WhispernetClient* GetWhispernetClient() override { | 86 WhispernetClient* GetWhispernetClient() override { |
87 return whispernet_client_.get(); | 87 return whispernet_client_.get(); |
88 } | 88 } |
89 | 89 |
90 // TODO(ckehoe): Add GCM tests. | 90 // TODO(ckehoe): Add GCM tests. |
91 gcm::GCMDriver* GetGCMDriver() override { | 91 gcm::GCMDriver* GetGCMDriver() override { |
92 return nullptr; | 92 return nullptr; |
93 } | 93 } |
94 | 94 |
95 const std::string GetDeviceId(bool authenticated) override { | 95 std::string GetDeviceId(bool authenticated) override { |
96 return device_id_by_auth_state_[authenticated]; | 96 return device_id_by_auth_state_[authenticated]; |
97 } | 97 } |
98 | 98 |
99 void SaveDeviceId(bool authenticated, const std::string& device_id) override { | 99 void SaveDeviceId(bool authenticated, const std::string& device_id) override { |
100 device_id_by_auth_state_[authenticated] = device_id; | 100 device_id_by_auth_state_[authenticated] = device_id; |
101 } | 101 } |
102 | 102 |
103 protected: | 103 protected: |
104 | 104 |
105 // Send test input to RpcHandler | 105 // Send test input to RpcHandler |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // Check processing. | 338 // Check processing. |
339 status_ = FAIL; | 339 status_ = FAIL; |
340 SendReportResponse(net::HTTP_OK, response.Pass()); | 340 SendReportResponse(net::HTTP_OK, response.Pass()); |
341 EXPECT_EQ(SUCCESS, status_); | 341 EXPECT_EQ(SUCCESS, status_); |
342 EXPECT_TRUE(TokenIsInvalid("bad token")); | 342 EXPECT_TRUE(TokenIsInvalid("bad token")); |
343 EXPECT_THAT(directive_handler_.added_directives(), | 343 EXPECT_THAT(directive_handler_.added_directives(), |
344 ElementsAre("Subscription 1", "Subscription 2")); | 344 ElementsAre("Subscription 1", "Subscription 2")); |
345 } | 345 } |
346 | 346 |
347 } // namespace copresence | 347 } // namespace copresence |
OLD | NEW |