| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "chrome/test/automation/tab_proxy.h" | 6 #include "chrome/test/automation/tab_proxy.h" |
| 7 #include "chrome/test/ui/ui_test.h" | 7 #include "chrome/test/ui/ui_test.h" |
| 8 #include "chrome/browser/net/url_request_failed_dns_job.h" | 8 #include "chrome/browser/net/url_request_failed_dns_job.h" |
| 9 #include "chrome/browser/net/url_request_mock_http_job.h" | 9 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 10 #include "net/url_request/url_request_unittest.h" | 10 #include "net/url_request/url_request_unittest.h" |
| 11 | 11 |
| 12 class ErrorPageTest : public UITest { | 12 class ErrorPageTest : public UITest { |
| 13 protected: | 13 protected: |
| 14 bool WaitForTitleMatching(const std::wstring& title) { | 14 bool WaitForTitleMatching(const std::wstring& title) { |
| 15 for (int i = 0; i < 100; ++i) { | 15 for (int i = 0; i < 10; ++i) { |
| 16 if (GetActiveTabTitle() == title) | 16 if (GetActiveTabTitle() == title) |
| 17 return true; | 17 return true; |
| 18 PlatformThread::Sleep(sleep_timeout_ms() / 10); | 18 PlatformThread::Sleep(sleep_timeout_ms()); |
| 19 } | 19 } |
| 20 EXPECT_EQ(title, GetActiveTabTitle()); | 20 EXPECT_EQ(title, GetActiveTabTitle()); |
| 21 return false; | 21 return false; |
| 22 } | 22 } |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 // Flaky, http://crbug.com/19361. | 25 // Flaky, http://crbug.com/19361. |
| 26 TEST_F(ErrorPageTest, FLAKY_DNSError_Basic) { | 26 TEST_F(ErrorPageTest, FLAKY_DNSError_Basic) { |
| 27 GURL test_url(URLRequestFailedDnsJob::kTestUrl); | 27 GURL test_url(URLRequestFailedDnsJob::kTestUrl); |
| 28 | 28 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // page. | 207 // page. |
| 208 NavigateToURLBlockUntilNavigationsComplete( | 208 NavigateToURLBlockUntilNavigationsComplete( |
| 209 URLRequestMockHTTPJob::GetMockUrl( | 209 URLRequestMockHTTPJob::GetMockUrl( |
| 210 FilePath(FILE_PATH_LITERAL("page404.html"))), 2); | 210 FilePath(FILE_PATH_LITERAL("page404.html"))), 2); |
| 211 EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); | 211 EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); |
| 212 | 212 |
| 213 EXPECT_TRUE(GetActiveTab()->GoBack()); | 213 EXPECT_TRUE(GetActiveTab()->GoBack()); |
| 214 | 214 |
| 215 EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness")); | 215 EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness")); |
| 216 } | 216 } |
| OLD | NEW |