summaryrefslogtreecommitdiffstats
path: root/chrome/browser/errorpage_browsertest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 15:39:26 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 15:39:26 +0000
commit1126a1d3fea816b525e9b1e621b2890cf97b2b8a (patch)
treeaa7a8a6831269674c06c9a751527b4d11da2dec4 /chrome/browser/errorpage_browsertest.cc
parentfe2b2b36d73c74db993d293538cb1bb6c08379fa (diff)
downloadchromium_src-1126a1d3fea816b525e9b1e621b2890cf97b2b8a.zip
chromium_src-1126a1d3fea816b525e9b1e621b2890cf97b2b8a.tar.gz
chromium_src-1126a1d3fea816b525e9b1e621b2890cf97b2b8a.tar.bz2
Fix another source of flakiness in ErrorPageTest
We need to wait for correct number of navigations when going back or forward to the LinkDoctor page. Re-enable previously disabled tests and remove the now-duplicate browser test. The test is still not very solid, because the LinkDoctor should be mocked. TEST=Covered by ui_tests. http://crbug.com/19361, http://crbug.com/19395 Review URL: http://codereview.chromium.org/174396 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/errorpage_browsertest.cc')
-rw-r--r--chrome/browser/errorpage_browsertest.cc132
1 files changed, 0 insertions, 132 deletions
diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc
deleted file mode 100644
index 338c521..0000000
--- a/chrome/browser/errorpage_browsertest.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/string_util.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/net/url_request_failed_dns_job.h"
-#include "chrome/browser/net/url_request_mock_http_job.h"
-#include "chrome/test/in_process_browser_test.h"
-#include "chrome/test/ui_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/glue/window_open_disposition.h"
-
-namespace {
-
-class ErrorPageBrowserTest : public InProcessBrowserTest {
- protected:
- // We're generally not sure what the title will be exactly (it comes from
- // external source, and may be localized etc), but it will alway contain the
- // hostname, so we check for that.
- // For a proper way to do that http://crbug.com/18365 has been filed.
- void AssertCurrentTabTitleContains(const std::string& text) {
- string16 title;
- EXPECT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title));
- EXPECT_NE(string16::npos, title.find(ASCIIToUTF16(text))) <<
- "could not find \"" << text << "\" in \"" << title << "\"";
- }
-};
-
-using ui_test_utils::NavigateToURL;
-
-// We want to wait for two navigations: first will be the failing one,
-// and the second will be the error page.
-using ui_test_utils::NavigateToURLBlockUntilNavigationsComplete;
-
-IN_PROC_BROWSER_TEST_F(ErrorPageBrowserTest, DNSError_Basic) {
- GURL test_url(URLRequestFailedDnsJob::kTestUrl);
- NavigateToURLBlockUntilNavigationsComplete(browser(), test_url, 2);
- AssertCurrentTabTitleContains(test_url.host());
-}
-
-// Test that a DNS error occuring in the main frame does not result in an
-// additional session history entry.
-IN_PROC_BROWSER_TEST_F(ErrorPageBrowserTest, DNSError_GoBack1) {
- GURL test_url(URLRequestFailedDnsJob::kTestUrl);
-
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(browser(), test_url, 2);
- AssertCurrentTabTitleContains(test_url.host());
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
-
- string16 title;
- ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title));
- EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
-}
-
-// Test that a DNS error occuring in the main frame does not result in an
-// additional session history entry.
-IN_PROC_BROWSER_TEST_F(ErrorPageBrowserTest, DNSError_GoBack2) {
- GURL test_url(URLRequestFailedDnsJob::kTestUrl);
-
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(browser(), test_url, 2);
- AssertCurrentTabTitleContains(test_url.host());
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationsInCurrentTab(browser(), 2));
- AssertCurrentTabTitleContains(test_url.host());
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
-
- string16 title;
- ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title));
- EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
-}
-
-// Test that a DNS error occuring in the main frame does not result in an
-// additional session history entry.
-IN_PROC_BROWSER_TEST_F(ErrorPageBrowserTest, DNSError_GoBackAndForward1) {
- GURL test_url(URLRequestFailedDnsJob::kTestUrl);
-
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(browser(), test_url, 2);
- AssertCurrentTabTitleContains(test_url.host());
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationsInCurrentTab(browser(), 2));
- AssertCurrentTabTitleContains(test_url.host());
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
-
- browser()->GoForward(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationsInCurrentTab(browser(), 2));
- AssertCurrentTabTitleContains(test_url.host());
-}
-
-// Test that a DNS error occuring in the main frame does not result in an
-// additional session history entry.
-IN_PROC_BROWSER_TEST_F(ErrorPageBrowserTest, DNSError_GoBackAndForward2) {
- GURL test_url(URLRequestFailedDnsJob::kTestUrl);
-
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
- NavigateToURLBlockUntilNavigationsComplete(browser(), test_url, 2);
- AssertCurrentTabTitleContains(test_url.host());
- NavigateToURL(browser(), URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationsInCurrentTab(browser(), 2));
- AssertCurrentTabTitleContains(test_url.host());
-
- browser()->GoBack(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
-
- browser()->GoForward(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationsInCurrentTab(browser(), 2));
- AssertCurrentTabTitleContains(test_url.host());
-
- browser()->GoForward(CURRENT_TAB);
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
-
- string16 title;
- ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title));
- EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
-}
-
-} // namespace