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 "base/utf_string_conversions.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) { |
(...skipping 185 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 } |
| 212 |
| 213 // Regression test for http://crbug.com/63649. |
| 214 TEST_F(ErrorPageTest, RedirectLoopCookies) { |
| 215 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 216 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 217 ASSERT_TRUE(test_server.Start()); |
| 218 |
| 219 GURL test_url = test_server.GetURL("files/redirect-loop.html"); |
| 220 |
| 221 ASSERT_TRUE(automation()->GetBrowserWindow(0)->SetDefaultContentSetting( |
| 222 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK)); |
| 223 |
| 224 NavigateToURLBlockUntilNavigationsComplete(test_url, 1); |
| 225 ASSERT_TRUE( |
| 226 WaitForTitleMatching(UTF8ToWide(test_url.spec()) + L" failed to load")); |
| 227 |
| 228 bool content_blocked = false; |
| 229 ASSERT_TRUE(GetActiveTab()->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, |
| 230 &content_blocked)); |
| 231 EXPECT_TRUE(content_blocked); |
| 232 } |
OLD | NEW |