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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Don't use initial delay unless the last request was an error. | 53 // Don't use initial delay unless the last request was an error. |
54 false, | 54 false, |
55 }; | 55 }; |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 class RegistrationRequestTest : public testing::Test { | 59 class RegistrationRequestTest : public testing::Test { |
60 public: | 60 public: |
61 RegistrationRequestTest(); | 61 RegistrationRequestTest(); |
62 virtual ~RegistrationRequestTest(); | 62 ~RegistrationRequestTest() override; |
63 | 63 |
64 void RegistrationCallback(RegistrationRequest::Status status, | 64 void RegistrationCallback(RegistrationRequest::Status status, |
65 const std::string& registration_id); | 65 const std::string& registration_id); |
66 | 66 |
67 void CreateRequest(const std::string& sender_ids); | 67 void CreateRequest(const std::string& sender_ids); |
68 void SetResponseStatusAndString(net::HttpStatusCode status_code, | 68 void SetResponseStatusAndString(net::HttpStatusCode status_code, |
69 const std::string& response_body); | 69 const std::string& response_body); |
70 void CompleteFetch(); | 70 void CompleteFetch(); |
71 void set_max_retry_count(int max_retry_count) { | 71 void set_max_retry_count(int max_retry_count) { |
72 max_retry_count_ = max_retry_count; | 72 max_retry_count_ = max_retry_count; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 418 |
419 SetResponseStatusAndString(net::HTTP_GATEWAY_TIMEOUT, "token=2501"); | 419 SetResponseStatusAndString(net::HTTP_GATEWAY_TIMEOUT, "token=2501"); |
420 CompleteFetch(); | 420 CompleteFetch(); |
421 | 421 |
422 EXPECT_TRUE(callback_called_); | 422 EXPECT_TRUE(callback_called_); |
423 EXPECT_EQ(RegistrationRequest::REACHED_MAX_RETRIES, status_); | 423 EXPECT_EQ(RegistrationRequest::REACHED_MAX_RETRIES, status_); |
424 EXPECT_EQ(std::string(), registration_id_); | 424 EXPECT_EQ(std::string(), registration_id_); |
425 } | 425 } |
426 | 426 |
427 } // namespace gcm | 427 } // namespace gcm |
OLD | NEW |