Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 4694008: Make pink's TabContentsWrapper change compile on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/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"
11 #include "chrome/browser/tab_contents/tab_contents.h" 11 #include "chrome/browser/tab_contents/tab_contents.h"
12 #include "chrome/browser/tab_contents_wrapper.h"
12 #include "chrome/browser/tabs/tab_strip_model.h" 13 #include "chrome/browser/tabs/tab_strip_model.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_navigator.h" 15 #include "chrome/browser/ui/browser_navigator.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "chrome/test/in_process_browser_test.h" 17 #include "chrome/test/in_process_browser_test.h"
17 #include "chrome/test/ui_test_utils.h" 18 #include "chrome/test/ui_test_utils.h"
18 #include "net/base/cert_status_flags.h" 19 #include "net/base/cert_status_flags.h"
19 #include "net/test/test_server.h" 20 #include "net/test/test_server.h"
20 21
21 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); 22 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 390 }
390 391
391 // Open a page with a HTTPS error in a tab with no prior navigation (through a 392 // Open a page with a HTTPS error in a tab with no prior navigation (through a
392 // link with a blank target). This is to test that the lack of navigation entry 393 // link with a blank target). This is to test that the lack of navigation entry
393 // does not cause any problems (it was causing a crasher, see 394 // does not cause any problems (it was causing a crasher, see
394 // http://crbug.com/19941). 395 // http://crbug.com/19941).
395 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { 396 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) {
396 ASSERT_TRUE(https_server_expired_.Start()); 397 ASSERT_TRUE(https_server_expired_.Start());
397 398
398 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); 399 GURL url = https_server_expired_.GetURL("files/ssl/google.htm");
399 TabContents* tab2 = 400 TabContentsWrapper* tab2 =
400 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); 401 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED);
401 ui_test_utils::WaitForLoadStop(&(tab2->controller())); 402 ui_test_utils::WaitForLoadStop(&(tab2->controller()));
402 403
403 // Verify our assumption that there was no prior navigation. 404 // Verify our assumption that there was no prior navigation.
404 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); 405 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK));
405 406
406 // We should have an interstitial page showing. 407 // We should have an interstitial page showing.
407 ASSERT_TRUE(tab2->interstitial_page()); 408 ASSERT_TRUE(tab2->tab_contents()->interstitial_page());
408 } 409 }
409 410
410 // 411 //
411 // Insecure content 412 // Insecure content
412 // 413 //
413 414
414 // Visits a page that displays insecure content. 415 // Visits a page that displays insecure content.
415 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { 416 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) {
416 ASSERT_TRUE(test_server()->Start()); 417 ASSERT_TRUE(test_server()->Start());
417 ASSERT_TRUE(https_server_.Start()); 418 ASSERT_TRUE(https_server_.Start());
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // Visits two pages from the same origin: one that displays insecure content and 520 // Visits two pages from the same origin: one that displays insecure content and
520 // one that doesn't. The test checks that we do not propagate the insecure 521 // one that doesn't. The test checks that we do not propagate the insecure
521 // content state from one to the other. 522 // content state from one to the other.
522 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { 523 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
523 ASSERT_TRUE(test_server()->Start()); 524 ASSERT_TRUE(test_server()->Start());
524 ASSERT_TRUE(https_server_.Start()); 525 ASSERT_TRUE(https_server_.Start());
525 526
526 ui_test_utils::NavigateToURL(browser(), 527 ui_test_utils::NavigateToURL(browser(),
527 https_server_.GetURL("files/ssl/blank_page.html")); 528 https_server_.GetURL("files/ssl/blank_page.html"));
528 529
529 TabContents* tab1 = browser()->GetSelectedTabContents(); 530 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
530 531
531 // This tab should be fine. 532 // This tab should be fine.
532 CheckAuthenticatedState(tab1, false); 533 CheckAuthenticatedState(tab1->tab_contents(), false);
533 534
534 // Create a new tab. 535 // Create a new tab.
535 std::string replacement_path; 536 std::string replacement_path;
536 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 537 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
537 "files/ssl/page_displays_insecure_content.html", 538 "files/ssl/page_displays_insecure_content.html",
538 test_server()->host_port_pair(), 539 test_server()->host_port_pair(),
539 &replacement_path)); 540 &replacement_path));
540 541
541 GURL url = https_server_.GetURL(replacement_path); 542 GURL url = https_server_.GetURL(replacement_path);
542 browser::NavigateParams params(browser(), url, PageTransition::TYPED); 543 browser::NavigateParams params(browser(), url, PageTransition::TYPED);
543 params.disposition = NEW_FOREGROUND_TAB; 544 params.disposition = NEW_FOREGROUND_TAB;
544 params.tabstrip_index = 0; 545 params.tabstrip_index = 0;
545 params.source_contents = tab1; 546 params.source_contents = tab1;
546 browser::Navigate(&params); 547 browser::Navigate(&params);
547 TabContents* tab2 = params.target_contents; 548 TabContentsWrapper* tab2 = params.target_contents;
548 ui_test_utils::WaitForNavigation(&(tab2->controller())); 549 ui_test_utils::WaitForNavigation(&(tab2->controller()));
549 550
550 // The new tab has insecure content. 551 // The new tab has insecure content.
551 CheckAuthenticatedState(tab2, true); 552 CheckAuthenticatedState(tab2->tab_contents(), true);
552 553
553 // The original tab should not be contaminated. 554 // The original tab should not be contaminated.
554 CheckAuthenticatedState(tab1, false); 555 CheckAuthenticatedState(tab1->tab_contents(), false);
555 } 556 }
556 557
557 // Visits two pages from the same origin: one that runs insecure content and one 558 // Visits two pages from the same origin: one that runs insecure content and one
558 // that doesn't. The test checks that we propagate the insecure content state 559 // that doesn't. The test checks that we propagate the insecure content state
559 // from one to the other. 560 // from one to the other.
560 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { 561 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) {
561 ASSERT_TRUE(test_server()->Start()); 562 ASSERT_TRUE(test_server()->Start());
562 ASSERT_TRUE(https_server_.Start()); 563 ASSERT_TRUE(https_server_.Start());
563 564
564 ui_test_utils::NavigateToURL(browser(), 565 ui_test_utils::NavigateToURL(browser(),
565 https_server_.GetURL("files/ssl/blank_page.html")); 566 https_server_.GetURL("files/ssl/blank_page.html"));
566 567
567 TabContents* tab1 = browser()->GetSelectedTabContents(); 568 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
568 569
569 // This tab should be fine. 570 // This tab should be fine.
570 CheckAuthenticatedState(tab1, false); 571 CheckAuthenticatedState(tab1->tab_contents(), false);
571 572
572 std::string replacement_path; 573 std::string replacement_path;
573 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 574 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
574 "files/ssl/page_runs_insecure_content.html", 575 "files/ssl/page_runs_insecure_content.html",
575 test_server()->host_port_pair(), 576 test_server()->host_port_pair(),
576 &replacement_path)); 577 &replacement_path));
577 578
578 // Create a new tab. 579 // Create a new tab.
579 GURL url = https_server_.GetURL(replacement_path); 580 GURL url = https_server_.GetURL(replacement_path);
580 browser::NavigateParams params(browser(), url, PageTransition::TYPED); 581 browser::NavigateParams params(browser(), url, PageTransition::TYPED);
581 params.disposition = NEW_FOREGROUND_TAB; 582 params.disposition = NEW_FOREGROUND_TAB;
582 params.source_contents = tab1; 583 params.source_contents = tab1;
583 browser::Navigate(&params); 584 browser::Navigate(&params);
584 TabContents* tab2 = params.target_contents; 585 TabContentsWrapper* tab2 = params.target_contents;
585 ui_test_utils::WaitForNavigation(&(tab2->controller())); 586 ui_test_utils::WaitForNavigation(&(tab2->controller()));
586 587
587 // The new tab has insecure content. 588 // The new tab has insecure content.
588 CheckAuthenticationBrokenState(tab2, 0, true, false); 589 CheckAuthenticationBrokenState(tab2->tab_contents(), 0, true, false);
589 590
590 // Which means the origin for the first tab has also been contaminated with 591 // Which means the origin for the first tab has also been contaminated with
591 // insecure content. 592 // insecure content.
592 CheckAuthenticationBrokenState(tab1, 0, true, false); 593 CheckAuthenticationBrokenState(tab1->tab_contents(), 0, true, false);
593 } 594 }
594 595
595 // Visits a page with an image over http. Visits another page over https 596 // Visits a page with an image over http. Visits another page over https
596 // referencing that same image over http (hoping it is coming from the webcore 597 // referencing that same image over http (hoping it is coming from the webcore
597 // memory cache). 598 // memory cache).
598 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { 599 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) {
599 ASSERT_TRUE(test_server()->Start()); 600 ASSERT_TRUE(test_server()->Start());
600 ASSERT_TRUE(https_server_.Start()); 601 ASSERT_TRUE(https_server_.Start());
601 602
602 std::string replacement_path; 603 std::string replacement_path;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 break; 737 break;
737 MessageLoop::current()->PostDelayedTask(FROM_HERE, 738 MessageLoop::current()->PostDelayedTask(FROM_HERE,
738 new MessageLoop::QuitTask(), 1000); 739 new MessageLoop::QuitTask(), 1000);
739 ui_test_utils::RunMessageLoop(); 740 ui_test_utils::RunMessageLoop();
740 } 741 }
741 ASSERT_EQ(1, static_cast<int>(tab1->constrained_window_count())); 742 ASSERT_EQ(1, static_cast<int>(tab1->constrained_window_count()));
742 743
743 // Let's add another tab to make sure the browser does not exit when we close 744 // Let's add another tab to make sure the browser does not exit when we close
744 // the first tab. 745 // the first tab.
745 GURL url = test_server()->GetURL("files/ssl/google.html"); 746 GURL url = test_server()->GetURL("files/ssl/google.html");
746 TabContents* tab2 = 747 TabContentsWrapper* tab2 =
747 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); 748 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED);
748 ui_test_utils::WaitForNavigation(&(tab2->controller())); 749 ui_test_utils::WaitForNavigation(&(tab2->controller()));
749 750
750 // Close the first tab. 751 // Close the first tab.
751 browser()->CloseTabContents(tab1); 752 browser()->CloseTabContents(tab1);
752 } 753 }
753 754
754 // Visit a page over bad https that is a redirect to a page with good https. 755 // Visit a page over bad https that is a redirect to a page with good https.
755 // Marked as flaky, see bug 40932. 756 // Marked as flaky, see bug 40932.
756 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) { 757 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectBadToGoodHTTPS) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1081
1081 // Visit a page over https that contains a frame with a redirect. 1082 // Visit a page over https that contains a frame with a redirect.
1082 1083
1083 // XMLHttpRequest insecure content in synchronous mode. 1084 // XMLHttpRequest insecure content in synchronous mode.
1084 1085
1085 // XMLHttpRequest insecure content in asynchronous mode. 1086 // XMLHttpRequest insecure content in asynchronous mode.
1086 1087
1087 // XMLHttpRequest over bad ssl in synchronous mode. 1088 // XMLHttpRequest over bad ssl in synchronous mode.
1088 1089
1089 // XMLHttpRequest over OK ssl in synchronous mode. 1090 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698