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

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

Issue 12832004: content: Move all listeners of NOTIFICATION_RENDER_VIEW_HOST_CREATED out of content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 9 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
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 "base/bind.h" 10 #include "base/bind.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 GURL final_url = test_server()->GetURL("files/title2.html"); 274 GURL final_url = test_server()->GetURL("files/title2.html");
275 GURL slow = test_server()->GetURL("slow?60"); 275 GURL slow = test_server()->GetURL("slow?60");
276 GURL first_url = test_server()->GetURL( 276 GURL first_url = test_server()->GetURL(
277 "client-redirect?" + slow.spec()); 277 "client-redirect?" + slow.spec());
278 278
279 content::WebContents* web_contents = 279 content::WebContents* web_contents =
280 browser()->tab_strip_model()->GetActiveWebContents(); 280 browser()->tab_strip_model()->GetActiveWebContents();
281 content::TestNavigationObserver observer( 281 content::TestNavigationObserver observer(
282 content::Source<content::NavigationController>( 282 content::Source<content::NavigationController>(
283 &web_contents->GetController()), 283 &web_contents->GetController()),
284 NULL, 2); 284 2);
285 285
286 ui_test_utils::NavigateToURLWithDisposition( 286 ui_test_utils::NavigateToURLWithDisposition(
287 browser(), first_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); 287 browser(), first_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE);
288 // We don't sleep here - the first navigation won't have been committed yet 288 // We don't sleep here - the first navigation won't have been committed yet
289 // because we told the server to wait a minute. This means the browser has 289 // because we told the server to wait a minute. This means the browser has
290 // started it's provisional load for the client redirect destination page but 290 // started it's provisional load for the client redirect destination page but
291 // hasn't completed. Our time is now! 291 // hasn't completed. Our time is now!
292 ui_test_utils::NavigateToURLWithDisposition( 292 ui_test_utils::NavigateToURLWithDisposition(
293 browser(), final_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); 293 browser(), final_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE);
294 observer.Wait(); 294 observer.Wait();
295 295
296 // 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
297 // at the expected page. 297 // at the expected page.
298 EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"), 298 EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"),
299 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); 299 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
300 300
301 bool final_navigation_not_redirect = true; 301 bool final_navigation_not_redirect = true;
302 std::vector<GURL> redirects = GetRedirects(first_url); 302 std::vector<GURL> redirects = GetRedirects(first_url);
303 // Check to make sure our request for files/title2.html doesn't get flagged 303 // Check to make sure our request for files/title2.html doesn't get flagged
304 // as a client redirect from the first (/client-redirect?) page. 304 // as a client redirect from the first (/client-redirect?) page.
305 for (std::vector<GURL>::iterator it = redirects.begin(); 305 for (std::vector<GURL>::iterator it = redirects.begin();
306 it != redirects.end(); ++it) { 306 it != redirects.end(); ++it) {
307 if (final_url.spec() == it->spec()) { 307 if (final_url.spec() == it->spec()) {
308 final_navigation_not_redirect = false; 308 final_navigation_not_redirect = false;
309 break; 309 break;
310 } 310 }
311 } 311 }
312 EXPECT_TRUE(final_navigation_not_redirect); 312 EXPECT_TRUE(final_navigation_not_redirect);
313 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698