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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 ASSERT_TRUE(interstitial_page); | 209 ASSERT_TRUE(interstitial_page); |
210 content::WindowedNotificationObserver observer( | 210 content::WindowedNotificationObserver observer( |
211 content::NOTIFICATION_LOAD_STOP, | 211 content::NOTIFICATION_LOAD_STOP, |
212 content::Source<NavigationController>(&tab->GetController())); | 212 content::Source<NavigationController>(&tab->GetController())); |
213 interstitial_page->Proceed(); | 213 interstitial_page->Proceed(); |
214 observer.Wait(); | 214 observer.Wait(); |
215 } | 215 } |
216 | 216 |
217 bool IsShowingWebContentsModalDialog() const { | 217 bool IsShowingWebContentsModalDialog() const { |
218 return WebContentsModalDialogManager::FromWebContents( | 218 return WebContentsModalDialogManager::FromWebContents( |
219 chrome::GetActiveWebContents(browser()))->IsShowingDialog(); | 219 browser()->tab_strip_model()->GetActiveWebContents())-> |
| 220 IsShowingDialog(); |
220 } | 221 } |
221 | 222 |
222 static bool GetFilePathWithHostAndPortReplacement( | 223 static bool GetFilePathWithHostAndPortReplacement( |
223 const std::string& original_file_path, | 224 const std::string& original_file_path, |
224 const net::HostPortPair& host_port_pair, | 225 const net::HostPortPair& host_port_pair, |
225 std::string* replacement_path) { | 226 std::string* replacement_path) { |
226 std::vector<net::TestServer::StringPair> replacement_text; | 227 std::vector<net::TestServer::StringPair> replacement_text; |
227 replacement_text.push_back( | 228 replacement_text.push_back( |
228 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); | 229 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); |
229 return net::TestServer::GetFilePathWithReplacements( | 230 return net::TestServer::GetFilePathWithReplacements( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 326 } |
326 }; | 327 }; |
327 | 328 |
328 // Visits a regular page over http. | 329 // Visits a regular page over http. |
329 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { | 330 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { |
330 ASSERT_TRUE(test_server()->Start()); | 331 ASSERT_TRUE(test_server()->Start()); |
331 | 332 |
332 ui_test_utils::NavigateToURL(browser(), | 333 ui_test_utils::NavigateToURL(browser(), |
333 test_server()->GetURL("files/ssl/google.html")); | 334 test_server()->GetURL("files/ssl/google.html")); |
334 | 335 |
335 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser())); | 336 CheckUnauthenticatedState( |
| 337 browser()->tab_strip_model()->GetActiveWebContents()); |
336 } | 338 } |
337 | 339 |
338 // Visits a page over http which includes broken https resources (status should | 340 // Visits a page over http which includes broken https resources (status should |
339 // be OK). | 341 // be OK). |
340 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give | 342 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give |
341 // the secure cookies away!). | 343 // the secure cookies away!). |
342 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { | 344 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { |
343 ASSERT_TRUE(test_server()->Start()); | 345 ASSERT_TRUE(test_server()->Start()); |
344 ASSERT_TRUE(https_server_expired_.Start()); | 346 ASSERT_TRUE(https_server_expired_.Start()); |
345 | 347 |
346 std::string replacement_path; | 348 std::string replacement_path; |
347 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 349 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
348 "files/ssl/page_with_unsafe_contents.html", | 350 "files/ssl/page_with_unsafe_contents.html", |
349 https_server_expired_.host_port_pair(), | 351 https_server_expired_.host_port_pair(), |
350 &replacement_path)); | 352 &replacement_path)); |
351 | 353 |
352 ui_test_utils::NavigateToURL( | 354 ui_test_utils::NavigateToURL( |
353 browser(), test_server()->GetURL(replacement_path)); | 355 browser(), test_server()->GetURL(replacement_path)); |
354 | 356 |
355 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser())); | 357 CheckUnauthenticatedState( |
| 358 browser()->tab_strip_model()->GetActiveWebContents()); |
356 } | 359 } |
357 | 360 |
358 // http://crbug.com/91745 | 361 // http://crbug.com/91745 |
359 #if defined(OS_CHROMEOS) | 362 #if defined(OS_CHROMEOS) |
360 #define MAYBE_TestOKHTTPS DISABLED_TestOKHTTPS | 363 #define MAYBE_TestOKHTTPS DISABLED_TestOKHTTPS |
361 #else | 364 #else |
362 #define MAYBE_TestOKHTTPS TestOKHTTPS | 365 #define MAYBE_TestOKHTTPS TestOKHTTPS |
363 #endif | 366 #endif |
364 | 367 |
365 // Visits a page over OK https: | 368 // Visits a page over OK https: |
366 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { | 369 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { |
367 ASSERT_TRUE(https_server_.Start()); | 370 ASSERT_TRUE(https_server_.Start()); |
368 | 371 |
369 ui_test_utils::NavigateToURL(browser(), | 372 ui_test_utils::NavigateToURL(browser(), |
370 https_server_.GetURL("files/ssl/google.html")); | 373 https_server_.GetURL("files/ssl/google.html")); |
371 | 374 |
372 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false); | 375 CheckAuthenticatedState( |
| 376 browser()->tab_strip_model()->GetActiveWebContents(), false); |
373 } | 377 } |
374 | 378 |
375 // Visits a page with https error and proceed: | 379 // Visits a page with https error and proceed: |
376 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { | 380 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { |
377 ASSERT_TRUE(https_server_expired_.Start()); | 381 ASSERT_TRUE(https_server_expired_.Start()); |
378 | 382 |
379 ui_test_utils::NavigateToURL(browser(), | 383 ui_test_utils::NavigateToURL(browser(), |
380 https_server_expired_.GetURL("files/ssl/google.html")); | 384 https_server_expired_.GetURL("files/ssl/google.html")); |
381 | 385 |
382 WebContents* tab = chrome::GetActiveWebContents(browser()); | 386 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
383 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 387 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
384 true); // Interstitial showing | 388 true); // Interstitial showing |
385 | 389 |
386 ProceedThroughInterstitial(tab); | 390 ProceedThroughInterstitial(tab); |
387 | 391 |
388 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 392 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
389 false); // No interstitial showing | 393 false); // No interstitial showing |
390 } | 394 } |
391 | 395 |
392 // Visits a page with https error and don't proceed (and ensure we can still | 396 // Visits a page with https error and don't proceed (and ensure we can still |
393 // navigate at that point): | 397 // navigate at that point): |
394 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) { | 398 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) { |
395 ASSERT_TRUE(test_server()->Start()); | 399 ASSERT_TRUE(test_server()->Start()); |
396 ASSERT_TRUE(https_server_.Start()); | 400 ASSERT_TRUE(https_server_.Start()); |
397 ASSERT_TRUE(https_server_expired_.Start()); | 401 ASSERT_TRUE(https_server_expired_.Start()); |
398 | 402 |
399 // First navigate to an OK page. | 403 // First navigate to an OK page. |
400 ui_test_utils::NavigateToURL(browser(), | 404 ui_test_utils::NavigateToURL(browser(), |
401 https_server_.GetURL("files/ssl/google.html")); | 405 https_server_.GetURL("files/ssl/google.html")); |
402 | 406 |
403 WebContents* tab = chrome::GetActiveWebContents(browser()); | 407 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
404 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 408 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
405 ASSERT_TRUE(entry); | 409 ASSERT_TRUE(entry); |
406 | 410 |
407 GURL cross_site_url = | 411 GURL cross_site_url = |
408 https_server_expired_.GetURL("files/ssl/google.html"); | 412 https_server_expired_.GetURL("files/ssl/google.html"); |
409 // Change the host name from 127.0.0.1 to localhost so it triggers a | 413 // Change the host name from 127.0.0.1 to localhost so it triggers a |
410 // cross-site navigation so we can test http://crbug.com/5800 is gone. | 414 // cross-site navigation so we can test http://crbug.com/5800 is gone. |
411 ASSERT_EQ("127.0.0.1", cross_site_url.host()); | 415 ASSERT_EQ("127.0.0.1", cross_site_url.host()); |
412 GURL::Replacements replacements; | 416 GURL::Replacements replacements; |
413 std::string new_host("localhost"); | 417 std::string new_host("localhost"); |
(...skipping 23 matching lines...) Expand all Loading... |
437 | 441 |
438 // Visits a page with https error and then goes back using Browser::GoBack. | 442 // Visits a page with https error and then goes back using Browser::GoBack. |
439 IN_PROC_BROWSER_TEST_F(SSLUITest, | 443 IN_PROC_BROWSER_TEST_F(SSLUITest, |
440 TestHTTPSExpiredCertAndGoBackViaButton) { | 444 TestHTTPSExpiredCertAndGoBackViaButton) { |
441 ASSERT_TRUE(test_server()->Start()); | 445 ASSERT_TRUE(test_server()->Start()); |
442 ASSERT_TRUE(https_server_expired_.Start()); | 446 ASSERT_TRUE(https_server_expired_.Start()); |
443 | 447 |
444 // First navigate to an HTTP page. | 448 // First navigate to an HTTP page. |
445 ui_test_utils::NavigateToURL(browser(), | 449 ui_test_utils::NavigateToURL(browser(), |
446 test_server()->GetURL("files/ssl/google.html")); | 450 test_server()->GetURL("files/ssl/google.html")); |
447 WebContents* tab = chrome::GetActiveWebContents(browser()); | 451 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
448 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 452 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
449 ASSERT_TRUE(entry); | 453 ASSERT_TRUE(entry); |
450 | 454 |
451 // Now go to a bad HTTPS page that shows an interstitial. | 455 // Now go to a bad HTTPS page that shows an interstitial. |
452 ui_test_utils::NavigateToURL(browser(), | 456 ui_test_utils::NavigateToURL(browser(), |
453 https_server_expired_.GetURL("files/ssl/google.html")); | 457 https_server_expired_.GetURL("files/ssl/google.html")); |
454 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 458 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
455 true); // Interstitial showing | 459 true); // Interstitial showing |
456 | 460 |
457 ProvisionalLoadWaiter load_failed_observer(tab); | 461 ProvisionalLoadWaiter load_failed_observer(tab); |
458 | 462 |
459 // Simulate user clicking on back button (crbug.com/39248). | 463 // Simulate user clicking on back button (crbug.com/39248). |
460 chrome::GoBack(browser(), CURRENT_TAB); | 464 chrome::GoBack(browser(), CURRENT_TAB); |
461 | 465 |
462 // Wait until we hear the load failure, and make sure we haven't swapped out | 466 // Wait until we hear the load failure, and make sure we haven't swapped out |
463 // the previous page. Prevents regression of http://crbug.com/82667. | 467 // the previous page. Prevents regression of http://crbug.com/82667. |
464 load_failed_observer.Wait(); | 468 load_failed_observer.Wait(); |
465 EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut( | 469 EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut( |
466 tab->GetRenderViewHost())); | 470 tab->GetRenderViewHost())); |
467 | 471 |
468 // We should be back at the original good page. | 472 // We should be back at the original good page. |
469 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage()); | 473 EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()-> |
| 474 GetInterstitialPage()); |
470 CheckUnauthenticatedState(tab); | 475 CheckUnauthenticatedState(tab); |
471 } | 476 } |
472 | 477 |
473 // Visits a page with https error and then goes back using GoToOffset. | 478 // Visits a page with https error and then goes back using GoToOffset. |
474 // Disabled because its flaky: http://crbug.com/40932, http://crbug.com/43575. | 479 // Disabled because its flaky: http://crbug.com/40932, http://crbug.com/43575. |
475 IN_PROC_BROWSER_TEST_F(SSLUITest, | 480 IN_PROC_BROWSER_TEST_F(SSLUITest, |
476 TestHTTPSExpiredCertAndGoBackViaMenu) { | 481 TestHTTPSExpiredCertAndGoBackViaMenu) { |
477 ASSERT_TRUE(test_server()->Start()); | 482 ASSERT_TRUE(test_server()->Start()); |
478 ASSERT_TRUE(https_server_expired_.Start()); | 483 ASSERT_TRUE(https_server_expired_.Start()); |
479 | 484 |
480 // First navigate to an HTTP page. | 485 // First navigate to an HTTP page. |
481 ui_test_utils::NavigateToURL(browser(), | 486 ui_test_utils::NavigateToURL(browser(), |
482 test_server()->GetURL("files/ssl/google.html")); | 487 test_server()->GetURL("files/ssl/google.html")); |
483 WebContents* tab = chrome::GetActiveWebContents(browser()); | 488 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
484 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 489 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
485 ASSERT_TRUE(entry); | 490 ASSERT_TRUE(entry); |
486 | 491 |
487 // Now go to a bad HTTPS page that shows an interstitial. | 492 // Now go to a bad HTTPS page that shows an interstitial. |
488 ui_test_utils::NavigateToURL(browser(), | 493 ui_test_utils::NavigateToURL(browser(), |
489 https_server_expired_.GetURL("files/ssl/google.html")); | 494 https_server_expired_.GetURL("files/ssl/google.html")); |
490 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 495 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
491 true); // Interstitial showing | 496 true); // Interstitial showing |
492 | 497 |
493 // Simulate user clicking and holding on back button (crbug.com/37215). | 498 // Simulate user clicking and holding on back button (crbug.com/37215). |
494 tab->GetController().GoToOffset(-1); | 499 tab->GetController().GoToOffset(-1); |
495 | 500 |
496 // We should be back at the original good page. | 501 // We should be back at the original good page. |
497 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage()); | 502 EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()-> |
| 503 GetInterstitialPage()); |
498 CheckUnauthenticatedState(tab); | 504 CheckUnauthenticatedState(tab); |
499 } | 505 } |
500 | 506 |
501 // Visits a page with https error and then goes forward using GoToOffset. | 507 // Visits a page with https error and then goes forward using GoToOffset. |
502 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) { | 508 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) { |
503 ASSERT_TRUE(test_server()->Start()); | 509 ASSERT_TRUE(test_server()->Start()); |
504 ASSERT_TRUE(https_server_expired_.Start()); | 510 ASSERT_TRUE(https_server_expired_.Start()); |
505 | 511 |
506 // First navigate to two HTTP pages. | 512 // First navigate to two HTTP pages. |
507 ui_test_utils::NavigateToURL(browser(), | 513 ui_test_utils::NavigateToURL(browser(), |
508 test_server()->GetURL("files/ssl/google.html")); | 514 test_server()->GetURL("files/ssl/google.html")); |
509 WebContents* tab = chrome::GetActiveWebContents(browser()); | 515 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
510 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); | 516 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); |
511 ASSERT_TRUE(entry1); | 517 ASSERT_TRUE(entry1); |
512 ui_test_utils::NavigateToURL(browser(), | 518 ui_test_utils::NavigateToURL(browser(), |
513 test_server()->GetURL("files/ssl/blank_page.html")); | 519 test_server()->GetURL("files/ssl/blank_page.html")); |
514 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); | 520 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); |
515 ASSERT_TRUE(entry2); | 521 ASSERT_TRUE(entry2); |
516 | 522 |
517 // Now go back so that a page is in the forward history. | 523 // Now go back so that a page is in the forward history. |
518 { | 524 { |
519 content::WindowedNotificationObserver observer( | 525 content::WindowedNotificationObserver observer( |
(...skipping 15 matching lines...) Expand all Loading... |
535 // Simulate user clicking and holding on forward button. | 541 // Simulate user clicking and holding on forward button. |
536 { | 542 { |
537 content::WindowedNotificationObserver observer( | 543 content::WindowedNotificationObserver observer( |
538 content::NOTIFICATION_LOAD_STOP, | 544 content::NOTIFICATION_LOAD_STOP, |
539 content::Source<NavigationController>(&tab->GetController())); | 545 content::Source<NavigationController>(&tab->GetController())); |
540 tab->GetController().GoToOffset(1); | 546 tab->GetController().GoToOffset(1); |
541 observer.Wait(); | 547 observer.Wait(); |
542 } | 548 } |
543 | 549 |
544 // We should be showing the second good page. | 550 // We should be showing the second good page. |
545 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage()); | 551 EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()-> |
| 552 GetInterstitialPage()); |
546 CheckUnauthenticatedState(tab); | 553 CheckUnauthenticatedState(tab); |
547 EXPECT_FALSE(tab->GetController().CanGoForward()); | 554 EXPECT_FALSE(tab->GetController().CanGoForward()); |
548 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); | 555 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); |
549 EXPECT_TRUE(entry2 == entry4); | 556 EXPECT_TRUE(entry2 == entry4); |
550 } | 557 } |
551 | 558 |
552 // Visit a HTTP page which request WSS connection to a server providing invalid | 559 // Visit a HTTP page which request WSS connection to a server providing invalid |
553 // certificate. Close the page while WSS connection waits for SSLManager's | 560 // certificate. Close the page while WSS connection waits for SSLManager's |
554 // response from UI thread. | 561 // response from UI thread. |
555 // Disabled on Windows because it was flaking on XP Tests (1). crbug.com/165258 | 562 // Disabled on Windows because it was flaking on XP Tests (1). crbug.com/165258 |
556 #if defined(OS_WIN) | 563 #if defined(OS_WIN) |
557 #define MAYBE_TestWSSInvalidCertAndClose DISABLED_TestWSSInvalidCertAndClose | 564 #define MAYBE_TestWSSInvalidCertAndClose DISABLED_TestWSSInvalidCertAndClose |
558 #else | 565 #else |
559 #define MAYBE_TestWSSInvalidCertAndClose TestWSSInvalidCertAndClose | 566 #define MAYBE_TestWSSInvalidCertAndClose TestWSSInvalidCertAndClose |
560 #endif | 567 #endif |
561 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestWSSInvalidCertAndClose) { | 568 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestWSSInvalidCertAndClose) { |
562 ASSERT_TRUE(test_server()->Start()); | 569 ASSERT_TRUE(test_server()->Start()); |
563 ASSERT_TRUE(wss_server_expired_.Start()); | 570 ASSERT_TRUE(wss_server_expired_.Start()); |
564 | 571 |
565 // Setup page title observer. | 572 // Setup page title observer. |
566 WebContents* tab = chrome::GetActiveWebContents(browser()); | 573 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
567 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 574 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
568 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 575 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
569 | 576 |
570 // Create GURLs to test pages. | 577 // Create GURLs to test pages. |
571 std::string masterUrlPath = StringPrintf("%s?%d", | 578 std::string masterUrlPath = StringPrintf("%s?%d", |
572 test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(), | 579 test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(), |
573 wss_server_expired_.host_port_pair().port()); | 580 wss_server_expired_.host_port_pair().port()); |
574 GURL masterUrl(masterUrlPath); | 581 GURL masterUrl(masterUrlPath); |
575 std::string slaveUrlPath = StringPrintf("%s?%d", | 582 std::string slaveUrlPath = StringPrintf("%s?%d", |
576 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), | 583 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), |
(...skipping 21 matching lines...) Expand all Loading... |
598 } | 605 } |
599 | 606 |
600 // Visit a HTTPS page and proceeds despite an invalid certificate. The page | 607 // Visit a HTTPS page and proceeds despite an invalid certificate. The page |
601 // requests WSS connection to the same origin host to check if WSS connection | 608 // requests WSS connection to the same origin host to check if WSS connection |
602 // share certificates policy with HTTPS correcly. | 609 // share certificates policy with HTTPS correcly. |
603 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { | 610 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { |
604 ASSERT_TRUE(test_server()->Start()); | 611 ASSERT_TRUE(test_server()->Start()); |
605 ASSERT_TRUE(wss_server_expired_.Start()); | 612 ASSERT_TRUE(wss_server_expired_.Start()); |
606 | 613 |
607 // Setup page title observer. | 614 // Setup page title observer. |
608 WebContents* tab = chrome::GetActiveWebContents(browser()); | 615 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
609 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 616 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
610 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 617 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
611 | 618 |
612 // Visit bad HTTPS page. | 619 // Visit bad HTTPS page. |
613 std::string scheme("https"); | 620 std::string scheme("https"); |
614 GURL::Replacements replacements; | 621 GURL::Replacements replacements; |
615 replacements.SetSchemeStr(scheme); | 622 replacements.SetSchemeStr(scheme); |
616 ui_test_utils::NavigateToURL( | 623 ui_test_utils::NavigateToURL( |
617 browser(), | 624 browser(), |
618 wss_server_expired_.GetURL( | 625 wss_server_expired_.GetURL( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 options, | 672 options, |
666 net::GetWebSocketTestDataDirectory()); | 673 net::GetWebSocketTestDataDirectory()); |
667 ASSERT_TRUE(wss_server.Start()); | 674 ASSERT_TRUE(wss_server.Start()); |
668 std::string scheme("https"); | 675 std::string scheme("https"); |
669 GURL::Replacements replacements; | 676 GURL::Replacements replacements; |
670 replacements.SetSchemeStr(scheme); | 677 replacements.SetSchemeStr(scheme); |
671 GURL url = wss_server.GetURL("connect_check.html").ReplaceComponents( | 678 GURL url = wss_server.GetURL("connect_check.html").ReplaceComponents( |
672 replacements); | 679 replacements); |
673 | 680 |
674 // Setup page title observer. | 681 // Setup page title observer. |
675 WebContents* tab = chrome::GetActiveWebContents(browser()); | 682 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
676 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 683 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
677 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 684 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
678 | 685 |
679 // Add an entry into AutoSelectCertificateForUrls policy for automatic client | 686 // Add an entry into AutoSelectCertificateForUrls policy for automatic client |
680 // cert selection. | 687 // cert selection. |
681 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 688 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
682 DCHECK(profile); | 689 DCHECK(profile); |
683 scoped_ptr<DictionaryValue> dict(new DictionaryValue()); | 690 scoped_ptr<DictionaryValue> dict(new DictionaryValue()); |
684 dict->SetString("ISSUER.CN", "pywebsocket"); | 691 dict->SetString("ISSUER.CN", "pywebsocket"); |
685 profile->GetHostContentSettingsMap()->SetWebsiteSetting( | 692 profile->GetHostContentSettingsMap()->SetWebsiteSetting( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 766 |
760 // To exit the browser cleanly (and this test) we need to complete the | 767 // To exit the browser cleanly (and this test) we need to complete the |
761 // download after completing this test. | 768 // download after completing this test. |
762 content::DownloadTestObserverTerminal dangerous_download_observer( | 769 content::DownloadTestObserverTerminal dangerous_download_observer( |
763 content::BrowserContext::GetDownloadManager(browser()->profile()), | 770 content::BrowserContext::GetDownloadManager(browser()->profile()), |
764 1, | 771 1, |
765 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT); | 772 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT); |
766 | 773 |
767 // Proceed through the SSL interstitial. This doesn't use | 774 // Proceed through the SSL interstitial. This doesn't use |
768 // |ProceedThroughInterstitial| since no page load will commit. | 775 // |ProceedThroughInterstitial| since no page load will commit. |
769 WebContents* tab = chrome::GetActiveWebContents(browser()); | 776 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
770 ASSERT_TRUE(tab != NULL); | 777 ASSERT_TRUE(tab != NULL); |
771 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); | 778 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); |
772 { | 779 { |
773 content::WindowedNotificationObserver observer( | 780 content::WindowedNotificationObserver observer( |
774 chrome::NOTIFICATION_DOWNLOAD_INITIATED, | 781 chrome::NOTIFICATION_DOWNLOAD_INITIATED, |
775 content::NotificationService::AllSources()); | 782 content::NotificationService::AllSources()); |
776 tab->GetInterstitialPage()->Proceed(); | 783 tab->GetInterstitialPage()->Proceed(); |
777 observer.Wait(); | 784 observer.Wait(); |
778 } | 785 } |
779 | 786 |
(...skipping 27 matching lines...) Expand all Loading... |
807 std::string replacement_path; | 814 std::string replacement_path; |
808 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 815 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
809 "files/ssl/page_displays_insecure_content.html", | 816 "files/ssl/page_displays_insecure_content.html", |
810 test_server()->host_port_pair(), | 817 test_server()->host_port_pair(), |
811 &replacement_path)); | 818 &replacement_path)); |
812 | 819 |
813 // Load a page that displays insecure content. | 820 // Load a page that displays insecure content. |
814 ui_test_utils::NavigateToURL(browser(), | 821 ui_test_utils::NavigateToURL(browser(), |
815 https_server_.GetURL(replacement_path)); | 822 https_server_.GetURL(replacement_path)); |
816 | 823 |
817 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), true); | 824 CheckAuthenticatedState( |
| 825 browser()->tab_strip_model()->GetActiveWebContents(), true); |
818 } | 826 } |
819 | 827 |
820 // Visits a page that runs insecure content and tries to suppress the insecure | 828 // Visits a page that runs insecure content and tries to suppress the insecure |
821 // content warnings by randomizing location.hash. | 829 // content warnings by randomizing location.hash. |
822 // Based on http://crbug.com/8706 | 830 // Based on http://crbug.com/8706 |
823 IN_PROC_BROWSER_TEST_F(SSLUITest, | 831 IN_PROC_BROWSER_TEST_F(SSLUITest, |
824 TestRunsInsecuredContentRandomizeHash) { | 832 TestRunsInsecuredContentRandomizeHash) { |
825 ASSERT_TRUE(test_server()->Start()); | 833 ASSERT_TRUE(test_server()->Start()); |
826 ASSERT_TRUE(https_server_.Start()); | 834 ASSERT_TRUE(https_server_.Start()); |
827 | 835 |
828 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 836 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
829 "files/ssl/page_runs_insecure_content.html")); | 837 "files/ssl/page_runs_insecure_content.html")); |
830 | 838 |
831 CheckAuthenticationBrokenState(chrome::GetActiveWebContents(browser()), 0, | 839 CheckAuthenticationBrokenState( |
832 true, false); | 840 browser()->tab_strip_model()->GetActiveWebContents(), 0, true, false); |
833 } | 841 } |
834 | 842 |
835 // Visits a page with unsafe content and make sure that: | 843 // Visits a page with unsafe content and make sure that: |
836 // - frames content is replaced with warning | 844 // - frames content is replaced with warning |
837 // - images and scripts are filtered out entirely | 845 // - images and scripts are filtered out entirely |
838 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) { | 846 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) { |
839 ASSERT_TRUE(https_server_.Start()); | 847 ASSERT_TRUE(https_server_.Start()); |
840 ASSERT_TRUE(https_server_expired_.Start()); | 848 ASSERT_TRUE(https_server_expired_.Start()); |
841 | 849 |
842 std::string replacement_path; | 850 std::string replacement_path; |
843 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 851 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
844 "files/ssl/page_with_unsafe_contents.html", | 852 "files/ssl/page_with_unsafe_contents.html", |
845 https_server_expired_.host_port_pair(), | 853 https_server_expired_.host_port_pair(), |
846 &replacement_path)); | 854 &replacement_path)); |
847 ui_test_utils::NavigateToURL(browser(), | 855 ui_test_utils::NavigateToURL(browser(), |
848 https_server_.GetURL(replacement_path)); | 856 https_server_.GetURL(replacement_path)); |
849 | 857 |
850 WebContents* tab = chrome::GetActiveWebContents(browser()); | 858 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
851 // When the bad content is filtered, the state is expected to be | 859 // When the bad content is filtered, the state is expected to be |
852 // authenticated. | 860 // authenticated. |
853 CheckAuthenticatedState(tab, false); | 861 CheckAuthenticatedState(tab, false); |
854 | 862 |
855 // Because of cross-frame scripting restrictions, we cannot access the iframe | 863 // Because of cross-frame scripting restrictions, we cannot access the iframe |
856 // content. So to know if the frame was loaded, we just check if a popup was | 864 // content. So to know if the frame was loaded, we just check if a popup was |
857 // opened (the iframe content opens one). | 865 // opened (the iframe content opens one). |
858 // Note: because of bug 1115868, no web contents modal dialog is opened right | 866 // Note: because of bug 1115868, no web contents modal dialog is opened right |
859 // now. Once the bug is fixed, this will do the real check. | 867 // now. Once the bug is fixed, this will do the real check. |
860 EXPECT_FALSE(IsShowingWebContentsModalDialog()); | 868 EXPECT_FALSE(IsShowingWebContentsModalDialog()); |
(...skipping 23 matching lines...) Expand all Loading... |
884 ASSERT_TRUE(https_server_.Start()); | 892 ASSERT_TRUE(https_server_.Start()); |
885 | 893 |
886 std::string replacement_path; | 894 std::string replacement_path; |
887 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 895 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
888 "files/ssl/page_with_dynamic_insecure_content.html", | 896 "files/ssl/page_with_dynamic_insecure_content.html", |
889 test_server()->host_port_pair(), | 897 test_server()->host_port_pair(), |
890 &replacement_path)); | 898 &replacement_path)); |
891 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 899 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
892 replacement_path)); | 900 replacement_path)); |
893 | 901 |
894 WebContents* tab = chrome::GetActiveWebContents(browser()); | 902 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
895 CheckAuthenticatedState(tab, false); | 903 CheckAuthenticatedState(tab, false); |
896 | 904 |
897 // Load the insecure image. | 905 // Load the insecure image. |
898 bool js_result = false; | 906 bool js_result = false; |
899 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 907 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
900 tab, | 908 tab, |
901 "loadBadImage();", | 909 "loadBadImage();", |
902 &js_result)); | 910 &js_result)); |
903 EXPECT_TRUE(js_result); | 911 EXPECT_TRUE(js_result); |
904 | 912 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 | 1011 |
1004 std::string replacement_path; | 1012 std::string replacement_path; |
1005 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1013 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1006 "files/ssl/page_displays_insecure_content.html", | 1014 "files/ssl/page_displays_insecure_content.html", |
1007 test_server()->host_port_pair(), | 1015 test_server()->host_port_pair(), |
1008 &replacement_path)); | 1016 &replacement_path)); |
1009 | 1017 |
1010 // Load original page over HTTP. | 1018 // Load original page over HTTP. |
1011 const GURL url_http = test_server()->GetURL(replacement_path); | 1019 const GURL url_http = test_server()->GetURL(replacement_path); |
1012 ui_test_utils::NavigateToURL(browser(), url_http); | 1020 ui_test_utils::NavigateToURL(browser(), url_http); |
1013 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1021 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1014 CheckUnauthenticatedState(tab); | 1022 CheckUnauthenticatedState(tab); |
1015 | 1023 |
1016 // Load again but over SSL. It should be marked as displaying insecure | 1024 // Load again but over SSL. It should be marked as displaying insecure |
1017 // content (even though the image comes from the WebCore memory cache). | 1025 // content (even though the image comes from the WebCore memory cache). |
1018 const GURL url_https = https_server_.GetURL(replacement_path); | 1026 const GURL url_https = https_server_.GetURL(replacement_path); |
1019 ui_test_utils::NavigateToURL(browser(), url_https); | 1027 ui_test_utils::NavigateToURL(browser(), url_https); |
1020 CheckAuthenticatedState(tab, true); | 1028 CheckAuthenticatedState(tab, true); |
1021 } | 1029 } |
1022 | 1030 |
1023 // http://crbug.com/84729 | 1031 // http://crbug.com/84729 |
(...skipping 13 matching lines...) Expand all Loading... |
1037 | 1045 |
1038 std::string replacement_path; | 1046 std::string replacement_path; |
1039 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1047 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1040 "files/ssl/page_runs_insecure_content.html", | 1048 "files/ssl/page_runs_insecure_content.html", |
1041 test_server()->host_port_pair(), | 1049 test_server()->host_port_pair(), |
1042 &replacement_path)); | 1050 &replacement_path)); |
1043 | 1051 |
1044 // Load original page over HTTP. | 1052 // Load original page over HTTP. |
1045 const GURL url_http = test_server()->GetURL(replacement_path); | 1053 const GURL url_http = test_server()->GetURL(replacement_path); |
1046 ui_test_utils::NavigateToURL(browser(), url_http); | 1054 ui_test_utils::NavigateToURL(browser(), url_http); |
1047 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1055 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1048 CheckUnauthenticatedState(tab); | 1056 CheckUnauthenticatedState(tab); |
1049 | 1057 |
1050 // Load again but over SSL. It should be marked as displaying insecure | 1058 // Load again but over SSL. It should be marked as displaying insecure |
1051 // content (even though the image comes from the WebCore memory cache). | 1059 // content (even though the image comes from the WebCore memory cache). |
1052 const GURL url_https = https_server_.GetURL(replacement_path); | 1060 const GURL url_https = https_server_.GetURL(replacement_path); |
1053 ui_test_utils::NavigateToURL(browser(), url_https); | 1061 ui_test_utils::NavigateToURL(browser(), url_https); |
1054 CheckAuthenticationBrokenState(tab, 0, true, false); | 1062 CheckAuthenticationBrokenState(tab, 0, true, false); |
1055 } | 1063 } |
1056 | 1064 |
1057 // This test ensures the CN invalid status does not 'stick' to a certificate | 1065 // This test ensures the CN invalid status does not 'stick' to a certificate |
1058 // (see bug #1044942) and that it depends on the host-name. | 1066 // (see bug #1044942) and that it depends on the host-name. |
1059 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { | 1067 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { |
1060 ASSERT_TRUE(https_server_.Start()); | 1068 ASSERT_TRUE(https_server_.Start()); |
1061 ASSERT_TRUE(https_server_mismatched_.Start()); | 1069 ASSERT_TRUE(https_server_mismatched_.Start()); |
1062 | 1070 |
1063 // First we hit the server with hostname, this generates an invalid policy | 1071 // First we hit the server with hostname, this generates an invalid policy |
1064 // error. | 1072 // error. |
1065 ui_test_utils::NavigateToURL(browser(), | 1073 ui_test_utils::NavigateToURL(browser(), |
1066 https_server_mismatched_.GetURL("files/ssl/google.html")); | 1074 https_server_mismatched_.GetURL("files/ssl/google.html")); |
1067 | 1075 |
1068 // We get an interstitial page as a result. | 1076 // We get an interstitial page as a result. |
1069 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1077 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1070 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 1078 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
1071 false, true); // Interstitial showing. | 1079 false, true); // Interstitial showing. |
1072 ProceedThroughInterstitial(tab); | 1080 ProceedThroughInterstitial(tab); |
1073 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 1081 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
1074 false, false); // No interstitial showing. | 1082 false, false); // No interstitial showing. |
1075 | 1083 |
1076 // Now we try again with the right host name this time. | 1084 // Now we try again with the right host name this time. |
1077 GURL url(https_server_.GetURL("files/ssl/google.html")); | 1085 GURL url(https_server_.GetURL("files/ssl/google.html")); |
1078 ui_test_utils::NavigateToURL(browser(), url); | 1086 ui_test_utils::NavigateToURL(browser(), url); |
1079 | 1087 |
(...skipping 17 matching lines...) Expand all Loading... |
1097 #define MAYBE_TestRefNavigation TestRefNavigation | 1105 #define MAYBE_TestRefNavigation TestRefNavigation |
1098 #endif | 1106 #endif |
1099 | 1107 |
1100 // Test that navigating to a #ref does not change a bad security state. | 1108 // Test that navigating to a #ref does not change a bad security state. |
1101 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { | 1109 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { |
1102 ASSERT_TRUE(https_server_expired_.Start()); | 1110 ASSERT_TRUE(https_server_expired_.Start()); |
1103 | 1111 |
1104 ui_test_utils::NavigateToURL(browser(), | 1112 ui_test_utils::NavigateToURL(browser(), |
1105 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); | 1113 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); |
1106 | 1114 |
1107 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1115 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1108 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1116 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1109 true); // Interstitial showing. | 1117 true); // Interstitial showing. |
1110 | 1118 |
1111 ProceedThroughInterstitial(tab); | 1119 ProceedThroughInterstitial(tab); |
1112 | 1120 |
1113 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1121 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1114 false); // No interstitial showing. | 1122 false); // No interstitial showing. |
1115 | 1123 |
1116 // Now navigate to a ref in the page, the security state should not have | 1124 // Now navigate to a ref in the page, the security state should not have |
1117 // changed. | 1125 // changed. |
(...skipping 14 matching lines...) Expand all Loading... |
1132 | 1140 |
1133 std::string replacement_path; | 1141 std::string replacement_path; |
1134 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1142 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1135 "files/ssl/page_with_unsafe_popup.html", | 1143 "files/ssl/page_with_unsafe_popup.html", |
1136 https_server_expired_.host_port_pair(), | 1144 https_server_expired_.host_port_pair(), |
1137 &replacement_path)); | 1145 &replacement_path)); |
1138 | 1146 |
1139 ui_test_utils::NavigateToURL(browser(), | 1147 ui_test_utils::NavigateToURL(browser(), |
1140 test_server()->GetURL(replacement_path)); | 1148 test_server()->GetURL(replacement_path)); |
1141 | 1149 |
1142 WebContents* tab1 = chrome::GetActiveWebContents(browser()); | 1150 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); |
1143 // It is probably overkill to add a notification for a popup-opening, let's | 1151 // It is probably overkill to add a notification for a popup-opening, let's |
1144 // just poll. | 1152 // just poll. |
1145 for (int i = 0; i < 10; i++) { | 1153 for (int i = 0; i < 10; i++) { |
1146 if (IsShowingWebContentsModalDialog()) | 1154 if (IsShowingWebContentsModalDialog()) |
1147 break; | 1155 break; |
1148 MessageLoop::current()->PostDelayedTask( | 1156 MessageLoop::current()->PostDelayedTask( |
1149 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); | 1157 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); |
1150 content::RunMessageLoop(); | 1158 content::RunMessageLoop(); |
1151 } | 1159 } |
1152 ASSERT_TRUE(IsShowingWebContentsModalDialog()); | 1160 ASSERT_TRUE(IsShowingWebContentsModalDialog()); |
(...skipping 14 matching lines...) Expand all Loading... |
1167 // Visit a page over bad https that is a redirect to a page with good https. | 1175 // Visit a page over bad https that is a redirect to a page with good https. |
1168 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { | 1176 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { |
1169 ASSERT_TRUE(https_server_.Start()); | 1177 ASSERT_TRUE(https_server_.Start()); |
1170 ASSERT_TRUE(https_server_expired_.Start()); | 1178 ASSERT_TRUE(https_server_expired_.Start()); |
1171 | 1179 |
1172 GURL url1 = https_server_expired_.GetURL("server-redirect?"); | 1180 GURL url1 = https_server_expired_.GetURL("server-redirect?"); |
1173 GURL url2 = https_server_.GetURL("files/ssl/google.html"); | 1181 GURL url2 = https_server_.GetURL("files/ssl/google.html"); |
1174 | 1182 |
1175 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 1183 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
1176 | 1184 |
1177 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1185 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1178 | 1186 |
1179 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1187 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1180 true); // Interstitial showing. | 1188 true); // Interstitial showing. |
1181 | 1189 |
1182 ProceedThroughInterstitial(tab); | 1190 ProceedThroughInterstitial(tab); |
1183 | 1191 |
1184 // We have been redirected to the good page. | 1192 // We have been redirected to the good page. |
1185 CheckAuthenticatedState(tab, false); | 1193 CheckAuthenticatedState(tab, false); |
1186 } | 1194 } |
1187 | 1195 |
1188 // Visit a page over good https that is a redirect to a page with bad https. | 1196 // Visit a page over good https that is a redirect to a page with bad https. |
1189 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) { | 1197 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) { |
1190 ASSERT_TRUE(https_server_.Start()); | 1198 ASSERT_TRUE(https_server_.Start()); |
1191 ASSERT_TRUE(https_server_expired_.Start()); | 1199 ASSERT_TRUE(https_server_expired_.Start()); |
1192 | 1200 |
1193 GURL url1 = https_server_.GetURL("server-redirect?"); | 1201 GURL url1 = https_server_.GetURL("server-redirect?"); |
1194 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); | 1202 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); |
1195 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 1203 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
1196 | 1204 |
1197 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1205 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1198 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1206 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1199 true); // Interstitial showing. | 1207 true); // Interstitial showing. |
1200 | 1208 |
1201 ProceedThroughInterstitial(tab); | 1209 ProceedThroughInterstitial(tab); |
1202 | 1210 |
1203 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1211 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1204 false); // No interstitial showing. | 1212 false); // No interstitial showing. |
1205 } | 1213 } |
1206 | 1214 |
1207 // Visit a page over http that is a redirect to a page with good HTTPS. | 1215 // Visit a page over http that is a redirect to a page with good HTTPS. |
1208 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { | 1216 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { |
1209 ASSERT_TRUE(test_server()->Start()); | 1217 ASSERT_TRUE(test_server()->Start()); |
1210 ASSERT_TRUE(https_server_.Start()); | 1218 ASSERT_TRUE(https_server_.Start()); |
1211 | 1219 |
1212 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1220 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1213 | 1221 |
1214 // HTTP redirects to good HTTPS. | 1222 // HTTP redirects to good HTTPS. |
1215 GURL http_url = test_server()->GetURL("server-redirect?"); | 1223 GURL http_url = test_server()->GetURL("server-redirect?"); |
1216 GURL good_https_url = | 1224 GURL good_https_url = |
1217 https_server_.GetURL("files/ssl/google.html"); | 1225 https_server_.GetURL("files/ssl/google.html"); |
1218 | 1226 |
1219 ui_test_utils::NavigateToURL(browser(), | 1227 ui_test_utils::NavigateToURL(browser(), |
1220 GURL(http_url.spec() + good_https_url.spec())); | 1228 GURL(http_url.spec() + good_https_url.spec())); |
1221 CheckAuthenticatedState(tab, false); | 1229 CheckAuthenticatedState(tab, false); |
1222 } | 1230 } |
1223 | 1231 |
1224 // Visit a page over http that is a redirect to a page with bad HTTPS. | 1232 // Visit a page over http that is a redirect to a page with bad HTTPS. |
1225 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToBadHTTPS) { | 1233 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToBadHTTPS) { |
1226 ASSERT_TRUE(test_server()->Start()); | 1234 ASSERT_TRUE(test_server()->Start()); |
1227 ASSERT_TRUE(https_server_expired_.Start()); | 1235 ASSERT_TRUE(https_server_expired_.Start()); |
1228 | 1236 |
1229 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1237 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1230 | 1238 |
1231 GURL http_url = test_server()->GetURL("server-redirect?"); | 1239 GURL http_url = test_server()->GetURL("server-redirect?"); |
1232 GURL bad_https_url = | 1240 GURL bad_https_url = |
1233 https_server_expired_.GetURL("files/ssl/google.html"); | 1241 https_server_expired_.GetURL("files/ssl/google.html"); |
1234 ui_test_utils::NavigateToURL(browser(), | 1242 ui_test_utils::NavigateToURL(browser(), |
1235 GURL(http_url.spec() + bad_https_url.spec())); | 1243 GURL(http_url.spec() + bad_https_url.spec())); |
1236 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1244 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1237 true); // Interstitial showing. | 1245 true); // Interstitial showing. |
1238 | 1246 |
1239 ProceedThroughInterstitial(tab); | 1247 ProceedThroughInterstitial(tab); |
1240 | 1248 |
1241 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1249 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1242 false); // No interstitial showing. | 1250 false); // No interstitial showing. |
1243 } | 1251 } |
1244 | 1252 |
1245 // Visit a page over https that is a redirect to a page with http (to make sure | 1253 // Visit a page over https that is a redirect to a page with http (to make sure |
1246 // we don't keep the secure state). | 1254 // we don't keep the secure state). |
1247 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { | 1255 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { |
1248 ASSERT_TRUE(test_server()->Start()); | 1256 ASSERT_TRUE(test_server()->Start()); |
1249 ASSERT_TRUE(https_server_.Start()); | 1257 ASSERT_TRUE(https_server_.Start()); |
1250 | 1258 |
1251 GURL https_url = https_server_.GetURL("server-redirect?"); | 1259 GURL https_url = https_server_.GetURL("server-redirect?"); |
1252 GURL http_url = test_server()->GetURL("files/ssl/google.html"); | 1260 GURL http_url = test_server()->GetURL("files/ssl/google.html"); |
1253 | 1261 |
1254 ui_test_utils::NavigateToURL(browser(), | 1262 ui_test_utils::NavigateToURL(browser(), |
1255 GURL(https_url.spec() + http_url.spec())); | 1263 GURL(https_url.spec() + http_url.spec())); |
1256 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser())); | 1264 CheckUnauthenticatedState( |
| 1265 browser()->tab_strip_model()->GetActiveWebContents()); |
1257 } | 1266 } |
1258 | 1267 |
1259 // Visits a page to which we could not connect (bad port) over http and https | 1268 // Visits a page to which we could not connect (bad port) over http and https |
1260 // and make sure the security style is correct. | 1269 // and make sure the security style is correct. |
1261 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { | 1270 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { |
1262 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); | 1271 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); |
1263 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser())); | 1272 CheckUnauthenticatedState( |
| 1273 browser()->tab_strip_model()->GetActiveWebContents()); |
1264 | 1274 |
1265 // Same thing over HTTPS. | 1275 // Same thing over HTTPS. |
1266 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17")); | 1276 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17")); |
1267 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser())); | 1277 CheckUnauthenticatedState( |
| 1278 browser()->tab_strip_model()->GetActiveWebContents()); |
1268 } | 1279 } |
1269 | 1280 |
1270 // | 1281 // |
1271 // Frame navigation | 1282 // Frame navigation |
1272 // | 1283 // |
1273 | 1284 |
1274 // From a good HTTPS top frame: | 1285 // From a good HTTPS top frame: |
1275 // - navigate to an OK HTTPS frame | 1286 // - navigate to an OK HTTPS frame |
1276 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 1287 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
1277 // back | 1288 // back |
1278 // - navigate to HTTP (expect insecure content), then back | 1289 // - navigate to HTTP (expect insecure content), then back |
1279 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { | 1290 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { |
1280 ASSERT_TRUE(test_server()->Start()); | 1291 ASSERT_TRUE(test_server()->Start()); |
1281 ASSERT_TRUE(https_server_.Start()); | 1292 ASSERT_TRUE(https_server_.Start()); |
1282 ASSERT_TRUE(https_server_expired_.Start()); | 1293 ASSERT_TRUE(https_server_expired_.Start()); |
1283 | 1294 |
1284 std::string top_frame_path; | 1295 std::string top_frame_path; |
1285 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1296 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1286 https_server_, | 1297 https_server_, |
1287 https_server_expired_, | 1298 https_server_expired_, |
1288 &top_frame_path)); | 1299 &top_frame_path)); |
1289 | 1300 |
1290 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1301 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1291 ui_test_utils::NavigateToURL(browser(), | 1302 ui_test_utils::NavigateToURL(browser(), |
1292 https_server_.GetURL(top_frame_path)); | 1303 https_server_.GetURL(top_frame_path)); |
1293 | 1304 |
1294 CheckAuthenticatedState(tab, false); | 1305 CheckAuthenticatedState(tab, false); |
1295 | 1306 |
1296 bool success = false; | 1307 bool success = false; |
1297 // Now navigate inside the frame. | 1308 // Now navigate inside the frame. |
1298 { | 1309 { |
1299 content::WindowedNotificationObserver observer( | 1310 content::WindowedNotificationObserver observer( |
1300 content::NOTIFICATION_LOAD_STOP, | 1311 content::NOTIFICATION_LOAD_STOP, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { | 1391 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { |
1381 ASSERT_TRUE(https_server_.Start()); | 1392 ASSERT_TRUE(https_server_.Start()); |
1382 ASSERT_TRUE(https_server_expired_.Start()); | 1393 ASSERT_TRUE(https_server_expired_.Start()); |
1383 | 1394 |
1384 std::string top_frame_path; | 1395 std::string top_frame_path; |
1385 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1396 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1386 https_server_, | 1397 https_server_, |
1387 https_server_expired_, | 1398 https_server_expired_, |
1388 &top_frame_path)); | 1399 &top_frame_path)); |
1389 | 1400 |
1390 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1401 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1391 ui_test_utils::NavigateToURL(browser(), | 1402 ui_test_utils::NavigateToURL(browser(), |
1392 https_server_expired_.GetURL(top_frame_path)); | 1403 https_server_expired_.GetURL(top_frame_path)); |
1393 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1404 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1394 true); // Interstitial showing | 1405 true); // Interstitial showing |
1395 | 1406 |
1396 ProceedThroughInterstitial(tab); | 1407 ProceedThroughInterstitial(tab); |
1397 | 1408 |
1398 // Navigate to a good frame. | 1409 // Navigate to a good frame. |
1399 bool success = false; | 1410 bool success = false; |
1400 content::WindowedNotificationObserver observer( | 1411 content::WindowedNotificationObserver observer( |
(...skipping 18 matching lines...) Expand all Loading... |
1419 ASSERT_TRUE(test_server()->Start()); | 1430 ASSERT_TRUE(test_server()->Start()); |
1420 ASSERT_TRUE(https_server_.Start()); | 1431 ASSERT_TRUE(https_server_.Start()); |
1421 ASSERT_TRUE(https_server_expired_.Start()); | 1432 ASSERT_TRUE(https_server_expired_.Start()); |
1422 | 1433 |
1423 std::string top_frame_path; | 1434 std::string top_frame_path; |
1424 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1435 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1425 https_server_, | 1436 https_server_, |
1426 https_server_expired_, | 1437 https_server_expired_, |
1427 &top_frame_path)); | 1438 &top_frame_path)); |
1428 | 1439 |
1429 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1440 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1430 ui_test_utils::NavigateToURL(browser(), | 1441 ui_test_utils::NavigateToURL(browser(), |
1431 test_server()->GetURL(top_frame_path)); | 1442 test_server()->GetURL(top_frame_path)); |
1432 CheckUnauthenticatedState(tab); | 1443 CheckUnauthenticatedState(tab); |
1433 | 1444 |
1434 // Now navigate inside the frame to a secure HTTPS frame. | 1445 // Now navigate inside the frame to a secure HTTPS frame. |
1435 { | 1446 { |
1436 bool success = false; | 1447 bool success = false; |
1437 content::WindowedNotificationObserver observer( | 1448 content::WindowedNotificationObserver observer( |
1438 content::NOTIFICATION_LOAD_STOP, | 1449 content::NOTIFICATION_LOAD_STOP, |
1439 content::Source<NavigationController>(&tab->GetController())); | 1450 content::Source<NavigationController>(&tab->GetController())); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 ASSERT_TRUE(https_server_.Start()); | 1493 ASSERT_TRUE(https_server_.Start()); |
1483 ASSERT_TRUE(https_server_expired_.Start()); | 1494 ASSERT_TRUE(https_server_expired_.Start()); |
1484 | 1495 |
1485 // This page will spawn a Worker which will try to load content from | 1496 // This page will spawn a Worker which will try to load content from |
1486 // BadCertServer. | 1497 // BadCertServer. |
1487 std::string page_with_unsafe_worker_path; | 1498 std::string page_with_unsafe_worker_path; |
1488 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, | 1499 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, |
1489 &page_with_unsafe_worker_path)); | 1500 &page_with_unsafe_worker_path)); |
1490 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 1501 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
1491 page_with_unsafe_worker_path)); | 1502 page_with_unsafe_worker_path)); |
1492 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1503 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1493 // Expect Worker not to load insecure content. | 1504 // Expect Worker not to load insecure content. |
1494 CheckWorkerLoadResult(tab, false); | 1505 CheckWorkerLoadResult(tab, false); |
1495 // The bad content is filtered, expect the state to be authenticated. | 1506 // The bad content is filtered, expect the state to be authenticated. |
1496 CheckAuthenticatedState(tab, false); | 1507 CheckAuthenticatedState(tab, false); |
1497 } | 1508 } |
1498 | 1509 |
1499 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) { | 1510 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) { |
1500 ASSERT_TRUE(https_server_.Start()); | 1511 ASSERT_TRUE(https_server_.Start()); |
1501 ASSERT_TRUE(https_server_expired_.Start()); | 1512 ASSERT_TRUE(https_server_expired_.Start()); |
1502 | 1513 |
1503 // Navigate to an unsafe site. Proceed with interstitial page to indicate | 1514 // Navigate to an unsafe site. Proceed with interstitial page to indicate |
1504 // the user approves the bad certificate. | 1515 // the user approves the bad certificate. |
1505 ui_test_utils::NavigateToURL(browser(), | 1516 ui_test_utils::NavigateToURL(browser(), |
1506 https_server_expired_.GetURL("files/ssl/blank_page.html")); | 1517 https_server_expired_.GetURL("files/ssl/blank_page.html")); |
1507 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1518 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1508 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1519 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1509 true); // Interstitial showing | 1520 true); // Interstitial showing |
1510 ProceedThroughInterstitial(tab); | 1521 ProceedThroughInterstitial(tab); |
1511 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1522 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1512 false); // No Interstitial | 1523 false); // No Interstitial |
1513 | 1524 |
1514 // Navigate to safe page that has Worker loading unsafe content. | 1525 // Navigate to safe page that has Worker loading unsafe content. |
1515 // Expect content to load but be marked as auth broken due to running insecure | 1526 // Expect content to load but be marked as auth broken due to running insecure |
1516 // content. | 1527 // content. |
1517 std::string page_with_unsafe_worker_path; | 1528 std::string page_with_unsafe_worker_path; |
(...skipping 14 matching lines...) Expand all Loading... |
1532 | 1543 |
1533 std::string replacement_path; | 1544 std::string replacement_path; |
1534 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1545 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1535 "files/ssl/page_displays_insecure_content.html", | 1546 "files/ssl/page_displays_insecure_content.html", |
1536 test_server()->host_port_pair(), | 1547 test_server()->host_port_pair(), |
1537 &replacement_path)); | 1548 &replacement_path)); |
1538 | 1549 |
1539 ui_test_utils::NavigateToURL(browser(), | 1550 ui_test_utils::NavigateToURL(browser(), |
1540 https_server_.GetURL(replacement_path)); | 1551 https_server_.GetURL(replacement_path)); |
1541 | 1552 |
1542 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false); | 1553 CheckAuthenticatedState( |
| 1554 browser()->tab_strip_model()->GetActiveWebContents(), false); |
1543 } | 1555 } |
1544 | 1556 |
1545 // Test that when the browser blocks displaying insecure content (iframes), the | 1557 // Test that when the browser blocks displaying insecure content (iframes), the |
1546 // indicator shows a secure page, because the blocking made the otherwise | 1558 // indicator shows a secure page, because the blocking made the otherwise |
1547 // unsafe page safe (the notification of this state is handled by other means) | 1559 // unsafe page safe (the notification of this state is handled by other means) |
1548 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { | 1560 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { |
1549 ASSERT_TRUE(test_server()->Start()); | 1561 ASSERT_TRUE(test_server()->Start()); |
1550 ASSERT_TRUE(https_server_.Start()); | 1562 ASSERT_TRUE(https_server_.Start()); |
1551 | 1563 |
1552 std::string replacement_path; | 1564 std::string replacement_path; |
1553 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1565 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1554 "files/ssl/page_displays_insecure_iframe.html", | 1566 "files/ssl/page_displays_insecure_iframe.html", |
1555 test_server()->host_port_pair(), | 1567 test_server()->host_port_pair(), |
1556 &replacement_path)); | 1568 &replacement_path)); |
1557 | 1569 |
1558 ui_test_utils::NavigateToURL(browser(), | 1570 ui_test_utils::NavigateToURL(browser(), |
1559 https_server_.GetURL(replacement_path)); | 1571 https_server_.GetURL(replacement_path)); |
1560 | 1572 |
1561 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false); | 1573 CheckAuthenticatedState( |
| 1574 browser()->tab_strip_model()->GetActiveWebContents(), false); |
1562 } | 1575 } |
1563 | 1576 |
1564 | 1577 |
1565 // Test that when the browser blocks running insecure content, the | 1578 // Test that when the browser blocks running insecure content, the |
1566 // indicator shows a secure page, because the blocking made the otherwise | 1579 // indicator shows a secure page, because the blocking made the otherwise |
1567 // unsafe page safe (the notification of this state is handled by other means). | 1580 // unsafe page safe (the notification of this state is handled by other means). |
1568 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { | 1581 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { |
1569 ASSERT_TRUE(test_server()->Start()); | 1582 ASSERT_TRUE(test_server()->Start()); |
1570 ASSERT_TRUE(https_server_.Start()); | 1583 ASSERT_TRUE(https_server_.Start()); |
1571 | 1584 |
1572 std::string replacement_path; | 1585 std::string replacement_path; |
1573 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1586 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1574 "files/ssl/page_runs_insecure_content.html", | 1587 "files/ssl/page_runs_insecure_content.html", |
1575 test_server()->host_port_pair(), | 1588 test_server()->host_port_pair(), |
1576 &replacement_path)); | 1589 &replacement_path)); |
1577 | 1590 |
1578 ui_test_utils::NavigateToURL(browser(), | 1591 ui_test_utils::NavigateToURL(browser(), |
1579 https_server_.GetURL(replacement_path)); | 1592 https_server_.GetURL(replacement_path)); |
1580 | 1593 |
1581 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false); | 1594 CheckAuthenticatedState( |
| 1595 browser()->tab_strip_model()->GetActiveWebContents(), false); |
1582 } | 1596 } |
1583 | 1597 |
1584 // Visit a page and establish a WebSocket connection over bad https with | 1598 // Visit a page and establish a WebSocket connection over bad https with |
1585 // --ignore-certificate-errors. The connection should be established without | 1599 // --ignore-certificate-errors. The connection should be established without |
1586 // interstitial page showing. | 1600 // interstitial page showing. |
1587 IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { | 1601 IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { |
1588 ASSERT_TRUE(test_server()->Start()); | 1602 ASSERT_TRUE(test_server()->Start()); |
1589 ASSERT_TRUE(wss_server_expired_.Start()); | 1603 ASSERT_TRUE(wss_server_expired_.Start()); |
1590 | 1604 |
1591 // Setup page title observer. | 1605 // Setup page title observer. |
1592 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1606 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1593 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 1607 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
1594 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 1608 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
1595 | 1609 |
1596 // Visit bad HTTPS page. | 1610 // Visit bad HTTPS page. |
1597 std::string scheme("https"); | 1611 std::string scheme("https"); |
1598 GURL::Replacements replacements; | 1612 GURL::Replacements replacements; |
1599 replacements.SetSchemeStr(scheme); | 1613 replacements.SetSchemeStr(scheme); |
1600 ui_test_utils::NavigateToURL( | 1614 ui_test_utils::NavigateToURL( |
1601 browser(), | 1615 browser(), |
1602 wss_server_expired_.GetURL( | 1616 wss_server_expired_.GetURL( |
(...skipping 11 matching lines...) Expand all Loading... |
1614 | 1628 |
1615 // Visit a page over https that contains a frame with a redirect. | 1629 // Visit a page over https that contains a frame with a redirect. |
1616 | 1630 |
1617 // XMLHttpRequest insecure content in synchronous mode. | 1631 // XMLHttpRequest insecure content in synchronous mode. |
1618 | 1632 |
1619 // XMLHttpRequest insecure content in asynchronous mode. | 1633 // XMLHttpRequest insecure content in asynchronous mode. |
1620 | 1634 |
1621 // XMLHttpRequest over bad ssl in synchronous mode. | 1635 // XMLHttpRequest over bad ssl in synchronous mode. |
1622 | 1636 |
1623 // XMLHttpRequest over OK ssl in synchronous mode. | 1637 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |