| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 registrar_.Add(this, | 44 registrar_.Add(this, |
| 45 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, | 45 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, |
| 46 content::Source<Profile>(profile_)); | 46 content::Source<Profile>(profile_)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Result captive_portal_result() const { return captive_portal_result_; } | 49 Result captive_portal_result() const { return captive_portal_result_; } |
| 50 | 50 |
| 51 int num_results_received() const { return num_results_received_; } | 51 int num_results_received() const { return num_results_received_; } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 void Observe(int type, | 54 virtual void Observe(int type, |
| 55 const content::NotificationSource& source, | 55 const content::NotificationSource& source, |
| 56 const content::NotificationDetails& details) { | 56 const content::NotificationDetails& details) OVERRIDE { |
| 57 ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT); | 57 ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT); |
| 58 ASSERT_EQ(profile_, content::Source<Profile>(source).ptr()); | 58 ASSERT_EQ(profile_, content::Source<Profile>(source).ptr()); |
| 59 | 59 |
| 60 CaptivePortalService::Results *results = | 60 CaptivePortalService::Results *results = |
| 61 content::Details<CaptivePortalService::Results>(details).ptr(); | 61 content::Details<CaptivePortalService::Results>(details).ptr(); |
| 62 | 62 |
| 63 EXPECT_EQ(captive_portal_result_, results->previous_result); | 63 EXPECT_EQ(captive_portal_result_, results->previous_result); |
| 64 EXPECT_EQ(captive_portal_service_->last_detection_result(), | 64 EXPECT_EQ(captive_portal_service_->last_detection_result(), |
| 65 results->result); | 65 results->result); |
| 66 | 66 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 510 |
| 511 RunTest(RESULT_NO_RESPONSE, | 511 RunTest(RESULT_NO_RESPONSE, |
| 512 net::OK, | 512 net::OK, |
| 513 503, | 513 503, |
| 514 0, | 514 0, |
| 515 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); | 515 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); |
| 516 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); | 516 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace captive_portal | 519 } // namespace captive_portal |
| OLD | NEW |