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

Side by Side Diff: chrome/browser/history/redirect_browsertest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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
OLDNEW
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 GURL final_url = embedded_test_server()->GetURL("/title2.html"); 275 GURL final_url = embedded_test_server()->GetURL("/title2.html");
276 GURL slow = embedded_test_server()->GetURL("/slow?60"); 276 GURL slow = embedded_test_server()->GetURL("/slow?60");
277 GURL first_url = 277 GURL first_url =
278 embedded_test_server()->GetURL("/client-redirect?" + slow.spec()); 278 embedded_test_server()->GetURL("/client-redirect?" + slow.spec());
279 279
280 content::WebContents* web_contents = 280 content::WebContents* web_contents =
281 browser()->tab_strip_model()->GetActiveWebContents(); 281 browser()->tab_strip_model()->GetActiveWebContents();
282 content::TestNavigationObserver observer(web_contents, 2); 282 content::TestNavigationObserver observer(web_contents, 2);
283 283
284 ui_test_utils::NavigateToURLWithDisposition( 284 ui_test_utils::NavigateToURLWithDisposition(
285 browser(), first_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); 285 browser(), first_url, WindowOpenDisposition::CURRENT_TAB,
286 ui_test_utils::BROWSER_TEST_NONE);
286 // We don't sleep here - the first navigation won't have been committed yet 287 // We don't sleep here - the first navigation won't have been committed yet
287 // because we told the server to wait a minute. This means the browser has 288 // because we told the server to wait a minute. This means the browser has
288 // started it's provisional load for the client redirect destination page but 289 // started it's provisional load for the client redirect destination page but
289 // hasn't completed. Our time is now! 290 // hasn't completed. Our time is now!
290 ui_test_utils::NavigateToURLWithDisposition( 291 ui_test_utils::NavigateToURLWithDisposition(
291 browser(), final_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); 292 browser(), final_url, WindowOpenDisposition::CURRENT_TAB,
293 ui_test_utils::BROWSER_TEST_NONE);
292 observer.Wait(); 294 observer.Wait();
293 295
294 // Check to make sure the navigation did in fact take place and we are 296 // Check to make sure the navigation did in fact take place and we are
295 // at the expected page. 297 // at the expected page.
296 EXPECT_EQ(base::ASCIIToUTF16("Title Of Awesomeness"), 298 EXPECT_EQ(base::ASCIIToUTF16("Title Of Awesomeness"),
297 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); 299 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
298 300
299 bool final_navigation_not_redirect = true; 301 bool final_navigation_not_redirect = true;
300 std::vector<GURL> redirects = GetRedirects(first_url); 302 std::vector<GURL> redirects = GetRedirects(first_url);
301 // Check to make sure our request for /title2.html doesn't get flagged 303 // Check to make sure our request for /title2.html doesn't get flagged
302 // as a client redirect from the first (/client-redirect?) page. 304 // as a client redirect from the first (/client-redirect?) page.
303 for (std::vector<GURL>::iterator it = redirects.begin(); 305 for (std::vector<GURL>::iterator it = redirects.begin();
304 it != redirects.end(); ++it) { 306 it != redirects.end(); ++it) {
305 if (final_url.spec() == it->spec()) { 307 if (final_url.spec() == it->spec()) {
306 final_navigation_not_redirect = false; 308 final_navigation_not_redirect = false;
307 break; 309 break;
308 } 310 }
309 } 311 }
310 EXPECT_TRUE(final_navigation_not_redirect); 312 EXPECT_TRUE(final_navigation_not_redirect);
311 } 313 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_browsertest.cc ('k') | chrome/browser/infobars/infobar_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698