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 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_FAKE_GCM_DRIVER__FOR_INSTANCE_ID_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_FAKE_GCM_DRIVER__FOR_INSTANCE_ID_H_ |
6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_FAKE_GCM_DRIVER__FOR_INSTANCE_ID_H_ | 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_FAKE_GCM_DRIVER__FOR_INSTANCE_ID_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
| 10 #include <utility> |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "components/gcm_driver/fake_gcm_driver.h" | 14 #include "components/gcm_driver/fake_gcm_driver.h" |
14 | 15 |
15 namespace instance_id { | 16 namespace instance_id { |
16 | 17 |
17 class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver, | 18 class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver, |
18 public gcm::InstanceIDStore { | 19 public gcm::InstanceIDHandler { |
19 public: | 20 public: |
20 FakeGCMDriverForInstanceID(); | 21 FakeGCMDriverForInstanceID(); |
21 ~FakeGCMDriverForInstanceID() override; | 22 ~FakeGCMDriverForInstanceID() override; |
22 | 23 |
23 // FakeGCMDriver overrides: | 24 // FakeGCMDriver overrides: |
24 gcm::InstanceIDStore* GetInstanceIDStore() override; | 25 gcm::InstanceIDHandler* GetInstanceIDHandler() override; |
25 | 26 |
26 // InstanceIDStore overrides: | 27 // InstanceIDHandler overrides: |
| 28 void GetToken(const std::string& app_id, |
| 29 const std::string& authorized_entity, |
| 30 const std::string& scope, |
| 31 const std::map<std::string, std::string>& options, |
| 32 const GetTokenCallback& callback) override; |
| 33 void DeleteToken(const std::string& app_id, |
| 34 const std::string& authorized_entity, |
| 35 const std::string& scope, |
| 36 const DeleteTokenCallback& callback) override; |
27 void AddInstanceIDData(const std::string& app_id, | 37 void AddInstanceIDData(const std::string& app_id, |
28 const std::string& instance_id_data) override; | 38 const std::string& instance_id, |
| 39 const std::string& extra_data) override; |
29 void RemoveInstanceIDData(const std::string& app_id) override; | 40 void RemoveInstanceIDData(const std::string& app_id) override; |
30 void GetInstanceIDData( | 41 void GetInstanceIDData( |
31 const std::string& app_id, | 42 const std::string& app_id, |
32 const gcm::InstanceIDStore::GetInstanceIDDataCallback& callback) override; | 43 const GetInstanceIDDataCallback& callback) override; |
33 | 44 |
34 private: | 45 private: |
35 std::map<std::string, std::string> instance_id_data_; | 46 std::map<std::string, std::pair<std::string, std::string>> instance_id_data_; |
| 47 std::map<std::string, std::string> tokens_; |
36 | 48 |
37 DISALLOW_COPY_AND_ASSIGN(FakeGCMDriverForInstanceID); | 49 DISALLOW_COPY_AND_ASSIGN(FakeGCMDriverForInstanceID); |
38 }; | 50 }; |
39 | 51 |
40 } // namespace instance_id | 52 } // namespace instance_id |
41 | 53 |
42 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_FAKE_GCM_DRIVER__FOR_INSTANCE_ID_H_ | 54 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_FAKE_GCM_DRIVER__FOR_INSTANCE_ID_H_ |
OLD | NEW |