| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/captive_portal/captive_portal_service.h" | 5 #include "chrome/browser/captive_portal/captive_portal_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } // namespace | 83 } // namespace |
| 84 | 84 |
| 85 class CaptivePortalServiceTest : public testing::Test, | 85 class CaptivePortalServiceTest : public testing::Test, |
| 86 public CaptivePortalDetectorTestBase { | 86 public CaptivePortalDetectorTestBase { |
| 87 public: | 87 public: |
| 88 CaptivePortalServiceTest() | 88 CaptivePortalServiceTest() |
| 89 : old_captive_portal_testing_state_( | 89 : old_captive_portal_testing_state_( |
| 90 CaptivePortalService::get_state_for_testing()) { | 90 CaptivePortalService::get_state_for_testing()) { |
| 91 } | 91 } |
| 92 | 92 |
| 93 virtual ~CaptivePortalServiceTest() { | 93 ~CaptivePortalServiceTest() override { |
| 94 CaptivePortalService::set_state_for_testing( | 94 CaptivePortalService::set_state_for_testing( |
| 95 old_captive_portal_testing_state_); | 95 old_captive_portal_testing_state_); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // |enable_service| is whether or not the captive portal service itself | 98 // |enable_service| is whether or not the captive portal service itself |
| 99 // should be disabled. This is different from enabling the captive portal | 99 // should be disabled. This is different from enabling the captive portal |
| 100 // detection preference. | 100 // detection preference. |
| 101 void Initialize(CaptivePortalService::TestingState testing_state) { | 101 void Initialize(CaptivePortalService::TestingState testing_state) { |
| 102 CaptivePortalService::set_state_for_testing(testing_state); | 102 CaptivePortalService::set_state_for_testing(testing_state); |
| 103 | 103 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 base::Time::FromString("Tue, 17 Apr 2012 18:02:00 GMT", &start_time)); | 516 base::Time::FromString("Tue, 17 Apr 2012 18:02:00 GMT", &start_time)); |
| 517 SetTime(start_time); | 517 SetTime(start_time); |
| 518 | 518 |
| 519 RunTest(captive_portal::RESULT_NO_RESPONSE, | 519 RunTest(captive_portal::RESULT_NO_RESPONSE, |
| 520 net::OK, | 520 net::OK, |
| 521 503, | 521 503, |
| 522 0, | 522 0, |
| 523 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); | 523 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); |
| 524 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); | 524 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); |
| 525 } | 525 } |
| OLD | NEW |