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

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

Issue 4664009: All SSL UI tests work with ephemeral ports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: #include <utility> 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/stringprintf.h"
6 #include "base/time.h" 5 #include "base/time.h"
7 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_navigator.h" 8 #include "chrome/browser/browser_navigator.h"
10 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
12 #include "chrome/browser/tab_contents/interstitial_page.h" 11 #include "chrome/browser/tab_contents/interstitial_page.h"
13 #include "chrome/browser/tab_contents/navigation_entry.h" 12 #include "chrome/browser/tab_contents/navigation_entry.h"
14 #include "chrome/browser/tab_contents/tab_contents.h" 13 #include "chrome/browser/tab_contents/tab_contents.h"
15 #include "chrome/browser/tabs/tab_strip_model.h" 14 #include "chrome/browser/tabs/tab_strip_model.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 109 }
111 110
112 void ProceedThroughInterstitial(TabContents* tab) { 111 void ProceedThroughInterstitial(TabContents* tab) {
113 InterstitialPage* interstitial_page = tab->interstitial_page(); 112 InterstitialPage* interstitial_page = tab->interstitial_page();
114 ASSERT_TRUE(interstitial_page); 113 ASSERT_TRUE(interstitial_page);
115 interstitial_page->Proceed(); 114 interstitial_page->Proceed();
116 // Wait for the navigation to be done. 115 // Wait for the navigation to be done.
117 ui_test_utils::WaitForNavigation(&(tab->controller())); 116 ui_test_utils::WaitForNavigation(&(tab->controller()));
118 } 117 }
119 118
120 std::string GetFileWithHostAndPortReplacement( 119 static bool GetFilePathWithHostAndPortReplacement(
121 const std::string& original_path, 120 const std::string& original_file_path,
122 const net::HostPortPair& host_port_pair) const { 121 const net::HostPortPair& host_port_pair,
123 return StringPrintf("%s?replace_orig=%s&replace_new=%s", 122 std::string* replacement_path) {
124 original_path.c_str(), 123 std::vector<net::TestServer::StringPair> replacement_text;
125 kReplaceText_, 124 replacement_text.push_back(
126 host_port_pair.ToString().c_str()); 125 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString()));
126 return net::TestServer::GetFilePathWithReplacements(
127 original_file_path, replacement_text, replacement_path);
128 }
129
130 static bool GetTopFramePath(const net::TestServer& http_server,
131 const net::TestServer& good_https_server,
132 const net::TestServer& bad_https_server,
133 std::string* top_frame_path) {
134 // The "frame_left.html" page contained in the top_frame.html page contains
135 // <a href>'s to three different servers. This sets up all of the
136 // replacement text to work with test servers which listen on ephemeral
137 // ports.
138 GURL http_url = http_server.GetURL("files/ssl/google.html");
139 GURL good_https_url = good_https_server.GetURL("files/ssl/google.html");
140 GURL bad_https_url = bad_https_server.GetURL(
141 "files/ssl/bad_iframe.html");
142
143 std::vector<net::TestServer::StringPair> replacement_text_frame_left;
144 replacement_text_frame_left.push_back(
145 make_pair("REPLACE_WITH_HTTP_PAGE", http_url.spec()));
146 replacement_text_frame_left.push_back(
147 make_pair("REPLACE_WITH_GOOD_HTTPS_PAGE", good_https_url.spec()));
148 replacement_text_frame_left.push_back(
149 make_pair("REPLACE_WITH_BAD_HTTPS_PAGE", bad_https_url.spec()));
150 std::string frame_left_path;
151 if (!net::TestServer::GetFilePathWithReplacements(
152 "frame_left.html",
153 replacement_text_frame_left,
154 &frame_left_path))
155 return false;
156
157 // Substitute the generated frame_left URL into the top_frame page.
158 std::vector<net::TestServer::StringPair> replacement_text_top_frame;
159 replacement_text_top_frame.push_back(
160 make_pair("REPLACE_WITH_FRAME_LEFT_PATH", frame_left_path));
161 return net::TestServer::GetFilePathWithReplacements(
162 "files/ssl/top_frame.html",
163 replacement_text_top_frame,
164 top_frame_path);
127 } 165 }
128 166
129 net::TestServer https_server_; 167 net::TestServer https_server_;
130 net::TestServer https_server_expired_; 168 net::TestServer https_server_expired_;
131 net::TestServer https_server_mismatched_; 169 net::TestServer https_server_mismatched_;
132 170
133 private: 171 private:
134 DISALLOW_COPY_AND_ASSIGN(SSLUITest); 172 DISALLOW_COPY_AND_ASSIGN(SSLUITest);
135
136 static const char* const kReplaceText_;
137 }; 173 };
138 174
139 // static
140 const char* const SSLUITest::kReplaceText_ = "REPLACE_WITH_HOST_AND_PORT";
141
142 // Visits a regular page over http. 175 // Visits a regular page over http.
143 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { 176 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) {
144 ASSERT_TRUE(test_server()->Start()); 177 ASSERT_TRUE(test_server()->Start());
145 178
146 ui_test_utils::NavigateToURL(browser(), 179 ui_test_utils::NavigateToURL(browser(),
147 test_server()->GetURL("files/ssl/google.html")); 180 test_server()->GetURL("files/ssl/google.html"));
148 181
149 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); 182 CheckUnauthenticatedState(browser()->GetSelectedTabContents());
150 } 183 }
151 184
152 // Visits a page over http which includes broken https resources (status should 185 // Visits a page over http which includes broken https resources (status should
153 // be OK). 186 // be OK).
154 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give 187 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give
155 // the secure cookies away!). 188 // the secure cookies away!).
156 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { 189 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) {
157 ASSERT_TRUE(test_server()->Start()); 190 ASSERT_TRUE(test_server()->Start());
158 ASSERT_TRUE(https_server_expired_.Start()); 191 ASSERT_TRUE(https_server_expired_.Start());
159 192
160 std::string replacement_path = GetFileWithHostAndPortReplacement( 193 std::string replacement_path;
194 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
161 "files/ssl/page_with_unsafe_contents.html", 195 "files/ssl/page_with_unsafe_contents.html",
162 https_server_expired_.host_port_pair()); 196 https_server_expired_.host_port_pair(),
197 &replacement_path));
163 198
164 ui_test_utils::NavigateToURL( 199 ui_test_utils::NavigateToURL(
165 browser(), test_server()->GetURL(replacement_path)); 200 browser(), test_server()->GetURL(replacement_path));
166 201
167 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); 202 CheckUnauthenticatedState(browser()->GetSelectedTabContents());
168 } 203 }
169 204
170 // Visits a page over OK https: 205 // Visits a page over OK https:
171 IN_PROC_BROWSER_TEST_F(SSLUITest, TestOKHTTPS) { 206 IN_PROC_BROWSER_TEST_F(SSLUITest, TestOKHTTPS) {
172 ASSERT_TRUE(https_server_.Start()); 207 ASSERT_TRUE(https_server_.Start());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 410
376 // 411 //
377 // Insecure content 412 // Insecure content
378 // 413 //
379 414
380 // Visits a page that displays insecure content. 415 // Visits a page that displays insecure content.
381 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { 416 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) {
382 ASSERT_TRUE(test_server()->Start()); 417 ASSERT_TRUE(test_server()->Start());
383 ASSERT_TRUE(https_server_.Start()); 418 ASSERT_TRUE(https_server_.Start());
384 419
385 std::string replacement_path = GetFileWithHostAndPortReplacement( 420 std::string replacement_path;
421 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
386 "files/ssl/page_displays_insecure_content.html", 422 "files/ssl/page_displays_insecure_content.html",
387 test_server()->host_port_pair()); 423 test_server()->host_port_pair(),
424 &replacement_path));
388 425
389 // Load a page that displays insecure content. 426 // Load a page that displays insecure content.
390 ui_test_utils::NavigateToURL(browser(), 427 ui_test_utils::NavigateToURL(browser(),
391 https_server_.GetURL(replacement_path)); 428 https_server_.GetURL(replacement_path));
392 429
393 CheckAuthenticatedState(browser()->GetSelectedTabContents(), true); 430 CheckAuthenticatedState(browser()->GetSelectedTabContents(), true);
394 } 431 }
395 432
396 // Visits a page that runs insecure content and tries to suppress the insecure 433 // Visits a page that runs insecure content and tries to suppress the insecure
397 // content warnings by randomizing location.hash. 434 // content warnings by randomizing location.hash.
(...skipping 12 matching lines...) Expand all
410 } 447 }
411 448
412 // Visits a page with unsafe content and make sure that: 449 // Visits a page with unsafe content and make sure that:
413 // - frames content is replaced with warning 450 // - frames content is replaced with warning
414 // - images and scripts are filtered out entirely 451 // - images and scripts are filtered out entirely
415 // Marked as flaky, see bug 40932. 452 // Marked as flaky, see bug 40932.
416 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { 453 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) {
417 ASSERT_TRUE(https_server_.Start()); 454 ASSERT_TRUE(https_server_.Start());
418 ASSERT_TRUE(https_server_expired_.Start()); 455 ASSERT_TRUE(https_server_expired_.Start());
419 456
420 std::string replacement_path = GetFileWithHostAndPortReplacement( 457 std::string replacement_path;
458 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
421 "files/ssl/page_with_unsafe_contents.html", 459 "files/ssl/page_with_unsafe_contents.html",
422 https_server_expired_.host_port_pair()); 460 https_server_expired_.host_port_pair(),
461 &replacement_path));
423 ui_test_utils::NavigateToURL(browser(), 462 ui_test_utils::NavigateToURL(browser(),
424 https_server_.GetURL(replacement_path)); 463 https_server_.GetURL(replacement_path));
425 464
426 TabContents* tab = browser()->GetSelectedTabContents(); 465 TabContents* tab = browser()->GetSelectedTabContents();
427 // When the bad content is filtered, the state is expected to be 466 // When the bad content is filtered, the state is expected to be
428 // authenticated. 467 // authenticated.
429 CheckAuthenticatedState(tab, false); 468 CheckAuthenticatedState(tab, false);
430 469
431 // Because of cross-frame scripting restrictions, we cannot access the iframe 470 // Because of cross-frame scripting restrictions, we cannot access the iframe
432 // content. So to know if the frame was loaded, we just check if a popup was 471 // content. So to know if the frame was loaded, we just check if a popup was
(...skipping 17 matching lines...) Expand all
450 L"window.domAutomationController.send(IsFooSet());", &js_result)); 489 L"window.domAutomationController.send(IsFooSet());", &js_result));
451 EXPECT_FALSE(js_result); 490 EXPECT_FALSE(js_result);
452 } 491 }
453 492
454 // Visits a page with insecure content loaded by JS (after the initial page 493 // Visits a page with insecure content loaded by JS (after the initial page
455 // load). 494 // load).
456 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentLoadedFromJS) { 495 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentLoadedFromJS) {
457 ASSERT_TRUE(test_server()->Start()); 496 ASSERT_TRUE(test_server()->Start());
458 ASSERT_TRUE(https_server_.Start()); 497 ASSERT_TRUE(https_server_.Start());
459 498
460 std::string replacement_path = GetFileWithHostAndPortReplacement( 499 std::string replacement_path;
500 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
461 "files/ssl/page_with_dynamic_insecure_content.html", 501 "files/ssl/page_with_dynamic_insecure_content.html",
462 test_server()->host_port_pair()); 502 test_server()->host_port_pair(),
503 &replacement_path));
463 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( 504 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
464 replacement_path)); 505 replacement_path));
465 506
466 TabContents* tab = browser()->GetSelectedTabContents(); 507 TabContents* tab = browser()->GetSelectedTabContents();
467 CheckAuthenticatedState(tab, false); 508 CheckAuthenticatedState(tab, false);
468 509
469 // Load the insecure image. 510 // Load the insecure image.
470 bool js_result = false; 511 bool js_result = false;
471 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 512 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
472 tab->render_view_host(), std::wstring(), L"loadBadImage();", &js_result)); 513 tab->render_view_host(), std::wstring(), L"loadBadImage();", &js_result));
(...skipping 12 matching lines...) Expand all
485 526
486 ui_test_utils::NavigateToURL(browser(), 527 ui_test_utils::NavigateToURL(browser(),
487 https_server_.GetURL("files/ssl/blank_page.html")); 528 https_server_.GetURL("files/ssl/blank_page.html"));
488 529
489 TabContents* tab1 = browser()->GetSelectedTabContents(); 530 TabContents* tab1 = browser()->GetSelectedTabContents();
490 531
491 // This tab should be fine. 532 // This tab should be fine.
492 CheckAuthenticatedState(tab1, false); 533 CheckAuthenticatedState(tab1, false);
493 534
494 // Create a new tab. 535 // Create a new tab.
495 std::string replacement_path = GetFileWithHostAndPortReplacement( 536 std::string replacement_path;
537 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
496 "files/ssl/page_displays_insecure_content.html", 538 "files/ssl/page_displays_insecure_content.html",
497 test_server()->host_port_pair()); 539 test_server()->host_port_pair(),
540 &replacement_path));
498 541
499 GURL url = https_server_.GetURL(replacement_path); 542 GURL url = https_server_.GetURL(replacement_path);
500 browser::NavigateParams params(browser(), url, PageTransition::TYPED); 543 browser::NavigateParams params(browser(), url, PageTransition::TYPED);
501 params.disposition = NEW_FOREGROUND_TAB; 544 params.disposition = NEW_FOREGROUND_TAB;
502 params.tabstrip_index = 0; 545 params.tabstrip_index = 0;
503 params.source_contents = tab1; 546 params.source_contents = tab1;
504 browser::Navigate(&params); 547 browser::Navigate(&params);
505 TabContents* tab2 = params.target_contents; 548 TabContents* tab2 = params.target_contents;
506 ui_test_utils::WaitForNavigation(&(tab2->controller())); 549 ui_test_utils::WaitForNavigation(&(tab2->controller()));
507 550
(...skipping 12 matching lines...) Expand all
520 ASSERT_TRUE(https_server_.Start()); 563 ASSERT_TRUE(https_server_.Start());
521 564
522 ui_test_utils::NavigateToURL(browser(), 565 ui_test_utils::NavigateToURL(browser(),
523 https_server_.GetURL("files/ssl/blank_page.html")); 566 https_server_.GetURL("files/ssl/blank_page.html"));
524 567
525 TabContents* tab1 = browser()->GetSelectedTabContents(); 568 TabContents* tab1 = browser()->GetSelectedTabContents();
526 569
527 // This tab should be fine. 570 // This tab should be fine.
528 CheckAuthenticatedState(tab1, false); 571 CheckAuthenticatedState(tab1, false);
529 572
530 std::string replacement_path = GetFileWithHostAndPortReplacement( 573 std::string replacement_path;
574 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
531 "files/ssl/page_runs_insecure_content.html", 575 "files/ssl/page_runs_insecure_content.html",
532 test_server()->host_port_pair()); 576 test_server()->host_port_pair(),
577 &replacement_path));
533 578
534 // Create a new tab. 579 // Create a new tab.
535 GURL url = https_server_.GetURL(replacement_path); 580 GURL url = https_server_.GetURL(replacement_path);
536 browser::NavigateParams params(browser(), url, PageTransition::TYPED); 581 browser::NavigateParams params(browser(), url, PageTransition::TYPED);
537 params.disposition = NEW_FOREGROUND_TAB; 582 params.disposition = NEW_FOREGROUND_TAB;
538 params.source_contents = tab1; 583 params.source_contents = tab1;
539 browser::Navigate(&params); 584 browser::Navigate(&params);
540 TabContents* tab2 = params.target_contents; 585 TabContents* tab2 = params.target_contents;
541 ui_test_utils::WaitForNavigation(&(tab2->controller())); 586 ui_test_utils::WaitForNavigation(&(tab2->controller()));
542 587
543 // The new tab has insecure content. 588 // The new tab has insecure content.
544 CheckAuthenticationBrokenState(tab2, 0, true, false); 589 CheckAuthenticationBrokenState(tab2, 0, true, false);
545 590
546 // 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
547 // insecure content. 592 // insecure content.
548 CheckAuthenticationBrokenState(tab1, 0, true, false); 593 CheckAuthenticationBrokenState(tab1, 0, true, false);
549 } 594 }
550 595
551 // 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
552 // 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
553 // memory cache). 598 // memory cache).
554 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { 599 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) {
555 ASSERT_TRUE(test_server()->Start()); 600 ASSERT_TRUE(test_server()->Start());
556 ASSERT_TRUE(https_server_.Start()); 601 ASSERT_TRUE(https_server_.Start());
557 602
558 std::string replacement_path = GetFileWithHostAndPortReplacement( 603 std::string replacement_path;
604 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
559 "files/ssl/page_displays_insecure_content.html", 605 "files/ssl/page_displays_insecure_content.html",
560 test_server()->host_port_pair()); 606 test_server()->host_port_pair(),
607 &replacement_path));
561 608
562 // Load original page over HTTP. 609 // Load original page over HTTP.
563 const GURL url_http = test_server()->GetURL(replacement_path); 610 const GURL url_http = test_server()->GetURL(replacement_path);
564 ui_test_utils::NavigateToURL(browser(), url_http); 611 ui_test_utils::NavigateToURL(browser(), url_http);
565 TabContents* tab = browser()->GetSelectedTabContents(); 612 TabContents* tab = browser()->GetSelectedTabContents();
566 CheckUnauthenticatedState(tab); 613 CheckUnauthenticatedState(tab);
567 614
568 // Load again but over SSL. It should be marked as displaying insecure 615 // Load again but over SSL. It should be marked as displaying insecure
569 // content (even though the image comes from the WebCore memory cache). 616 // content (even though the image comes from the WebCore memory cache).
570 const GURL url_https = https_server_.GetURL(replacement_path); 617 const GURL url_https = https_server_.GetURL(replacement_path);
571 ui_test_utils::NavigateToURL(browser(), url_https); 618 ui_test_utils::NavigateToURL(browser(), url_https);
572 CheckAuthenticatedState(tab, true); 619 CheckAuthenticatedState(tab, true);
573 } 620 }
574 621
575 // Visits a page with script over http. Visits another page over https 622 // Visits a page with script over http. Visits another page over https
576 // referencing that same script over http (hoping it is coming from the webcore 623 // referencing that same script over http (hoping it is coming from the webcore
577 // memory cache). 624 // memory cache).
578 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsCachedInsecureContent) { 625 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsCachedInsecureContent) {
579 ASSERT_TRUE(test_server()->Start()); 626 ASSERT_TRUE(test_server()->Start());
580 ASSERT_TRUE(https_server_.Start()); 627 ASSERT_TRUE(https_server_.Start());
581 628
582 std::string replacement_path = GetFileWithHostAndPortReplacement( 629 std::string replacement_path;
630 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
583 "files/ssl/page_runs_insecure_content.html", 631 "files/ssl/page_runs_insecure_content.html",
584 test_server()->host_port_pair()); 632 test_server()->host_port_pair(),
633 &replacement_path));
585 634
586 // Load original page over HTTP. 635 // Load original page over HTTP.
587 const GURL url_http = test_server()->GetURL(replacement_path); 636 const GURL url_http = test_server()->GetURL(replacement_path);
588 ui_test_utils::NavigateToURL(browser(), url_http); 637 ui_test_utils::NavigateToURL(browser(), url_http);
589 TabContents* tab = browser()->GetSelectedTabContents(); 638 TabContents* tab = browser()->GetSelectedTabContents();
590 CheckUnauthenticatedState(tab); 639 CheckUnauthenticatedState(tab);
591 640
592 // Load again but over SSL. It should be marked as displaying insecure 641 // Load again but over SSL. It should be marked as displaying insecure
593 // content (even though the image comes from the WebCore memory cache). 642 // content (even though the image comes from the WebCore memory cache).
594 const GURL url_https = https_server_.GetURL(replacement_path); 643 const GURL url_https = https_server_.GetURL(replacement_path);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 } 713 }
665 714
666 // Tests that closing a page that has a unsafe pop-up does not crash the 715 // Tests that closing a page that has a unsafe pop-up does not crash the
667 // browser (bug #1966). 716 // browser (bug #1966).
668 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not 717 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not
669 // opened as it is not initiated by a user gesture. 718 // opened as it is not initiated by a user gesture.
670 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { 719 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
671 ASSERT_TRUE(test_server()->Start()); 720 ASSERT_TRUE(test_server()->Start());
672 ASSERT_TRUE(https_server_expired_.Start()); 721 ASSERT_TRUE(https_server_expired_.Start());
673 722
674 std::string replacement_path = GetFileWithHostAndPortReplacement( 723 std::string replacement_path;
724 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
675 "files/ssl/page_with_unsafe_popup.html", 725 "files/ssl/page_with_unsafe_popup.html",
676 https_server_expired_.host_port_pair()); 726 https_server_expired_.host_port_pair(),
727 &replacement_path));
677 728
678 ui_test_utils::NavigateToURL(browser(), 729 ui_test_utils::NavigateToURL(browser(),
679 test_server()->GetURL(replacement_path)); 730 test_server()->GetURL(replacement_path));
680 731
681 TabContents* tab1 = browser()->GetSelectedTabContents(); 732 TabContents* tab1 = browser()->GetSelectedTabContents();
682 // It is probably overkill to add a notification for a popup-opening, let's 733 // It is probably overkill to add a notification for a popup-opening, let's
683 // just poll. 734 // just poll.
684 for (int i = 0; i < 10; i++) { 735 for (int i = 0; i < 10; i++) {
685 if (static_cast<int>(tab1->constrained_window_count()) > 0) 736 if (static_cast<int>(tab1->constrained_window_count()) > 0)
686 break; 737 break;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 // - navigate to an OK HTTPS frame 866 // - navigate to an OK HTTPS frame
816 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then 867 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then
817 // back 868 // back
818 // - navigate to HTTP (expect insecure content), then back 869 // - navigate to HTTP (expect insecure content), then back
819 // Disabled, http://crbug.com/18626. 870 // Disabled, http://crbug.com/18626.
820 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestGoodFrameNavigation) { 871 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestGoodFrameNavigation) {
821 ASSERT_TRUE(test_server()->Start()); 872 ASSERT_TRUE(test_server()->Start());
822 ASSERT_TRUE(https_server_.Start()); 873 ASSERT_TRUE(https_server_.Start());
823 ASSERT_TRUE(https_server_expired_.Start()); 874 ASSERT_TRUE(https_server_expired_.Start());
824 875
876 std::string top_frame_path;
877 ASSERT_TRUE(GetTopFramePath(*test_server(),
878 https_server_,
879 https_server_expired_,
880 &top_frame_path));
881
825 TabContents* tab = browser()->GetSelectedTabContents(); 882 TabContents* tab = browser()->GetSelectedTabContents();
826 ui_test_utils::NavigateToURL(browser(), 883 ui_test_utils::NavigateToURL(browser(),
827 https_server_.GetURL("files/ssl/top_frame.html")); 884 https_server_.GetURL(top_frame_path));
828 885
829 CheckAuthenticatedState(tab, false); 886 CheckAuthenticatedState(tab, false);
830 887
831 bool success = false; 888 bool success = false;
832 // Now navigate inside the frame. 889 // Now navigate inside the frame.
833 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 890 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
834 tab->render_view_host(), std::wstring(), 891 tab->render_view_host(), std::wstring(),
835 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", 892 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
836 &success)); 893 &success));
837 EXPECT_TRUE(success); 894 EXPECT_TRUE(success);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 CheckAuthenticatedState(tab, true); 940 CheckAuthenticatedState(tab, true);
884 } 941 }
885 942
886 // From a bad HTTPS top frame: 943 // From a bad HTTPS top frame:
887 // - navigate to an OK HTTPS frame (expected to be still authentication broken). 944 // - navigate to an OK HTTPS frame (expected to be still authentication broken).
888 // Marked as flaky, see bug 40932. 945 // Marked as flaky, see bug 40932.
889 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { 946 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) {
890 ASSERT_TRUE(https_server_.Start()); 947 ASSERT_TRUE(https_server_.Start());
891 ASSERT_TRUE(https_server_expired_.Start()); 948 ASSERT_TRUE(https_server_expired_.Start());
892 949
950 std::string top_frame_path;
951 ASSERT_TRUE(GetTopFramePath(*test_server(),
952 https_server_,
953 https_server_expired_,
954 &top_frame_path));
955
893 TabContents* tab = browser()->GetSelectedTabContents(); 956 TabContents* tab = browser()->GetSelectedTabContents();
894 ui_test_utils::NavigateToURL(browser(), 957 ui_test_utils::NavigateToURL(browser(),
895 https_server_expired_.GetURL("files/ssl/top_frame.html")); 958 https_server_expired_.GetURL(top_frame_path));
896 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 959 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
897 true); // Interstitial showing 960 true); // Interstitial showing
898 961
899 ProceedThroughInterstitial(tab); 962 ProceedThroughInterstitial(tab);
900 963
901 // Navigate to a good frame. 964 // Navigate to a good frame.
902 bool success = false; 965 bool success = false;
903 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 966 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
904 tab->render_view_host(), std::wstring(), 967 tab->render_view_host(), std::wstring(),
905 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", 968 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
(...skipping 15 matching lines...) Expand all
921 #else 984 #else
922 // Marked as flaky, see bug 40932. 985 // Marked as flaky, see bug 40932.
923 #define MAYBE_TestUnauthenticatedFrameNavigation \ 986 #define MAYBE_TestUnauthenticatedFrameNavigation \
924 FLAKY_TestUnauthenticatedFrameNavigation 987 FLAKY_TestUnauthenticatedFrameNavigation
925 #endif 988 #endif
926 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestUnauthenticatedFrameNavigation) { 989 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestUnauthenticatedFrameNavigation) {
927 ASSERT_TRUE(test_server()->Start()); 990 ASSERT_TRUE(test_server()->Start());
928 ASSERT_TRUE(https_server_.Start()); 991 ASSERT_TRUE(https_server_.Start());
929 ASSERT_TRUE(https_server_expired_.Start()); 992 ASSERT_TRUE(https_server_expired_.Start());
930 993
994 std::string top_frame_path;
995 ASSERT_TRUE(GetTopFramePath(*test_server(),
996 https_server_,
997 https_server_expired_,
998 &top_frame_path));
999
931 TabContents* tab = browser()->GetSelectedTabContents(); 1000 TabContents* tab = browser()->GetSelectedTabContents();
932 ui_test_utils::NavigateToURL(browser(), 1001 ui_test_utils::NavigateToURL(browser(),
933 test_server()->GetURL("files/ssl/top_frame.html")); 1002 test_server()->GetURL(top_frame_path));
934 CheckUnauthenticatedState(tab); 1003 CheckUnauthenticatedState(tab);
935 1004
936 // Now navigate inside the frame to a secure HTTPS frame. 1005 // Now navigate inside the frame to a secure HTTPS frame.
937 bool success = false; 1006 bool success = false;
938 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 1007 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
939 tab->render_view_host(), std::wstring(), 1008 tab->render_view_host(), std::wstring(),
940 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", 1009 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
941 &success)); 1010 &success));
942 EXPECT_TRUE(success); 1011 EXPECT_TRUE(success);
943 ui_test_utils::WaitForNavigation(&tab->controller()); 1012 ui_test_utils::WaitForNavigation(&tab->controller());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 1081
1013 // 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.
1014 1083
1015 // XMLHttpRequest insecure content in synchronous mode. 1084 // XMLHttpRequest insecure content in synchronous mode.
1016 1085
1017 // XMLHttpRequest insecure content in asynchronous mode. 1086 // XMLHttpRequest insecure content in asynchronous mode.
1018 1087
1019 // XMLHttpRequest over bad ssl in synchronous mode. 1088 // XMLHttpRequest over bad ssl in synchronous mode.
1020 1089
1021 // XMLHttpRequest over OK ssl in synchronous mode. 1090 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc ('k') | chrome/test/data/ssl/frame_left.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698