OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Navigates the browser to server and client redirect pages and makes sure | 5 // Navigates the browser to server and client redirect pages and makes sure |
6 // that the correct redirects are reflected in the history database. Errors | 6 // that the correct redirects are reflected in the history database. Errors |
7 // here might indicate that WebKit changed the calls our glue layer gets in | 7 // here might indicate that WebKit changed the calls our glue layer gets in |
8 // the case of redirects. It may also mean problems with the history system. | 8 // the case of redirects. It may also mean problems with the history system. |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 content::WebContents* web_contents = | 163 content::WebContents* web_contents = |
164 browser()->tab_strip_model()->GetActiveWebContents(); | 164 browser()->tab_strip_model()->GetActiveWebContents(); |
165 content::TestNavigationObserver navigation_observer(web_contents); | 165 content::TestNavigationObserver navigation_observer(web_contents); |
166 | 166 |
167 // Simulate a click to force to make a user-initiated location change; | 167 // Simulate a click to force to make a user-initiated location change; |
168 // otherwise, a non user-initiated in-page location change will be treated | 168 // otherwise, a non user-initiated in-page location change will be treated |
169 // as client redirect and the redirect will be recoreded, which can cause | 169 // as client redirect and the redirect will be recoreded, which can cause |
170 // this test failed. | 170 // this test failed. |
171 content::SimulateMouseClick(web_contents, 0, | 171 content::SimulateMouseClick(web_contents, 0, |
172 WebKit::WebMouseEvent::ButtonLeft); | 172 blink::WebMouseEvent::ButtonLeft); |
173 navigation_observer.Wait(); | 173 navigation_observer.Wait(); |
174 | 174 |
175 std::vector<GURL> redirects = GetRedirects(first_url); | 175 std::vector<GURL> redirects = GetRedirects(first_url); |
176 | 176 |
177 // There should be no redirects from first_url, because the anchor location | 177 // There should be no redirects from first_url, because the anchor location |
178 // change that occurs should not be flagged as a redirect and the meta-refresh | 178 // change that occurs should not be flagged as a redirect and the meta-refresh |
179 // won't have fired yet. | 179 // won't have fired yet. |
180 ASSERT_EQ(0U, redirects.size()); | 180 ASSERT_EQ(0U, redirects.size()); |
181 EXPECT_EQ("myanchor", web_contents->GetURL().ref()); | 181 EXPECT_EQ("myanchor", web_contents->GetURL().ref()); |
182 } | 182 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // as a client redirect from the first (/client-redirect?) page. | 300 // as a client redirect from the first (/client-redirect?) page. |
301 for (std::vector<GURL>::iterator it = redirects.begin(); | 301 for (std::vector<GURL>::iterator it = redirects.begin(); |
302 it != redirects.end(); ++it) { | 302 it != redirects.end(); ++it) { |
303 if (final_url.spec() == it->spec()) { | 303 if (final_url.spec() == it->spec()) { |
304 final_navigation_not_redirect = false; | 304 final_navigation_not_redirect = false; |
305 break; | 305 break; |
306 } | 306 } |
307 } | 307 } |
308 EXPECT_TRUE(final_navigation_not_redirect); | 308 EXPECT_TRUE(final_navigation_not_redirect); |
309 } | 309 } |
OLD | NEW |