| 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 <stdint.h> |
| 6 |
| 5 #include <map> | 7 #include <map> |
| 6 #include <string> | 8 #include <string> |
| 7 #include <vector> | 9 #include <vector> |
| 8 | 10 |
| 9 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_tokenizer.h" | 12 #include "base/strings/string_tokenizer.h" |
| 11 #include "google_apis/gcm/engine/gcm_registration_request_handler.h" | 13 #include "google_apis/gcm/engine/gcm_registration_request_handler.h" |
| 12 #include "google_apis/gcm/engine/gcm_request_test_base.h" | 14 #include "google_apis/gcm/engine/gcm_request_test_base.h" |
| 13 #include "google_apis/gcm/engine/instance_id_get_token_request_handler.h" | 15 #include "google_apis/gcm/engine/instance_id_get_token_request_handler.h" |
| 14 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" | 16 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" |
| 15 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
| 16 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
| 17 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 18 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
| 19 | 21 |
| 20 namespace gcm { | 22 namespace gcm { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 const uint64 kAndroidId = 42UL; | 25 const uint64_t kAndroidId = 42UL; |
| 24 const char kAppId[] = "TestAppId"; | 26 const char kAppId[] = "TestAppId"; |
| 25 const char kDeveloperId[] = "Project1"; | 27 const char kDeveloperId[] = "Project1"; |
| 26 const char kLoginHeader[] = "AidLogin"; | 28 const char kLoginHeader[] = "AidLogin"; |
| 27 const char kRegistrationURL[] = "http://foo.bar/register"; | 29 const char kRegistrationURL[] = "http://foo.bar/register"; |
| 28 const uint64 kSecurityToken = 77UL; | 30 const uint64_t kSecurityToken = 77UL; |
| 29 const int kGCMVersion = 40; | 31 const int kGCMVersion = 40; |
| 30 const char kInstanceId[] = "IID1"; | 32 const char kInstanceId[] = "IID1"; |
| 31 const char kScope[] = "GCM"; | 33 const char kScope[] = "GCM"; |
| 32 | 34 |
| 33 } // namespace | 35 } // namespace |
| 34 | 36 |
| 35 class RegistrationRequestTest : public GCMRequestTestBase { | 37 class RegistrationRequestTest : public GCMRequestTestBase { |
| 36 public: | 38 public: |
| 37 RegistrationRequestTest(); | 39 RegistrationRequestTest(); |
| 38 ~RegistrationRequestTest() override; | 40 ~RegistrationRequestTest() override; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 521 |
| 520 SetResponse(net::HTTP_OK, "token=2501"); | 522 SetResponse(net::HTTP_OK, "token=2501"); |
| 521 CompleteFetch(); | 523 CompleteFetch(); |
| 522 | 524 |
| 523 EXPECT_TRUE(callback_called_); | 525 EXPECT_TRUE(callback_called_); |
| 524 EXPECT_EQ(RegistrationRequest::SUCCESS, status_); | 526 EXPECT_EQ(RegistrationRequest::SUCCESS, status_); |
| 525 EXPECT_EQ("2501", registration_id_); | 527 EXPECT_EQ("2501", registration_id_); |
| 526 } | 528 } |
| 527 | 529 |
| 528 } // namespace gcm | 530 } // namespace gcm |
| OLD | NEW |