| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 private: | 78 private: |
| 79 // InterstitialPageDelegate implementation: | 79 // InterstitialPageDelegate implementation: |
| 80 std::string GetHTMLContents() override { return "HTML Contents"; } | 80 std::string GetHTMLContents() override { return "HTML Contents"; } |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(MockInterstitialPageDelegate); | 82 DISALLOW_COPY_AND_ASSIGN(MockInterstitialPageDelegate); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { | 85 class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { |
| 86 public: | 86 public: |
| 87 // testing::Test: | 87 // testing::Test: |
| 88 virtual void SetUp() override { | 88 void SetUp() override { |
| 89 ChromeRenderViewHostTestHarness::SetUp(); | 89 ChromeRenderViewHostTestHarness::SetUp(); |
| 90 tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( | 90 tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( |
| 91 web_contents())); | 91 web_contents())); |
| 92 | 92 |
| 93 // Most tests don't run the message loop, so don't use a timer for them. | 93 // Most tests don't run the message loop, so don't use a timer for them. |
| 94 tab_reloader_->set_slow_ssl_load_time(base::TimeDelta()); | 94 tab_reloader_->set_slow_ssl_load_time(base::TimeDelta()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 virtual void TearDown() override { | 97 void TearDown() override { |
| 98 EXPECT_FALSE(tab_reloader().TimerRunning()); | 98 EXPECT_FALSE(tab_reloader().TimerRunning()); |
| 99 tab_reloader_.reset(NULL); | 99 tab_reloader_.reset(NULL); |
| 100 ChromeRenderViewHostTestHarness::TearDown(); | 100 ChromeRenderViewHostTestHarness::TearDown(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 TestCaptivePortalTabReloader& tab_reloader() { return *tab_reloader_.get(); } | 103 TestCaptivePortalTabReloader& tab_reloader() { return *tab_reloader_.get(); } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 scoped_ptr<TestCaptivePortalTabReloader> tab_reloader_; | 106 scoped_ptr<TestCaptivePortalTabReloader> tab_reloader_; |
| 107 }; | 107 }; |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 696 |
| 697 // There should be no captive portal check pending after the redirect. | 697 // There should be no captive portal check pending after the redirect. |
| 698 base::MessageLoop::current()->RunUntilIdle(); | 698 base::MessageLoop::current()->RunUntilIdle(); |
| 699 | 699 |
| 700 // Logging in shouldn't do anything. | 700 // Logging in shouldn't do anything. |
| 701 tab_reloader().OnCaptivePortalResults( | 701 tab_reloader().OnCaptivePortalResults( |
| 702 captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, | 702 captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, |
| 703 captive_portal::RESULT_INTERNET_CONNECTED); | 703 captive_portal::RESULT_INTERNET_CONNECTED); |
| 704 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, tab_reloader().state()); | 704 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, tab_reloader().state()); |
| 705 } | 705 } |
| OLD | NEW |