Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: chrome/browser/errorpage_uitest.cc

Issue 6546069: Only display Link Doctor page on 404 errors with no body (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove all postponed data code Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/renderer/navigation_state.h » ('j') | chrome/renderer/navigation_state.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/test_timeouts.h" 6 #include "base/test/test_timeouts.h"
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "chrome/test/automation/tab_proxy.h" 8 #include "chrome/test/automation/tab_proxy.h"
9 #include "chrome/test/ui/ui_test.h" 9 #include "chrome/test/ui/ui_test.h"
10 #include "chrome/browser/net/url_request_failed_dns_job.h" 10 #include "chrome/browser/net/url_request_failed_dns_job.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 FilePath(FILE_PATH_LITERAL("title2.html")))); 158 FilePath(FILE_PATH_LITERAL("title2.html"))));
159 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( 159 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(
160 FilePath(FILE_PATH_LITERAL("iframe_dns_error.html")))); 160 FilePath(FILE_PATH_LITERAL("iframe_dns_error.html"))));
161 161
162 EXPECT_TRUE(GetActiveTab()->GoBack()); 162 EXPECT_TRUE(GetActiveTab()->GoBack());
163 EXPECT_TRUE(GetActiveTab()->GoForward()); 163 EXPECT_TRUE(GetActiveTab()->GoForward());
164 164
165 EXPECT_TRUE(WaitForTitleMatching(L"Blah")); 165 EXPECT_TRUE(WaitForTitleMatching(L"Blah"));
166 } 166 }
167 167
168 #if defined(OS_WIN) 168 // Checks that the Link Doctor is not loaded when we receive an actual 404 page.
169 // Might be related to http://crbug.com/60937 169 TEST_F(ErrorPageTest, Page404) {
170 #define MAYBE_IFrame404 FLAKY_IFrame404 170 NavigateToURLBlockUntilNavigationsComplete(
171 #else 171 URLRequestMockHTTPJob::GetMockUrl(
172 #define MAYBE_IFrame404 IFrame404 172 FilePath(FILE_PATH_LITERAL("page404.html"))), 1);
173 #endif
174 173
175 TEST_F(ErrorPageTest, MAYBE_IFrame404) {
176 // iframes that have 404 pages should not trigger an alternate error page.
177 // In this test, the iframe sets the title of the parent page to "SUCCESS"
178 // when the iframe loads. If the iframe fails to load (because an alternate
179 // error page loads instead), then the title will remain as "FAIL".
180 net::TestServer test_server(net::TestServer::TYPE_HTTP,
181 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
182 ASSERT_TRUE(test_server.Start());
183 NavigateToURL(test_server.GetURL("files/iframe404.html"));
184 EXPECT_TRUE(WaitForTitleMatching(L"SUCCESS")); 174 EXPECT_TRUE(WaitForTitleMatching(L"SUCCESS"));
185 } 175 }
186
187 TEST_F(ErrorPageTest, Page404) {
188 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(
189 FilePath(FILE_PATH_LITERAL("title2.html"))));
190 // The first navigation should fail, and the second one should be the error
191 // page.
192 NavigateToURLBlockUntilNavigationsComplete(
193 URLRequestMockHTTPJob::GetMockUrl(
194 FilePath(FILE_PATH_LITERAL("page404.html"))), 2);
195
196 EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
197 }
198
199 TEST_F(ErrorPageTest, Page404_GoBack) {
200 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(
201 FilePath(FILE_PATH_LITERAL("title2.html"))));
202 // The first navigation should fail, and the second one should be the error
203 // page.
204 NavigateToURLBlockUntilNavigationsComplete(
205 URLRequestMockHTTPJob::GetMockUrl(
206 FilePath(FILE_PATH_LITERAL("page404.html"))), 2);
207 EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
208
209 EXPECT_TRUE(GetActiveTab()->GoBack());
210
211 EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness"));
212 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/navigation_state.h » ('j') | chrome/renderer/navigation_state.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698