summaryrefslogtreecommitdiffstats
path: root/chrome/browser/errorpage_uitest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 16:42:20 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 16:42:20 +0000
commit2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6 (patch)
treea7aba3f6a60e08bf29d2cc90e2d343f3530b812c /chrome/browser/errorpage_uitest.cc
parentd1fda80b9254869bab3ca816c135088c9724970e (diff)
downloadchromium_src-2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6.zip
chromium_src-2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6.tar.gz
chromium_src-2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6.tar.bz2
Revert r24606-24607. The tree didn't like them. :(
TBR=darin Review URL: http://codereview.chromium.org/173574 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/errorpage_uitest.cc')
-rw-r--r--chrome/browser/errorpage_uitest.cc41
1 files changed, 25 insertions, 16 deletions
diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc
index f6e54fb..3e34822 100644
--- a/chrome/browser/errorpage_uitest.cc
+++ b/chrome/browser/errorpage_uitest.cc
@@ -19,6 +19,15 @@ class ErrorPageTest : public UITest {
}
return false;
}
+ bool WaitForTitleContaining(const std::string& title_substring) {
+ for (int i = 0; i < 100; ++i) {
+ std::wstring title = GetActiveTabTitle();
+ if (title.find(UTF8ToWide(title_substring)) != std::wstring::npos)
+ return true;
+ PlatformThread::Sleep(sleep_timeout_ms() / 10);
+ }
+ return false;
+ }
};
TEST_F(ErrorPageTest, DNSError_Basic) {
@@ -28,7 +37,7 @@ TEST_F(ErrorPageTest, DNSError_Basic) {
// page.
NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
}
TEST_F(ErrorPageTest, DNSError_GoBack1) {
@@ -37,8 +46,8 @@ TEST_F(ErrorPageTest, DNSError_GoBack1) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
@@ -51,14 +60,14 @@ TEST_F(ErrorPageTest, DNSError_GoBack2) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoBackBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness"));
@@ -71,20 +80,20 @@ TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoBackBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoForwardBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
}
TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) {
@@ -94,19 +103,19 @@ TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoBackBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoForwardBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoForward();
EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness"));
@@ -166,13 +175,13 @@ TEST_F(ErrorPageTest, Page404) {
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"page404.html"));
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining("page404.html"));
}
TEST_F(ErrorPageTest, Page404_GoBack) {
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"page404.html"));
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining("page404.html"));
GetActiveTab()->GoBack();