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 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 5 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 TEST_F(GCMProfileServiceTest, RegisterAndUnregister) { | 249 TEST_F(GCMProfileServiceTest, RegisterAndUnregister) { |
250 CreateGCMProfileService(); | 250 CreateGCMProfileService(); |
251 SignIn(); | 251 SignIn(); |
252 | 252 |
253 std::vector<std::string> sender_ids; | 253 std::vector<std::string> sender_ids; |
254 sender_ids.push_back("sender"); | 254 sender_ids.push_back("sender"); |
255 RegisterAndWaitForCompletion(sender_ids); | 255 RegisterAndWaitForCompletion(sender_ids); |
256 | 256 |
257 std::string expected_registration_id = | 257 std::string expected_registration_id = |
258 FakeGCMClient::GetRegistrationIdFromSenderIds(sender_ids); | 258 GetGCMClient()->GetRegistrationIdFromSenderIds(sender_ids); |
259 EXPECT_EQ(expected_registration_id, registration_id()); | 259 EXPECT_EQ(expected_registration_id, registration_id()); |
260 EXPECT_EQ(GCMClient::SUCCESS, registration_result()); | 260 EXPECT_EQ(GCMClient::SUCCESS, registration_result()); |
261 | 261 |
262 UnregisterAndWaitForCompletion(); | 262 UnregisterAndWaitForCompletion(); |
263 EXPECT_EQ(GCMClient::SUCCESS, unregistration_result()); | 263 EXPECT_EQ(GCMClient::SUCCESS, unregistration_result()); |
264 } | 264 } |
265 | 265 |
266 TEST_F(GCMProfileServiceTest, Send) { | 266 TEST_F(GCMProfileServiceTest, Send) { |
267 CreateGCMProfileService(); | 267 CreateGCMProfileService(); |
268 SignIn(); | 268 SignIn(); |
269 | 269 |
270 GCMClient::OutgoingMessage message; | 270 GCMClient::OutgoingMessage message; |
271 message.id = "1"; | 271 message.id = "1"; |
272 message.data["key1"] = "value1"; | 272 message.data["key1"] = "value1"; |
273 SendAndWaitForCompletion( message); | 273 SendAndWaitForCompletion( message); |
274 | 274 |
275 EXPECT_EQ(message.id, send_message_id()); | 275 EXPECT_EQ(message.id, send_message_id()); |
276 EXPECT_EQ(GCMClient::SUCCESS, send_result()); | 276 EXPECT_EQ(GCMClient::SUCCESS, send_result()); |
277 } | 277 } |
278 | 278 |
279 } // namespace gcm | 279 } // namespace gcm |
OLD | NEW |