OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/threading/platform_thread.h" |
6 #include "chrome/test/automation/tab_proxy.h" | 7 #include "chrome/test/automation/tab_proxy.h" |
7 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
8 #include "chrome/browser/net/url_request_failed_dns_job.h" | 9 #include "chrome/browser/net/url_request_failed_dns_job.h" |
9 #include "chrome/browser/net/url_request_mock_http_job.h" | 10 #include "chrome/browser/net/url_request_mock_http_job.h" |
10 #include "net/test/test_server.h" | 11 #include "net/test/test_server.h" |
11 | 12 |
12 class ErrorPageTest : public UITest { | 13 class ErrorPageTest : public UITest { |
13 protected: | 14 protected: |
14 bool WaitForTitleMatching(const std::wstring& title) { | 15 bool WaitForTitleMatching(const std::wstring& title) { |
15 for (int i = 0; i < 10; ++i) { | 16 for (int i = 0; i < 10; ++i) { |
16 if (GetActiveTabTitle() == title) | 17 if (GetActiveTabTitle() == title) |
17 return true; | 18 return true; |
18 PlatformThread::Sleep(sleep_timeout_ms()); | 19 base::PlatformThread::Sleep(sleep_timeout_ms()); |
19 } | 20 } |
20 EXPECT_EQ(title, GetActiveTabTitle()); | 21 EXPECT_EQ(title, GetActiveTabTitle()); |
21 return false; | 22 return false; |
22 } | 23 } |
23 }; | 24 }; |
24 | 25 |
25 TEST_F(ErrorPageTest, DNSError_Basic) { | 26 TEST_F(ErrorPageTest, DNSError_Basic) { |
26 GURL test_url(URLRequestFailedDnsJob::kTestUrl); | 27 GURL test_url(URLRequestFailedDnsJob::kTestUrl); |
27 | 28 |
28 // The first navigation should fail, and the second one should be the error | 29 // The first navigation should fail, and the second one should be the error |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // page. | 202 // page. |
202 NavigateToURLBlockUntilNavigationsComplete( | 203 NavigateToURLBlockUntilNavigationsComplete( |
203 URLRequestMockHTTPJob::GetMockUrl( | 204 URLRequestMockHTTPJob::GetMockUrl( |
204 FilePath(FILE_PATH_LITERAL("page404.html"))), 2); | 205 FilePath(FILE_PATH_LITERAL("page404.html"))), 2); |
205 EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); | 206 EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor")); |
206 | 207 |
207 EXPECT_TRUE(GetActiveTab()->GoBack()); | 208 EXPECT_TRUE(GetActiveTab()->GoBack()); |
208 | 209 |
209 EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness")); | 210 EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness")); |
210 } | 211 } |
OLD | NEW |