| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 159 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 160 content::TestNavigationObserver navigation_observer( | 160 content::TestNavigationObserver navigation_observer( |
| 161 content::Source<content::NavigationController>( | 161 content::Source<content::NavigationController>( |
| 162 &web_contents->GetController())); | 162 &web_contents->GetController())); |
| 163 | 163 |
| 164 // Simulate a click to force to make a user-initiated location change; | 164 // Simulate a click to force to make a user-initiated location change; |
| 165 // otherwise, a non user-initiated in-page location change will be treated | 165 // otherwise, a non user-initiated in-page location change will be treated |
| 166 // as client redirect and the redirect will be recoreded, which can cause | 166 // as client redirect and the redirect will be recoreded, which can cause |
| 167 // this test failed. | 167 // this test failed. |
| 168 content::SimulateMouseClick(web_contents); | 168 content::SimulateMouseClick(web_contents, 0, |
| 169 WebKit::WebMouseEvent::ButtonLeft); |
| 169 navigation_observer.Wait(); | 170 navigation_observer.Wait(); |
| 170 | 171 |
| 171 std::vector<GURL> redirects = GetRedirects(first_url); | 172 std::vector<GURL> redirects = GetRedirects(first_url); |
| 172 | 173 |
| 173 // There should be no redirects from first_url, because the anchor location | 174 // There should be no redirects from first_url, because the anchor location |
| 174 // change that occurs should not be flagged as a redirect and the meta-refresh | 175 // change that occurs should not be flagged as a redirect and the meta-refresh |
| 175 // won't have fired yet. | 176 // won't have fired yet. |
| 176 ASSERT_EQ(0U, redirects.size()); | 177 ASSERT_EQ(0U, redirects.size()); |
| 177 EXPECT_EQ("myanchor", web_contents->GetURL().ref()); | 178 EXPECT_EQ("myanchor", web_contents->GetURL().ref()); |
| 178 } | 179 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // as a client redirect from the first (/client-redirect?) page. | 297 // as a client redirect from the first (/client-redirect?) page. |
| 297 for (std::vector<GURL>::iterator it = redirects.begin(); | 298 for (std::vector<GURL>::iterator it = redirects.begin(); |
| 298 it != redirects.end(); ++it) { | 299 it != redirects.end(); ++it) { |
| 299 if (final_url.spec() == it->spec()) { | 300 if (final_url.spec() == it->spec()) { |
| 300 final_navigation_not_redirect = false; | 301 final_navigation_not_redirect = false; |
| 301 break; | 302 break; |
| 302 } | 303 } |
| 303 } | 304 } |
| 304 EXPECT_TRUE(final_navigation_not_redirect); | 305 EXPECT_TRUE(final_navigation_not_redirect); |
| 305 } | 306 } |
| OLD | NEW |