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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 net::HttpCache* cache( | 490 net::HttpCache* cache( |
491 getter->GetURLRequestContext()->http_transaction_factory()->GetCache()); | 491 getter->GetURLRequestContext()->http_transaction_factory()->GetCache()); |
492 DCHECK(cache); | 492 DCHECK(cache); |
493 scoped_ptr<net::HttpTransactionFactory> factory( | 493 scoped_ptr<net::HttpTransactionFactory> factory( |
494 new net::FailingHttpTransactionFactory(cache->GetSession(), error)); | 494 new net::FailingHttpTransactionFactory(cache->GetSession(), error)); |
495 // Throw away old version; since this is a a browser test, we don't | 495 // Throw away old version; since this is a a browser test, we don't |
496 // need to restore the old state. | 496 // need to restore the old state. |
497 cache->SetHttpNetworkTransactionFactoryForTesting(factory.Pass()); | 497 cache->SetHttpNetworkTransactionFactoryForTesting(factory.Pass()); |
498 } | 498 } |
499 | 499 |
500 // See crbug.com/109669 | |
501 #if defined(USE_AURA) | |
502 #define MAYBE_DNSError_Basic DISABLED_DNSError_Basic | |
503 #else | |
504 #define MAYBE_DNSError_Basic DNSError_Basic | |
505 #endif | |
506 // Test that a DNS error occuring in the main frame redirects to an error page. | 500 // Test that a DNS error occuring in the main frame redirects to an error page. |
507 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_Basic) { | 501 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_Basic) { |
508 // The first navigation should fail, and the second one should be the error | 502 // The first navigation should fail, and the second one should be the error |
509 // page. | 503 // page. |
510 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 504 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
511 browser(), GetDnsErrorURL(), 2); | 505 browser(), GetDnsErrorURL(), 2); |
512 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 506 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
513 EXPECT_EQ(1, link_doctor_handler()->num_requests()); | 507 EXPECT_EQ(1, link_doctor_handler()->num_requests()); |
514 } | 508 } |
515 | 509 |
516 // See crbug.com/109669 | |
517 #if defined(USE_AURA) | |
518 #define MAYBE_DNSError_GoBack1 DISABLED_DNSError_GoBack1 | |
519 #else | |
520 #define MAYBE_DNSError_GoBack1 DNSError_GoBack1 | |
521 #endif | |
522 | |
523 // Test that a DNS error occuring in the main frame does not result in an | 510 // Test that a DNS error occuring in the main frame does not result in an |
524 // additional session history entry. | 511 // additional session history entry. |
525 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_GoBack1) { | 512 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack1) { |
526 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 513 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
527 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 514 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
528 browser(), GetDnsErrorURL(), 2); | 515 browser(), GetDnsErrorURL(), 2); |
529 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 516 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
530 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 517 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
531 EXPECT_EQ(1, link_doctor_handler()->num_requests()); | 518 EXPECT_EQ(1, link_doctor_handler()->num_requests()); |
532 } | 519 } |
533 | 520 |
534 // See crbug.com/109669 | |
535 #if defined(USE_AURA) | |
536 #define MAYBE_DNSError_GoBack2 DISABLED_DNSError_GoBack2 | |
537 #else | |
538 #define MAYBE_DNSError_GoBack2 DNSError_GoBack2 | |
539 #endif | |
540 // Test that a DNS error occuring in the main frame does not result in an | 521 // Test that a DNS error occuring in the main frame does not result in an |
541 // additional session history entry. | 522 // additional session history entry. |
542 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2) { | 523 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2) { |
mmenke
2014/05/14 15:59:23
I enabled these three when investigating flake in
| |
543 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 524 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
544 | 525 |
545 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 526 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
546 browser(), GetDnsErrorURL(), 2); | 527 browser(), GetDnsErrorURL(), 2); |
547 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 528 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
548 EXPECT_EQ(1, link_doctor_handler()->num_requests()); | 529 EXPECT_EQ(1, link_doctor_handler()->num_requests()); |
549 | 530 |
550 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 531 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
551 | 532 |
552 GoBackAndWaitForNavigations(2); | 533 GoBackAndWaitForNavigations(2); |
553 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 534 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
554 EXPECT_EQ(2, link_doctor_handler()->num_requests()); | 535 EXPECT_EQ(2, link_doctor_handler()->num_requests()); |
555 | 536 |
556 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 537 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
557 EXPECT_EQ(2, link_doctor_handler()->num_requests()); | 538 EXPECT_EQ(2, link_doctor_handler()->num_requests()); |
558 } | 539 } |
559 | 540 |
560 // See crbug.com/109669 | |
561 #if defined(USE_AURA) | |
562 #define MAYBE_DNSError_GoBack2AndForward DISABLED_DNSError_GoBack2AndForward | |
563 #else | |
564 #define MAYBE_DNSError_GoBack2AndForward DNSError_GoBack2AndForward | |
565 #endif | |
566 // Test that a DNS error occuring in the main frame does not result in an | 541 // Test that a DNS error occuring in the main frame does not result in an |
567 // additional session history entry. | 542 // additional session history entry. |
568 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { | 543 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { |
569 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 544 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
570 | 545 |
571 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 546 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
572 browser(), GetDnsErrorURL(), 2); | 547 browser(), GetDnsErrorURL(), 2); |
573 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 548 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
574 EXPECT_EQ(1, link_doctor_handler()->num_requests()); | 549 EXPECT_EQ(1, link_doctor_handler()->num_requests()); |
575 | 550 |
576 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 551 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
577 | 552 |
578 GoBackAndWaitForNavigations(2); | 553 GoBackAndWaitForNavigations(2); |
579 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 554 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
580 EXPECT_EQ(2, link_doctor_handler()->num_requests()); | 555 EXPECT_EQ(2, link_doctor_handler()->num_requests()); |
581 | 556 |
582 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 557 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
583 | 558 |
584 GoForwardAndWaitForNavigations(2); | 559 GoForwardAndWaitForNavigations(2); |
585 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 560 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
586 EXPECT_EQ(3, link_doctor_handler()->num_requests()); | 561 EXPECT_EQ(3, link_doctor_handler()->num_requests()); |
587 } | 562 } |
588 | 563 |
589 // See crbug.com/109669 | |
590 #if defined(USE_AURA) | |
591 #define MAYBE_DNSError_GoBack2Forward2 DISABLED_DNSError_GoBack2Forward2 | |
592 #else | |
593 #define MAYBE_DNSError_GoBack2Forward2 DNSError_GoBack2Forward2 | |
594 #endif | |
595 // Test that a DNS error occuring in the main frame does not result in an | 564 // Test that a DNS error occuring in the main frame does not result in an |
596 // additional session history entry. | 565 // additional session history entry. |
597 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { | 566 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { |
598 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 567 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
599 | 568 |
600 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 569 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
601 browser(), GetDnsErrorURL(), 2); | 570 browser(), GetDnsErrorURL(), 2); |
602 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 571 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
603 EXPECT_EQ(1, link_doctor_handler()->num_requests()); | 572 EXPECT_EQ(1, link_doctor_handler()->num_requests()); |
604 | 573 |
605 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 574 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
606 | 575 |
607 GoBackAndWaitForNavigations(2); | 576 GoBackAndWaitForNavigations(2); |
608 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 577 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
609 EXPECT_EQ(2, link_doctor_handler()->num_requests()); | 578 EXPECT_EQ(2, link_doctor_handler()->num_requests()); |
610 | 579 |
611 GoBackAndWaitForTitle("Title Of More Awesomeness", 1); | 580 GoBackAndWaitForTitle("Title Of More Awesomeness", 1); |
612 | 581 |
613 GoForwardAndWaitForNavigations(2); | 582 GoForwardAndWaitForNavigations(2); |
614 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 583 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
615 EXPECT_EQ(3, link_doctor_handler()->num_requests()); | 584 EXPECT_EQ(3, link_doctor_handler()->num_requests()); |
616 | 585 |
617 GoForwardAndWaitForTitle("Title Of Awesomeness", 1); | 586 GoForwardAndWaitForTitle("Title Of Awesomeness", 1); |
618 EXPECT_EQ(3, link_doctor_handler()->num_requests()); | 587 EXPECT_EQ(3, link_doctor_handler()->num_requests()); |
619 } | 588 } |
620 | 589 |
621 // See crbug.com/109669 | |
622 #if defined(USE_AURA) | |
623 #define MAYBE_DNSError_DoSearch DNSError_DoSearch | |
624 #else | |
625 #define MAYBE_DNSError_DoSearch DNSError_DoSearch | |
626 #endif | |
627 // Test that the search button on a DNS error page works. | 590 // Test that the search button on a DNS error page works. |
628 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_DoSearch) { | 591 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_DoSearch) { |
629 // The first navigation should fail, and the second one should be the error | 592 // The first navigation should fail, and the second one should be the error |
630 // page. | 593 // page. |
631 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 594 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
632 browser(), GetDnsErrorURL(), 2); | 595 browser(), GetDnsErrorURL(), 2); |
633 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); | 596 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
634 EXPECT_EQ(1, link_doctor_handler()->num_requests()); | 597 EXPECT_EQ(1, link_doctor_handler()->num_requests()); |
635 | 598 |
636 content::WebContents* web_contents = | 599 content::WebContents* web_contents = |
637 browser()->tab_strip_model()->GetActiveWebContents(); | 600 browser()->tab_strip_model()->GetActiveWebContents(); |
638 | 601 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1139 browser(), | 1102 browser(), |
1140 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, | 1103 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, |
1141 kHostname), | 1104 kHostname), |
1142 1); | 1105 1); |
1143 | 1106 |
1144 ToggleHelpBox(browser()); | 1107 ToggleHelpBox(browser()); |
1145 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); | 1108 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); |
1146 } | 1109 } |
1147 | 1110 |
1148 } // namespace | 1111 } // namespace |
OLD | NEW |