| 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 <memory> | 10 #include <memory> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 content::WebContents* web_contents = | 165 content::WebContents* web_contents = |
| 166 browser()->tab_strip_model()->GetActiveWebContents(); | 166 browser()->tab_strip_model()->GetActiveWebContents(); |
| 167 content::TestNavigationObserver navigation_observer(web_contents); | 167 content::TestNavigationObserver navigation_observer(web_contents); |
| 168 | 168 |
| 169 // Simulate a click to force to make a user-initiated location change; | 169 // Simulate a click to force to make a user-initiated location change; |
| 170 // otherwise, a non user-initiated in-page location change will be treated | 170 // otherwise, a non user-initiated in-page location change will be treated |
| 171 // as client redirect and the redirect will be recoreded, which can cause | 171 // as client redirect and the redirect will be recoreded, which can cause |
| 172 // this test failed. | 172 // this test failed. |
| 173 content::SimulateMouseClick(web_contents, 0, | 173 content::SimulateMouseClick(web_contents, 0, |
| 174 blink::WebMouseEvent::ButtonLeft); | 174 blink::WebMouseEvent::Button::Left); |
| 175 navigation_observer.Wait(); | 175 navigation_observer.Wait(); |
| 176 | 176 |
| 177 std::vector<GURL> redirects = GetRedirects(first_url); | 177 std::vector<GURL> redirects = GetRedirects(first_url); |
| 178 | 178 |
| 179 // There should be no redirects from first_url, because the anchor location | 179 // There should be no redirects from first_url, because the anchor location |
| 180 // change that occurs should not be flagged as a redirect and the meta-refresh | 180 // change that occurs should not be flagged as a redirect and the meta-refresh |
| 181 // won't have fired yet. | 181 // won't have fired yet. |
| 182 ASSERT_EQ(0U, redirects.size()); | 182 ASSERT_EQ(0U, redirects.size()); |
| 183 EXPECT_EQ("myanchor", web_contents->GetURL().ref()); | 183 EXPECT_EQ("myanchor", web_contents->GetURL().ref()); |
| 184 } | 184 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // as a client redirect from the first (/client-redirect?) page. | 302 // as a client redirect from the first (/client-redirect?) page. |
| 303 for (std::vector<GURL>::iterator it = redirects.begin(); | 303 for (std::vector<GURL>::iterator it = redirects.begin(); |
| 304 it != redirects.end(); ++it) { | 304 it != redirects.end(); ++it) { |
| 305 if (final_url.spec() == it->spec()) { | 305 if (final_url.spec() == it->spec()) { |
| 306 final_navigation_not_redirect = false; | 306 final_navigation_not_redirect = false; |
| 307 break; | 307 break; |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 EXPECT_TRUE(final_navigation_not_redirect); | 310 EXPECT_TRUE(final_navigation_not_redirect); |
| 311 } | 311 } |
| OLD | NEW |