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 // TODO(fgorski): Update parameters to const ref. |
| 59 void CheckInFinished(std::string username, CheckinInfo checkin_info); |
59 void RegisterFinished(std::string username, | 60 void RegisterFinished(std::string username, |
60 std::string app_id, | 61 std::string app_id, |
61 std::string registrion_id); | 62 std::string registrion_id); |
62 void SendFinished(std::string username, | 63 void SendFinished(std::string username, |
63 std::string app_id, | 64 std::string app_id, |
64 std::string message_id); | 65 std::string message_id); |
65 void MessageReceived(std::string username, | 66 void MessageReceived(std::string username, |
66 std::string app_id, | 67 std::string app_id, |
67 IncomingMessage message); | 68 IncomingMessage message); |
68 void MessagesDeleted(std::string username, std::string app_id); | 69 void MessagesDeleted(std::string username, std::string app_id); |
69 void MessageSendError(std::string username, | 70 void MessageSendError(std::string username, |
70 std::string app_id, | 71 std::string app_id, |
71 std::string message_id); | 72 std::string message_id); |
72 void LoadingCompleted(); | 73 void LoadingCompleted(); |
73 | 74 |
74 std::map<std::string, Delegate*> delegates_; | 75 std::map<std::string, Delegate*> delegates_; |
75 | 76 |
76 bool is_loading_; | 77 bool is_loading_; |
77 | 78 |
78 // The testing code could set this to simulate the server error in order to | 79 // The testing code could set this to simulate the server error in order to |
79 // test the error scenario. | 80 // test the error scenario. |
80 bool simulate_server_error_; | 81 bool simulate_server_error_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(GCMClientMock); | 83 DISALLOW_COPY_AND_ASSIGN(GCMClientMock); |
83 }; | 84 }; |
84 | 85 |
85 } // namespace gcm | 86 } // namespace gcm |
86 | 87 |
87 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ | 88 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ |
OLD | NEW |