| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 CaptivePortalResult captive_portal_result() const { | 48 CaptivePortalResult captive_portal_result() const { |
| 49 return captive_portal_result_; | 49 return captive_portal_result_; |
| 50 } | 50 } |
| 51 | 51 |
| 52 int num_results_received() const { return num_results_received_; } | 52 int num_results_received() const { return num_results_received_; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 virtual void Observe(int type, | 55 virtual void Observe(int type, |
| 56 const content::NotificationSource& source, | 56 const content::NotificationSource& source, |
| 57 const content::NotificationDetails& details) OVERRIDE { | 57 const content::NotificationDetails& details) override { |
| 58 ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT); | 58 ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT); |
| 59 ASSERT_EQ(profile_, content::Source<Profile>(source).ptr()); | 59 ASSERT_EQ(profile_, content::Source<Profile>(source).ptr()); |
| 60 | 60 |
| 61 CaptivePortalService::Results *results = | 61 CaptivePortalService::Results *results = |
| 62 content::Details<CaptivePortalService::Results>(details).ptr(); | 62 content::Details<CaptivePortalService::Results>(details).ptr(); |
| 63 | 63 |
| 64 EXPECT_EQ(captive_portal_result_, results->previous_result); | 64 EXPECT_EQ(captive_portal_result_, results->previous_result); |
| 65 EXPECT_EQ(captive_portal_service_->last_detection_result(), | 65 EXPECT_EQ(captive_portal_service_->last_detection_result(), |
| 66 results->result); | 66 results->result); |
| 67 | 67 |
| (...skipping 448 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 |