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_helper.h" | 5 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/captive_portal/captive_portal_service.h" | 9 #include "chrome/browser/captive_portal/captive_portal_service.h" |
10 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" | 10 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // the harness in any other way. | 65 // the harness in any other way. |
66 class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness { | 66 class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness { |
67 public: | 67 public: |
68 CaptivePortalTabHelperTest() | 68 CaptivePortalTabHelperTest() |
69 : tab_helper_(NULL), | 69 : tab_helper_(NULL), |
70 mock_reloader_(new testing::StrictMock<MockCaptivePortalTabReloader>) { | 70 mock_reloader_(new testing::StrictMock<MockCaptivePortalTabReloader>) { |
71 tab_helper_.SetTabReloaderForTest(mock_reloader_); | 71 tab_helper_.SetTabReloaderForTest(mock_reloader_); |
72 } | 72 } |
73 virtual ~CaptivePortalTabHelperTest() {} | 73 virtual ~CaptivePortalTabHelperTest() {} |
74 | 74 |
75 virtual void SetUp() OVERRIDE { | 75 virtual void SetUp() override { |
76 ChromeRenderViewHostTestHarness::SetUp(); | 76 ChromeRenderViewHostTestHarness::SetUp(); |
77 web_contents1_.reset(CreateTestWebContents()); | 77 web_contents1_.reset(CreateTestWebContents()); |
78 web_contents2_.reset(CreateTestWebContents()); | 78 web_contents2_.reset(CreateTestWebContents()); |
79 } | 79 } |
80 | 80 |
81 virtual void TearDown() OVERRIDE { | 81 virtual void TearDown() override { |
82 web_contents2_.reset(NULL); | 82 web_contents2_.reset(NULL); |
83 web_contents1_.reset(NULL); | 83 web_contents1_.reset(NULL); |
84 ChromeRenderViewHostTestHarness::TearDown(); | 84 ChromeRenderViewHostTestHarness::TearDown(); |
85 } | 85 } |
86 | 86 |
87 // Simulates a successful load of |url|. | 87 // Simulates a successful load of |url|. |
88 void SimulateSuccess(const GURL& url, | 88 void SimulateSuccess(const GURL& url, |
89 content::RenderViewHost* render_view_host) { | 89 content::RenderViewHost* render_view_host) { |
90 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); | 90 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); |
91 tab_helper().DidStartProvisionalLoadForFrame( | 91 tab_helper().DidStartProvisionalLoadForFrame( |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 EXPECT_FALSE(tab_helper().IsLoginTab()); | 632 EXPECT_FALSE(tab_helper().IsLoginTab()); |
633 | 633 |
634 ObservePortalResult(captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, | 634 ObservePortalResult(captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, |
635 captive_portal::RESULT_NO_RESPONSE); | 635 captive_portal::RESULT_NO_RESPONSE); |
636 EXPECT_FALSE(tab_helper().IsLoginTab()); | 636 EXPECT_FALSE(tab_helper().IsLoginTab()); |
637 | 637 |
638 ObservePortalResult(captive_portal::RESULT_NO_RESPONSE, | 638 ObservePortalResult(captive_portal::RESULT_NO_RESPONSE, |
639 captive_portal::RESULT_INTERNET_CONNECTED); | 639 captive_portal::RESULT_INTERNET_CONNECTED); |
640 EXPECT_FALSE(tab_helper().IsLoginTab()); | 640 EXPECT_FALSE(tab_helper().IsLoginTab()); |
641 } | 641 } |
OLD | NEW |