diff options
Diffstat (limited to 'chrome/browser/errorpage_uitest.cc')
-rw-r--r-- | chrome/browser/errorpage_uitest.cc | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc index 3e34822..c8b54fa 100644 --- a/chrome/browser/errorpage_uitest.cc +++ b/chrome/browser/errorpage_uitest.cc @@ -19,15 +19,6 @@ 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) { @@ -37,7 +28,7 @@ TEST_F(ErrorPageTest, DNSError_Basic) { // page. NavigateToURLBlockUntilNavigationsComplete(test_url, 2); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); } TEST_F(ErrorPageTest, DNSError_GoBack1) { @@ -47,7 +38,7 @@ TEST_F(ErrorPageTest, DNSError_GoBack1) { NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html")); NavigateToURL(test_url); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); GetActiveTab()->GoBack(); @@ -61,13 +52,13 @@ TEST_F(ErrorPageTest, DNSError_GoBack2) { NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html")); NavigateToURL(test_url); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); 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(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); GetActiveTab()->GoBack(); EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness")); @@ -81,19 +72,19 @@ TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html")); NavigateToURL(test_url); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); 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(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); GetActiveTab()->GoBack(); // The first navigation should fail, and the second one should be the error // page. GetActiveTab()->GoForwardBlockUntilNavigationsComplete(2); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); } TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { @@ -104,18 +95,18 @@ TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html")); NavigateToURL(test_url); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); 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(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); GetActiveTab()->GoBack(); // The first navigation should fail, and the second one should be the error // page. GetActiveTab()->GoForwardBlockUntilNavigationsComplete(2); - EXPECT_TRUE(WaitForTitleContaining(test_url.host())); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); GetActiveTab()->GoForward(); EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness")); @@ -175,13 +166,13 @@ TEST_F(ErrorPageTest, Page404) { NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html")); NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"page404.html")); - EXPECT_TRUE(WaitForTitleContaining("page404.html")); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); } TEST_F(ErrorPageTest, Page404_GoBack) { NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html")); NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"page404.html")); - EXPECT_TRUE(WaitForTitleContaining("page404.html")); + EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); GetActiveTab()->GoBack(); |