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 10 matching lines...) Expand all Loading... |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
23 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 namespace captive_portal { | 27 namespace captive_portal { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // A short amount of time that some tests wait for. | |
32 const int kShortTimeMs = 10; | |
33 | |
34 // An observer watches the CaptivePortalDetector. It tracks the last | 31 // An observer watches the CaptivePortalDetector. It tracks the last |
35 // received result and the total number of received results. | 32 // received result and the total number of received results. |
36 class CaptivePortalObserver : public content::NotificationObserver { | 33 class CaptivePortalObserver : public content::NotificationObserver { |
37 public: | 34 public: |
38 CaptivePortalObserver(Profile* profile, | 35 CaptivePortalObserver(Profile* profile, |
39 CaptivePortalService* captive_portal_service) | 36 CaptivePortalService* captive_portal_service) |
40 : captive_portal_result_( | 37 : captive_portal_result_( |
41 captive_portal_service->last_detection_result()), | 38 captive_portal_service->last_detection_result()), |
42 num_results_received_(0), | 39 num_results_received_(0), |
43 profile_(profile), | 40 profile_(profile), |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 508 |
512 RunTest(RESULT_NO_RESPONSE, | 509 RunTest(RESULT_NO_RESPONSE, |
513 net::OK, | 510 net::OK, |
514 503, | 511 503, |
515 0, | 512 0, |
516 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); | 513 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); |
517 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); | 514 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); |
518 } | 515 } |
519 | 516 |
520 } // namespace captive_portal | 517 } // namespace captive_portal |
OLD | NEW |