OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ | 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ |
6 #define CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ | 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 const std::string& app_id, | 40 const std::string& app_id, |
41 const IncomingMessage& message); | 41 const IncomingMessage& message); |
42 void DeleteMessages(const std::string& username, const std::string& app_id); | 42 void DeleteMessages(const std::string& username, const std::string& app_id); |
43 | 43 |
44 void set_simulate_server_error(bool simulate_server_error) { | 44 void set_simulate_server_error(bool simulate_server_error) { |
45 simulate_server_error_ = simulate_server_error; | 45 simulate_server_error_ = simulate_server_error; |
46 } | 46 } |
47 | 47 |
48 void SetIsLoading(bool is_loading); | 48 void SetIsLoading(bool is_loading); |
49 | 49 |
50 static CheckInInfo GetCheckInInfoFromUsername(const std::string& username); | 50 static CheckinInfo GetCheckinInfoFromUsername(const std::string& username); |
51 static std::string GetRegistrationIdFromSenderIds( | 51 static std::string GetRegistrationIdFromSenderIds( |
52 const std::vector<std::string>& sender_ids); | 52 const std::vector<std::string>& sender_ids); |
53 | 53 |
54 private: | 54 private: |
55 Delegate* GetDelegate(const std::string& username) const; | 55 Delegate* GetDelegate(const std::string& username) const; |
56 | 56 |
57 // Called on IO thread. | 57 // Called on IO thread. |
58 void CheckInFinished(std::string username, CheckInInfo checkin_info); | 58 void CheckInFinished(std::string username, CheckinInfo checkin_info); |
Nicolas Zea
2014/01/07 00:41:52
nit: this, and all these other params should be pa
fgorski
2014/01/07 23:46:44
Added a TODO
| |
59 void RegisterFinished(std::string username, | 59 void RegisterFinished(std::string username, |
60 std::string app_id, | 60 std::string app_id, |
61 std::string registrion_id); | 61 std::string registrion_id); |
62 void SendFinished(std::string username, | 62 void SendFinished(std::string username, |
63 std::string app_id, | 63 std::string app_id, |
64 std::string message_id); | 64 std::string message_id); |
65 void MessageReceived(std::string username, | 65 void MessageReceived(std::string username, |
66 std::string app_id, | 66 std::string app_id, |
67 IncomingMessage message); | 67 IncomingMessage message); |
68 void MessagesDeleted(std::string username, std::string app_id); | 68 void MessagesDeleted(std::string username, std::string app_id); |
69 void MessageSendError(std::string username, | 69 void MessageSendError(std::string username, |
70 std::string app_id, | 70 std::string app_id, |
71 std::string message_id); | 71 std::string message_id); |
72 void LoadingCompleted(); | 72 void LoadingCompleted(); |
73 | 73 |
74 std::map<std::string, Delegate*> delegates_; | 74 std::map<std::string, Delegate*> delegates_; |
75 | 75 |
76 bool is_loading_; | 76 bool is_loading_; |
77 | 77 |
78 // The testing code could set this to simulate the server error in order to | 78 // The testing code could set this to simulate the server error in order to |
79 // test the error scenario. | 79 // test the error scenario. |
80 bool simulate_server_error_; | 80 bool simulate_server_error_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(GCMClientMock); | 82 DISALLOW_COPY_AND_ASSIGN(GCMClientMock); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace gcm | 85 } // namespace gcm |
86 | 86 |
87 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ | 87 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ |
OLD | NEW |