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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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) 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"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_commands.h" 13 #include "chrome/browser/ui/browser_commands.h"
14 #include "chrome/browser/ui/browser_navigator.h" 14 #include "chrome/browser/ui/browser_navigator.h"
15 #include "chrome/browser/ui/browser_tabstrip.h"
15 #include "chrome/browser/ui/constrained_window_tab_helper.h" 16 #include "chrome/browser/ui/constrained_window_tab_helper.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/public/browser/interstitial_page.h" 24 #include "content/public/browser/interstitial_page.h"
24 #include "content/public/browser/navigation_controller.h" 25 #include "content/public/browser/navigation_controller.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); 193 InterstitialPage* interstitial_page = tab->GetInterstitialPage();
193 ASSERT_TRUE(interstitial_page); 194 ASSERT_TRUE(interstitial_page);
194 ui_test_utils::WindowedNotificationObserver observer( 195 ui_test_utils::WindowedNotificationObserver observer(
195 content::NOTIFICATION_LOAD_STOP, 196 content::NOTIFICATION_LOAD_STOP,
196 content::Source<NavigationController>(&tab->GetController())); 197 content::Source<NavigationController>(&tab->GetController()));
197 interstitial_page->Proceed(); 198 interstitial_page->Proceed();
198 observer.Wait(); 199 observer.Wait();
199 } 200 }
200 201
201 int GetConstrainedWindowCount() const { 202 int GetConstrainedWindowCount() const {
202 return static_cast<int>(browser()->GetActiveTabContents()-> 203 return static_cast<int>(chrome::GetActiveTabContents(browser())->
203 constrained_window_tab_helper()->constrained_window_count()); 204 constrained_window_tab_helper()->constrained_window_count());
204 } 205 }
205 206
206 static bool GetFilePathWithHostAndPortReplacement( 207 static bool GetFilePathWithHostAndPortReplacement(
207 const std::string& original_file_path, 208 const std::string& original_file_path,
208 const net::HostPortPair& host_port_pair, 209 const net::HostPortPair& host_port_pair,
209 std::string* replacement_path) { 210 std::string* replacement_path) {
210 std::vector<net::TestServer::StringPair> replacement_text; 211 std::vector<net::TestServer::StringPair> replacement_text;
211 replacement_text.push_back( 212 replacement_text.push_back(
212 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); 213 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString()));
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 297 }
297 }; 298 };
298 299
299 // Visits a regular page over http. 300 // Visits a regular page over http.
300 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { 301 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) {
301 ASSERT_TRUE(test_server()->Start()); 302 ASSERT_TRUE(test_server()->Start());
302 303
303 ui_test_utils::NavigateToURL(browser(), 304 ui_test_utils::NavigateToURL(browser(),
304 test_server()->GetURL("files/ssl/google.html")); 305 test_server()->GetURL("files/ssl/google.html"));
305 306
306 CheckUnauthenticatedState(browser()->GetActiveWebContents()); 307 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
307 } 308 }
308 309
309 // Visits a page over http which includes broken https resources (status should 310 // Visits a page over http which includes broken https resources (status should
310 // be OK). 311 // be OK).
311 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give 312 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give
312 // the secure cookies away!). 313 // the secure cookies away!).
313 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { 314 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) {
314 ASSERT_TRUE(test_server()->Start()); 315 ASSERT_TRUE(test_server()->Start());
315 ASSERT_TRUE(https_server_expired_.Start()); 316 ASSERT_TRUE(https_server_expired_.Start());
316 317
317 std::string replacement_path; 318 std::string replacement_path;
318 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 319 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
319 "files/ssl/page_with_unsafe_contents.html", 320 "files/ssl/page_with_unsafe_contents.html",
320 https_server_expired_.host_port_pair(), 321 https_server_expired_.host_port_pair(),
321 &replacement_path)); 322 &replacement_path));
322 323
323 ui_test_utils::NavigateToURL( 324 ui_test_utils::NavigateToURL(
324 browser(), test_server()->GetURL(replacement_path)); 325 browser(), test_server()->GetURL(replacement_path));
325 326
326 CheckUnauthenticatedState(browser()->GetActiveWebContents()); 327 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
327 } 328 }
328 329
329 // http://crbug.com/91745 330 // http://crbug.com/91745
330 #if defined(OS_CHROMEOS) 331 #if defined(OS_CHROMEOS)
331 #define MAYBE_TestOKHTTPS DISABLED_TestOKHTTPS 332 #define MAYBE_TestOKHTTPS DISABLED_TestOKHTTPS
332 #else 333 #else
333 #define MAYBE_TestOKHTTPS TestOKHTTPS 334 #define MAYBE_TestOKHTTPS TestOKHTTPS
334 #endif 335 #endif
335 336
336 // Visits a page over OK https: 337 // Visits a page over OK https:
337 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { 338 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) {
338 ASSERT_TRUE(https_server_.Start()); 339 ASSERT_TRUE(https_server_.Start());
339 340
340 ui_test_utils::NavigateToURL(browser(), 341 ui_test_utils::NavigateToURL(browser(),
341 https_server_.GetURL("files/ssl/google.html")); 342 https_server_.GetURL("files/ssl/google.html"));
342 343
343 CheckAuthenticatedState(browser()->GetActiveWebContents(), false); 344 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
344 } 345 }
345 346
346 // Visits a page with https error and proceed: 347 // Visits a page with https error and proceed:
347 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { 348 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) {
348 ASSERT_TRUE(https_server_expired_.Start()); 349 ASSERT_TRUE(https_server_expired_.Start());
349 350
350 ui_test_utils::NavigateToURL(browser(), 351 ui_test_utils::NavigateToURL(browser(),
351 https_server_expired_.GetURL("files/ssl/google.html")); 352 https_server_expired_.GetURL("files/ssl/google.html"));
352 353
353 WebContents* tab = browser()->GetActiveWebContents(); 354 WebContents* tab = chrome::GetActiveWebContents(browser());
354 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 355 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
355 true); // Interstitial showing 356 true); // Interstitial showing
356 357
357 ProceedThroughInterstitial(tab); 358 ProceedThroughInterstitial(tab);
358 359
359 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 360 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
360 false); // No interstitial showing 361 false); // No interstitial showing
361 } 362 }
362 363
363 // Visits a page with https error and don't proceed (and ensure we can still 364 // Visits a page with https error and don't proceed (and ensure we can still
364 // navigate at that point): 365 // navigate at that point):
365 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) { 366 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) {
366 ASSERT_TRUE(test_server()->Start()); 367 ASSERT_TRUE(test_server()->Start());
367 ASSERT_TRUE(https_server_.Start()); 368 ASSERT_TRUE(https_server_.Start());
368 ASSERT_TRUE(https_server_expired_.Start()); 369 ASSERT_TRUE(https_server_expired_.Start());
369 370
370 // First navigate to an OK page. 371 // First navigate to an OK page.
371 ui_test_utils::NavigateToURL(browser(), 372 ui_test_utils::NavigateToURL(browser(),
372 https_server_.GetURL("files/ssl/google.html")); 373 https_server_.GetURL("files/ssl/google.html"));
373 374
374 WebContents* tab = browser()->GetActiveWebContents(); 375 WebContents* tab = chrome::GetActiveWebContents(browser());
375 NavigationEntry* entry = tab->GetController().GetActiveEntry(); 376 NavigationEntry* entry = tab->GetController().GetActiveEntry();
376 ASSERT_TRUE(entry); 377 ASSERT_TRUE(entry);
377 378
378 GURL cross_site_url = 379 GURL cross_site_url =
379 https_server_expired_.GetURL("files/ssl/google.html"); 380 https_server_expired_.GetURL("files/ssl/google.html");
380 // Change the host name from 127.0.0.1 to localhost so it triggers a 381 // Change the host name from 127.0.0.1 to localhost so it triggers a
381 // cross-site navigation so we can test http://crbug.com/5800 is gone. 382 // cross-site navigation so we can test http://crbug.com/5800 is gone.
382 ASSERT_EQ("127.0.0.1", cross_site_url.host()); 383 ASSERT_EQ("127.0.0.1", cross_site_url.host());
383 GURL::Replacements replacements; 384 GURL::Replacements replacements;
384 std::string new_host("localhost"); 385 std::string new_host("localhost");
(...skipping 23 matching lines...) Expand all
408 409
409 // Visits a page with https error and then goes back using Browser::GoBack. 410 // Visits a page with https error and then goes back using Browser::GoBack.
410 IN_PROC_BROWSER_TEST_F(SSLUITest, 411 IN_PROC_BROWSER_TEST_F(SSLUITest,
411 TestHTTPSExpiredCertAndGoBackViaButton) { 412 TestHTTPSExpiredCertAndGoBackViaButton) {
412 ASSERT_TRUE(test_server()->Start()); 413 ASSERT_TRUE(test_server()->Start());
413 ASSERT_TRUE(https_server_expired_.Start()); 414 ASSERT_TRUE(https_server_expired_.Start());
414 415
415 // First navigate to an HTTP page. 416 // First navigate to an HTTP page.
416 ui_test_utils::NavigateToURL(browser(), 417 ui_test_utils::NavigateToURL(browser(),
417 test_server()->GetURL("files/ssl/google.html")); 418 test_server()->GetURL("files/ssl/google.html"));
418 WebContents* tab = browser()->GetActiveWebContents(); 419 WebContents* tab = chrome::GetActiveWebContents(browser());
419 NavigationEntry* entry = tab->GetController().GetActiveEntry(); 420 NavigationEntry* entry = tab->GetController().GetActiveEntry();
420 ASSERT_TRUE(entry); 421 ASSERT_TRUE(entry);
421 422
422 // Now go to a bad HTTPS page that shows an interstitial. 423 // Now go to a bad HTTPS page that shows an interstitial.
423 ui_test_utils::NavigateToURL(browser(), 424 ui_test_utils::NavigateToURL(browser(),
424 https_server_expired_.GetURL("files/ssl/google.html")); 425 https_server_expired_.GetURL("files/ssl/google.html"));
425 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 426 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
426 true); // Interstitial showing 427 true); // Interstitial showing
427 428
428 ProvisionalLoadWaiter load_failed_observer(tab); 429 ProvisionalLoadWaiter load_failed_observer(tab);
429 430
430 // Simulate user clicking on back button (crbug.com/39248). 431 // Simulate user clicking on back button (crbug.com/39248).
431 chrome::GoBack(browser(), CURRENT_TAB); 432 chrome::GoBack(browser(), CURRENT_TAB);
432 433
433 // Wait until we hear the load failure, and make sure we haven't swapped out 434 // Wait until we hear the load failure, and make sure we haven't swapped out
434 // the previous page. Prevents regression of http://crbug.com/82667. 435 // the previous page. Prevents regression of http://crbug.com/82667.
435 load_failed_observer.Wait(); 436 load_failed_observer.Wait();
436 EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut( 437 EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut(
437 tab->GetRenderViewHost())); 438 tab->GetRenderViewHost()));
438 439
439 // We should be back at the original good page. 440 // We should be back at the original good page.
440 EXPECT_FALSE(browser()->GetActiveWebContents()->GetInterstitialPage()); 441 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage());
441 CheckUnauthenticatedState(tab); 442 CheckUnauthenticatedState(tab);
442 } 443 }
443 444
444 // Visits a page with https error and then goes back using GoToOffset. 445 // Visits a page with https error and then goes back using GoToOffset.
445 // Disabled because its flaky: http://crbug.com/40932, http://crbug.com/43575. 446 // Disabled because its flaky: http://crbug.com/40932, http://crbug.com/43575.
446 IN_PROC_BROWSER_TEST_F(SSLUITest, 447 IN_PROC_BROWSER_TEST_F(SSLUITest,
447 TestHTTPSExpiredCertAndGoBackViaMenu) { 448 TestHTTPSExpiredCertAndGoBackViaMenu) {
448 ASSERT_TRUE(test_server()->Start()); 449 ASSERT_TRUE(test_server()->Start());
449 ASSERT_TRUE(https_server_expired_.Start()); 450 ASSERT_TRUE(https_server_expired_.Start());
450 451
451 // First navigate to an HTTP page. 452 // First navigate to an HTTP page.
452 ui_test_utils::NavigateToURL(browser(), 453 ui_test_utils::NavigateToURL(browser(),
453 test_server()->GetURL("files/ssl/google.html")); 454 test_server()->GetURL("files/ssl/google.html"));
454 WebContents* tab = browser()->GetActiveWebContents(); 455 WebContents* tab = chrome::GetActiveWebContents(browser());
455 NavigationEntry* entry = tab->GetController().GetActiveEntry(); 456 NavigationEntry* entry = tab->GetController().GetActiveEntry();
456 ASSERT_TRUE(entry); 457 ASSERT_TRUE(entry);
457 458
458 // Now go to a bad HTTPS page that shows an interstitial. 459 // Now go to a bad HTTPS page that shows an interstitial.
459 ui_test_utils::NavigateToURL(browser(), 460 ui_test_utils::NavigateToURL(browser(),
460 https_server_expired_.GetURL("files/ssl/google.html")); 461 https_server_expired_.GetURL("files/ssl/google.html"));
461 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 462 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
462 true); // Interstitial showing 463 true); // Interstitial showing
463 464
464 // Simulate user clicking and holding on back button (crbug.com/37215). 465 // Simulate user clicking and holding on back button (crbug.com/37215).
465 tab->GetController().GoToOffset(-1); 466 tab->GetController().GoToOffset(-1);
466 467
467 // We should be back at the original good page. 468 // We should be back at the original good page.
468 EXPECT_FALSE(browser()->GetActiveWebContents()->GetInterstitialPage()); 469 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage());
469 CheckUnauthenticatedState(tab); 470 CheckUnauthenticatedState(tab);
470 } 471 }
471 472
472 // Visits a page with https error and then goes forward using GoToOffset. 473 // Visits a page with https error and then goes forward using GoToOffset.
473 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) { 474 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) {
474 ASSERT_TRUE(test_server()->Start()); 475 ASSERT_TRUE(test_server()->Start());
475 ASSERT_TRUE(https_server_expired_.Start()); 476 ASSERT_TRUE(https_server_expired_.Start());
476 477
477 // First navigate to two HTTP pages. 478 // First navigate to two HTTP pages.
478 ui_test_utils::NavigateToURL(browser(), 479 ui_test_utils::NavigateToURL(browser(),
479 test_server()->GetURL("files/ssl/google.html")); 480 test_server()->GetURL("files/ssl/google.html"));
480 WebContents* tab = browser()->GetActiveWebContents(); 481 WebContents* tab = chrome::GetActiveWebContents(browser());
481 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); 482 NavigationEntry* entry1 = tab->GetController().GetActiveEntry();
482 ASSERT_TRUE(entry1); 483 ASSERT_TRUE(entry1);
483 ui_test_utils::NavigateToURL(browser(), 484 ui_test_utils::NavigateToURL(browser(),
484 test_server()->GetURL("files/ssl/blank_page.html")); 485 test_server()->GetURL("files/ssl/blank_page.html"));
485 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); 486 NavigationEntry* entry2 = tab->GetController().GetActiveEntry();
486 ASSERT_TRUE(entry2); 487 ASSERT_TRUE(entry2);
487 488
488 // Now go back so that a page is in the forward history. 489 // Now go back so that a page is in the forward history.
489 { 490 {
490 ui_test_utils::WindowedNotificationObserver observer( 491 ui_test_utils::WindowedNotificationObserver observer(
(...skipping 15 matching lines...) Expand all
506 // Simulate user clicking and holding on forward button. 507 // Simulate user clicking and holding on forward button.
507 { 508 {
508 ui_test_utils::WindowedNotificationObserver observer( 509 ui_test_utils::WindowedNotificationObserver observer(
509 content::NOTIFICATION_LOAD_STOP, 510 content::NOTIFICATION_LOAD_STOP,
510 content::Source<NavigationController>(&tab->GetController())); 511 content::Source<NavigationController>(&tab->GetController()));
511 tab->GetController().GoToOffset(1); 512 tab->GetController().GoToOffset(1);
512 observer.Wait(); 513 observer.Wait();
513 } 514 }
514 515
515 // We should be showing the second good page. 516 // We should be showing the second good page.
516 EXPECT_FALSE(browser()->GetActiveWebContents()->GetInterstitialPage()); 517 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage());
517 CheckUnauthenticatedState(tab); 518 CheckUnauthenticatedState(tab);
518 EXPECT_FALSE(tab->GetController().CanGoForward()); 519 EXPECT_FALSE(tab->GetController().CanGoForward());
519 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); 520 NavigationEntry* entry4 = tab->GetController().GetActiveEntry();
520 EXPECT_TRUE(entry2 == entry4); 521 EXPECT_TRUE(entry2 == entry4);
521 } 522 }
522 523
523 // Visit a HTTP page which request WSS connection to a server providing invalid 524 // Visit a HTTP page which request WSS connection to a server providing invalid
524 // certificate. Close the page while WSS connection waits for SSLManager's 525 // certificate. Close the page while WSS connection waits for SSLManager's
525 // response from UI thread. 526 // response from UI thread.
526 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) { 527 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) {
527 ASSERT_TRUE(test_server()->Start()); 528 ASSERT_TRUE(test_server()->Start());
528 ASSERT_TRUE(https_server_expired_.Start()); 529 ASSERT_TRUE(https_server_expired_.Start());
529 530
530 // Setup page title observer. 531 // Setup page title observer.
531 WebContents* tab = browser()->GetActiveWebContents(); 532 WebContents* tab = chrome::GetActiveWebContents(browser());
532 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); 533 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
533 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 534 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
534 535
535 // Create GURLs to test pages. 536 // Create GURLs to test pages.
536 std::string masterUrlPath = StringPrintf("%s?%d", 537 std::string masterUrlPath = StringPrintf("%s?%d",
537 test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(), 538 test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(),
538 https_server_expired_.host_port_pair().port()); 539 https_server_expired_.host_port_pair().port());
539 GURL masterUrl(masterUrlPath); 540 GURL masterUrl(masterUrlPath);
540 std::string slaveUrlPath = StringPrintf("%s?%d", 541 std::string slaveUrlPath = StringPrintf("%s?%d",
541 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), 542 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(),
542 https_server_expired_.host_port_pair().port()); 543 https_server_expired_.host_port_pair().port());
543 GURL slaveUrl(slaveUrlPath); 544 GURL slaveUrl(slaveUrlPath);
544 545
545 // Create tabs and visit pages which keep on creating wss connections. 546 // Create tabs and visit pages which keep on creating wss connections.
546 TabContents* tabs[16]; 547 TabContents* tabs[16];
547 for (int i = 0; i < 16; ++i) { 548 for (int i = 0; i < 16; ++i) {
548 tabs[i] = browser()->AddSelectedTabWithURL( 549 tabs[i] = chrome::AddSelectedTabWithURL(browser(), slaveUrl,
549 slaveUrl, content::PAGE_TRANSITION_LINK); 550 content::PAGE_TRANSITION_LINK);
550 } 551 }
551 chrome::SelectNextTab(browser()); 552 chrome::SelectNextTab(browser());
552 553
553 // Visit a page which waits for one TLS handshake failure. 554 // Visit a page which waits for one TLS handshake failure.
554 // The title will be changed to 'PASS'. 555 // The title will be changed to 'PASS'.
555 ui_test_utils::NavigateToURL(browser(), masterUrl); 556 ui_test_utils::NavigateToURL(browser(), masterUrl);
556 const string16 result = watcher.WaitAndGetTitle(); 557 const string16 result = watcher.WaitAndGetTitle();
557 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); 558 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass"));
558 559
559 // Close tabs which contains the test page. 560 // Close tabs which contains the test page.
560 for (int i = 0; i < 16; ++i) 561 for (int i = 0; i < 16; ++i)
561 browser()->CloseTabContents(tabs[i]->web_contents()); 562 chrome::CloseWebContents(browser(), tabs[i]->web_contents());
562 browser()->CloseTabContents(tab); 563 chrome::CloseWebContents(browser(), tab);
563 } 564 }
564 565
565 // Visit a HTTPS page and proceeds despite an invalid certificate. The page 566 // Visit a HTTPS page and proceeds despite an invalid certificate. The page
566 // requests WSS connection to the same origin host to check if WSS connection 567 // requests WSS connection to the same origin host to check if WSS connection
567 // share certificates policy with HTTPS correcly. 568 // share certificates policy with HTTPS correcly.
568 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { 569 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) {
569 ASSERT_TRUE(test_server()->Start()); 570 ASSERT_TRUE(test_server()->Start());
570 ASSERT_TRUE(https_server_expired_.Start()); 571 ASSERT_TRUE(https_server_expired_.Start());
571 572
572 // Start pywebsocket with TLS. 573 // Start pywebsocket with TLS.
573 ui_test_utils::TestWebSocketServer wss_server; 574 ui_test_utils::TestWebSocketServer wss_server;
574 int port = wss_server.UseRandomPort(); 575 int port = wss_server.UseRandomPort();
575 wss_server.UseTLS(); 576 wss_server.UseTLS();
576 FilePath wss_root_dir; 577 FilePath wss_root_dir;
577 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); 578 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir));
578 ASSERT_TRUE(wss_server.Start(wss_root_dir)); 579 ASSERT_TRUE(wss_server.Start(wss_root_dir));
579 580
580 // Setup page title observer. 581 // Setup page title observer.
581 WebContents* tab = browser()->GetActiveWebContents(); 582 WebContents* tab = chrome::GetActiveWebContents(browser());
582 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); 583 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
583 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 584 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
584 585
585 // Visit bad HTTPS page. 586 // Visit bad HTTPS page.
586 std::string urlPath = 587 std::string urlPath =
587 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html"); 588 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html");
588 ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); 589 ui_test_utils::NavigateToURL(browser(), GURL(urlPath));
589 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 590 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
590 false, true); // Interstitial showing 591 false, true); // Interstitial showing
591 592
(...skipping 15 matching lines...) Expand all
607 #endif // defined(OS_CHROMEOS) 608 #endif // defined(OS_CHROMEOS)
608 609
609 // Open a page with a HTTPS error in a tab with no prior navigation (through a 610 // Open a page with a HTTPS error in a tab with no prior navigation (through a
610 // link with a blank target). This is to test that the lack of navigation entry 611 // link with a blank target). This is to test that the lack of navigation entry
611 // does not cause any problems (it was causing a crasher, see 612 // does not cause any problems (it was causing a crasher, see
612 // http://crbug.com/19941). 613 // http://crbug.com/19941).
613 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { 614 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) {
614 ASSERT_TRUE(https_server_expired_.Start()); 615 ASSERT_TRUE(https_server_expired_.Start());
615 616
616 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); 617 GURL url = https_server_expired_.GetURL("files/ssl/google.htm");
617 TabContents* tab2 = 618 TabContents* tab2 = chrome::AddSelectedTabWithURL(
618 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); 619 browser(), url, content::PAGE_TRANSITION_TYPED);
619 ui_test_utils::WaitForLoadStop(tab2->web_contents()); 620 ui_test_utils::WaitForLoadStop(tab2->web_contents());
620 621
621 // Verify our assumption that there was no prior navigation. 622 // Verify our assumption that there was no prior navigation.
622 EXPECT_FALSE(chrome::CanGoBack(browser())); 623 EXPECT_FALSE(chrome::CanGoBack(browser()));
623 624
624 // We should have an interstitial page showing. 625 // We should have an interstitial page showing.
625 ASSERT_TRUE(tab2->web_contents()->GetInterstitialPage()); 626 ASSERT_TRUE(tab2->web_contents()->GetInterstitialPage());
626 } 627 }
627 628
628 // Disabled due to crash in downloads code that this triggers. 629 // Disabled due to crash in downloads code that this triggers.
(...skipping 14 matching lines...) Expand all
643 content::NOTIFICATION_LOAD_STOP, 644 content::NOTIFICATION_LOAD_STOP,
644 content::NotificationService::AllSources()); 645 content::NotificationService::AllSources());
645 browser::NavigateParams navigate_params(browser(), url_dangerous, 646 browser::NavigateParams navigate_params(browser(), url_dangerous,
646 content::PAGE_TRANSITION_TYPED); 647 content::PAGE_TRANSITION_TYPED);
647 browser::Navigate(&navigate_params); 648 browser::Navigate(&navigate_params);
648 observer.Wait(); 649 observer.Wait();
649 } 650 }
650 651
651 // Proceed through the SSL interstitial. This doesn't use 652 // Proceed through the SSL interstitial. This doesn't use
652 // |ProceedThroughInterstitial| since no page load will commit. 653 // |ProceedThroughInterstitial| since no page load will commit.
653 WebContents* tab = browser()->GetActiveWebContents(); 654 WebContents* tab = chrome::GetActiveWebContents(browser());
654 ASSERT_TRUE(tab != NULL); 655 ASSERT_TRUE(tab != NULL);
655 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); 656 ASSERT_TRUE(tab->GetInterstitialPage() != NULL);
656 { 657 {
657 ui_test_utils::WindowedNotificationObserver observer( 658 ui_test_utils::WindowedNotificationObserver observer(
658 chrome::NOTIFICATION_DOWNLOAD_INITIATED, 659 chrome::NOTIFICATION_DOWNLOAD_INITIATED,
659 content::NotificationService::AllSources()); 660 content::NotificationService::AllSources());
660 tab->GetInterstitialPage()->Proceed(); 661 tab->GetInterstitialPage()->Proceed();
661 observer.Wait(); 662 observer.Wait();
662 } 663 }
663 664
(...skipping 18 matching lines...) Expand all
682 std::string replacement_path; 683 std::string replacement_path;
683 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 684 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
684 "files/ssl/page_displays_insecure_content.html", 685 "files/ssl/page_displays_insecure_content.html",
685 test_server()->host_port_pair(), 686 test_server()->host_port_pair(),
686 &replacement_path)); 687 &replacement_path));
687 688
688 // Load a page that displays insecure content. 689 // Load a page that displays insecure content.
689 ui_test_utils::NavigateToURL(browser(), 690 ui_test_utils::NavigateToURL(browser(),
690 https_server_.GetURL(replacement_path)); 691 https_server_.GetURL(replacement_path));
691 692
692 CheckAuthenticatedState(browser()->GetActiveWebContents(), true); 693 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), true);
693 } 694 }
694 695
695 // Visits a page that runs insecure content and tries to suppress the insecure 696 // Visits a page that runs insecure content and tries to suppress the insecure
696 // content warnings by randomizing location.hash. 697 // content warnings by randomizing location.hash.
697 // Based on http://crbug.com/8706 698 // Based on http://crbug.com/8706
698 IN_PROC_BROWSER_TEST_F(SSLUITest, 699 IN_PROC_BROWSER_TEST_F(SSLUITest,
699 TestRunsInsecuredContentRandomizeHash) { 700 TestRunsInsecuredContentRandomizeHash) {
700 ASSERT_TRUE(test_server()->Start()); 701 ASSERT_TRUE(test_server()->Start());
701 ASSERT_TRUE(https_server_.Start()); 702 ASSERT_TRUE(https_server_.Start());
702 703
703 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( 704 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
704 "files/ssl/page_runs_insecure_content.html")); 705 "files/ssl/page_runs_insecure_content.html"));
705 706
706 CheckAuthenticationBrokenState(browser()->GetActiveWebContents(), 0, true, 707 CheckAuthenticationBrokenState(chrome::GetActiveWebContents(browser()), 0,
707 false); 708 true, false);
708 } 709 }
709 710
710 // Visits a page with unsafe content and make sure that: 711 // Visits a page with unsafe content and make sure that:
711 // - frames content is replaced with warning 712 // - frames content is replaced with warning
712 // - images and scripts are filtered out entirely 713 // - images and scripts are filtered out entirely
713 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) { 714 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) {
714 ASSERT_TRUE(https_server_.Start()); 715 ASSERT_TRUE(https_server_.Start());
715 ASSERT_TRUE(https_server_expired_.Start()); 716 ASSERT_TRUE(https_server_expired_.Start());
716 717
717 std::string replacement_path; 718 std::string replacement_path;
718 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 719 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
719 "files/ssl/page_with_unsafe_contents.html", 720 "files/ssl/page_with_unsafe_contents.html",
720 https_server_expired_.host_port_pair(), 721 https_server_expired_.host_port_pair(),
721 &replacement_path)); 722 &replacement_path));
722 ui_test_utils::NavigateToURL(browser(), 723 ui_test_utils::NavigateToURL(browser(),
723 https_server_.GetURL(replacement_path)); 724 https_server_.GetURL(replacement_path));
724 725
725 WebContents* tab = browser()->GetActiveWebContents(); 726 WebContents* tab = chrome::GetActiveWebContents(browser());
726 // When the bad content is filtered, the state is expected to be 727 // When the bad content is filtered, the state is expected to be
727 // authenticated. 728 // authenticated.
728 CheckAuthenticatedState(tab, false); 729 CheckAuthenticatedState(tab, false);
729 730
730 // Because of cross-frame scripting restrictions, we cannot access the iframe 731 // Because of cross-frame scripting restrictions, we cannot access the iframe
731 // content. So to know if the frame was loaded, we just check if a popup was 732 // content. So to know if the frame was loaded, we just check if a popup was
732 // opened (the iframe content opens one). 733 // opened (the iframe content opens one).
733 // Note: because of bug 1115868, no constrained window is opened right now. 734 // Note: because of bug 1115868, no constrained window is opened right now.
734 // Once the bug is fixed, this will do the real check. 735 // Once the bug is fixed, this will do the real check.
735 EXPECT_EQ(0, GetConstrainedWindowCount()); 736 EXPECT_EQ(0, GetConstrainedWindowCount());
(...skipping 21 matching lines...) Expand all
757 ASSERT_TRUE(https_server_.Start()); 758 ASSERT_TRUE(https_server_.Start());
758 759
759 std::string replacement_path; 760 std::string replacement_path;
760 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 761 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
761 "files/ssl/page_with_dynamic_insecure_content.html", 762 "files/ssl/page_with_dynamic_insecure_content.html",
762 test_server()->host_port_pair(), 763 test_server()->host_port_pair(),
763 &replacement_path)); 764 &replacement_path));
764 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( 765 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
765 replacement_path)); 766 replacement_path));
766 767
767 WebContents* tab = browser()->GetActiveWebContents(); 768 WebContents* tab = chrome::GetActiveWebContents(browser());
768 CheckAuthenticatedState(tab, false); 769 CheckAuthenticatedState(tab, false);
769 770
770 // Load the insecure image. 771 // Load the insecure image.
771 bool js_result = false; 772 bool js_result = false;
772 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 773 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
773 tab->GetRenderViewHost(), std::wstring(), L"loadBadImage();", 774 tab->GetRenderViewHost(), std::wstring(), L"loadBadImage();",
774 &js_result)); 775 &js_result));
775 EXPECT_TRUE(js_result); 776 EXPECT_TRUE(js_result);
776 777
777 // We should now have insecure content. 778 // We should now have insecure content.
778 CheckAuthenticatedState(tab, true); 779 CheckAuthenticatedState(tab, true);
779 } 780 }
780 781
781 // Visits two pages from the same origin: one that displays insecure content and 782 // Visits two pages from the same origin: one that displays insecure content and
782 // one that doesn't. The test checks that we do not propagate the insecure 783 // one that doesn't. The test checks that we do not propagate the insecure
783 // content state from one to the other. 784 // content state from one to the other.
784 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { 785 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
785 ASSERT_TRUE(test_server()->Start()); 786 ASSERT_TRUE(test_server()->Start());
786 ASSERT_TRUE(https_server_.Start()); 787 ASSERT_TRUE(https_server_.Start());
787 788
788 ui_test_utils::NavigateToURL(browser(), 789 ui_test_utils::NavigateToURL(browser(),
789 https_server_.GetURL("files/ssl/blank_page.html")); 790 https_server_.GetURL("files/ssl/blank_page.html"));
790 791
791 TabContents* tab1 = browser()->GetActiveTabContents(); 792 TabContents* tab1 = chrome::GetActiveTabContents(browser());
792 793
793 // This tab should be fine. 794 // This tab should be fine.
794 CheckAuthenticatedState(tab1->web_contents(), false); 795 CheckAuthenticatedState(tab1->web_contents(), false);
795 796
796 // Create a new tab. 797 // Create a new tab.
797 std::string replacement_path; 798 std::string replacement_path;
798 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 799 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
799 "files/ssl/page_displays_insecure_content.html", 800 "files/ssl/page_displays_insecure_content.html",
800 test_server()->host_port_pair(), 801 test_server()->host_port_pair(),
801 &replacement_path)); 802 &replacement_path));
(...skipping 21 matching lines...) Expand all
823 // Visits two pages from the same origin: one that runs insecure content and one 824 // Visits two pages from the same origin: one that runs insecure content and one
824 // that doesn't. The test checks that we propagate the insecure content state 825 // that doesn't. The test checks that we propagate the insecure content state
825 // from one to the other. 826 // from one to the other.
826 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { 827 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) {
827 ASSERT_TRUE(test_server()->Start()); 828 ASSERT_TRUE(test_server()->Start());
828 ASSERT_TRUE(https_server_.Start()); 829 ASSERT_TRUE(https_server_.Start());
829 830
830 ui_test_utils::NavigateToURL(browser(), 831 ui_test_utils::NavigateToURL(browser(),
831 https_server_.GetURL("files/ssl/blank_page.html")); 832 https_server_.GetURL("files/ssl/blank_page.html"));
832 833
833 TabContents* tab1 = browser()->GetActiveTabContents(); 834 TabContents* tab1 = chrome::GetActiveTabContents(browser());
834 835
835 // This tab should be fine. 836 // This tab should be fine.
836 CheckAuthenticatedState(tab1->web_contents(), false); 837 CheckAuthenticatedState(tab1->web_contents(), false);
837 838
838 std::string replacement_path; 839 std::string replacement_path;
839 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 840 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
840 "files/ssl/page_runs_insecure_content.html", 841 "files/ssl/page_runs_insecure_content.html",
841 test_server()->host_port_pair(), 842 test_server()->host_port_pair(),
842 &replacement_path)); 843 &replacement_path));
843 844
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 878
878 std::string replacement_path; 879 std::string replacement_path;
879 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 880 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
880 "files/ssl/page_displays_insecure_content.html", 881 "files/ssl/page_displays_insecure_content.html",
881 test_server()->host_port_pair(), 882 test_server()->host_port_pair(),
882 &replacement_path)); 883 &replacement_path));
883 884
884 // Load original page over HTTP. 885 // Load original page over HTTP.
885 const GURL url_http = test_server()->GetURL(replacement_path); 886 const GURL url_http = test_server()->GetURL(replacement_path);
886 ui_test_utils::NavigateToURL(browser(), url_http); 887 ui_test_utils::NavigateToURL(browser(), url_http);
887 WebContents* tab = browser()->GetActiveWebContents(); 888 WebContents* tab = chrome::GetActiveWebContents(browser());
888 CheckUnauthenticatedState(tab); 889 CheckUnauthenticatedState(tab);
889 890
890 // Load again but over SSL. It should be marked as displaying insecure 891 // Load again but over SSL. It should be marked as displaying insecure
891 // content (even though the image comes from the WebCore memory cache). 892 // content (even though the image comes from the WebCore memory cache).
892 const GURL url_https = https_server_.GetURL(replacement_path); 893 const GURL url_https = https_server_.GetURL(replacement_path);
893 ui_test_utils::NavigateToURL(browser(), url_https); 894 ui_test_utils::NavigateToURL(browser(), url_https);
894 CheckAuthenticatedState(tab, true); 895 CheckAuthenticatedState(tab, true);
895 } 896 }
896 897
897 // http://crbug.com/84729 898 // http://crbug.com/84729
(...skipping 13 matching lines...) Expand all
911 912
912 std::string replacement_path; 913 std::string replacement_path;
913 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 914 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
914 "files/ssl/page_runs_insecure_content.html", 915 "files/ssl/page_runs_insecure_content.html",
915 test_server()->host_port_pair(), 916 test_server()->host_port_pair(),
916 &replacement_path)); 917 &replacement_path));
917 918
918 // Load original page over HTTP. 919 // Load original page over HTTP.
919 const GURL url_http = test_server()->GetURL(replacement_path); 920 const GURL url_http = test_server()->GetURL(replacement_path);
920 ui_test_utils::NavigateToURL(browser(), url_http); 921 ui_test_utils::NavigateToURL(browser(), url_http);
921 WebContents* tab = browser()->GetActiveWebContents(); 922 WebContents* tab = chrome::GetActiveWebContents(browser());
922 CheckUnauthenticatedState(tab); 923 CheckUnauthenticatedState(tab);
923 924
924 // Load again but over SSL. It should be marked as displaying insecure 925 // Load again but over SSL. It should be marked as displaying insecure
925 // content (even though the image comes from the WebCore memory cache). 926 // content (even though the image comes from the WebCore memory cache).
926 const GURL url_https = https_server_.GetURL(replacement_path); 927 const GURL url_https = https_server_.GetURL(replacement_path);
927 ui_test_utils::NavigateToURL(browser(), url_https); 928 ui_test_utils::NavigateToURL(browser(), url_https);
928 CheckAuthenticationBrokenState(tab, 0, true, false); 929 CheckAuthenticationBrokenState(tab, 0, true, false);
929 } 930 }
930 931
931 // This test ensures the CN invalid status does not 'stick' to a certificate 932 // This test ensures the CN invalid status does not 'stick' to a certificate
932 // (see bug #1044942) and that it depends on the host-name. 933 // (see bug #1044942) and that it depends on the host-name.
933 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { 934 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) {
934 ASSERT_TRUE(https_server_.Start()); 935 ASSERT_TRUE(https_server_.Start());
935 ASSERT_TRUE(https_server_mismatched_.Start()); 936 ASSERT_TRUE(https_server_mismatched_.Start());
936 937
937 // First we hit the server with hostname, this generates an invalid policy 938 // First we hit the server with hostname, this generates an invalid policy
938 // error. 939 // error.
939 ui_test_utils::NavigateToURL(browser(), 940 ui_test_utils::NavigateToURL(browser(),
940 https_server_mismatched_.GetURL("files/ssl/google.html")); 941 https_server_mismatched_.GetURL("files/ssl/google.html"));
941 942
942 // We get an interstitial page as a result. 943 // We get an interstitial page as a result.
943 WebContents* tab = browser()->GetActiveWebContents(); 944 WebContents* tab = chrome::GetActiveWebContents(browser());
944 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 945 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
945 false, true); // Interstitial showing. 946 false, true); // Interstitial showing.
946 ProceedThroughInterstitial(tab); 947 ProceedThroughInterstitial(tab);
947 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 948 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
948 false, false); // No interstitial showing. 949 false, false); // No interstitial showing.
949 950
950 // Now we try again with the right host name this time. 951 // Now we try again with the right host name this time.
951 GURL url(https_server_.GetURL("files/ssl/google.html")); 952 GURL url(https_server_.GetURL("files/ssl/google.html"));
952 ui_test_utils::NavigateToURL(browser(), url); 953 ui_test_utils::NavigateToURL(browser(), url);
953 954
(...skipping 17 matching lines...) Expand all
971 #define MAYBE_TestRefNavigation TestRefNavigation 972 #define MAYBE_TestRefNavigation TestRefNavigation
972 #endif 973 #endif
973 974
974 // Test that navigating to a #ref does not change a bad security state. 975 // Test that navigating to a #ref does not change a bad security state.
975 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { 976 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) {
976 ASSERT_TRUE(https_server_expired_.Start()); 977 ASSERT_TRUE(https_server_expired_.Start());
977 978
978 ui_test_utils::NavigateToURL(browser(), 979 ui_test_utils::NavigateToURL(browser(),
979 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); 980 https_server_expired_.GetURL("files/ssl/page_with_refs.html"));
980 981
981 WebContents* tab = browser()->GetActiveWebContents(); 982 WebContents* tab = chrome::GetActiveWebContents(browser());
982 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 983 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
983 true); // Interstitial showing. 984 true); // Interstitial showing.
984 985
985 ProceedThroughInterstitial(tab); 986 ProceedThroughInterstitial(tab);
986 987
987 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 988 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
988 false); // No interstitial showing. 989 false); // No interstitial showing.
989 990
990 // Now navigate to a ref in the page, the security state should not have 991 // Now navigate to a ref in the page, the security state should not have
991 // changed. 992 // changed.
(...skipping 14 matching lines...) Expand all
1006 1007
1007 std::string replacement_path; 1008 std::string replacement_path;
1008 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 1009 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
1009 "files/ssl/page_with_unsafe_popup.html", 1010 "files/ssl/page_with_unsafe_popup.html",
1010 https_server_expired_.host_port_pair(), 1011 https_server_expired_.host_port_pair(),
1011 &replacement_path)); 1012 &replacement_path));
1012 1013
1013 ui_test_utils::NavigateToURL(browser(), 1014 ui_test_utils::NavigateToURL(browser(),
1014 test_server()->GetURL(replacement_path)); 1015 test_server()->GetURL(replacement_path));
1015 1016
1016 WebContents* tab1 = browser()->GetActiveWebContents(); 1017 WebContents* tab1 = chrome::GetActiveWebContents(browser());
1017 // It is probably overkill to add a notification for a popup-opening, let's 1018 // It is probably overkill to add a notification for a popup-opening, let's
1018 // just poll. 1019 // just poll.
1019 for (int i = 0; i < 10; i++) { 1020 for (int i = 0; i < 10; i++) {
1020 if (GetConstrainedWindowCount() > 0) 1021 if (GetConstrainedWindowCount() > 0)
1021 break; 1022 break;
1022 MessageLoop::current()->PostDelayedTask( 1023 MessageLoop::current()->PostDelayedTask(
1023 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); 1024 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1));
1024 ui_test_utils::RunMessageLoop(); 1025 ui_test_utils::RunMessageLoop();
1025 } 1026 }
1026 ASSERT_EQ(1, GetConstrainedWindowCount()); 1027 ASSERT_EQ(1, GetConstrainedWindowCount());
1027 1028
1028 // Let's add another tab to make sure the browser does not exit when we close 1029 // Let's add another tab to make sure the browser does not exit when we close
1029 // the first tab. 1030 // the first tab.
1030 GURL url = test_server()->GetURL("files/ssl/google.html"); 1031 GURL url = test_server()->GetURL("files/ssl/google.html");
1031 ui_test_utils::WindowedNotificationObserver observer( 1032 ui_test_utils::WindowedNotificationObserver observer(
1032 content::NOTIFICATION_LOAD_STOP, 1033 content::NOTIFICATION_LOAD_STOP,
1033 content::NotificationService::AllSources()); 1034 content::NotificationService::AllSources());
1034 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); 1035 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
1035 observer.Wait(); 1036 observer.Wait();
1036 1037
1037 // Close the first tab. 1038 // Close the first tab.
1038 browser()->CloseTabContents(tab1); 1039 chrome::CloseWebContents(browser(), tab1);
1039 } 1040 }
1040 1041
1041 // Visit a page over bad https that is a redirect to a page with good https. 1042 // Visit a page over bad https that is a redirect to a page with good https.
1042 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { 1043 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) {
1043 ASSERT_TRUE(https_server_.Start()); 1044 ASSERT_TRUE(https_server_.Start());
1044 ASSERT_TRUE(https_server_expired_.Start()); 1045 ASSERT_TRUE(https_server_expired_.Start());
1045 1046
1046 GURL url1 = https_server_expired_.GetURL("server-redirect?"); 1047 GURL url1 = https_server_expired_.GetURL("server-redirect?");
1047 GURL url2 = https_server_.GetURL("files/ssl/google.html"); 1048 GURL url2 = https_server_.GetURL("files/ssl/google.html");
1048 1049
1049 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); 1050 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec()));
1050 1051
1051 WebContents* tab = browser()->GetActiveWebContents(); 1052 WebContents* tab = chrome::GetActiveWebContents(browser());
1052 1053
1053 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1054 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1054 true); // Interstitial showing. 1055 true); // Interstitial showing.
1055 1056
1056 ProceedThroughInterstitial(tab); 1057 ProceedThroughInterstitial(tab);
1057 1058
1058 // We have been redirected to the good page. 1059 // We have been redirected to the good page.
1059 CheckAuthenticatedState(tab, false); 1060 CheckAuthenticatedState(tab, false);
1060 } 1061 }
1061 1062
1062 // Visit a page over good https that is a redirect to a page with bad https. 1063 // Visit a page over good https that is a redirect to a page with bad https.
1063 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) { 1064 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) {
1064 ASSERT_TRUE(https_server_.Start()); 1065 ASSERT_TRUE(https_server_.Start());
1065 ASSERT_TRUE(https_server_expired_.Start()); 1066 ASSERT_TRUE(https_server_expired_.Start());
1066 1067
1067 GURL url1 = https_server_.GetURL("server-redirect?"); 1068 GURL url1 = https_server_.GetURL("server-redirect?");
1068 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); 1069 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html");
1069 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); 1070 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec()));
1070 1071
1071 WebContents* tab = browser()->GetActiveWebContents(); 1072 WebContents* tab = chrome::GetActiveWebContents(browser());
1072 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1073 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1073 true); // Interstitial showing. 1074 true); // Interstitial showing.
1074 1075
1075 ProceedThroughInterstitial(tab); 1076 ProceedThroughInterstitial(tab);
1076 1077
1077 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1078 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1078 false); // No interstitial showing. 1079 false); // No interstitial showing.
1079 } 1080 }
1080 1081
1081 // Visit a page over http that is a redirect to a page with good HTTPS. 1082 // Visit a page over http that is a redirect to a page with good HTTPS.
1082 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { 1083 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) {
1083 ASSERT_TRUE(test_server()->Start()); 1084 ASSERT_TRUE(test_server()->Start());
1084 ASSERT_TRUE(https_server_.Start()); 1085 ASSERT_TRUE(https_server_.Start());
1085 1086
1086 WebContents* tab = browser()->GetActiveWebContents(); 1087 WebContents* tab = chrome::GetActiveWebContents(browser());
1087 1088
1088 // HTTP redirects to good HTTPS. 1089 // HTTP redirects to good HTTPS.
1089 GURL http_url = test_server()->GetURL("server-redirect?"); 1090 GURL http_url = test_server()->GetURL("server-redirect?");
1090 GURL good_https_url = 1091 GURL good_https_url =
1091 https_server_.GetURL("files/ssl/google.html"); 1092 https_server_.GetURL("files/ssl/google.html");
1092 1093
1093 ui_test_utils::NavigateToURL(browser(), 1094 ui_test_utils::NavigateToURL(browser(),
1094 GURL(http_url.spec() + good_https_url.spec())); 1095 GURL(http_url.spec() + good_https_url.spec()));
1095 CheckAuthenticatedState(tab, false); 1096 CheckAuthenticatedState(tab, false);
1096 } 1097 }
1097 1098
1098 // Visit a page over http that is a redirect to a page with bad HTTPS. 1099 // Visit a page over http that is a redirect to a page with bad HTTPS.
1099 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToBadHTTPS) { 1100 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToBadHTTPS) {
1100 ASSERT_TRUE(test_server()->Start()); 1101 ASSERT_TRUE(test_server()->Start());
1101 ASSERT_TRUE(https_server_expired_.Start()); 1102 ASSERT_TRUE(https_server_expired_.Start());
1102 1103
1103 WebContents* tab = browser()->GetActiveWebContents(); 1104 WebContents* tab = chrome::GetActiveWebContents(browser());
1104 1105
1105 GURL http_url = test_server()->GetURL("server-redirect?"); 1106 GURL http_url = test_server()->GetURL("server-redirect?");
1106 GURL bad_https_url = 1107 GURL bad_https_url =
1107 https_server_expired_.GetURL("files/ssl/google.html"); 1108 https_server_expired_.GetURL("files/ssl/google.html");
1108 ui_test_utils::NavigateToURL(browser(), 1109 ui_test_utils::NavigateToURL(browser(),
1109 GURL(http_url.spec() + bad_https_url.spec())); 1110 GURL(http_url.spec() + bad_https_url.spec()));
1110 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1111 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1111 true); // Interstitial showing. 1112 true); // Interstitial showing.
1112 1113
1113 ProceedThroughInterstitial(tab); 1114 ProceedThroughInterstitial(tab);
1114 1115
1115 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1116 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1116 false); // No interstitial showing. 1117 false); // No interstitial showing.
1117 } 1118 }
1118 1119
1119 // Visit a page over https that is a redirect to a page with http (to make sure 1120 // Visit a page over https that is a redirect to a page with http (to make sure
1120 // we don't keep the secure state). 1121 // we don't keep the secure state).
1121 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { 1122 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) {
1122 ASSERT_TRUE(test_server()->Start()); 1123 ASSERT_TRUE(test_server()->Start());
1123 ASSERT_TRUE(https_server_.Start()); 1124 ASSERT_TRUE(https_server_.Start());
1124 1125
1125 GURL https_url = https_server_.GetURL("server-redirect?"); 1126 GURL https_url = https_server_.GetURL("server-redirect?");
1126 GURL http_url = test_server()->GetURL("files/ssl/google.html"); 1127 GURL http_url = test_server()->GetURL("files/ssl/google.html");
1127 1128
1128 ui_test_utils::NavigateToURL(browser(), 1129 ui_test_utils::NavigateToURL(browser(),
1129 GURL(https_url.spec() + http_url.spec())); 1130 GURL(https_url.spec() + http_url.spec()));
1130 CheckUnauthenticatedState(browser()->GetActiveWebContents()); 1131 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
1131 } 1132 }
1132 1133
1133 // Visits a page to which we could not connect (bad port) over http and https 1134 // Visits a page to which we could not connect (bad port) over http and https
1134 // and make sure the security style is correct. 1135 // and make sure the security style is correct.
1135 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { 1136 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) {
1136 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); 1137 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17"));
1137 CheckUnauthenticatedState(browser()->GetActiveWebContents()); 1138 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
1138 1139
1139 // Same thing over HTTPS. 1140 // Same thing over HTTPS.
1140 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17")); 1141 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17"));
1141 CheckUnauthenticatedState(browser()->GetActiveWebContents()); 1142 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
1142 } 1143 }
1143 1144
1144 // 1145 //
1145 // Frame navigation 1146 // Frame navigation
1146 // 1147 //
1147 1148
1148 // From a good HTTPS top frame: 1149 // From a good HTTPS top frame:
1149 // - navigate to an OK HTTPS frame 1150 // - navigate to an OK HTTPS frame
1150 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then 1151 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then
1151 // back 1152 // back
1152 // - navigate to HTTP (expect insecure content), then back 1153 // - navigate to HTTP (expect insecure content), then back
1153 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { 1154 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) {
1154 ASSERT_TRUE(test_server()->Start()); 1155 ASSERT_TRUE(test_server()->Start());
1155 ASSERT_TRUE(https_server_.Start()); 1156 ASSERT_TRUE(https_server_.Start());
1156 ASSERT_TRUE(https_server_expired_.Start()); 1157 ASSERT_TRUE(https_server_expired_.Start());
1157 1158
1158 std::string top_frame_path; 1159 std::string top_frame_path;
1159 ASSERT_TRUE(GetTopFramePath(*test_server(), 1160 ASSERT_TRUE(GetTopFramePath(*test_server(),
1160 https_server_, 1161 https_server_,
1161 https_server_expired_, 1162 https_server_expired_,
1162 &top_frame_path)); 1163 &top_frame_path));
1163 1164
1164 WebContents* tab = browser()->GetActiveWebContents(); 1165 WebContents* tab = chrome::GetActiveWebContents(browser());
1165 ui_test_utils::NavigateToURL(browser(), 1166 ui_test_utils::NavigateToURL(browser(),
1166 https_server_.GetURL(top_frame_path)); 1167 https_server_.GetURL(top_frame_path));
1167 1168
1168 CheckAuthenticatedState(tab, false); 1169 CheckAuthenticatedState(tab, false);
1169 1170
1170 bool success = false; 1171 bool success = false;
1171 // Now navigate inside the frame. 1172 // Now navigate inside the frame.
1172 { 1173 {
1173 ui_test_utils::WindowedNotificationObserver observer( 1174 ui_test_utils::WindowedNotificationObserver observer(
1174 content::NOTIFICATION_LOAD_STOP, 1175 content::NOTIFICATION_LOAD_STOP,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { 1253 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) {
1253 ASSERT_TRUE(https_server_.Start()); 1254 ASSERT_TRUE(https_server_.Start());
1254 ASSERT_TRUE(https_server_expired_.Start()); 1255 ASSERT_TRUE(https_server_expired_.Start());
1255 1256
1256 std::string top_frame_path; 1257 std::string top_frame_path;
1257 ASSERT_TRUE(GetTopFramePath(*test_server(), 1258 ASSERT_TRUE(GetTopFramePath(*test_server(),
1258 https_server_, 1259 https_server_,
1259 https_server_expired_, 1260 https_server_expired_,
1260 &top_frame_path)); 1261 &top_frame_path));
1261 1262
1262 WebContents* tab = browser()->GetActiveWebContents(); 1263 WebContents* tab = chrome::GetActiveWebContents(browser());
1263 ui_test_utils::NavigateToURL(browser(), 1264 ui_test_utils::NavigateToURL(browser(),
1264 https_server_expired_.GetURL(top_frame_path)); 1265 https_server_expired_.GetURL(top_frame_path));
1265 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1266 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1266 true); // Interstitial showing 1267 true); // Interstitial showing
1267 1268
1268 ProceedThroughInterstitial(tab); 1269 ProceedThroughInterstitial(tab);
1269 1270
1270 // Navigate to a good frame. 1271 // Navigate to a good frame.
1271 bool success = false; 1272 bool success = false;
1272 ui_test_utils::WindowedNotificationObserver observer( 1273 ui_test_utils::WindowedNotificationObserver observer(
(...skipping 18 matching lines...) Expand all
1291 ASSERT_TRUE(test_server()->Start()); 1292 ASSERT_TRUE(test_server()->Start());
1292 ASSERT_TRUE(https_server_.Start()); 1293 ASSERT_TRUE(https_server_.Start());
1293 ASSERT_TRUE(https_server_expired_.Start()); 1294 ASSERT_TRUE(https_server_expired_.Start());
1294 1295
1295 std::string top_frame_path; 1296 std::string top_frame_path;
1296 ASSERT_TRUE(GetTopFramePath(*test_server(), 1297 ASSERT_TRUE(GetTopFramePath(*test_server(),
1297 https_server_, 1298 https_server_,
1298 https_server_expired_, 1299 https_server_expired_,
1299 &top_frame_path)); 1300 &top_frame_path));
1300 1301
1301 WebContents* tab = browser()->GetActiveWebContents(); 1302 WebContents* tab = chrome::GetActiveWebContents(browser());
1302 ui_test_utils::NavigateToURL(browser(), 1303 ui_test_utils::NavigateToURL(browser(),
1303 test_server()->GetURL(top_frame_path)); 1304 test_server()->GetURL(top_frame_path));
1304 CheckUnauthenticatedState(tab); 1305 CheckUnauthenticatedState(tab);
1305 1306
1306 // Now navigate inside the frame to a secure HTTPS frame. 1307 // Now navigate inside the frame to a secure HTTPS frame.
1307 { 1308 {
1308 bool success = false; 1309 bool success = false;
1309 ui_test_utils::WindowedNotificationObserver observer( 1310 ui_test_utils::WindowedNotificationObserver observer(
1310 content::NOTIFICATION_LOAD_STOP, 1311 content::NOTIFICATION_LOAD_STOP,
1311 content::Source<NavigationController>(&tab->GetController())); 1312 content::Source<NavigationController>(&tab->GetController()));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 ASSERT_TRUE(https_server_.Start()); 1353 ASSERT_TRUE(https_server_.Start());
1353 ASSERT_TRUE(https_server_expired_.Start()); 1354 ASSERT_TRUE(https_server_expired_.Start());
1354 1355
1355 // This page will spawn a Worker which will try to load content from 1356 // This page will spawn a Worker which will try to load content from
1356 // BadCertServer. 1357 // BadCertServer.
1357 std::string page_with_unsafe_worker_path; 1358 std::string page_with_unsafe_worker_path;
1358 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, 1359 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_,
1359 &page_with_unsafe_worker_path)); 1360 &page_with_unsafe_worker_path));
1360 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( 1361 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
1361 page_with_unsafe_worker_path)); 1362 page_with_unsafe_worker_path));
1362 WebContents* tab = browser()->GetActiveWebContents(); 1363 WebContents* tab = chrome::GetActiveWebContents(browser());
1363 // Expect Worker not to load insecure content. 1364 // Expect Worker not to load insecure content.
1364 CheckWorkerLoadResult(tab, false); 1365 CheckWorkerLoadResult(tab, false);
1365 // The bad content is filtered, expect the state to be authenticated. 1366 // The bad content is filtered, expect the state to be authenticated.
1366 CheckAuthenticatedState(tab, false); 1367 CheckAuthenticatedState(tab, false);
1367 } 1368 }
1368 1369
1369 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) { 1370 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) {
1370 ASSERT_TRUE(https_server_.Start()); 1371 ASSERT_TRUE(https_server_.Start());
1371 ASSERT_TRUE(https_server_expired_.Start()); 1372 ASSERT_TRUE(https_server_expired_.Start());
1372 1373
1373 // Navigate to an unsafe site. Proceed with interstitial page to indicate 1374 // Navigate to an unsafe site. Proceed with interstitial page to indicate
1374 // the user approves the bad certificate. 1375 // the user approves the bad certificate.
1375 ui_test_utils::NavigateToURL(browser(), 1376 ui_test_utils::NavigateToURL(browser(),
1376 https_server_expired_.GetURL("files/ssl/blank_page.html")); 1377 https_server_expired_.GetURL("files/ssl/blank_page.html"));
1377 WebContents* tab = browser()->GetActiveWebContents(); 1378 WebContents* tab = chrome::GetActiveWebContents(browser());
1378 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1379 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1379 true); // Interstitial showing 1380 true); // Interstitial showing
1380 ProceedThroughInterstitial(tab); 1381 ProceedThroughInterstitial(tab);
1381 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, 1382 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
1382 false); // No Interstitial 1383 false); // No Interstitial
1383 1384
1384 // Navigate to safe page that has Worker loading unsafe content. 1385 // Navigate to safe page that has Worker loading unsafe content.
1385 // Expect content to load but be marked as auth broken due to running insecure 1386 // Expect content to load but be marked as auth broken due to running insecure
1386 // content. 1387 // content.
1387 std::string page_with_unsafe_worker_path; 1388 std::string page_with_unsafe_worker_path;
(...skipping 14 matching lines...) Expand all
1402 1403
1403 std::string replacement_path; 1404 std::string replacement_path;
1404 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 1405 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
1405 "files/ssl/page_displays_insecure_content.html", 1406 "files/ssl/page_displays_insecure_content.html",
1406 test_server()->host_port_pair(), 1407 test_server()->host_port_pair(),
1407 &replacement_path)); 1408 &replacement_path));
1408 1409
1409 ui_test_utils::NavigateToURL(browser(), 1410 ui_test_utils::NavigateToURL(browser(),
1410 https_server_.GetURL(replacement_path)); 1411 https_server_.GetURL(replacement_path));
1411 1412
1412 CheckAuthenticatedState(browser()->GetActiveWebContents(), false); 1413 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
1413 } 1414 }
1414 1415
1415 // Test that when the browser blocks displaying insecure content (iframes), the 1416 // Test that when the browser blocks displaying insecure content (iframes), the
1416 // indicator shows a secure page, because the blocking made the otherwise 1417 // indicator shows a secure page, because the blocking made the otherwise
1417 // unsafe page safe (the notification of this state is handled by other means) 1418 // unsafe page safe (the notification of this state is handled by other means)
1418 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { 1419 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) {
1419 ASSERT_TRUE(test_server()->Start()); 1420 ASSERT_TRUE(test_server()->Start());
1420 ASSERT_TRUE(https_server_.Start()); 1421 ASSERT_TRUE(https_server_.Start());
1421 1422
1422 std::string replacement_path; 1423 std::string replacement_path;
1423 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 1424 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
1424 "files/ssl/page_displays_insecure_iframe.html", 1425 "files/ssl/page_displays_insecure_iframe.html",
1425 test_server()->host_port_pair(), 1426 test_server()->host_port_pair(),
1426 &replacement_path)); 1427 &replacement_path));
1427 1428
1428 ui_test_utils::NavigateToURL(browser(), 1429 ui_test_utils::NavigateToURL(browser(),
1429 https_server_.GetURL(replacement_path)); 1430 https_server_.GetURL(replacement_path));
1430 1431
1431 CheckAuthenticatedState(browser()->GetActiveWebContents(), false); 1432 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
1432 } 1433 }
1433 1434
1434 1435
1435 // Test that when the browser blocks running insecure content, the 1436 // Test that when the browser blocks running insecure content, the
1436 // indicator shows a secure page, because the blocking made the otherwise 1437 // indicator shows a secure page, because the blocking made the otherwise
1437 // unsafe page safe (the notification of this state is handled by other means). 1438 // unsafe page safe (the notification of this state is handled by other means).
1438 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { 1439 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) {
1439 ASSERT_TRUE(test_server()->Start()); 1440 ASSERT_TRUE(test_server()->Start());
1440 ASSERT_TRUE(https_server_.Start()); 1441 ASSERT_TRUE(https_server_.Start());
1441 1442
1442 std::string replacement_path; 1443 std::string replacement_path;
1443 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 1444 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
1444 "files/ssl/page_runs_insecure_content.html", 1445 "files/ssl/page_runs_insecure_content.html",
1445 test_server()->host_port_pair(), 1446 test_server()->host_port_pair(),
1446 &replacement_path)); 1447 &replacement_path));
1447 1448
1448 ui_test_utils::NavigateToURL(browser(), 1449 ui_test_utils::NavigateToURL(browser(),
1449 https_server_.GetURL(replacement_path)); 1450 https_server_.GetURL(replacement_path));
1450 1451
1451 CheckAuthenticatedState(browser()->GetActiveWebContents(), false); 1452 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
1452 } 1453 }
1453 1454
1454 1455
1455 // TODO(jcampan): more tests to do below. 1456 // TODO(jcampan): more tests to do below.
1456 1457
1457 // Visit a page over https that contains a frame with a redirect. 1458 // Visit a page over https that contains a frame with a redirect.
1458 1459
1459 // XMLHttpRequest insecure content in synchronous mode. 1460 // XMLHttpRequest insecure content in synchronous mode.
1460 1461
1461 // XMLHttpRequest insecure content in asynchronous mode. 1462 // XMLHttpRequest insecure content in asynchronous mode.
1462 1463
1463 // XMLHttpRequest over bad ssl in synchronous mode. 1464 // XMLHttpRequest over bad ssl in synchronous mode.
1464 1465
1465 // XMLHttpRequest over OK ssl in synchronous mode. 1466 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698