| 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 6362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6373 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 6373 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6374 ASSERT_EQ(1U, root->child_count()); | 6374 ASSERT_EQ(1U, root->child_count()); |
| 6375 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); | 6375 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); |
| 6376 ASSERT_TRUE(mixed_child); | 6376 ASSERT_TRUE(mixed_child); |
| 6377 // The child iframe attempted to create a mixed iframe; this should | 6377 // The child iframe attempted to create a mixed iframe; this should |
| 6378 // have been blocked, so the mixed iframe should not have committed a | 6378 // have been blocked, so the mixed iframe should not have committed a |
| 6379 // load. | 6379 // load. |
| 6380 EXPECT_FALSE(mixed_child->has_committed_real_load()); | 6380 EXPECT_FALSE(mixed_child->has_committed_real_load()); |
| 6381 } | 6381 } |
| 6382 | 6382 |
| 6383 // Test that subresources with certificate errors that are redundant | |
| 6384 // with the main page do not get reported to the browser. That is, if | |
| 6385 // https://redundant.test frames https://a.com which frames | |
| 6386 // https://redundant.test which loads an image with certificate errors, | |
| 6387 // the browser doesn't care and doesn't need to know about the image's | |
| 6388 // certificate errors because they are redundant with the main page | |
| 6389 // load. | |
| 6390 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, | |
| 6391 SubresourceWithRedundantCertificateErrors) { | |
| 6392 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | |
| 6393 https_server.ServeFilesFromSourceDirectory("content/test/data"); | |
| 6394 ASSERT_TRUE(https_server.Start()); | |
| 6395 SetupCrossSiteRedirector(&https_server); | |
| 6396 | |
| 6397 GURL url(https_server.GetURL( | |
| 6398 "redundant.test", "/mixed-content/redundant-cert-error-in-iframe.html")); | |
| 6399 EXPECT_TRUE(NavigateToURL(shell(), url)); | |
| 6400 | |
| 6401 NavigationEntry* entry = | |
| 6402 shell()->web_contents()->GetController().GetLastCommittedEntry(); | |
| 6403 ASSERT_TRUE(entry); | |
| 6404 | |
| 6405 // The main page was loaded with certificate errors. | |
| 6406 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, | |
| 6407 entry->GetSSL().security_style); | |
| 6408 | |
| 6409 // The image that the iframe loaded had certificate errors also, but | |
| 6410 // they were redundant with the main resource, so the page should not | |
| 6411 // be marked as displaying insecure content. | |
| 6412 EXPECT_FALSE(entry->GetSSL().content_status & | |
| 6413 SSLStatus::DISPLAYED_INSECURE_CONTENT); | |
| 6414 } | |
| 6415 | |
| 6416 // Test that subresources with certificate errors that are NOT redundant | 6383 // Test that subresources with certificate errors that are NOT redundant |
| 6417 // with the main page DO get reported to the browser. That is, if | 6384 // with the main page DO get reported to the browser. That is, if |
| 6418 // https://nonredundant.test frames https://a.com which loads an image | 6385 // https://nonredundant.test frames https://a.com which loads an image |
| 6419 // with certificate errors, the browser should be notified about the | 6386 // with certificate errors, the browser should be notified about the |
| 6420 // subresource with certificate errors and downgrade the UI | 6387 // subresource with certificate errors and downgrade the UI |
| 6421 // appropriately. | 6388 // appropriately. |
| 6422 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, | 6389 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
| 6423 SubresourceWithNonRedundantCertificateErrors) { | 6390 SubresourceWithNonRedundantCertificateErrors) { |
| 6424 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 6391 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 6425 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 6392 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7494 | 7461 |
| 7495 shell()->web_contents()->WasShown(); | 7462 shell()->web_contents()->WasShown(); |
| 7496 | 7463 |
| 7497 EXPECT_TRUE(ExecuteScriptAndExtractInt( | 7464 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 7498 root->child_at(0)->current_frame_host(), | 7465 root->child_at(0)->current_frame_host(), |
| 7499 "window.domAutomationController.send(event_fired);", &event_fired)); | 7466 "window.domAutomationController.send(event_fired);", &event_fired)); |
| 7500 EXPECT_EQ(2, event_fired); | 7467 EXPECT_EQ(2, event_fired); |
| 7501 } | 7468 } |
| 7502 | 7469 |
| 7503 } // namespace content | 7470 } // namespace content |
| OLD | NEW |