| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/time.h" | 6 #include "base/time.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 // Open a page with a HTTPS error in a tab with no prior navigation (through a | 470 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
| 471 // link with a blank target). This is to test that the lack of navigation entry | 471 // link with a blank target). This is to test that the lack of navigation entry |
| 472 // does not cause any problems (it was causing a crasher, see | 472 // does not cause any problems (it was causing a crasher, see |
| 473 // http://crbug.com/19941). | 473 // http://crbug.com/19941). |
| 474 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { | 474 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { |
| 475 ASSERT_TRUE(https_server_expired_.Start()); | 475 ASSERT_TRUE(https_server_expired_.Start()); |
| 476 | 476 |
| 477 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); | 477 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); |
| 478 TabContentsWrapper* tab2 = | 478 TabContentsWrapper* tab2 = |
| 479 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); | 479 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
| 480 ui_test_utils::WaitForLoadStop(tab2->tab_contents()); | 480 ui_test_utils::WaitForLoadStop(tab2->tab_contents()); |
| 481 | 481 |
| 482 // Verify our assumption that there was no prior navigation. | 482 // Verify our assumption that there was no prior navigation. |
| 483 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); | 483 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); |
| 484 | 484 |
| 485 // We should have an interstitial page showing. | 485 // We should have an interstitial page showing. |
| 486 ASSERT_TRUE(tab2->tab_contents()->interstitial_page()); | 486 ASSERT_TRUE(tab2->tab_contents()->interstitial_page()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 // Disabled due to crash in downloads code that this triggers. | 489 // Disabled due to crash in downloads code that this triggers. |
| 490 // http://crbug.com/95331 | 490 // http://crbug.com/95331 |
| 491 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { | 491 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { |
| 492 ASSERT_TRUE(test_server()->Start()); | 492 ASSERT_TRUE(test_server()->Start()); |
| 493 ASSERT_TRUE(https_server_expired_.Start()); | 493 ASSERT_TRUE(https_server_expired_.Start()); |
| 494 GURL url_non_dangerous = test_server()->GetURL(""); | 494 GURL url_non_dangerous = test_server()->GetURL(""); |
| 495 GURL url_dangerous = https_server_expired_.GetURL( | 495 GURL url_dangerous = https_server_expired_.GetURL( |
| 496 "files/downloads/dangerous/dangerous.exe"); | 496 "files/downloads/dangerous/dangerous.exe"); |
| 497 | 497 |
| 498 // Visit a non-dangerous page. | 498 // Visit a non-dangerous page. |
| 499 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); | 499 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); |
| 500 | 500 |
| 501 // Now, start a transition to dangerous download. | 501 // Now, start a transition to dangerous download. |
| 502 { | 502 { |
| 503 ui_test_utils::WindowedNotificationObserver observer( | 503 ui_test_utils::WindowedNotificationObserver observer( |
| 504 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 504 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); |
| 505 browser::NavigateParams navigate_params(browser(), url_dangerous, | 505 browser::NavigateParams navigate_params(browser(), url_dangerous, |
| 506 PageTransition::TYPED); | 506 content::PAGE_TRANSITION_TYPED); |
| 507 browser::Navigate(&navigate_params); | 507 browser::Navigate(&navigate_params); |
| 508 observer.Wait(); | 508 observer.Wait(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 // Proceed through the SSL interstitial. This doesn't use | 511 // Proceed through the SSL interstitial. This doesn't use |
| 512 // |ProceedThroughInterstitial| since no page load will commit. | 512 // |ProceedThroughInterstitial| since no page load will commit. |
| 513 TabContents* tab = browser()->GetSelectedTabContents(); | 513 TabContents* tab = browser()->GetSelectedTabContents(); |
| 514 ASSERT_TRUE(tab != NULL); | 514 ASSERT_TRUE(tab != NULL); |
| 515 ASSERT_TRUE(tab->interstitial_page() != NULL); | 515 ASSERT_TRUE(tab->interstitial_page() != NULL); |
| 516 { | 516 { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 CheckAuthenticatedState(tab1->tab_contents(), false); | 654 CheckAuthenticatedState(tab1->tab_contents(), false); |
| 655 | 655 |
| 656 // Create a new tab. | 656 // Create a new tab. |
| 657 std::string replacement_path; | 657 std::string replacement_path; |
| 658 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 658 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 659 "files/ssl/page_displays_insecure_content.html", | 659 "files/ssl/page_displays_insecure_content.html", |
| 660 test_server()->host_port_pair(), | 660 test_server()->host_port_pair(), |
| 661 &replacement_path)); | 661 &replacement_path)); |
| 662 | 662 |
| 663 GURL url = https_server_.GetURL(replacement_path); | 663 GURL url = https_server_.GetURL(replacement_path); |
| 664 browser::NavigateParams params(browser(), url, PageTransition::TYPED); | 664 browser::NavigateParams params( |
| 665 browser(), url, content::PAGE_TRANSITION_TYPED); |
| 665 params.disposition = NEW_FOREGROUND_TAB; | 666 params.disposition = NEW_FOREGROUND_TAB; |
| 666 params.tabstrip_index = 0; | 667 params.tabstrip_index = 0; |
| 667 params.source_contents = tab1; | 668 params.source_contents = tab1; |
| 668 ui_test_utils::WindowedNotificationObserver observer( | 669 ui_test_utils::WindowedNotificationObserver observer( |
| 669 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 670 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); |
| 670 browser::Navigate(¶ms); | 671 browser::Navigate(¶ms); |
| 671 TabContentsWrapper* tab2 = params.target_contents; | 672 TabContentsWrapper* tab2 = params.target_contents; |
| 672 observer.Wait(); | 673 observer.Wait(); |
| 673 | 674 |
| 674 // The new tab has insecure content. | 675 // The new tab has insecure content. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 694 CheckAuthenticatedState(tab1->tab_contents(), false); | 695 CheckAuthenticatedState(tab1->tab_contents(), false); |
| 695 | 696 |
| 696 std::string replacement_path; | 697 std::string replacement_path; |
| 697 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 698 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 698 "files/ssl/page_runs_insecure_content.html", | 699 "files/ssl/page_runs_insecure_content.html", |
| 699 test_server()->host_port_pair(), | 700 test_server()->host_port_pair(), |
| 700 &replacement_path)); | 701 &replacement_path)); |
| 701 | 702 |
| 702 // Create a new tab. | 703 // Create a new tab. |
| 703 GURL url = https_server_.GetURL(replacement_path); | 704 GURL url = https_server_.GetURL(replacement_path); |
| 704 browser::NavigateParams params(browser(), url, PageTransition::TYPED); | 705 browser::NavigateParams params( |
| 706 browser(), url, content::PAGE_TRANSITION_TYPED); |
| 705 params.disposition = NEW_FOREGROUND_TAB; | 707 params.disposition = NEW_FOREGROUND_TAB; |
| 706 params.source_contents = tab1; | 708 params.source_contents = tab1; |
| 707 ui_test_utils::WindowedNotificationObserver observer( | 709 ui_test_utils::WindowedNotificationObserver observer( |
| 708 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 710 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); |
| 709 browser::Navigate(¶ms); | 711 browser::Navigate(¶ms); |
| 710 TabContentsWrapper* tab2 = params.target_contents; | 712 TabContentsWrapper* tab2 = params.target_contents; |
| 711 observer.Wait(); | 713 observer.Wait(); |
| 712 | 714 |
| 713 // The new tab has insecure content. | 715 // The new tab has insecure content. |
| 714 CheckAuthenticationBrokenState(tab2->tab_contents(), 0, true, false); | 716 CheckAuthenticationBrokenState(tab2->tab_contents(), 0, true, false); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 new MessageLoop::QuitTask(), 1000); | 876 new MessageLoop::QuitTask(), 1000); |
| 875 ui_test_utils::RunMessageLoop(); | 877 ui_test_utils::RunMessageLoop(); |
| 876 } | 878 } |
| 877 ASSERT_EQ(1, GetConstrainedWindowCount()); | 879 ASSERT_EQ(1, GetConstrainedWindowCount()); |
| 878 | 880 |
| 879 // Let's add another tab to make sure the browser does not exit when we close | 881 // Let's add another tab to make sure the browser does not exit when we close |
| 880 // the first tab. | 882 // the first tab. |
| 881 GURL url = test_server()->GetURL("files/ssl/google.html"); | 883 GURL url = test_server()->GetURL("files/ssl/google.html"); |
| 882 ui_test_utils::WindowedNotificationObserver observer( | 884 ui_test_utils::WindowedNotificationObserver observer( |
| 883 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 885 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); |
| 884 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); | 886 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
| 885 observer.Wait(); | 887 observer.Wait(); |
| 886 | 888 |
| 887 // Close the first tab. | 889 // Close the first tab. |
| 888 browser()->CloseTabContents(tab1); | 890 browser()->CloseTabContents(tab1); |
| 889 } | 891 } |
| 890 | 892 |
| 891 // Visit a page over bad https that is a redirect to a page with good https. | 893 // Visit a page over bad https that is a redirect to a page with good https. |
| 892 // Crashes: http://crbug.com/77374 | 894 // Crashes: http://crbug.com/77374 |
| 893 // Previously marked as flaky: http://crbug.com/40932 | 895 // Previously marked as flaky: http://crbug.com/40932 |
| 894 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestRedirectBadToGoodHTTPS) { | 896 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestRedirectBadToGoodHTTPS) { |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1297 |
| 1296 // Visit a page over https that contains a frame with a redirect. | 1298 // Visit a page over https that contains a frame with a redirect. |
| 1297 | 1299 |
| 1298 // XMLHttpRequest insecure content in synchronous mode. | 1300 // XMLHttpRequest insecure content in synchronous mode. |
| 1299 | 1301 |
| 1300 // XMLHttpRequest insecure content in asynchronous mode. | 1302 // XMLHttpRequest insecure content in asynchronous mode. |
| 1301 | 1303 |
| 1302 // XMLHttpRequest over bad ssl in synchronous mode. | 1304 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1303 | 1305 |
| 1304 // XMLHttpRequest over OK ssl in synchronous mode. | 1306 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |