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 "google_apis/gcm/gcm_client_impl.h" | 5 #include "google_apis/gcm/gcm_client_impl.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/test/simple_test_clock.h" | 10 #include "base/test/simple_test_clock.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 TEST_F(GCMClientImplTest, CheckOut) { | 360 TEST_F(GCMClientImplTest, CheckOut) { |
361 EXPECT_TRUE(mcs_client()); | 361 EXPECT_TRUE(mcs_client()); |
362 gcm_client()->CheckOut(); | 362 gcm_client()->CheckOut(); |
363 EXPECT_FALSE(mcs_client()); | 363 EXPECT_FALSE(mcs_client()); |
364 } | 364 } |
365 | 365 |
366 TEST_F(GCMClientImplTest, RegisterApp) { | 366 TEST_F(GCMClientImplTest, RegisterApp) { |
367 std::vector<std::string> senders; | 367 std::vector<std::string> senders; |
368 senders.push_back("sender"); | 368 senders.push_back("sender"); |
369 gcm_client()->Register("app_id", "cert", senders); | 369 gcm_client()->Register("app_id", senders); |
370 CompleteRegistration("reg_id"); | 370 CompleteRegistration("reg_id"); |
371 | 371 |
372 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); | 372 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); |
373 EXPECT_EQ("app_id", last_app_id()); | 373 EXPECT_EQ("app_id", last_app_id()); |
374 EXPECT_EQ("reg_id", last_registration_id()); | 374 EXPECT_EQ("reg_id", last_registration_id()); |
375 EXPECT_EQ(GCMClient::SUCCESS, last_result()); | 375 EXPECT_EQ(GCMClient::SUCCESS, last_result()); |
376 } | 376 } |
377 | 377 |
378 TEST_F(GCMClientImplTest, UnregisterApp) { | 378 TEST_F(GCMClientImplTest, UnregisterApp) { |
379 gcm_client()->Unregister("app_id"); | 379 gcm_client()->Unregister("app_id"); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); | 444 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); |
445 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); | 445 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); |
446 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from()); | 446 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from()); |
447 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to()); | 447 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to()); |
448 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key()); | 448 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key()); |
449 EXPECT_EQ("value", | 449 EXPECT_EQ("value", |
450 mcs_client()->last_data_message_stanza().app_data(0).value()); | 450 mcs_client()->last_data_message_stanza().app_data(0).value()); |
451 } | 451 } |
452 | 452 |
453 } // namespace gcm | 453 } // namespace gcm |
OLD | NEW |