| 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_tab_reloader.h" | 5 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/captive_portal/captive_portal_service.h" | 9 #include "chrome/browser/captive_portal/captive_portal_service.h" |
| 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 web_contents, true, GURL("http://blah"), this); | 71 web_contents, true, GURL("http://blah"), this); |
| 72 interstitial_page->DontCreateViewForTesting(); | 72 interstitial_page->DontCreateViewForTesting(); |
| 73 interstitial_page->Show(); | 73 interstitial_page->Show(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual ~MockInterstitialPageDelegate() { | 76 virtual ~MockInterstitialPageDelegate() { |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // InterstitialPageDelegate implementation: | 80 // InterstitialPageDelegate implementation: |
| 81 virtual std::string GetHTMLContents() OVERRIDE { | 81 virtual std::string GetHTMLContents() override { |
| 82 return "HTML Contents"; | 82 return "HTML Contents"; |
| 83 } | 83 } |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(MockInterstitialPageDelegate); | 85 DISALLOW_COPY_AND_ASSIGN(MockInterstitialPageDelegate); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { | 88 class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { |
| 89 public: | 89 public: |
| 90 // testing::Test: | 90 // testing::Test: |
| 91 virtual void SetUp() OVERRIDE { | 91 virtual void SetUp() override { |
| 92 ChromeRenderViewHostTestHarness::SetUp(); | 92 ChromeRenderViewHostTestHarness::SetUp(); |
| 93 tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( | 93 tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( |
| 94 web_contents())); | 94 web_contents())); |
| 95 | 95 |
| 96 // Most tests don't run the message loop, so don't use a timer for them. | 96 // Most tests don't run the message loop, so don't use a timer for them. |
| 97 tab_reloader_->set_slow_ssl_load_time(base::TimeDelta()); | 97 tab_reloader_->set_slow_ssl_load_time(base::TimeDelta()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 virtual void TearDown() OVERRIDE { | 100 virtual void TearDown() override { |
| 101 EXPECT_FALSE(tab_reloader().TimerRunning()); | 101 EXPECT_FALSE(tab_reloader().TimerRunning()); |
| 102 tab_reloader_.reset(NULL); | 102 tab_reloader_.reset(NULL); |
| 103 ChromeRenderViewHostTestHarness::TearDown(); | 103 ChromeRenderViewHostTestHarness::TearDown(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 TestCaptivePortalTabReloader& tab_reloader() { return *tab_reloader_.get(); } | 106 TestCaptivePortalTabReloader& tab_reloader() { return *tab_reloader_.get(); } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 scoped_ptr<TestCaptivePortalTabReloader> tab_reloader_; | 109 scoped_ptr<TestCaptivePortalTabReloader> tab_reloader_; |
| 110 }; | 110 }; |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 | 699 |
| 700 // There should be no captive portal check pending after the redirect. | 700 // There should be no captive portal check pending after the redirect. |
| 701 base::MessageLoop::current()->RunUntilIdle(); | 701 base::MessageLoop::current()->RunUntilIdle(); |
| 702 | 702 |
| 703 // Logging in shouldn't do anything. | 703 // Logging in shouldn't do anything. |
| 704 tab_reloader().OnCaptivePortalResults( | 704 tab_reloader().OnCaptivePortalResults( |
| 705 captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, | 705 captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, |
| 706 captive_portal::RESULT_INTERNET_CONNECTED); | 706 captive_portal::RESULT_INTERNET_CONNECTED); |
| 707 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, tab_reloader().state()); | 707 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, tab_reloader().state()); |
| 708 } | 708 } |
| OLD | NEW |