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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); | 139 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); |
140 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, | 140 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, |
141 entry->GetSSL().security_style); | 141 entry->GetSSL().security_style); |
142 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); | 142 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
143 EXPECT_FALSE(!!(entry->GetSSL().content_status & | 143 EXPECT_FALSE(!!(entry->GetSSL().content_status & |
144 SSLStatus::DISPLAYED_INSECURE_CONTENT)); | 144 SSLStatus::DISPLAYED_INSECURE_CONTENT)); |
145 EXPECT_FALSE( | 145 EXPECT_FALSE( |
146 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); | 146 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); |
147 } | 147 } |
148 | 148 |
| 149 void CheckBrokenAuthenticatedState(WebContents* tab) { |
| 150 ASSERT_FALSE(tab->IsCrashed()); |
| 151 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 152 ASSERT_TRUE(entry); |
| 153 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); |
| 154 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, |
| 155 entry->GetSSL().security_style); |
| 156 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 157 EXPECT_FALSE(!!(entry->GetSSL().content_status & |
| 158 SSLStatus::DISPLAYED_INSECURE_CONTENT)); |
| 159 EXPECT_TRUE( |
| 160 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); |
| 161 } |
| 162 |
149 void CheckAuthenticationBrokenState(WebContents* tab, | 163 void CheckAuthenticationBrokenState(WebContents* tab, |
150 net::CertStatus error, | 164 net::CertStatus error, |
151 bool ran_insecure_content, | 165 bool ran_insecure_content, |
152 bool interstitial) { | 166 bool interstitial) { |
153 ASSERT_FALSE(tab->IsCrashed()); | 167 ASSERT_FALSE(tab->IsCrashed()); |
154 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 168 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
155 ASSERT_TRUE(entry); | 169 ASSERT_TRUE(entry); |
156 EXPECT_EQ(interstitial ? | 170 EXPECT_EQ(interstitial ? |
157 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, | 171 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, |
158 entry->GetPageType()); | 172 entry->GetPageType()); |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 | 1300 |
1287 // | 1301 // |
1288 // Frame navigation | 1302 // Frame navigation |
1289 // | 1303 // |
1290 | 1304 |
1291 // From a good HTTPS top frame: | 1305 // From a good HTTPS top frame: |
1292 // - navigate to an OK HTTPS frame | 1306 // - navigate to an OK HTTPS frame |
1293 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 1307 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
1294 // back | 1308 // back |
1295 // - navigate to HTTP (expect insecure content), then back | 1309 // - navigate to HTTP (expect insecure content), then back |
1296 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestGoodFrameNavigation) { | 1310 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { |
1297 ASSERT_TRUE(test_server()->Start()); | 1311 ASSERT_TRUE(test_server()->Start()); |
1298 ASSERT_TRUE(https_server_.Start()); | 1312 ASSERT_TRUE(https_server_.Start()); |
1299 ASSERT_TRUE(https_server_expired_.Start()); | 1313 ASSERT_TRUE(https_server_expired_.Start()); |
1300 | 1314 |
1301 std::string top_frame_path; | 1315 std::string top_frame_path; |
1302 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1316 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1303 https_server_, | 1317 https_server_, |
1304 https_server_expired_, | 1318 https_server_expired_, |
1305 &top_frame_path)); | 1319 &top_frame_path)); |
1306 | 1320 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 content::NOTIFICATION_LOAD_STOP, | 1385 content::NOTIFICATION_LOAD_STOP, |
1372 content::Source<NavigationController>(&tab->GetController())); | 1386 content::Source<NavigationController>(&tab->GetController())); |
1373 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 1387 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
1374 tab, | 1388 tab, |
1375 "window.domAutomationController.send(clickLink('HTTPLink'));", | 1389 "window.domAutomationController.send(clickLink('HTTPLink'));", |
1376 &success)); | 1390 &success)); |
1377 ASSERT_TRUE(success); | 1391 ASSERT_TRUE(success); |
1378 observer.Wait(); | 1392 observer.Wait(); |
1379 } | 1393 } |
1380 | 1394 |
1381 // Our state should be insecure. | 1395 // Our state should be unathenticated (in the ran mixed script sense) |
1382 CheckAuthenticatedState(tab, true); | 1396 CheckBrokenAuthenticatedState(tab); |
1383 | 1397 |
1384 // Go back, our state should be unchanged. | 1398 // Go back, our state should be unchanged. |
1385 { | 1399 { |
1386 content::WindowedNotificationObserver observer( | 1400 content::WindowedNotificationObserver observer( |
1387 content::NOTIFICATION_LOAD_STOP, | 1401 content::NOTIFICATION_LOAD_STOP, |
1388 content::Source<NavigationController>(&tab->GetController())); | 1402 content::Source<NavigationController>(&tab->GetController())); |
1389 tab->GetController().GoBack(); | 1403 tab->GetController().GoBack(); |
1390 observer.Wait(); | 1404 observer.Wait(); |
1391 } | 1405 } |
1392 CheckAuthenticatedState(tab, true); | 1406 |
| 1407 CheckBrokenAuthenticatedState(tab); |
1393 } | 1408 } |
1394 | 1409 |
1395 // From a bad HTTPS top frame: | 1410 // From a bad HTTPS top frame: |
1396 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 1411 // - navigate to an OK HTTPS frame (expected to be still authentication broken). |
1397 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { | 1412 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { |
1398 ASSERT_TRUE(https_server_.Start()); | 1413 ASSERT_TRUE(https_server_.Start()); |
1399 ASSERT_TRUE(https_server_expired_.Start()); | 1414 ASSERT_TRUE(https_server_expired_.Start()); |
1400 | 1415 |
1401 std::string top_frame_path; | 1416 std::string top_frame_path; |
1402 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1417 ASSERT_TRUE(GetTopFramePath(*test_server(), |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 | 1649 |
1635 // Visit a page over https that contains a frame with a redirect. | 1650 // Visit a page over https that contains a frame with a redirect. |
1636 | 1651 |
1637 // XMLHttpRequest insecure content in synchronous mode. | 1652 // XMLHttpRequest insecure content in synchronous mode. |
1638 | 1653 |
1639 // XMLHttpRequest insecure content in asynchronous mode. | 1654 // XMLHttpRequest insecure content in asynchronous mode. |
1640 | 1655 |
1641 // XMLHttpRequest over bad ssl in synchronous mode. | 1656 // XMLHttpRequest over bad ssl in synchronous mode. |
1642 | 1657 |
1643 // XMLHttpRequest over OK ssl in synchronous mode. | 1658 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |