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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // destroys it. | 66 // destroys it. |
67 explicit MockInterstitialPageDelegate( | 67 explicit MockInterstitialPageDelegate( |
68 content::WebContents* web_contents) { | 68 content::WebContents* web_contents) { |
69 content::InterstitialPage* interstitial_page = | 69 content::InterstitialPage* interstitial_page = |
70 content::InterstitialPage::Create( | 70 content::InterstitialPage::Create( |
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 ~MockInterstitialPageDelegate() override {} |
77 } | |
78 | 77 |
79 private: | 78 private: |
80 // InterstitialPageDelegate implementation: | 79 // InterstitialPageDelegate implementation: |
81 virtual std::string GetHTMLContents() override { | 80 std::string GetHTMLContents() override { return "HTML Contents"; } |
82 return "HTML Contents"; | |
83 } | |
84 | 81 |
85 DISALLOW_COPY_AND_ASSIGN(MockInterstitialPageDelegate); | 82 DISALLOW_COPY_AND_ASSIGN(MockInterstitialPageDelegate); |
86 }; | 83 }; |
87 | 84 |
88 class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { | 85 class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { |
89 public: | 86 public: |
90 // testing::Test: | 87 // testing::Test: |
91 virtual void SetUp() override { | 88 virtual void SetUp() override { |
92 ChromeRenderViewHostTestHarness::SetUp(); | 89 ChromeRenderViewHostTestHarness::SetUp(); |
93 tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( | 90 tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 696 |
700 // There should be no captive portal check pending after the redirect. | 697 // There should be no captive portal check pending after the redirect. |
701 base::MessageLoop::current()->RunUntilIdle(); | 698 base::MessageLoop::current()->RunUntilIdle(); |
702 | 699 |
703 // Logging in shouldn't do anything. | 700 // Logging in shouldn't do anything. |
704 tab_reloader().OnCaptivePortalResults( | 701 tab_reloader().OnCaptivePortalResults( |
705 captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, | 702 captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, |
706 captive_portal::RESULT_INTERNET_CONNECTED); | 703 captive_portal::RESULT_INTERNET_CONNECTED); |
707 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, tab_reloader().state()); | 704 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, tab_reloader().state()); |
708 } | 705 } |
OLD | NEW |