| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/time.h" | 5 #include "base/time.h" |
| 6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
| 7 #include "chrome/browser/pref_service.h" | 7 #include "chrome/browser/pref_service.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "chrome/browser/tab_contents/interstitial_page.h" | 9 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 10 #include "chrome/browser/tab_contents/navigation_entry.h" | 10 #include "chrome/browser/tab_contents/navigation_entry.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 TabContents* tab1 = browser()->GetSelectedTabContents(); | 492 TabContents* tab1 = browser()->GetSelectedTabContents(); |
| 493 | 493 |
| 494 // This tab should be fine. | 494 // This tab should be fine. |
| 495 CheckAuthenticatedState(tab1, false); | 495 CheckAuthenticatedState(tab1, false); |
| 496 | 496 |
| 497 // Create a new tab. | 497 // Create a new tab. |
| 498 GURL url = https_server->TestServerPage( | 498 GURL url = https_server->TestServerPage( |
| 499 "files/ssl/page_displays_insecure_content.html"); | 499 "files/ssl/page_displays_insecure_content.html"); |
| 500 TabContents* tab2 = browser()->AddTabWithURL(url, GURL(), | 500 TabContents* tab2 = browser()->AddTabWithURL(url, GURL(), |
| 501 PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, | 501 PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, |
| 502 tab1->GetSiteInstance(), std::string()); | 502 tab1->GetSiteInstance(), std::string(), NULL); |
| 503 ui_test_utils::WaitForNavigation(&(tab2->controller())); | 503 ui_test_utils::WaitForNavigation(&(tab2->controller())); |
| 504 | 504 |
| 505 // The new tab has insecure content. | 505 // The new tab has insecure content. |
| 506 CheckAuthenticatedState(tab2, true); | 506 CheckAuthenticatedState(tab2, true); |
| 507 | 507 |
| 508 // The original tab should not be contaminated. | 508 // The original tab should not be contaminated. |
| 509 CheckAuthenticatedState(tab1, false); | 509 CheckAuthenticatedState(tab1, false); |
| 510 } | 510 } |
| 511 | 511 |
| 512 // Visits two pages from the same origin: one that runs insecure content and one | 512 // Visits two pages from the same origin: one that runs insecure content and one |
| (...skipping 11 matching lines...) Expand all Loading... |
| 524 TabContents* tab1 = browser()->GetSelectedTabContents(); | 524 TabContents* tab1 = browser()->GetSelectedTabContents(); |
| 525 | 525 |
| 526 // This tab should be fine. | 526 // This tab should be fine. |
| 527 CheckAuthenticatedState(tab1, false); | 527 CheckAuthenticatedState(tab1, false); |
| 528 | 528 |
| 529 // Create a new tab. | 529 // Create a new tab. |
| 530 GURL url = | 530 GURL url = |
| 531 https_server->TestServerPage("files/ssl/page_runs_insecure_content.html"); | 531 https_server->TestServerPage("files/ssl/page_runs_insecure_content.html"); |
| 532 TabContents* tab2 = browser()->AddTabWithURL(url, GURL(), | 532 TabContents* tab2 = browser()->AddTabWithURL(url, GURL(), |
| 533 PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, | 533 PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, |
| 534 tab1->GetSiteInstance(), std::string()); | 534 tab1->GetSiteInstance(), std::string(), NULL); |
| 535 ui_test_utils::WaitForNavigation(&(tab2->controller())); | 535 ui_test_utils::WaitForNavigation(&(tab2->controller())); |
| 536 | 536 |
| 537 // The new tab has insecure content. | 537 // The new tab has insecure content. |
| 538 CheckAuthenticationBrokenState(tab2, 0, true, false); | 538 CheckAuthenticationBrokenState(tab2, 0, true, false); |
| 539 | 539 |
| 540 // Which means the origin for the first tab has also been contaminated with | 540 // Which means the origin for the first tab has also been contaminated with |
| 541 // insecure content. | 541 // insecure content. |
| 542 CheckAuthenticationBrokenState(tab1, 0, true, false); | 542 CheckAuthenticationBrokenState(tab1, 0, true, false); |
| 543 } | 543 } |
| 544 | 544 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 break; | 686 break; |
| 687 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 687 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 688 new MessageLoop::QuitTask(), 1000); | 688 new MessageLoop::QuitTask(), 1000); |
| 689 ui_test_utils::RunMessageLoop(); | 689 ui_test_utils::RunMessageLoop(); |
| 690 } | 690 } |
| 691 ASSERT_EQ(1, static_cast<int>(tab1->constrained_window_count())); | 691 ASSERT_EQ(1, static_cast<int>(tab1->constrained_window_count())); |
| 692 | 692 |
| 693 // Let's add another tab to make sure the browser does not exit when we close | 693 // Let's add another tab to make sure the browser does not exit when we close |
| 694 // the first tab. | 694 // the first tab. |
| 695 GURL url = http_server->TestServerPage("files/ssl/google.html"); | 695 GURL url = http_server->TestServerPage("files/ssl/google.html"); |
| 696 Browser* browser_used = NULL; |
| 696 TabContents* tab2 = browser()->AddTabWithURL( | 697 TabContents* tab2 = browser()->AddTabWithURL( |
| 697 url, GURL(), PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, NULL, | 698 url, GURL(), PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, NULL, |
| 698 std::string()); | 699 std::string(), &browser_used); |
| 699 ui_test_utils::WaitForNavigation(&(tab2->controller())); | 700 ui_test_utils::WaitForNavigation(&(tab2->controller())); |
| 700 | 701 |
| 702 // Ensure that the tab was created in the correct browser. |
| 703 EXPECT_EQ(browser(), browser_used); |
| 704 |
| 701 // Close the first tab. | 705 // Close the first tab. |
| 702 browser()->CloseTabContents(tab1); | 706 browser()->CloseTabContents(tab1); |
| 703 } | 707 } |
| 704 | 708 |
| 705 // Visit a page over bad https that is a redirect to a page with good https. | 709 // Visit a page over bad https that is a redirect to a page with good https. |
| 706 // Marked as flaky, see bug 40932. | 710 // Marked as flaky, see bug 40932. |
| 707 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) { | 711 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) { |
| 708 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); | 712 scoped_refptr<net::HTTPSTestServer> good_https_server = GoodCertServer(); |
| 709 ASSERT_TRUE(good_https_server.get() != NULL); | 713 ASSERT_TRUE(good_https_server.get() != NULL); |
| 710 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); | 714 scoped_refptr<net::HTTPSTestServer> bad_https_server = BadCertServer(); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1039 |
| 1036 // Visit a page over https that contains a frame with a redirect. | 1040 // Visit a page over https that contains a frame with a redirect. |
| 1037 | 1041 |
| 1038 // XMLHttpRequest insecure content in synchronous mode. | 1042 // XMLHttpRequest insecure content in synchronous mode. |
| 1039 | 1043 |
| 1040 // XMLHttpRequest insecure content in asynchronous mode. | 1044 // XMLHttpRequest insecure content in asynchronous mode. |
| 1041 | 1045 |
| 1042 // XMLHttpRequest over bad ssl in synchronous mode. | 1046 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1043 | 1047 |
| 1044 // XMLHttpRequest over OK ssl in synchronous mode. | 1048 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |