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 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ |
6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ | 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/gcm_driver/gcm_client.h" | 10 #include "components/gcm_driver/gcm_client.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 }; | 25 }; |
26 | 26 |
27 enum StartMode { | 27 enum StartMode { |
28 NO_DELAY_START, | 28 NO_DELAY_START, |
29 DELAY_START, | 29 DELAY_START, |
30 }; | 30 }; |
31 | 31 |
32 FakeGCMClient(StartMode start_mode, | 32 FakeGCMClient(StartMode start_mode, |
33 const scoped_refptr<base::SequencedTaskRunner>& ui_thread, | 33 const scoped_refptr<base::SequencedTaskRunner>& ui_thread, |
34 const scoped_refptr<base::SequencedTaskRunner>& io_thread); | 34 const scoped_refptr<base::SequencedTaskRunner>& io_thread); |
35 virtual ~FakeGCMClient(); | 35 ~FakeGCMClient() override; |
36 | 36 |
37 // Overridden from GCMClient: | 37 // Overridden from GCMClient: |
38 // Called on IO thread. | 38 // Called on IO thread. |
39 virtual void Initialize( | 39 void Initialize( |
40 const ChromeBuildInfo& chrome_build_info, | 40 const ChromeBuildInfo& chrome_build_info, |
41 const base::FilePath& store_path, | 41 const base::FilePath& store_path, |
42 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 42 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
43 const scoped_refptr<net::URLRequestContextGetter>& | 43 const scoped_refptr<net::URLRequestContextGetter>& |
44 url_request_context_getter, | 44 url_request_context_getter, |
45 scoped_ptr<Encryptor> encryptor, | 45 scoped_ptr<Encryptor> encryptor, |
46 Delegate* delegate) override; | 46 Delegate* delegate) override; |
47 virtual void Start() override; | 47 void Start() override; |
48 virtual void Stop() override; | 48 void Stop() override; |
49 virtual void CheckOut() override; | 49 void CheckOut() override; |
50 virtual void Register(const std::string& app_id, | 50 void Register(const std::string& app_id, |
51 const std::vector<std::string>& sender_ids) override; | 51 const std::vector<std::string>& sender_ids) override; |
52 virtual void Unregister(const std::string& app_id) override; | 52 void Unregister(const std::string& app_id) override; |
53 virtual void Send(const std::string& app_id, | 53 void Send(const std::string& app_id, |
54 const std::string& receiver_id, | 54 const std::string& receiver_id, |
55 const OutgoingMessage& message) override; | 55 const OutgoingMessage& message) override; |
56 virtual void SetRecording(bool recording) override; | 56 void SetRecording(bool recording) override; |
57 virtual void ClearActivityLogs() override; | 57 void ClearActivityLogs() override; |
58 virtual GCMStatistics GetStatistics() const override; | 58 GCMStatistics GetStatistics() const override; |
59 virtual void SetAccountTokens( | 59 void SetAccountTokens( |
60 const std::vector<AccountTokenInfo>& account_tokens) override; | 60 const std::vector<AccountTokenInfo>& account_tokens) override; |
61 virtual void UpdateAccountMapping( | 61 void UpdateAccountMapping(const AccountMapping& account_mapping) override; |
62 const AccountMapping& account_mapping) override; | 62 void RemoveAccountMapping(const std::string& account_id) override; |
63 virtual void RemoveAccountMapping(const std::string& account_id) override; | |
64 | 63 |
65 // Initiate the loading that has been delayed. | 64 // Initiate the loading that has been delayed. |
66 // Called on UI thread. | 65 // Called on UI thread. |
67 void PerformDelayedLoading(); | 66 void PerformDelayedLoading(); |
68 | 67 |
69 // Simulate receiving something from the server. | 68 // Simulate receiving something from the server. |
70 // Called on UI thread. | 69 // Called on UI thread. |
71 void ReceiveMessage(const std::string& app_id, | 70 void ReceiveMessage(const std::string& app_id, |
72 const IncomingMessage& message); | 71 const IncomingMessage& message); |
73 void DeleteMessages(const std::string& app_id); | 72 void DeleteMessages(const std::string& app_id); |
(...skipping 28 matching lines...) Expand all Loading... |
102 scoped_refptr<base::SequencedTaskRunner> ui_thread_; | 101 scoped_refptr<base::SequencedTaskRunner> ui_thread_; |
103 scoped_refptr<base::SequencedTaskRunner> io_thread_; | 102 scoped_refptr<base::SequencedTaskRunner> io_thread_; |
104 base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_; | 103 base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_; |
105 | 104 |
106 DISALLOW_COPY_AND_ASSIGN(FakeGCMClient); | 105 DISALLOW_COPY_AND_ASSIGN(FakeGCMClient); |
107 }; | 106 }; |
108 | 107 |
109 } // namespace gcm | 108 } // namespace gcm |
110 | 109 |
111 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ | 110 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ |
OLD | NEW |