Chromium Code Reviews| 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 "chrome/browser/captive_portal/captive_portal_service.h" | 8 #include "chrome/browser/captive_portal/captive_portal_service.h" |
| 9 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" | 9 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "content/public/browser/notification_details.h" | 11 #include "content/public/browser/notification_details.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/browser/notification_source.h" | 13 #include "content/public/browser/notification_source.h" |
| 14 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace captive_portal { | 19 namespace captive_portal { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 const char* const kHttpUrl = "http://whatever.com/"; | 23 const char* const kHttpUrl = "http://whatever.com/"; |
| 24 const char* const kHttpsUrl = "https://whatever.com/"; | 24 const char* const kHttpsUrl = "https://whatever.com/"; |
| 25 | |
| 26 // Used for cross-process navigations. Shouldn't actually matter whether this | |
| 27 // is different from kHttpsUrl, but best to keep things consistent. | |
| 28 const char* const kHttpsUrl2 = "https://cross_process.com/"; | |
| 29 | |
| 25 // Error pages use a "data:" URL. Shouldn't actually matter what this is. | 30 // Error pages use a "data:" URL. Shouldn't actually matter what this is. |
| 26 const char* const kErrorPageUrl = "data:blah"; | 31 const char* const kErrorPageUrl = "data:blah"; |
| 27 | 32 |
| 33 // Some navigations behave differently depending on if they're cross-process | |
| 34 // or not. | |
| 35 enum NavigationType { | |
| 36 kSameProcess, | |
| 37 kCrossProcess, | |
| 38 }; | |
| 39 | |
| 28 } // namespace | 40 } // namespace |
| 29 | 41 |
| 30 class MockCaptivePortalTabReloader : public CaptivePortalTabReloader { | 42 class MockCaptivePortalTabReloader : public CaptivePortalTabReloader { |
| 31 public: | 43 public: |
| 32 MockCaptivePortalTabReloader() | 44 MockCaptivePortalTabReloader() |
| 33 : CaptivePortalTabReloader(NULL, NULL, base::Callback<void()>()) { | 45 : CaptivePortalTabReloader(NULL, NULL, base::Callback<void()>()) { |
| 34 } | 46 } |
| 35 | 47 |
| 36 MOCK_METHOD1(OnLoadStart, void(bool)); | 48 MOCK_METHOD1(OnLoadStart, void(bool)); |
| 37 MOCK_METHOD1(OnLoadCommitted, void(int)); | 49 MOCK_METHOD1(OnLoadCommitted, void(int)); |
| 38 MOCK_METHOD0(OnAbort, void()); | 50 MOCK_METHOD0(OnAbort, void()); |
| 39 MOCK_METHOD1(OnRedirect, void(bool)); | 51 MOCK_METHOD1(OnRedirect, void(bool)); |
| 40 MOCK_METHOD2(OnCaptivePortalResults, void(Result, Result)); | 52 MOCK_METHOD2(OnCaptivePortalResults, void(Result, Result)); |
| 41 }; | 53 }; |
| 42 | 54 |
| 55 class TestCaptivePortalTabHelper : public CaptivePortalTabHelper { | |
| 56 public: | |
| 57 TestCaptivePortalTabHelper() : CaptivePortalTabHelper(NULL, NULL) { | |
| 58 } | |
| 59 | |
| 60 private: | |
| 61 friend class CaptivePortalTabHelperTest; | |
| 62 | |
| 63 // The child id of the provisional RenderViewHost is just the "address" | |
| 64 // of the fake pointer as an integer. | |
| 65 virtual int GetProvisionalChildID() const OVERRIDE { | |
|
cbentzel
2012/08/15 17:00:38
This is rather gross. I assume that it is difficul
mmenke
2012/08/16 14:30:03
Oh, that works. For some reason, I was under the
| |
| 66 if (!provisional_render_view_host()) | |
| 67 return -1; | |
| 68 return static_cast<int>( | |
| 69 reinterpret_cast<size_t>(provisional_render_view_host())); | |
| 70 } | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(TestCaptivePortalTabHelper); | |
| 73 }; | |
| 74 | |
| 43 class CaptivePortalTabHelperTest : public testing::Test { | 75 class CaptivePortalTabHelperTest : public testing::Test { |
| 44 public: | 76 public: |
| 45 CaptivePortalTabHelperTest() | 77 CaptivePortalTabHelperTest() |
| 46 : tab_helper_(NULL, NULL), | 78 : fake_render_view_host1_(reinterpret_cast<content::RenderViewHost*>(1)), |
| 79 fake_render_view_host2_(reinterpret_cast<content::RenderViewHost*>(2)), | |
| 47 mock_reloader_(new testing::StrictMock<MockCaptivePortalTabReloader>) { | 80 mock_reloader_(new testing::StrictMock<MockCaptivePortalTabReloader>) { |
| 48 tab_helper_.SetTabReloaderForTest(mock_reloader_); | 81 tab_helper_.SetTabReloaderForTest(mock_reloader_); |
| 49 } | 82 } |
| 50 virtual ~CaptivePortalTabHelperTest() {} | 83 virtual ~CaptivePortalTabHelperTest() {} |
| 51 | 84 |
| 52 // Simulates a successful load of |url|. | 85 // Simulates a successful load of |url|. |
| 53 void SimulateSuccess(const GURL& url) { | 86 void SimulateSuccess(const GURL& url, |
| 87 content::RenderViewHost* render_view_host) { | |
| 54 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); | 88 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); |
| 55 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, NULL); | 89 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, |
| 90 render_view_host); | |
| 56 | 91 |
| 57 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); | 92 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); |
| 58 tab_helper().DidCommitProvisionalLoadForFrame( | 93 tab_helper().DidCommitProvisionalLoadForFrame( |
| 59 1, true, url, content::PAGE_TRANSITION_LINK, NULL); | 94 1, true, url, content::PAGE_TRANSITION_LINK, render_view_host); |
| 60 } | 95 } |
| 61 | 96 |
| 62 // Simulates a connection timeout while requesting |url|. | 97 // Simulates a connection timeout while requesting |url|. |
| 63 void SimulateTimeout(const GURL& url) { | 98 void SimulateTimeout(const GURL& url, |
| 99 content::RenderViewHost* render_view_host) { | |
| 64 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); | 100 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); |
| 65 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, NULL); | 101 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, |
| 102 render_view_host); | |
| 66 | 103 |
| 67 tab_helper().DidFailProvisionalLoad( | 104 tab_helper().DidFailProvisionalLoad( |
| 68 1, true, url, net::ERR_TIMED_OUT, string16(), NULL); | 105 1, true, url, net::ERR_TIMED_OUT, string16(), render_view_host); |
| 69 | 106 |
| 70 // Provisional load starts for the error page. | 107 // Provisional load starts for the error page. |
| 71 tab_helper().DidStartProvisionalLoadForFrame( | 108 tab_helper().DidStartProvisionalLoadForFrame( |
| 72 1, true, GURL(kErrorPageUrl), true, NULL); | 109 1, true, GURL(kErrorPageUrl), true, render_view_host); |
| 73 | 110 |
| 74 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1); | 111 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1); |
| 75 tab_helper().DidCommitProvisionalLoadForFrame( | 112 tab_helper().DidCommitProvisionalLoadForFrame( |
| 76 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, NULL); | 113 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, |
| 114 render_view_host); | |
| 77 } | 115 } |
| 78 | 116 |
| 79 // Simulates an abort while requesting |url|. | 117 // Simulates an abort while requesting |url|. |
| 80 void SimulateAbort(const GURL& url) { | 118 void SimulateAbort(const GURL& url, |
| 119 content::RenderViewHost* render_view_host, | |
| 120 NavigationType navigation_type) { | |
| 81 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); | 121 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); |
| 82 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, NULL); | 122 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, |
| 123 render_view_host); | |
| 83 | 124 |
| 84 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); | 125 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); |
| 85 tab_helper().DidFailProvisionalLoad( | 126 if (navigation_type == kSameProcess) { |
| 86 1, true, url, net::ERR_ABORTED, string16(), NULL); | 127 tab_helper().DidFailProvisionalLoad( |
| 128 1, true, url, net::ERR_ABORTED, string16(), render_view_host); | |
| 129 } else { | |
| 130 // For interrupted provisional cross-process navigations, the | |
| 131 // RenderViewHost is destroyed without sending a DidFailProvisionalLoad | |
| 132 // notification. | |
| 133 tab_helper().Observe( | |
| 134 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | |
| 135 content::Source<content::RenderViewHost>(render_view_host), | |
| 136 content::NotificationService::NoDetails()); | |
| 137 } | |
| 138 | |
| 139 // Make sure that above call resulted in abort, for tests that continue | |
| 140 // after the abort. | |
| 141 EXPECT_CALL(mock_reloader(), OnAbort()).Times(0); | |
| 87 } | 142 } |
| 88 | 143 |
| 89 // Simulates an abort while loading an error page. | 144 // Simulates an abort while loading an error page. |
| 90 void SimulateAbortTimeout(const GURL& url) { | 145 void SimulateAbortTimeout(const GURL& url, |
| 146 content::RenderViewHost* render_view_host, | |
| 147 NavigationType navigation_type) { | |
| 91 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); | 148 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); |
| 92 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, NULL); | 149 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, false, |
| 150 render_view_host); | |
| 93 | 151 |
| 94 tab_helper().DidFailProvisionalLoad( | 152 tab_helper().DidFailProvisionalLoad( |
| 95 1, true, url, net::ERR_TIMED_OUT, string16(), NULL); | 153 1, true, url, net::ERR_TIMED_OUT, string16(), render_view_host); |
| 96 | 154 |
| 97 // Start event for the error page. | 155 // Start event for the error page. |
| 98 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, true, NULL); | 156 tab_helper().DidStartProvisionalLoadForFrame(1, true, url, true, |
| 157 render_view_host); | |
| 99 | 158 |
| 100 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); | 159 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); |
| 101 tab_helper().DidFailProvisionalLoad( | 160 if (navigation_type == kSameProcess) { |
| 102 1, true, url, net::ERR_ABORTED, string16(), NULL); | 161 tab_helper().DidFailProvisionalLoad( |
| 162 1, true, url, net::ERR_ABORTED, string16(), render_view_host); | |
| 163 } else { | |
| 164 // For interrupted provisional cross-process navigations, the | |
| 165 // RenderViewHost is destroyed without sending a DidFailProvisionalLoad | |
| 166 // notification. | |
| 167 tab_helper().Observe( | |
| 168 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | |
| 169 content::Source<content::RenderViewHost>(render_view_host), | |
| 170 content::NotificationService::NoDetails()); | |
| 171 } | |
| 172 | |
| 173 // Make sure that above call resulted in abort, for tests that continue | |
| 174 // after the abort. | |
| 175 EXPECT_CALL(mock_reloader(), OnAbort()).Times(0); | |
| 103 } | 176 } |
| 104 | 177 |
| 105 CaptivePortalTabHelper& tab_helper() { | 178 TestCaptivePortalTabHelper& tab_helper() { |
| 106 return tab_helper_; | 179 return tab_helper_; |
| 107 } | 180 } |
| 108 | 181 |
| 109 // Simulates a captive portal redirect by calling the Observe method. | 182 // Simulates a captive portal redirect by calling the Observe method. |
| 110 void ObservePortalResult(Result previous_result, Result result) { | 183 void ObservePortalResult(Result previous_result, Result result) { |
| 111 content::Source<Profile> source_profile(NULL); | 184 content::Source<Profile> source_profile(NULL); |
| 112 | 185 |
| 113 CaptivePortalService::Results results; | 186 CaptivePortalService::Results results; |
| 114 results.previous_result = previous_result; | 187 results.previous_result = previous_result; |
| 115 results.result = result; | 188 results.result = result; |
| 116 content::Details<CaptivePortalService::Results> details_results(&results); | 189 content::Details<CaptivePortalService::Results> details_results(&results); |
| 117 | 190 |
| 118 EXPECT_CALL(mock_reloader(), OnCaptivePortalResults(previous_result, | 191 EXPECT_CALL(mock_reloader(), OnCaptivePortalResults(previous_result, |
| 119 result)).Times(1); | 192 result)).Times(1); |
| 120 tab_helper().Observe(chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, | 193 tab_helper().Observe(chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, |
| 121 source_profile, | 194 source_profile, |
| 122 details_results); | 195 details_results); |
| 123 } | 196 } |
| 124 | 197 |
| 125 // Simulates a redirect. Uses OnRedirect rather than Observe, for simplicity. | 198 // Simulates a redirect. Uses OnRedirect rather than Observe, for simplicity. |
| 126 void OnRedirect(int64 frame_id, const GURL& new_url) { | 199 void OnRedirect(ResourceType::Type type, const GURL& new_url, int child_id) { |
| 127 content::Source<content::WebContents> source_contents(NULL); | 200 tab_helper().OnRedirect(child_id, type, new_url); |
| 128 | |
| 129 tab_helper().OnRedirect(frame_id, new_url); | |
| 130 } | 201 } |
| 131 | 202 |
| 132 MockCaptivePortalTabReloader& mock_reloader() { return *mock_reloader_; } | 203 MockCaptivePortalTabReloader& mock_reloader() { return *mock_reloader_; } |
| 133 | 204 |
| 134 void SetIsLoginTab() { | 205 void SetIsLoginTab() { |
| 135 tab_helper().SetIsLoginTab(); | 206 tab_helper().SetIsLoginTab(); |
| 136 } | 207 } |
| 137 | 208 |
| 209 content::RenderViewHost* fake_render_view_host1() { | |
| 210 return fake_render_view_host1_; | |
| 211 } | |
| 212 | |
| 213 content::RenderViewHost* fake_render_view_host2() { | |
| 214 return fake_render_view_host2_; | |
| 215 } | |
| 216 | |
| 138 private: | 217 private: |
| 139 CaptivePortalTabHelper tab_helper_; | 218 // Fake RenderViewHost pointers. Non-NULL and distinct, can't be |
| 219 // dereferenced. Two are needed to simulate cross-process navigations. | |
| 220 content::RenderViewHost* fake_render_view_host1_; | |
| 221 content::RenderViewHost* fake_render_view_host2_; | |
| 222 | |
| 223 TestCaptivePortalTabHelper tab_helper_; | |
| 140 | 224 |
| 141 // Owned by |tab_helper_|. | 225 // Owned by |tab_helper_|. |
| 142 testing::StrictMock<MockCaptivePortalTabReloader>* mock_reloader_; | 226 testing::StrictMock<MockCaptivePortalTabReloader>* mock_reloader_; |
| 143 | 227 |
| 144 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabHelperTest); | 228 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabHelperTest); |
| 145 }; | 229 }; |
| 146 | 230 |
| 147 TEST_F(CaptivePortalTabHelperTest, HttpSuccess) { | 231 TEST_F(CaptivePortalTabHelperTest, HttpSuccess) { |
| 148 SimulateSuccess(GURL(kHttpUrl)); | 232 SimulateSuccess(GURL(kHttpUrl), fake_render_view_host1()); |
| 149 tab_helper().DidStopLoading(NULL); | 233 tab_helper().DidStopLoading(fake_render_view_host1()); |
| 150 } | 234 } |
| 151 | 235 |
| 152 TEST_F(CaptivePortalTabHelperTest, HttpTimeout) { | 236 TEST_F(CaptivePortalTabHelperTest, HttpTimeout) { |
| 153 SimulateTimeout(GURL(kHttpUrl)); | 237 SimulateTimeout(GURL(kHttpUrl), fake_render_view_host1()); |
| 154 tab_helper().DidStopLoading(NULL); | 238 tab_helper().DidStopLoading(fake_render_view_host1()); |
| 155 } | 239 } |
| 156 | 240 |
| 157 // Same as above, but simulates what happens when the Link Doctor is enabled, | 241 // Same as above, but simulates what happens when the Link Doctor is enabled, |
| 158 // which adds another provisional load/commit for the error page, after the | 242 // which adds another provisional load/commit for the error page, after the |
| 159 // first two. | 243 // first two. |
| 160 TEST_F(CaptivePortalTabHelperTest, HttpTimeoutLinkDoctor) { | 244 TEST_F(CaptivePortalTabHelperTest, HttpTimeoutLinkDoctor) { |
| 161 SimulateTimeout(GURL(kHttpUrl)); | 245 SimulateTimeout(GURL(kHttpUrl), fake_render_view_host1()); |
| 162 | 246 |
| 163 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); | 247 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); |
| 164 // Provisional load starts for the error page. | 248 // Provisional load starts for the error page. |
| 165 tab_helper().DidStartProvisionalLoadForFrame( | 249 tab_helper().DidStartProvisionalLoadForFrame( |
| 166 1, true, GURL(kErrorPageUrl), true, NULL); | 250 1, true, GURL(kErrorPageUrl), true, fake_render_view_host1()); |
| 167 | 251 |
| 168 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); | 252 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); |
| 169 tab_helper().DidCommitProvisionalLoadForFrame( | 253 tab_helper().DidCommitProvisionalLoadForFrame( |
| 170 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, NULL); | 254 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, |
| 171 tab_helper().DidStopLoading(NULL); | 255 fake_render_view_host1()); |
| 256 tab_helper().DidStopLoading(fake_render_view_host1()); | |
| 172 } | 257 } |
| 173 | 258 |
| 174 TEST_F(CaptivePortalTabHelperTest, HttpsSuccess) { | 259 TEST_F(CaptivePortalTabHelperTest, HttpsSuccess) { |
| 175 SimulateSuccess(GURL(kHttpsUrl)); | 260 SimulateSuccess(GURL(kHttpsUrl), fake_render_view_host1()); |
| 176 tab_helper().DidStopLoading(NULL); | 261 tab_helper().DidStopLoading(fake_render_view_host1()); |
| 177 EXPECT_FALSE(tab_helper().IsLoginTab()); | 262 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 178 } | 263 } |
| 179 | 264 |
| 180 TEST_F(CaptivePortalTabHelperTest, HttpsTimeout) { | 265 TEST_F(CaptivePortalTabHelperTest, HttpsTimeout) { |
| 181 SimulateTimeout(GURL(kHttpsUrl)); | 266 SimulateTimeout(GURL(kHttpsUrl), fake_render_view_host1()); |
| 182 // Make sure no state was carried over from the timeout. | 267 // Make sure no state was carried over from the timeout. |
| 183 SimulateSuccess(GURL(kHttpsUrl)); | 268 SimulateSuccess(GURL(kHttpsUrl), fake_render_view_host1()); |
| 184 EXPECT_FALSE(tab_helper().IsLoginTab()); | 269 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 185 } | 270 } |
| 186 | 271 |
| 187 TEST_F(CaptivePortalTabHelperTest, HttpsAbort) { | 272 TEST_F(CaptivePortalTabHelperTest, HttpsAbort) { |
| 188 SimulateAbort(GURL(kHttpsUrl)); | 273 SimulateAbort(GURL(kHttpsUrl), fake_render_view_host1(), kSameProcess); |
| 189 // Make sure no state was carried over from the abort. | 274 // Make sure no state was carried over from the abort. |
| 190 SimulateSuccess(GURL(kHttpsUrl)); | 275 SimulateSuccess(GURL(kHttpsUrl), fake_render_view_host1()); |
| 276 EXPECT_FALSE(tab_helper().IsLoginTab()); | |
| 277 } | |
| 278 | |
| 279 // A cross-process navigation is aborted by a same-site navigation. | |
| 280 TEST_F(CaptivePortalTabHelperTest, AbortCrossProcess) { | |
| 281 SimulateAbort(GURL(kHttpsUrl2), fake_render_view_host2(), kCrossProcess); | |
| 282 // Make sure no state was carried over from the abort. | |
| 283 SimulateSuccess(GURL(kHttpUrl), fake_render_view_host1()); | |
| 191 EXPECT_FALSE(tab_helper().IsLoginTab()); | 284 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 192 } | 285 } |
| 193 | 286 |
| 194 // Abort while there's a provisional timeout error page loading. | 287 // Abort while there's a provisional timeout error page loading. |
| 195 TEST_F(CaptivePortalTabHelperTest, HttpsAbortTimeout) { | 288 TEST_F(CaptivePortalTabHelperTest, HttpsAbortTimeout) { |
| 196 SimulateAbortTimeout(GURL(kHttpsUrl)); | 289 SimulateAbortTimeout(GURL(kHttpsUrl), fake_render_view_host1(), kSameProcess); |
| 197 // Make sure no state was carried over from the timeout or the abort. | 290 // Make sure no state was carried over from the timeout or the abort. |
| 198 SimulateSuccess(GURL(kHttpsUrl)); | 291 SimulateSuccess(GURL(kHttpsUrl), fake_render_view_host1()); |
| 199 EXPECT_FALSE(tab_helper().IsLoginTab()); | 292 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 200 } | 293 } |
| 201 | 294 |
| 295 // Abort a cross-process navigation while there's a provisional timeout error | |
| 296 // page loading. | |
| 297 TEST_F(CaptivePortalTabHelperTest, AbortTimeoutCrossProcess) { | |
| 298 SimulateAbortTimeout(GURL(kHttpsUrl2), fake_render_view_host2(), | |
| 299 kCrossProcess); | |
| 300 // Make sure no state was carried over from the timeout or the abort. | |
| 301 SimulateSuccess(GURL(kHttpsUrl), fake_render_view_host1()); | |
| 302 EXPECT_FALSE(tab_helper().IsLoginTab()); | |
| 303 } | |
| 304 | |
| 305 // Opposite case from above - a same-process error page is aborted in favor of | |
| 306 // a cross-process one. | |
| 307 TEST_F(CaptivePortalTabHelperTest, HttpsAbortTimeoutForCrossProcess) { | |
| 308 SimulateAbortTimeout(GURL(kHttpsUrl), fake_render_view_host1(), kSameProcess); | |
| 309 // Make sure no state was carried over from the timeout or the abort. | |
| 310 SimulateSuccess(GURL(kHttpsUrl2), fake_render_view_host2()); | |
| 311 EXPECT_FALSE(tab_helper().IsLoginTab()); | |
| 312 } | |
| 313 | |
| 314 // A provisional same-site navigation is interrupted by a cross-process | |
| 315 // navigation without sending an abort first. | |
| 316 TEST_F(CaptivePortalTabHelperTest, UnexpectedProvisionalLoad) { | |
| 317 GURL same_site_url = GURL(kHttpUrl); | |
| 318 GURL cross_process_url = GURL(kHttpsUrl2); | |
| 319 | |
| 320 // A same-site load for the original RenderViewHost starts. | |
| 321 EXPECT_CALL(mock_reloader(), | |
| 322 OnLoadStart(same_site_url.SchemeIsSecure())).Times(1); | |
| 323 tab_helper().DidStartProvisionalLoadForFrame(1, true, same_site_url, false, | |
| 324 fake_render_view_host1()); | |
| 325 | |
| 326 // It's unexpectedly interrupted by a cross-process navigation, which starts | |
| 327 // navigating before the old navigation cancels. We generate an abort message | |
| 328 // for the old navigation. | |
| 329 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); | |
| 330 EXPECT_CALL(mock_reloader(), | |
| 331 OnLoadStart(cross_process_url.SchemeIsSecure())).Times(1); | |
| 332 tab_helper().DidStartProvisionalLoadForFrame(1, true, cross_process_url, | |
| 333 false, fake_render_view_host2()); | |
| 334 | |
| 335 // The cross-process navigation fails. | |
| 336 tab_helper().DidFailProvisionalLoad( | |
| 337 1, true, cross_process_url, net::ERR_FAILED, string16(), | |
| 338 fake_render_view_host2()); | |
| 339 | |
| 340 // The same-site navigation finally is aborted. | |
| 341 tab_helper().DidFailProvisionalLoad( | |
| 342 1, true, same_site_url, net::ERR_ABORTED, string16(), | |
| 343 fake_render_view_host1()); | |
| 344 | |
| 345 // The provisional load starts for the error page for the cross-process | |
| 346 // navigation. | |
| 347 tab_helper().DidStartProvisionalLoadForFrame( | |
| 348 1, true, GURL(kErrorPageUrl), true, fake_render_view_host2()); | |
| 349 | |
| 350 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_FAILED)).Times(1); | |
| 351 tab_helper().DidCommitProvisionalLoadForFrame( | |
| 352 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_TYPED, | |
| 353 fake_render_view_host2()); | |
| 354 } | |
| 355 | |
| 356 // Similar to the above test, except the original RenderViewHost manages to | |
| 357 // commit before its navigation is aborted. | |
| 358 TEST_F(CaptivePortalTabHelperTest, UnexpectedCommit) { | |
| 359 GURL same_site_url = GURL(kHttpUrl); | |
| 360 GURL cross_process_url = GURL(kHttpsUrl2); | |
| 361 | |
| 362 // A same-site load for the original RenderViewHost starts. | |
| 363 EXPECT_CALL(mock_reloader(), | |
| 364 OnLoadStart(same_site_url.SchemeIsSecure())).Times(1); | |
| 365 tab_helper().DidStartProvisionalLoadForFrame(1, true, same_site_url, false, | |
| 366 fake_render_view_host1()); | |
| 367 | |
| 368 // It's unexpectedly interrupted by a cross-process navigation, which starts | |
| 369 // navigating before the old navigation cancels. We generate an abort message | |
| 370 // for the old navigation. | |
| 371 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); | |
| 372 EXPECT_CALL(mock_reloader(), | |
| 373 OnLoadStart(cross_process_url.SchemeIsSecure())).Times(1); | |
| 374 tab_helper().DidStartProvisionalLoadForFrame(1, true, cross_process_url, | |
| 375 false, fake_render_view_host2()); | |
| 376 | |
| 377 // The cross-process navigation fails. | |
| 378 tab_helper().DidFailProvisionalLoad( | |
| 379 1, true, cross_process_url, net::ERR_FAILED, string16(), | |
| 380 fake_render_view_host2()); | |
| 381 | |
| 382 // The same-site navigation succeeds. | |
| 383 EXPECT_CALL(mock_reloader(), OnAbort()).Times(1); | |
| 384 EXPECT_CALL(mock_reloader(), | |
| 385 OnLoadStart(same_site_url.SchemeIsSecure())).Times(1); | |
| 386 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); | |
| 387 tab_helper().DidCommitProvisionalLoadForFrame( | |
| 388 1, true, same_site_url, content::PAGE_TRANSITION_LINK, | |
| 389 fake_render_view_host1()); | |
| 390 } | |
| 391 | |
| 202 // Simulates navigations for a number of subframes, and makes sure no | 392 // Simulates navigations for a number of subframes, and makes sure no |
| 203 // CaptivePortalTabHelper function is called. | 393 // CaptivePortalTabHelper function is called. |
| 204 TEST_F(CaptivePortalTabHelperTest, HttpsSubframe) { | 394 TEST_F(CaptivePortalTabHelperTest, HttpsSubframe) { |
| 205 GURL url = GURL(kHttpsUrl); | 395 GURL url = GURL(kHttpsUrl); |
| 206 // Normal load. | 396 // Normal load. |
| 207 tab_helper().DidStartProvisionalLoadForFrame(1, false, url, false, NULL); | 397 tab_helper().DidStartProvisionalLoadForFrame(1, false, url, false, |
| 398 fake_render_view_host1()); | |
| 208 tab_helper().DidCommitProvisionalLoadForFrame( | 399 tab_helper().DidCommitProvisionalLoadForFrame( |
| 209 1, false, url, content::PAGE_TRANSITION_LINK, NULL); | 400 1, false, url, content::PAGE_TRANSITION_LINK, fake_render_view_host1()); |
| 210 | 401 |
| 211 // Timeout. | 402 // Timeout. |
| 212 tab_helper().DidStartProvisionalLoadForFrame(2, false, url, false, NULL); | 403 tab_helper().DidStartProvisionalLoadForFrame(2, false, url, false, |
| 404 fake_render_view_host1()); | |
| 213 tab_helper().DidFailProvisionalLoad( | 405 tab_helper().DidFailProvisionalLoad( |
| 214 2, false, url, net::ERR_TIMED_OUT, string16(), NULL); | 406 2, false, url, net::ERR_TIMED_OUT, string16(), fake_render_view_host1()); |
| 215 tab_helper().DidStartProvisionalLoadForFrame(2, false, url, true, NULL); | 407 tab_helper().DidStartProvisionalLoadForFrame(2, false, url, true, |
| 408 fake_render_view_host1()); | |
| 216 tab_helper().DidFailProvisionalLoad( | 409 tab_helper().DidFailProvisionalLoad( |
| 217 2, false, url, net::ERR_ABORTED, string16(), NULL); | 410 2, false, url, net::ERR_ABORTED, string16(), fake_render_view_host1()); |
| 218 | 411 |
| 219 // Abort. | 412 // Abort. |
| 220 tab_helper().DidStartProvisionalLoadForFrame(3, false, url, false, NULL); | 413 tab_helper().DidStartProvisionalLoadForFrame(3, false, url, false, |
| 414 fake_render_view_host1()); | |
| 221 tab_helper().DidFailProvisionalLoad( | 415 tab_helper().DidFailProvisionalLoad( |
| 222 3, false, url, net::ERR_ABORTED, string16(), NULL); | 416 3, false, url, net::ERR_ABORTED, string16(), fake_render_view_host1()); |
| 223 } | 417 } |
| 224 | 418 |
| 225 // Simulates a subframe erroring out at the same time as a provisional load, | 419 // Simulates a subframe erroring out at the same time as a provisional load, |
| 226 // but with a different error code. Make sure the TabHelper sees the correct | 420 // but with a different error code. Make sure the TabHelper sees the correct |
| 227 // error. | 421 // error. |
| 228 TEST_F(CaptivePortalTabHelperTest, HttpsSubframeParallelError) { | 422 TEST_F(CaptivePortalTabHelperTest, HttpsSubframeParallelError) { |
| 229 // URL used by both frames. | 423 // URL used by both frames. |
| 230 GURL url = GURL(kHttpsUrl); | 424 GURL url = GURL(kHttpsUrl); |
| 231 | 425 |
| 232 int frame_id = 2; | 426 int frame_id = 2; |
| 233 int subframe_id = 1; | 427 int subframe_id = 1; |
| 234 | 428 |
| 235 // Loads start. | 429 // Loads start. |
| 236 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); | 430 EXPECT_CALL(mock_reloader(), OnLoadStart(url.SchemeIsSecure())).Times(1); |
| 237 tab_helper().DidStartProvisionalLoadForFrame( | 431 tab_helper().DidStartProvisionalLoadForFrame( |
| 238 frame_id, true, url, false, NULL); | 432 frame_id, true, url, false, fake_render_view_host1()); |
| 239 tab_helper().DidStartProvisionalLoadForFrame( | 433 tab_helper().DidStartProvisionalLoadForFrame( |
| 240 subframe_id, false, url, false, NULL); | 434 subframe_id, false, url, false, fake_render_view_host1()); |
| 241 | 435 |
| 242 // Loads return errors. | 436 // Loads return errors. |
| 243 tab_helper().DidFailProvisionalLoad( | 437 tab_helper().DidFailProvisionalLoad( |
| 244 frame_id, true, url, net::ERR_UNEXPECTED, string16(), NULL); | 438 frame_id, true, url, net::ERR_UNEXPECTED, string16(), |
| 439 fake_render_view_host1()); | |
| 245 tab_helper().DidFailProvisionalLoad( | 440 tab_helper().DidFailProvisionalLoad( |
| 246 subframe_id, false, url, net::ERR_TIMED_OUT, string16(), NULL); | 441 subframe_id, false, url, net::ERR_TIMED_OUT, string16(), |
| 442 fake_render_view_host1()); | |
| 247 | 443 |
| 248 // Provisional load starts for the error pages. | 444 // Provisional load starts for the error pages. |
| 249 tab_helper().DidStartProvisionalLoadForFrame( | 445 tab_helper().DidStartProvisionalLoadForFrame( |
| 250 frame_id, true, url, true, NULL); | 446 frame_id, true, url, true, fake_render_view_host1()); |
| 251 tab_helper().DidStartProvisionalLoadForFrame( | 447 tab_helper().DidStartProvisionalLoadForFrame( |
| 252 subframe_id, false, url, true, NULL); | 448 subframe_id, false, url, true, fake_render_view_host1()); |
| 253 | 449 |
| 254 // Error page load finishes. | 450 // Error page load finishes. |
| 255 tab_helper().DidCommitProvisionalLoadForFrame( | 451 tab_helper().DidCommitProvisionalLoadForFrame( |
| 256 subframe_id, false, url, content::PAGE_TRANSITION_AUTO_SUBFRAME, NULL); | 452 subframe_id, false, url, content::PAGE_TRANSITION_AUTO_SUBFRAME, |
| 453 fake_render_view_host1()); | |
| 257 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_UNEXPECTED)).Times(1); | 454 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_UNEXPECTED)).Times(1); |
| 258 tab_helper().DidCommitProvisionalLoadForFrame( | 455 tab_helper().DidCommitProvisionalLoadForFrame( |
| 259 frame_id, true, url, content::PAGE_TRANSITION_LINK, NULL); | 456 frame_id, true, url, content::PAGE_TRANSITION_LINK, |
| 457 fake_render_view_host1()); | |
| 260 } | 458 } |
| 261 | 459 |
| 262 // Simulates an HTTP to HTTPS redirect, which then times out. | 460 // Simulates an HTTP to HTTPS redirect, which then times out. |
| 263 TEST_F(CaptivePortalTabHelperTest, HttpToHttpsRedirectTimeout) { | 461 TEST_F(CaptivePortalTabHelperTest, HttpToHttpsRedirectTimeout) { |
| 264 GURL http_url("http://mail.google.com"); | 462 GURL http_url(kHttpUrl); |
| 265 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); | 463 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); |
| 266 tab_helper().DidStartProvisionalLoadForFrame(1, true, http_url, false, NULL); | 464 tab_helper().DidStartProvisionalLoadForFrame(1, true, http_url, false, |
| 465 fake_render_view_host1()); | |
| 267 | 466 |
| 268 GURL https_url("https://mail.google.com"); | 467 GURL https_url(kHttpsUrl); |
| 269 EXPECT_CALL(mock_reloader(), OnRedirect(true)).Times(1); | 468 EXPECT_CALL(mock_reloader(), OnRedirect(true)).Times(1); |
| 270 OnRedirect(1, https_url); | 469 OnRedirect(ResourceType::MAIN_FRAME, https_url, 1); |
| 271 | 470 |
| 272 tab_helper().DidFailProvisionalLoad( | 471 tab_helper().DidFailProvisionalLoad( |
| 273 1, true, https_url, net::ERR_TIMED_OUT, string16(), NULL); | 472 1, true, https_url, net::ERR_TIMED_OUT, string16(), |
| 473 fake_render_view_host1()); | |
| 274 | 474 |
| 275 // Provisional load starts for the error page. | 475 // Provisional load starts for the error page. |
| 276 tab_helper().DidStartProvisionalLoadForFrame( | 476 tab_helper().DidStartProvisionalLoadForFrame( |
| 277 1, true, GURL(kErrorPageUrl), true, NULL); | 477 1, true, GURL(kErrorPageUrl), true, fake_render_view_host1()); |
| 278 | 478 |
| 279 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1); | 479 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1); |
| 280 tab_helper().DidCommitProvisionalLoadForFrame( | 480 tab_helper().DidCommitProvisionalLoadForFrame( |
| 281 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, NULL); | 481 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, |
| 482 fake_render_view_host1()); | |
| 282 } | 483 } |
| 283 | 484 |
| 284 // Simulates an HTTPS to HTTP redirect. | 485 // Simulates an HTTPS to HTTP redirect. |
| 285 TEST_F(CaptivePortalTabHelperTest, HttpsToHttpRedirect) { | 486 TEST_F(CaptivePortalTabHelperTest, HttpsToHttpRedirect) { |
| 286 GURL https_url("https://mail.google.com"); | 487 GURL https_url(kHttpsUrl); |
| 287 EXPECT_CALL(mock_reloader(), OnLoadStart(true)).Times(1); | 488 EXPECT_CALL(mock_reloader(), |
| 288 tab_helper().DidStartProvisionalLoadForFrame(1, true, https_url, false, NULL); | 489 OnLoadStart(https_url.SchemeIsSecure())).Times(1); |
| 490 tab_helper().DidStartProvisionalLoadForFrame(1, true, https_url, false, | |
| 491 fake_render_view_host1()); | |
| 289 | 492 |
| 290 GURL http_url("http://mail.google.com"); | 493 GURL http_url(kHttpUrl); |
| 291 EXPECT_CALL(mock_reloader(), OnRedirect(false)).Times(1); | 494 EXPECT_CALL(mock_reloader(), OnRedirect(http_url.SchemeIsSecure())).Times(1); |
| 292 OnRedirect(1, http_url); | 495 OnRedirect(ResourceType::MAIN_FRAME, http_url, 1); |
| 293 | 496 |
| 294 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); | 497 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); |
| 295 tab_helper().DidCommitProvisionalLoadForFrame( | 498 tab_helper().DidCommitProvisionalLoadForFrame( |
| 296 1, true, http_url, content::PAGE_TRANSITION_LINK, NULL); | 499 1, true, http_url, content::PAGE_TRANSITION_LINK, |
| 500 fake_render_view_host1()); | |
| 297 } | 501 } |
| 298 | 502 |
| 299 // Simulates an HTTPS to HTTPS redirect. | 503 // Simulates an HTTPS to HTTPS redirect. |
| 300 TEST_F(CaptivePortalTabHelperTest, HttpToHttpRedirect) { | 504 TEST_F(CaptivePortalTabHelperTest, HttpToHttpRedirect) { |
| 301 GURL https_url("https://mail.google.com"); | 505 GURL http_url(kHttpUrl); |
| 302 EXPECT_CALL(mock_reloader(), OnLoadStart(true)).Times(1); | 506 EXPECT_CALL(mock_reloader(), |
| 303 tab_helper().DidStartProvisionalLoadForFrame(1, true, https_url, false, NULL); | 507 OnLoadStart(http_url.SchemeIsSecure())).Times(1); |
| 508 tab_helper().DidStartProvisionalLoadForFrame(1, true, http_url, false, | |
| 509 fake_render_view_host1()); | |
| 304 | 510 |
| 305 GURL http_url("https://www.google.com"); | 511 EXPECT_CALL(mock_reloader(), OnRedirect(http_url.SchemeIsSecure())).Times(1); |
| 306 EXPECT_CALL(mock_reloader(), OnRedirect(true)).Times(1); | 512 OnRedirect(ResourceType::MAIN_FRAME, http_url, 1); |
| 307 OnRedirect(1, http_url); | |
| 308 | 513 |
| 309 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); | 514 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); |
| 310 tab_helper().DidCommitProvisionalLoadForFrame( | 515 tab_helper().DidCommitProvisionalLoadForFrame( |
| 311 1, true, http_url, content::PAGE_TRANSITION_LINK, NULL); | 516 1, true, http_url, content::PAGE_TRANSITION_LINK, |
| 517 fake_render_view_host1()); | |
| 312 } | 518 } |
| 313 | 519 |
| 314 // Simulates redirect of a subframe. | 520 // Simulates redirect of a subframe. |
| 315 TEST_F(CaptivePortalTabHelperTest, SubframeRedirect) { | 521 TEST_F(CaptivePortalTabHelperTest, SubframeRedirect) { |
| 316 GURL http_url("http://mail.google.com"); | 522 GURL http_url(kHttpUrl); |
| 317 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); | 523 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); |
| 318 tab_helper().DidStartProvisionalLoadForFrame(1, true, http_url, false, NULL); | 524 tab_helper().DidStartProvisionalLoadForFrame(1, true, http_url, false, |
| 525 fake_render_view_host1()); | |
| 319 | 526 |
| 320 GURL https_url("https://mail.google.com"); | 527 GURL https_url(kHttpsUrl); |
| 321 OnRedirect(2, https_url); | 528 OnRedirect(ResourceType::SUB_FRAME, https_url, 1); |
| 322 | 529 |
| 323 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); | 530 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1); |
| 324 tab_helper().DidCommitProvisionalLoadForFrame( | 531 tab_helper().DidCommitProvisionalLoadForFrame( |
| 325 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, NULL); | 532 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, |
| 533 fake_render_view_host1()); | |
| 534 } | |
| 535 | |
| 536 // Simulates a redirect, for another RenderViewHost. | |
| 537 TEST_F(CaptivePortalTabHelperTest, OtherRenderViewHostRedirect) { | |
| 538 GURL http_url(kHttpUrl); | |
| 539 EXPECT_CALL(mock_reloader(), OnLoadStart(false)).Times(1); | |
| 540 tab_helper().DidStartProvisionalLoadForFrame(1, true, http_url, false, | |
| 541 fake_render_view_host1()); | |
| 542 | |
| 543 // Another RenderViewHost sees a redirect. None of the reloader's functions | |
| 544 // should be called. | |
| 545 GURL https_url(kHttpsUrl); | |
| 546 OnRedirect(ResourceType::MAIN_FRAME, https_url, 2); | |
| 547 | |
| 548 tab_helper().DidFailProvisionalLoad( | |
| 549 1, true, https_url, net::ERR_TIMED_OUT, string16(), | |
| 550 fake_render_view_host1()); | |
| 551 | |
| 552 // Provisional load starts for the error page. | |
| 553 tab_helper().DidStartProvisionalLoadForFrame( | |
| 554 1, true, GURL(kErrorPageUrl), true, fake_render_view_host1()); | |
| 555 | |
| 556 EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::ERR_TIMED_OUT)).Times(1); | |
| 557 tab_helper().DidCommitProvisionalLoadForFrame( | |
| 558 1, true, GURL(kErrorPageUrl), content::PAGE_TRANSITION_LINK, | |
| 559 fake_render_view_host1()); | |
| 326 } | 560 } |
| 327 | 561 |
| 328 TEST_F(CaptivePortalTabHelperTest, LoginTabLogin) { | 562 TEST_F(CaptivePortalTabHelperTest, LoginTabLogin) { |
| 329 EXPECT_FALSE(tab_helper().IsLoginTab()); | 563 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 330 SetIsLoginTab(); | 564 SetIsLoginTab(); |
| 331 EXPECT_TRUE(tab_helper().IsLoginTab()); | 565 EXPECT_TRUE(tab_helper().IsLoginTab()); |
| 332 | 566 |
| 333 ObservePortalResult(RESULT_INTERNET_CONNECTED, RESULT_INTERNET_CONNECTED); | 567 ObservePortalResult(RESULT_INTERNET_CONNECTED, RESULT_INTERNET_CONNECTED); |
| 334 EXPECT_FALSE(tab_helper().IsLoginTab()); | 568 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 335 } | 569 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 EXPECT_FALSE(tab_helper().IsLoginTab()); | 602 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 369 | 603 |
| 370 ObservePortalResult(RESULT_BEHIND_CAPTIVE_PORTAL, RESULT_NO_RESPONSE); | 604 ObservePortalResult(RESULT_BEHIND_CAPTIVE_PORTAL, RESULT_NO_RESPONSE); |
| 371 EXPECT_FALSE(tab_helper().IsLoginTab()); | 605 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 372 | 606 |
| 373 ObservePortalResult(RESULT_NO_RESPONSE, RESULT_INTERNET_CONNECTED); | 607 ObservePortalResult(RESULT_NO_RESPONSE, RESULT_INTERNET_CONNECTED); |
| 374 EXPECT_FALSE(tab_helper().IsLoginTab()); | 608 EXPECT_FALSE(tab_helper().IsLoginTab()); |
| 375 } | 609 } |
| 376 | 610 |
| 377 } // namespace captive_portal | 611 } // namespace captive_portal |
| OLD | NEW |