Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/dom_operation_notification_details.h" | 7 #include "chrome/browser/dom_operation_notification_details.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" | 9 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 const GURL url("http://www.google.com"); | 249 const GURL url("http://www.google.com"); |
| 250 controller().LoadURL( | 250 controller().LoadURL( |
| 251 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 251 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 252 EXPECT_FALSE(contents()->cross_navigation_pending()); | 252 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 253 EXPECT_EQ(instance1, orig_rvh->site_instance()); | 253 EXPECT_EQ(instance1, orig_rvh->site_instance()); |
| 254 // Controller's pending entry will have a NULL site instance until we assign | 254 // Controller's pending entry will have a NULL site instance until we assign |
| 255 // it in DidNavigate. | 255 // it in DidNavigate. |
| 256 EXPECT_TRUE(controller().GetActiveEntry()->site_instance() == NULL); | 256 EXPECT_TRUE(controller().GetActiveEntry()->site_instance() == NULL); |
| 257 | 257 |
| 258 // DidNavigate from the page | 258 // DidNavigate from the page |
| 259 ViewHostMsg_FrameNavigate_Params params; | 259 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 260 InitNavigateParams(¶ms, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 261 contents()->TestDidNavigate(orig_rvh, params); | |
| 262 EXPECT_FALSE(contents()->cross_navigation_pending()); | 260 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 263 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 261 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 264 EXPECT_EQ(instance1, orig_rvh->site_instance()); | 262 EXPECT_EQ(instance1, orig_rvh->site_instance()); |
| 265 // Controller's entry should now have the SiteInstance, or else we won't be | 263 // Controller's entry should now have the SiteInstance, or else we won't be |
| 266 // able to find it later. | 264 // able to find it later. |
| 267 EXPECT_EQ(instance1, controller().GetActiveEntry()->site_instance()); | 265 EXPECT_EQ(instance1, controller().GetActiveEntry()->site_instance()); |
| 268 } | 266 } |
| 269 | 267 |
| 270 // Test that we reject NavigateToEntry if the url is over content::kMaxURLChars. | 268 // Test that we reject NavigateToEntry if the url is over content::kMaxURLChars. |
| 271 TEST_F(TabContentsTest, NavigateToExcessivelyLongURL) { | 269 TEST_F(TabContentsTest, NavigateToExcessivelyLongURL) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 284 contents()->transition_cross_site = true; | 282 contents()->transition_cross_site = true; |
| 285 TestRenderViewHost* orig_rvh = rvh(); | 283 TestRenderViewHost* orig_rvh = rvh(); |
| 286 int orig_rvh_delete_count = 0; | 284 int orig_rvh_delete_count = 0; |
| 287 orig_rvh->set_delete_counter(&orig_rvh_delete_count); | 285 orig_rvh->set_delete_counter(&orig_rvh_delete_count); |
| 288 SiteInstance* instance1 = contents()->GetSiteInstance(); | 286 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 289 | 287 |
| 290 // Navigate to URL. First URL should use first RenderViewHost. | 288 // Navigate to URL. First URL should use first RenderViewHost. |
| 291 const GURL url("http://www.google.com"); | 289 const GURL url("http://www.google.com"); |
| 292 controller().LoadURL( | 290 controller().LoadURL( |
| 293 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 291 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 294 ViewHostMsg_FrameNavigate_Params params1; | 292 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 295 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 296 contents()->TestDidNavigate(orig_rvh, params1); | |
| 297 | 293 |
| 298 EXPECT_FALSE(contents()->cross_navigation_pending()); | 294 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 299 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 295 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 300 | 296 |
| 301 // Navigate to new site | 297 // Navigate to new site |
| 302 const GURL url2("http://www.yahoo.com"); | 298 const GURL url2("http://www.yahoo.com"); |
| 303 controller().LoadURL( | 299 controller().LoadURL( |
| 304 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 300 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 305 EXPECT_TRUE(contents()->cross_navigation_pending()); | 301 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 306 TestRenderViewHost* pending_rvh = contents()->pending_rvh(); | 302 TestRenderViewHost* pending_rvh = contents()->pending_rvh(); |
| 307 int pending_rvh_delete_count = 0; | 303 int pending_rvh_delete_count = 0; |
| 308 pending_rvh->set_delete_counter(&pending_rvh_delete_count); | 304 pending_rvh->set_delete_counter(&pending_rvh_delete_count); |
| 309 | 305 |
| 310 // Navigations should be suspended in pending_rvh until ShouldCloseACK. | 306 // Navigations should be suspended in pending_rvh until ShouldCloseACK. |
| 311 EXPECT_TRUE(pending_rvh->are_navigations_suspended()); | 307 EXPECT_TRUE(pending_rvh->are_navigations_suspended()); |
| 312 orig_rvh->SendShouldCloseACK(true); | 308 orig_rvh->SendShouldCloseACK(true); |
| 313 EXPECT_FALSE(pending_rvh->are_navigations_suspended()); | 309 EXPECT_FALSE(pending_rvh->are_navigations_suspended()); |
| 314 | 310 |
| 315 // DidNavigate from the pending page | 311 // DidNavigate from the pending page |
| 316 ViewHostMsg_FrameNavigate_Params params2; | 312 contents()->TestDidNavigate( |
| 317 InitNavigateParams(¶ms2, 1, url2, content::PAGE_TRANSITION_TYPED); | 313 pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); |
| 318 contents()->TestDidNavigate(pending_rvh, params2); | |
| 319 SiteInstance* instance2 = contents()->GetSiteInstance(); | 314 SiteInstance* instance2 = contents()->GetSiteInstance(); |
| 320 | 315 |
| 321 EXPECT_FALSE(contents()->cross_navigation_pending()); | 316 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 322 EXPECT_EQ(pending_rvh, contents()->render_view_host()); | 317 EXPECT_EQ(pending_rvh, contents()->render_view_host()); |
| 323 EXPECT_NE(instance1, instance2); | 318 EXPECT_NE(instance1, instance2); |
| 324 EXPECT_TRUE(contents()->pending_rvh() == NULL); | 319 EXPECT_TRUE(contents()->pending_rvh() == NULL); |
| 325 // We keep the original RVH around, swapped out. | 320 // We keep the original RVH around, swapped out. |
| 326 EXPECT_TRUE(contents()->render_manager_for_testing()->IsSwappedOut(orig_rvh)); | 321 EXPECT_TRUE(contents()->render_manager_for_testing()->IsSwappedOut(orig_rvh)); |
| 327 EXPECT_EQ(orig_rvh_delete_count, 0); | 322 EXPECT_EQ(orig_rvh_delete_count, 0); |
| 328 | 323 |
| 329 // Going back should switch SiteInstances again. The first SiteInstance is | 324 // Going back should switch SiteInstances again. The first SiteInstance is |
| 330 // stored in the NavigationEntry, so it should be the same as at the start. | 325 // stored in the NavigationEntry, so it should be the same as at the start. |
| 331 // We should use the same RVH as before, swapping it back in. | 326 // We should use the same RVH as before, swapping it back in. |
| 332 controller().GoBack(); | 327 controller().GoBack(); |
| 333 TestRenderViewHost* goback_rvh = contents()->pending_rvh(); | 328 TestRenderViewHost* goback_rvh = contents()->pending_rvh(); |
| 334 EXPECT_EQ(orig_rvh, goback_rvh); | 329 EXPECT_EQ(orig_rvh, goback_rvh); |
| 335 EXPECT_TRUE(contents()->cross_navigation_pending()); | 330 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 336 | 331 |
| 337 // Navigations should be suspended in goback_rvh until ShouldCloseACK. | 332 // Navigations should be suspended in goback_rvh until ShouldCloseACK. |
| 338 EXPECT_TRUE(goback_rvh->are_navigations_suspended()); | 333 EXPECT_TRUE(goback_rvh->are_navigations_suspended()); |
| 339 pending_rvh->SendShouldCloseACK(true); | 334 pending_rvh->SendShouldCloseACK(true); |
| 340 EXPECT_FALSE(goback_rvh->are_navigations_suspended()); | 335 EXPECT_FALSE(goback_rvh->are_navigations_suspended()); |
| 341 | 336 |
| 342 // DidNavigate from the back action | 337 // DidNavigate from the back action |
| 343 contents()->TestDidNavigate(goback_rvh, params1); | 338 contents()->TestDidNavigate( |
| 339 goback_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); | |
| 344 EXPECT_FALSE(contents()->cross_navigation_pending()); | 340 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 345 EXPECT_EQ(goback_rvh, contents()->render_view_host()); | 341 EXPECT_EQ(goback_rvh, contents()->render_view_host()); |
| 346 EXPECT_EQ(instance1, contents()->GetSiteInstance()); | 342 EXPECT_EQ(instance1, contents()->GetSiteInstance()); |
| 347 // The pending RVH should now be swapped out, not deleted. | 343 // The pending RVH should now be swapped out, not deleted. |
| 348 EXPECT_TRUE(contents()->render_manager_for_testing()-> | 344 EXPECT_TRUE(contents()->render_manager_for_testing()-> |
| 349 IsSwappedOut(pending_rvh)); | 345 IsSwappedOut(pending_rvh)); |
| 350 EXPECT_EQ(pending_rvh_delete_count, 0); | 346 EXPECT_EQ(pending_rvh_delete_count, 0); |
| 351 | 347 |
| 352 // Close tab and ensure RVHs are deleted. | 348 // Close tab and ensure RVHs are deleted. |
| 353 DeleteContents(); | 349 DeleteContents(); |
| 354 EXPECT_EQ(orig_rvh_delete_count, 1); | 350 EXPECT_EQ(orig_rvh_delete_count, 1); |
| 355 EXPECT_EQ(pending_rvh_delete_count, 1); | 351 EXPECT_EQ(pending_rvh_delete_count, 1); |
| 356 } | 352 } |
| 357 | 353 |
| 358 // Test that navigating across a site boundary after a crash creates a new | 354 // Test that navigating across a site boundary after a crash creates a new |
| 359 // RVH without requiring a cross-site transition (i.e., PENDING state). | 355 // RVH without requiring a cross-site transition (i.e., PENDING state). |
| 360 TEST_F(TabContentsTest, CrossSiteBoundariesAfterCrash) { | 356 TEST_F(TabContentsTest, CrossSiteBoundariesAfterCrash) { |
| 361 contents()->transition_cross_site = true; | 357 contents()->transition_cross_site = true; |
| 362 TestRenderViewHost* orig_rvh = rvh(); | 358 TestRenderViewHost* orig_rvh = rvh(); |
| 363 int orig_rvh_delete_count = 0; | 359 int orig_rvh_delete_count = 0; |
| 364 orig_rvh->set_delete_counter(&orig_rvh_delete_count); | 360 orig_rvh->set_delete_counter(&orig_rvh_delete_count); |
| 365 SiteInstance* instance1 = contents()->GetSiteInstance(); | 361 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 366 | 362 |
| 367 // Navigate to URL. First URL should use first RenderViewHost. | 363 // Navigate to URL. First URL should use first RenderViewHost. |
| 368 const GURL url("http://www.google.com"); | 364 const GURL url("http://www.google.com"); |
| 369 controller().LoadURL( | 365 controller().LoadURL( |
| 370 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 366 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 371 ViewHostMsg_FrameNavigate_Params params1; | 367 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 372 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 373 contents()->TestDidNavigate(orig_rvh, params1); | |
| 374 | 368 |
| 375 EXPECT_FALSE(contents()->cross_navigation_pending()); | 369 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 376 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 370 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 377 | 371 |
| 378 // Crash the renderer. | 372 // Crash the renderer. |
| 379 orig_rvh->set_render_view_created(false); | 373 orig_rvh->set_render_view_created(false); |
| 380 | 374 |
| 381 // Navigate to new site. We should not go into PENDING. | 375 // Navigate to new site. We should not go into PENDING. |
| 382 const GURL url2("http://www.yahoo.com"); | 376 const GURL url2("http://www.yahoo.com"); |
| 383 controller().LoadURL( | 377 controller().LoadURL( |
| 384 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 378 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 385 TestRenderViewHost* new_rvh = rvh(); | 379 TestRenderViewHost* new_rvh = rvh(); |
| 386 EXPECT_FALSE(contents()->cross_navigation_pending()); | 380 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 387 EXPECT_TRUE(contents()->pending_rvh() == NULL); | 381 EXPECT_TRUE(contents()->pending_rvh() == NULL); |
| 388 EXPECT_NE(orig_rvh, new_rvh); | 382 EXPECT_NE(orig_rvh, new_rvh); |
| 389 EXPECT_EQ(orig_rvh_delete_count, 1); | 383 EXPECT_EQ(orig_rvh_delete_count, 1); |
| 390 | 384 |
| 391 // DidNavigate from the new page | 385 // DidNavigate from the new page |
| 392 ViewHostMsg_FrameNavigate_Params params2; | 386 contents()->TestDidNavigate(new_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); |
| 393 InitNavigateParams(¶ms2, 1, url2, content::PAGE_TRANSITION_TYPED); | |
| 394 contents()->TestDidNavigate(new_rvh, params2); | |
| 395 SiteInstance* instance2 = contents()->GetSiteInstance(); | 387 SiteInstance* instance2 = contents()->GetSiteInstance(); |
| 396 | 388 |
| 397 EXPECT_FALSE(contents()->cross_navigation_pending()); | 389 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 398 EXPECT_EQ(new_rvh, rvh()); | 390 EXPECT_EQ(new_rvh, rvh()); |
| 399 EXPECT_NE(instance1, instance2); | 391 EXPECT_NE(instance1, instance2); |
| 400 EXPECT_TRUE(contents()->pending_rvh() == NULL); | 392 EXPECT_TRUE(contents()->pending_rvh() == NULL); |
| 401 | 393 |
| 402 // Close tab and ensure RVHs are deleted. | 394 // Close tab and ensure RVHs are deleted. |
| 403 DeleteContents(); | 395 DeleteContents(); |
| 404 EXPECT_EQ(orig_rvh_delete_count, 1); | 396 EXPECT_EQ(orig_rvh_delete_count, 1); |
| 405 } | 397 } |
| 406 | 398 |
| 407 // Test that opening a new tab in the same SiteInstance and then navigating | 399 // Test that opening a new tab in the same SiteInstance and then navigating |
| 408 // both tabs to a new site will place both tabs in a single SiteInstance. | 400 // both tabs to a new site will place both tabs in a single SiteInstance. |
| 409 TEST_F(TabContentsTest, NavigateTwoTabsCrossSite) { | 401 TEST_F(TabContentsTest, NavigateTwoTabsCrossSite) { |
| 410 contents()->transition_cross_site = true; | 402 contents()->transition_cross_site = true; |
| 411 TestRenderViewHost* orig_rvh = rvh(); | 403 TestRenderViewHost* orig_rvh = rvh(); |
| 412 SiteInstance* instance1 = contents()->GetSiteInstance(); | 404 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 413 | 405 |
| 414 // Navigate to URL. First URL should use first RenderViewHost. | 406 // Navigate to URL. First URL should use first RenderViewHost. |
| 415 const GURL url("http://www.google.com"); | 407 const GURL url("http://www.google.com"); |
| 416 controller().LoadURL( | 408 controller().LoadURL( |
| 417 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 409 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 418 ViewHostMsg_FrameNavigate_Params params1; | 410 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 419 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 420 contents()->TestDidNavigate(orig_rvh, params1); | |
| 421 | 411 |
| 422 // Open a new tab with the same SiteInstance, navigated to the same site. | 412 // Open a new tab with the same SiteInstance, navigated to the same site. |
| 423 TestTabContents contents2(profile(), instance1); | 413 TestTabContents contents2(profile(), instance1); |
| 424 params1.page_id = 2; // Need this since the site instance is the same (which | |
| 425 // is the scope of page IDs) and we want to consider | |
| 426 // this a new page. | |
| 427 contents2.transition_cross_site = true; | 414 contents2.transition_cross_site = true; |
| 428 contents2.controller().LoadURL(url, GURL(), content::PAGE_TRANSITION_TYPED, | 415 contents2.controller().LoadURL(url, GURL(), content::PAGE_TRANSITION_TYPED, |
| 429 std::string()); | 416 std::string()); |
| 430 contents2.TestDidNavigate(contents2.render_view_host(), params1); | 417 // Need this page id to be 2since the site instance is the same (which is the |
|
Jói
2011/12/05 10:30:51
2since -> 2 since
| |
| 418 // scope of page IDs) and we want to consider this a new page. | |
| 419 contents2.TestDidNavigate( | |
| 420 contents2.render_view_host(), 2, url, content::PAGE_TRANSITION_TYPED); | |
| 431 | 421 |
| 432 // Navigate first tab to a new site | 422 // Navigate first tab to a new site |
| 433 const GURL url2a("http://www.yahoo.com"); | 423 const GURL url2a("http://www.yahoo.com"); |
| 434 controller().LoadURL( | 424 controller().LoadURL( |
| 435 url2a, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 425 url2a, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 436 orig_rvh->SendShouldCloseACK(true); | 426 orig_rvh->SendShouldCloseACK(true); |
| 437 TestRenderViewHost* pending_rvh_a = contents()->pending_rvh(); | 427 TestRenderViewHost* pending_rvh_a = contents()->pending_rvh(); |
| 438 ViewHostMsg_FrameNavigate_Params params2a; | 428 contents()->TestDidNavigate( |
| 439 InitNavigateParams(¶ms2a, 1, url2a, content::PAGE_TRANSITION_TYPED); | 429 pending_rvh_a, 1, url2a, content::PAGE_TRANSITION_TYPED); |
| 440 contents()->TestDidNavigate(pending_rvh_a, params2a); | |
| 441 SiteInstance* instance2a = contents()->GetSiteInstance(); | 430 SiteInstance* instance2a = contents()->GetSiteInstance(); |
| 442 EXPECT_NE(instance1, instance2a); | 431 EXPECT_NE(instance1, instance2a); |
| 443 | 432 |
| 444 // Navigate second tab to the same site as the first tab | 433 // Navigate second tab to the same site as the first tab |
| 445 const GURL url2b("http://mail.yahoo.com"); | 434 const GURL url2b("http://mail.yahoo.com"); |
| 446 contents2.controller().LoadURL(url2b, GURL(), content::PAGE_TRANSITION_TYPED, | 435 contents2.controller().LoadURL(url2b, GURL(), content::PAGE_TRANSITION_TYPED, |
| 447 std::string()); | 436 std::string()); |
| 448 TestRenderViewHost* rvh2 = | 437 TestRenderViewHost* rvh2 = |
| 449 static_cast<TestRenderViewHost*>(contents2.render_view_host()); | 438 static_cast<TestRenderViewHost*>(contents2.render_view_host()); |
| 450 rvh2->SendShouldCloseACK(true); | 439 rvh2->SendShouldCloseACK(true); |
| 451 TestRenderViewHost* pending_rvh_b = contents2.pending_rvh(); | 440 TestRenderViewHost* pending_rvh_b = contents2.pending_rvh(); |
| 452 EXPECT_TRUE(pending_rvh_b != NULL); | 441 EXPECT_TRUE(pending_rvh_b != NULL); |
| 453 EXPECT_TRUE(contents2.cross_navigation_pending()); | 442 EXPECT_TRUE(contents2.cross_navigation_pending()); |
| 454 | 443 |
| 455 // NOTE(creis): We used to be in danger of showing a sad tab page here if the | 444 // NOTE(creis): We used to be in danger of showing a sad tab page here if the |
| 456 // second tab hadn't navigated somewhere first (bug 1145430). That case is | 445 // second tab hadn't navigated somewhere first (bug 1145430). That case is |
| 457 // now covered by the CrossSiteBoundariesAfterCrash test. | 446 // now covered by the CrossSiteBoundariesAfterCrash test. |
| 458 | 447 contents2.TestDidNavigate( |
| 459 ViewHostMsg_FrameNavigate_Params params2b; | 448 pending_rvh_b, 2, url2b, content::PAGE_TRANSITION_TYPED); |
| 460 InitNavigateParams(¶ms2b, 2, url2b, content::PAGE_TRANSITION_TYPED); | |
| 461 contents2.TestDidNavigate(pending_rvh_b, params2b); | |
| 462 SiteInstance* instance2b = contents2.GetSiteInstance(); | 449 SiteInstance* instance2b = contents2.GetSiteInstance(); |
| 463 EXPECT_NE(instance1, instance2b); | 450 EXPECT_NE(instance1, instance2b); |
| 464 | 451 |
| 465 // Both tabs should now be in the same SiteInstance. | 452 // Both tabs should now be in the same SiteInstance. |
| 466 EXPECT_EQ(instance2a, instance2b); | 453 EXPECT_EQ(instance2a, instance2b); |
| 467 } | 454 } |
| 468 | 455 |
| 469 // Tests that TabContents uses the current URL, not the SiteInstance's site, to | 456 // Tests that TabContents uses the current URL, not the SiteInstance's site, to |
| 470 // determine whether a navigation is cross-site. | 457 // determine whether a navigation is cross-site. |
| 471 TEST_F(TabContentsTest, CrossSiteComparesAgainstCurrentPage) { | 458 TEST_F(TabContentsTest, CrossSiteComparesAgainstCurrentPage) { |
| 472 contents()->transition_cross_site = true; | 459 contents()->transition_cross_site = true; |
| 473 TestRenderViewHost* orig_rvh = rvh(); | 460 TestRenderViewHost* orig_rvh = rvh(); |
| 474 SiteInstance* instance1 = contents()->GetSiteInstance(); | 461 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 475 | 462 |
| 476 // Navigate to URL. | 463 // Navigate to URL. |
| 477 const GURL url("http://www.google.com"); | 464 const GURL url("http://www.google.com"); |
| 478 controller().LoadURL( | 465 controller().LoadURL( |
| 479 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 466 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 480 ViewHostMsg_FrameNavigate_Params params1; | 467 contents()->TestDidNavigate( |
| 481 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | 468 orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 482 contents()->TestDidNavigate(orig_rvh, params1); | |
| 483 | 469 |
| 484 // Open a related tab to a second site. | 470 // Open a related tab to a second site. |
| 485 TestTabContents contents2(profile(), instance1); | 471 TestTabContents contents2(profile(), instance1); |
| 486 contents2.transition_cross_site = true; | 472 contents2.transition_cross_site = true; |
| 487 const GURL url2("http://www.yahoo.com"); | 473 const GURL url2("http://www.yahoo.com"); |
| 488 contents2.controller().LoadURL(url2, GURL(), content::PAGE_TRANSITION_TYPED, | 474 contents2.controller().LoadURL(url2, GURL(), content::PAGE_TRANSITION_TYPED, |
| 489 std::string()); | 475 std::string()); |
| 490 // The first RVH in contents2 isn't live yet, so we shortcut the cross site | 476 // The first RVH in contents2 isn't live yet, so we shortcut the cross site |
| 491 // pending. | 477 // pending. |
| 492 TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( | 478 TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( |
| 493 contents2.render_view_host()); | 479 contents2.render_view_host()); |
| 494 EXPECT_FALSE(contents2.cross_navigation_pending()); | 480 EXPECT_FALSE(contents2.cross_navigation_pending()); |
| 495 ViewHostMsg_FrameNavigate_Params params2; | 481 contents2.TestDidNavigate(rvh2, 2, url2, content::PAGE_TRANSITION_TYPED); |
| 496 InitNavigateParams(¶ms2, 2, url2, content::PAGE_TRANSITION_TYPED); | |
| 497 contents2.TestDidNavigate(rvh2, params2); | |
| 498 SiteInstance* instance2 = contents2.GetSiteInstance(); | 482 SiteInstance* instance2 = contents2.GetSiteInstance(); |
| 499 EXPECT_NE(instance1, instance2); | 483 EXPECT_NE(instance1, instance2); |
| 500 EXPECT_FALSE(contents2.cross_navigation_pending()); | 484 EXPECT_FALSE(contents2.cross_navigation_pending()); |
| 501 | 485 |
| 502 // Simulate a link click in first tab to second site. Doesn't switch | 486 // Simulate a link click in first tab to second site. Doesn't switch |
| 503 // SiteInstances, because we don't intercept WebKit navigations. | 487 // SiteInstances, because we don't intercept WebKit navigations. |
| 504 ViewHostMsg_FrameNavigate_Params params3; | 488 contents()->TestDidNavigate( |
| 505 InitNavigateParams(¶ms3, 2, url2, content::PAGE_TRANSITION_TYPED); | 489 orig_rvh, 2, url2, content::PAGE_TRANSITION_TYPED); |
| 506 contents()->TestDidNavigate(orig_rvh, params3); | |
| 507 SiteInstance* instance3 = contents()->GetSiteInstance(); | 490 SiteInstance* instance3 = contents()->GetSiteInstance(); |
| 508 EXPECT_EQ(instance1, instance3); | 491 EXPECT_EQ(instance1, instance3); |
| 509 EXPECT_FALSE(contents()->cross_navigation_pending()); | 492 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 510 | 493 |
| 511 // Navigate to the new site. Doesn't switch SiteInstancees, because we | 494 // Navigate to the new site. Doesn't switch SiteInstancees, because we |
| 512 // compare against the current URL, not the SiteInstance's site. | 495 // compare against the current URL, not the SiteInstance's site. |
| 513 const GURL url3("http://mail.yahoo.com"); | 496 const GURL url3("http://mail.yahoo.com"); |
| 514 controller().LoadURL( | 497 controller().LoadURL( |
| 515 url3, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 498 url3, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 516 EXPECT_FALSE(contents()->cross_navigation_pending()); | 499 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 517 ViewHostMsg_FrameNavigate_Params params4; | 500 contents()->TestDidNavigate( |
| 518 InitNavigateParams(¶ms4, 3, url3, content::PAGE_TRANSITION_TYPED); | 501 orig_rvh, 3, url3, content::PAGE_TRANSITION_TYPED); |
| 519 contents()->TestDidNavigate(orig_rvh, params4); | |
| 520 SiteInstance* instance4 = contents()->GetSiteInstance(); | 502 SiteInstance* instance4 = contents()->GetSiteInstance(); |
| 521 EXPECT_EQ(instance1, instance4); | 503 EXPECT_EQ(instance1, instance4); |
| 522 } | 504 } |
| 523 | 505 |
| 524 // Test that the onbeforeunload and onunload handlers run when navigating | 506 // Test that the onbeforeunload and onunload handlers run when navigating |
| 525 // across site boundaries. | 507 // across site boundaries. |
| 526 TEST_F(TabContentsTest, CrossSiteUnloadHandlers) { | 508 TEST_F(TabContentsTest, CrossSiteUnloadHandlers) { |
| 527 contents()->transition_cross_site = true; | 509 contents()->transition_cross_site = true; |
| 528 TestRenderViewHost* orig_rvh = rvh(); | 510 TestRenderViewHost* orig_rvh = rvh(); |
| 529 SiteInstance* instance1 = contents()->GetSiteInstance(); | 511 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 530 | 512 |
| 531 // Navigate to URL. First URL should use first RenderViewHost. | 513 // Navigate to URL. First URL should use first RenderViewHost. |
| 532 const GURL url("http://www.google.com"); | 514 const GURL url("http://www.google.com"); |
| 533 controller().LoadURL( | 515 controller().LoadURL( |
| 534 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 516 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 535 ViewHostMsg_FrameNavigate_Params params1; | 517 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 536 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 537 contents()->TestDidNavigate(orig_rvh, params1); | |
| 538 EXPECT_FALSE(contents()->cross_navigation_pending()); | 518 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 539 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 519 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 540 | 520 |
| 541 // Navigate to new site, but simulate an onbeforeunload denial. | 521 // Navigate to new site, but simulate an onbeforeunload denial. |
| 542 const GURL url2("http://www.yahoo.com"); | 522 const GURL url2("http://www.yahoo.com"); |
| 543 controller().LoadURL( | 523 controller().LoadURL( |
| 544 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 524 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 545 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); | 525 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 546 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, false)); | 526 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, false)); |
| 547 EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); | 527 EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 548 EXPECT_FALSE(contents()->cross_navigation_pending()); | 528 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 549 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 529 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 550 | 530 |
| 551 // Navigate again, but simulate an onbeforeunload approval. | 531 // Navigate again, but simulate an onbeforeunload approval. |
| 552 controller().LoadURL( | 532 controller().LoadURL( |
| 553 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 533 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 554 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); | 534 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 555 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); | 535 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); |
| 556 EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); | 536 EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 557 EXPECT_TRUE(contents()->cross_navigation_pending()); | 537 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 558 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( | 538 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( |
| 559 contents()->pending_rvh()); | 539 contents()->pending_rvh()); |
| 560 | 540 |
| 561 // We won't hear DidNavigate until the onunload handler has finished running. | 541 // We won't hear DidNavigate until the onunload handler has finished running. |
| 562 // (No way to simulate that here, but it involves a call from RDH to | 542 // (No way to simulate that here, but it involves a call from RDH to |
| 563 // TabContents::OnCrossSiteResponse.) | 543 // TabContents::OnCrossSiteResponse.) |
| 564 | 544 |
| 565 // DidNavigate from the pending page | 545 // DidNavigate from the pending page |
| 566 ViewHostMsg_FrameNavigate_Params params2; | 546 contents()->TestDidNavigate( |
| 567 InitNavigateParams(¶ms2, 1, url2, content::PAGE_TRANSITION_TYPED); | 547 pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); |
| 568 contents()->TestDidNavigate(pending_rvh, params2); | |
| 569 SiteInstance* instance2 = contents()->GetSiteInstance(); | 548 SiteInstance* instance2 = contents()->GetSiteInstance(); |
| 570 EXPECT_FALSE(contents()->cross_navigation_pending()); | 549 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 571 EXPECT_EQ(pending_rvh, rvh()); | 550 EXPECT_EQ(pending_rvh, rvh()); |
| 572 EXPECT_NE(instance1, instance2); | 551 EXPECT_NE(instance1, instance2); |
| 573 EXPECT_TRUE(contents()->pending_rvh() == NULL); | 552 EXPECT_TRUE(contents()->pending_rvh() == NULL); |
| 574 } | 553 } |
| 575 | 554 |
| 576 // Test that during a slow cross-site navigation, the original renderer can | 555 // Test that during a slow cross-site navigation, the original renderer can |
| 577 // navigate to a different URL and have it displayed, canceling the slow | 556 // navigate to a different URL and have it displayed, canceling the slow |
| 578 // navigation. | 557 // navigation. |
| 579 TEST_F(TabContentsTest, CrossSiteNavigationPreempted) { | 558 TEST_F(TabContentsTest, CrossSiteNavigationPreempted) { |
| 580 contents()->transition_cross_site = true; | 559 contents()->transition_cross_site = true; |
| 581 TestRenderViewHost* orig_rvh = rvh(); | 560 TestRenderViewHost* orig_rvh = rvh(); |
| 582 SiteInstance* instance1 = contents()->GetSiteInstance(); | 561 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 583 | 562 |
| 584 // Navigate to URL. First URL should use first RenderViewHost. | 563 // Navigate to URL. First URL should use first RenderViewHost. |
| 585 const GURL url("http://www.google.com"); | 564 const GURL url("http://www.google.com"); |
| 586 controller().LoadURL( | 565 controller().LoadURL( |
| 587 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 566 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 588 ViewHostMsg_FrameNavigate_Params params1; | 567 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 589 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 590 contents()->TestDidNavigate(orig_rvh, params1); | |
| 591 EXPECT_FALSE(contents()->cross_navigation_pending()); | 568 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 592 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 569 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 593 | 570 |
| 594 // Navigate to new site, simulating an onbeforeunload approval. | 571 // Navigate to new site, simulating an onbeforeunload approval. |
| 595 const GURL url2("http://www.yahoo.com"); | 572 const GURL url2("http://www.yahoo.com"); |
| 596 controller().LoadURL( | 573 controller().LoadURL( |
| 597 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 574 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 598 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); | 575 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 599 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); | 576 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); |
| 600 EXPECT_TRUE(contents()->cross_navigation_pending()); | 577 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 612 } | 589 } |
| 613 | 590 |
| 614 TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { | 591 TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { |
| 615 contents()->transition_cross_site = true; | 592 contents()->transition_cross_site = true; |
| 616 | 593 |
| 617 // Start with NTP, which gets a new RVH with WebUI bindings. | 594 // Start with NTP, which gets a new RVH with WebUI bindings. |
| 618 const GURL url1("chrome://newtab"); | 595 const GURL url1("chrome://newtab"); |
| 619 controller().LoadURL( | 596 controller().LoadURL( |
| 620 url1, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 597 url1, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 621 TestRenderViewHost* ntp_rvh = rvh(); | 598 TestRenderViewHost* ntp_rvh = rvh(); |
| 622 ViewHostMsg_FrameNavigate_Params params1; | 599 contents()->TestDidNavigate(ntp_rvh, 1, url1, content::PAGE_TRANSITION_TYPED); |
| 623 InitNavigateParams(¶ms1, 1, url1, content::PAGE_TRANSITION_TYPED); | |
| 624 contents()->TestDidNavigate(ntp_rvh, params1); | |
| 625 NavigationEntry* entry1 = controller().GetLastCommittedEntry(); | 600 NavigationEntry* entry1 = controller().GetLastCommittedEntry(); |
| 626 SiteInstance* instance1 = contents()->GetSiteInstance(); | 601 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 627 | 602 |
| 628 EXPECT_FALSE(contents()->cross_navigation_pending()); | 603 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 629 EXPECT_EQ(ntp_rvh, contents()->render_view_host()); | 604 EXPECT_EQ(ntp_rvh, contents()->render_view_host()); |
| 630 EXPECT_EQ(url1, entry1->url()); | 605 EXPECT_EQ(url1, entry1->url()); |
| 631 EXPECT_EQ(instance1, entry1->site_instance()); | 606 EXPECT_EQ(instance1, entry1->site_instance()); |
| 632 EXPECT_TRUE(ntp_rvh->enabled_bindings() & content::BINDINGS_POLICY_WEB_UI); | 607 EXPECT_TRUE(ntp_rvh->enabled_bindings() & content::BINDINGS_POLICY_WEB_UI); |
| 633 | 608 |
| 634 // Navigate to new site. | 609 // Navigate to new site. |
| 635 const GURL url2("http://www.google.com"); | 610 const GURL url2("http://www.google.com"); |
| 636 controller().LoadURL( | 611 controller().LoadURL( |
| 637 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 612 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 638 EXPECT_TRUE(contents()->cross_navigation_pending()); | 613 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 639 TestRenderViewHost* google_rvh = contents()->pending_rvh(); | 614 TestRenderViewHost* google_rvh = contents()->pending_rvh(); |
| 640 | 615 |
| 641 // Simulate beforeunload approval. | 616 // Simulate beforeunload approval. |
| 642 EXPECT_TRUE(ntp_rvh->is_waiting_for_beforeunload_ack()); | 617 EXPECT_TRUE(ntp_rvh->is_waiting_for_beforeunload_ack()); |
| 643 ntp_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); | 618 ntp_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); |
| 644 | 619 |
| 645 // DidNavigate from the pending page. | 620 // DidNavigate from the pending page. |
| 646 ViewHostMsg_FrameNavigate_Params params2; | 621 contents()->TestDidNavigate( |
| 647 InitNavigateParams(¶ms2, 1, url2, content::PAGE_TRANSITION_TYPED); | 622 google_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); |
| 648 contents()->TestDidNavigate(google_rvh, params2); | |
| 649 NavigationEntry* entry2 = controller().GetLastCommittedEntry(); | 623 NavigationEntry* entry2 = controller().GetLastCommittedEntry(); |
| 650 SiteInstance* instance2 = contents()->GetSiteInstance(); | 624 SiteInstance* instance2 = contents()->GetSiteInstance(); |
| 651 | 625 |
| 652 EXPECT_FALSE(contents()->cross_navigation_pending()); | 626 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 653 EXPECT_EQ(google_rvh, contents()->render_view_host()); | 627 EXPECT_EQ(google_rvh, contents()->render_view_host()); |
| 654 EXPECT_NE(instance1, instance2); | 628 EXPECT_NE(instance1, instance2); |
| 655 EXPECT_FALSE(contents()->pending_rvh()); | 629 EXPECT_FALSE(contents()->pending_rvh()); |
| 656 EXPECT_EQ(url2, entry2->url()); | 630 EXPECT_EQ(url2, entry2->url()); |
| 657 EXPECT_EQ(instance2, entry2->site_instance()); | 631 EXPECT_EQ(instance2, entry2->site_instance()); |
| 658 EXPECT_FALSE(google_rvh->enabled_bindings() & | 632 EXPECT_FALSE(google_rvh->enabled_bindings() & |
| 659 content::BINDINGS_POLICY_WEB_UI); | 633 content::BINDINGS_POLICY_WEB_UI); |
| 660 | 634 |
| 661 // Navigate to third page on same site. | 635 // Navigate to third page on same site. |
| 662 const GURL url3("http://news.google.com"); | 636 const GURL url3("http://news.google.com"); |
| 663 controller().LoadURL( | 637 controller().LoadURL( |
| 664 url3, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 638 url3, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 665 EXPECT_FALSE(contents()->cross_navigation_pending()); | 639 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 666 ViewHostMsg_FrameNavigate_Params params3; | 640 contents()->TestDidNavigate( |
| 667 InitNavigateParams(¶ms3, 2, url3, content::PAGE_TRANSITION_TYPED); | 641 google_rvh, 2, url3, content::PAGE_TRANSITION_TYPED); |
| 668 contents()->TestDidNavigate(google_rvh, params3); | |
| 669 NavigationEntry* entry3 = controller().GetLastCommittedEntry(); | 642 NavigationEntry* entry3 = controller().GetLastCommittedEntry(); |
| 670 SiteInstance* instance3 = contents()->GetSiteInstance(); | 643 SiteInstance* instance3 = contents()->GetSiteInstance(); |
| 671 | 644 |
| 672 EXPECT_FALSE(contents()->cross_navigation_pending()); | 645 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 673 EXPECT_EQ(google_rvh, contents()->render_view_host()); | 646 EXPECT_EQ(google_rvh, contents()->render_view_host()); |
| 674 EXPECT_EQ(instance2, instance3); | 647 EXPECT_EQ(instance2, instance3); |
| 675 EXPECT_FALSE(contents()->pending_rvh()); | 648 EXPECT_FALSE(contents()->pending_rvh()); |
| 676 EXPECT_EQ(url3, entry3->url()); | 649 EXPECT_EQ(url3, entry3->url()); |
| 677 EXPECT_EQ(instance3, entry3->site_instance()); | 650 EXPECT_EQ(instance3, entry3->site_instance()); |
| 678 | 651 |
| 679 // Go back within the site. | 652 // Go back within the site. |
| 680 controller().GoBack(); | 653 controller().GoBack(); |
| 681 EXPECT_FALSE(contents()->cross_navigation_pending()); | 654 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 682 EXPECT_EQ(entry2, controller().pending_entry()); | 655 EXPECT_EQ(entry2, controller().pending_entry()); |
| 683 | 656 |
| 684 // Before that commits, go back again. | 657 // Before that commits, go back again. |
| 685 controller().GoBack(); | 658 controller().GoBack(); |
| 686 EXPECT_TRUE(contents()->cross_navigation_pending()); | 659 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 687 EXPECT_TRUE(contents()->pending_rvh()); | 660 EXPECT_TRUE(contents()->pending_rvh()); |
| 688 EXPECT_EQ(entry1, controller().pending_entry()); | 661 EXPECT_EQ(entry1, controller().pending_entry()); |
| 689 | 662 |
| 690 // Simulate beforeunload approval. | 663 // Simulate beforeunload approval. |
| 691 EXPECT_TRUE(google_rvh->is_waiting_for_beforeunload_ack()); | 664 EXPECT_TRUE(google_rvh->is_waiting_for_beforeunload_ack()); |
| 692 google_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); | 665 google_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); |
| 693 | 666 |
| 694 // DidNavigate from the first back. This aborts the second back's pending RVH. | 667 // DidNavigate from the first back. This aborts the second back's pending RVH. |
| 695 contents()->TestDidNavigate(google_rvh, params2); | 668 contents()->TestDidNavigate( |
| 669 google_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); | |
| 696 | 670 |
| 697 // We should commit this page and forget about the second back. | 671 // We should commit this page and forget about the second back. |
| 698 EXPECT_FALSE(contents()->cross_navigation_pending()); | 672 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 699 EXPECT_FALSE(controller().pending_entry()); | 673 EXPECT_FALSE(controller().pending_entry()); |
| 700 EXPECT_EQ(google_rvh, contents()->render_view_host()); | 674 EXPECT_EQ(google_rvh, contents()->render_view_host()); |
| 701 EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url()); | 675 EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url()); |
| 702 | 676 |
| 703 // We should not have corrupted the NTP entry. | 677 // We should not have corrupted the NTP entry. |
| 704 EXPECT_EQ(instance3, entry3->site_instance()); | 678 EXPECT_EQ(instance3, entry3->site_instance()); |
| 705 EXPECT_EQ(instance2, entry2->site_instance()); | 679 EXPECT_EQ(instance2, entry2->site_instance()); |
| 706 EXPECT_EQ(instance1, entry1->site_instance()); | 680 EXPECT_EQ(instance1, entry1->site_instance()); |
| 707 EXPECT_EQ(url1, entry1->url()); | 681 EXPECT_EQ(url1, entry1->url()); |
| 708 } | 682 } |
| 709 | 683 |
| 710 // Test that during a slow cross-site navigation, a sub-frame navigation in the | 684 // Test that during a slow cross-site navigation, a sub-frame navigation in the |
| 711 // original renderer will not cancel the slow navigation (bug 42029). | 685 // original renderer will not cancel the slow navigation (bug 42029). |
| 712 TEST_F(TabContentsTest, CrossSiteNavigationNotPreemptedByFrame) { | 686 TEST_F(TabContentsTest, CrossSiteNavigationNotPreemptedByFrame) { |
| 713 contents()->transition_cross_site = true; | 687 contents()->transition_cross_site = true; |
| 714 TestRenderViewHost* orig_rvh = rvh(); | 688 TestRenderViewHost* orig_rvh = rvh(); |
| 715 | 689 |
| 716 // Navigate to URL. First URL should use first RenderViewHost. | 690 // Navigate to URL. First URL should use first RenderViewHost. |
| 717 const GURL url("http://www.google.com"); | 691 const GURL url("http://www.google.com"); |
| 718 controller().LoadURL( | 692 controller().LoadURL( |
| 719 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 693 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 720 ViewHostMsg_FrameNavigate_Params params1; | 694 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 721 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 722 contents()->TestDidNavigate(orig_rvh, params1); | |
| 723 EXPECT_FALSE(contents()->cross_navigation_pending()); | 695 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 724 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 696 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 725 | 697 |
| 726 // Start navigating to new site. | 698 // Start navigating to new site. |
| 727 const GURL url2("http://www.yahoo.com"); | 699 const GURL url2("http://www.yahoo.com"); |
| 728 controller().LoadURL( | 700 controller().LoadURL( |
| 729 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 701 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 730 | 702 |
| 731 // Simulate a sub-frame navigation arriving and ensure the RVH is still | 703 // Simulate a sub-frame navigation arriving and ensure the RVH is still |
| 732 // waiting for a before unload response. | 704 // waiting for a before unload response. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 | 737 |
| 766 // Suppose the first navigation tries to commit now, with a | 738 // Suppose the first navigation tries to commit now, with a |
| 767 // ViewMsg_Stop in flight. This should not cancel the pending navigation, | 739 // ViewMsg_Stop in flight. This should not cancel the pending navigation, |
| 768 // but it should act as if the beforeunload ack arrived. | 740 // but it should act as if the beforeunload ack arrived. |
| 769 orig_rvh->SendNavigate(1, GURL("chrome://newtab")); | 741 orig_rvh->SendNavigate(1, GURL("chrome://newtab")); |
| 770 EXPECT_TRUE(contents()->cross_navigation_pending()); | 742 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 771 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 743 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 772 EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); | 744 EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 773 | 745 |
| 774 // The pending navigation should be able to commit successfully. | 746 // The pending navigation should be able to commit successfully. |
| 775 ViewHostMsg_FrameNavigate_Params params2; | 747 contents()->TestDidNavigate( |
| 776 InitNavigateParams(¶ms2, 1, url2, content::PAGE_TRANSITION_TYPED); | 748 pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); |
| 777 contents()->TestDidNavigate(pending_rvh, params2); | |
| 778 EXPECT_FALSE(contents()->cross_navigation_pending()); | 749 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 779 EXPECT_EQ(pending_rvh, contents()->render_view_host()); | 750 EXPECT_EQ(pending_rvh, contents()->render_view_host()); |
| 780 } | 751 } |
| 781 | 752 |
| 782 // Test that the original renderer cannot preempt a cross-site navigation once | 753 // Test that the original renderer cannot preempt a cross-site navigation once |
| 783 // the unload request has been made. At this point, the cross-site navigation | 754 // the unload request has been made. At this point, the cross-site navigation |
| 784 // is almost ready to be displayed, and the original renderer is only given a | 755 // is almost ready to be displayed, and the original renderer is only given a |
| 785 // short chance to run an unload handler. Prevents regression of bug 23942. | 756 // short chance to run an unload handler. Prevents regression of bug 23942. |
| 786 TEST_F(TabContentsTest, CrossSiteCantPreemptAfterUnload) { | 757 TEST_F(TabContentsTest, CrossSiteCantPreemptAfterUnload) { |
| 787 contents()->transition_cross_site = true; | 758 contents()->transition_cross_site = true; |
| 788 TestRenderViewHost* orig_rvh = rvh(); | 759 TestRenderViewHost* orig_rvh = rvh(); |
| 789 SiteInstance* instance1 = contents()->GetSiteInstance(); | 760 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 790 | 761 |
| 791 // Navigate to URL. First URL should use first RenderViewHost. | 762 // Navigate to URL. First URL should use first RenderViewHost. |
| 792 const GURL url("http://www.google.com"); | 763 const GURL url("http://www.google.com"); |
| 793 controller().LoadURL( | 764 controller().LoadURL( |
| 794 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 765 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 795 ViewHostMsg_FrameNavigate_Params params1; | 766 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 796 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 797 contents()->TestDidNavigate(orig_rvh, params1); | |
| 798 EXPECT_FALSE(contents()->cross_navigation_pending()); | 767 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 799 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 768 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 800 | 769 |
| 801 // Navigate to new site, simulating an onbeforeunload approval. | 770 // Navigate to new site, simulating an onbeforeunload approval. |
| 802 const GURL url2("http://www.yahoo.com"); | 771 const GURL url2("http://www.yahoo.com"); |
| 803 controller().LoadURL( | 772 controller().LoadURL( |
| 804 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 773 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 805 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); | 774 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); |
| 806 EXPECT_TRUE(contents()->cross_navigation_pending()); | 775 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 807 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( | 776 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 818 ViewHostMsg_FrameNavigate_Params params1a; | 787 ViewHostMsg_FrameNavigate_Params params1a; |
| 819 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), | 788 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), |
| 820 content::PAGE_TRANSITION_TYPED); | 789 content::PAGE_TRANSITION_TYPED); |
| 821 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); | 790 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); |
| 822 | 791 |
| 823 // Verify that the pending navigation is still in progress. | 792 // Verify that the pending navigation is still in progress. |
| 824 EXPECT_TRUE(contents()->cross_navigation_pending()); | 793 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 825 EXPECT_TRUE(contents()->pending_rvh() != NULL); | 794 EXPECT_TRUE(contents()->pending_rvh() != NULL); |
| 826 | 795 |
| 827 // DidNavigate from the pending page should commit it. | 796 // DidNavigate from the pending page should commit it. |
| 828 ViewHostMsg_FrameNavigate_Params params2; | 797 contents()->TestDidNavigate( |
| 829 InitNavigateParams(¶ms2, 1, url2, content::PAGE_TRANSITION_TYPED); | 798 pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); |
| 830 contents()->TestDidNavigate(pending_rvh, params2); | |
| 831 SiteInstance* instance2 = contents()->GetSiteInstance(); | 799 SiteInstance* instance2 = contents()->GetSiteInstance(); |
| 832 EXPECT_FALSE(contents()->cross_navigation_pending()); | 800 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 833 EXPECT_EQ(pending_rvh, rvh()); | 801 EXPECT_EQ(pending_rvh, rvh()); |
| 834 EXPECT_NE(instance1, instance2); | 802 EXPECT_NE(instance1, instance2); |
| 835 EXPECT_TRUE(contents()->pending_rvh() == NULL); | 803 EXPECT_TRUE(contents()->pending_rvh() == NULL); |
| 836 } | 804 } |
| 837 | 805 |
| 838 // Test that a cross-site navigation that doesn't commit after the unload | 806 // Test that a cross-site navigation that doesn't commit after the unload |
| 839 // handler doesn't leave the tab in a stuck state. http://crbug.com/88562. | 807 // handler doesn't leave the tab in a stuck state. http://crbug.com/88562. |
| 840 TEST_F(TabContentsTest, CrossSiteNavigationCanceled) { | 808 TEST_F(TabContentsTest, CrossSiteNavigationCanceled) { |
| 841 contents()->transition_cross_site = true; | 809 contents()->transition_cross_site = true; |
| 842 TestRenderViewHost* orig_rvh = rvh(); | 810 TestRenderViewHost* orig_rvh = rvh(); |
| 843 SiteInstance* instance1 = contents()->GetSiteInstance(); | 811 SiteInstance* instance1 = contents()->GetSiteInstance(); |
| 844 | 812 |
| 845 // Navigate to URL. First URL should use first RenderViewHost. | 813 // Navigate to URL. First URL should use first RenderViewHost. |
| 846 const GURL url("http://www.google.com"); | 814 const GURL url("http://www.google.com"); |
| 847 controller().LoadURL( | 815 controller().LoadURL( |
| 848 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 816 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 849 ViewHostMsg_FrameNavigate_Params params1; | 817 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 850 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 851 contents()->TestDidNavigate(orig_rvh, params1); | |
| 852 EXPECT_FALSE(contents()->cross_navigation_pending()); | 818 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| 853 EXPECT_EQ(orig_rvh, contents()->render_view_host()); | 819 EXPECT_EQ(orig_rvh, contents()->render_view_host()); |
| 854 | 820 |
| 855 // Navigate to new site, simulating an onbeforeunload approval. | 821 // Navigate to new site, simulating an onbeforeunload approval. |
| 856 const GURL url2("http://www.yahoo.com"); | 822 const GURL url2("http://www.yahoo.com"); |
| 857 controller().LoadURL( | 823 controller().LoadURL( |
| 858 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 824 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 859 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); | 825 EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); |
| 860 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); | 826 orig_rvh->TestOnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true)); |
| 861 EXPECT_TRUE(contents()->cross_navigation_pending()); | 827 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 885 TestRenderViewHost* orig_rvh = rvh(); | 851 TestRenderViewHost* orig_rvh = rvh(); |
| 886 | 852 |
| 887 // Navigate to URL. There should be no committed entry yet. | 853 // Navigate to URL. There should be no committed entry yet. |
| 888 const GURL url("http://www.google.com"); | 854 const GURL url("http://www.google.com"); |
| 889 controller().LoadURL( | 855 controller().LoadURL( |
| 890 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 856 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 891 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 857 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 892 EXPECT_TRUE(entry == NULL); | 858 EXPECT_TRUE(entry == NULL); |
| 893 | 859 |
| 894 // Committed entry should have content state after DidNavigate. | 860 // Committed entry should have content state after DidNavigate. |
| 895 ViewHostMsg_FrameNavigate_Params params1; | 861 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 896 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | |
| 897 contents()->TestDidNavigate(orig_rvh, params1); | |
| 898 entry = controller().GetLastCommittedEntry(); | 862 entry = controller().GetLastCommittedEntry(); |
| 899 EXPECT_FALSE(entry->content_state().empty()); | 863 EXPECT_FALSE(entry->content_state().empty()); |
| 900 | 864 |
| 901 // Navigate to same site. | 865 // Navigate to same site. |
| 902 const GURL url2("http://images.google.com"); | 866 const GURL url2("http://images.google.com"); |
| 903 controller().LoadURL( | 867 controller().LoadURL( |
| 904 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 868 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 905 entry = controller().GetLastCommittedEntry(); | 869 entry = controller().GetLastCommittedEntry(); |
| 906 EXPECT_FALSE(entry->content_state().empty()); | 870 EXPECT_FALSE(entry->content_state().empty()); |
| 907 | 871 |
| 908 // Committed entry should have content state after DidNavigate. | 872 // Committed entry should have content state after DidNavigate. |
| 909 ViewHostMsg_FrameNavigate_Params params2; | 873 contents()->TestDidNavigate( |
| 910 InitNavigateParams(¶ms2, 2, url2, content::PAGE_TRANSITION_TYPED); | 874 orig_rvh, 2, url2, content::PAGE_TRANSITION_TYPED); |
| 911 contents()->TestDidNavigate(orig_rvh, params2); | |
| 912 entry = controller().GetLastCommittedEntry(); | 875 entry = controller().GetLastCommittedEntry(); |
| 913 EXPECT_FALSE(entry->content_state().empty()); | 876 EXPECT_FALSE(entry->content_state().empty()); |
| 914 | 877 |
| 915 // Now go back. Committed entry should still have content state. | 878 // Now go back. Committed entry should still have content state. |
| 916 controller().GoBack(); | 879 controller().GoBack(); |
| 917 contents()->TestDidNavigate(orig_rvh, params1); | 880 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 918 entry = controller().GetLastCommittedEntry(); | 881 entry = controller().GetLastCommittedEntry(); |
| 919 EXPECT_FALSE(entry->content_state().empty()); | 882 EXPECT_FALSE(entry->content_state().empty()); |
| 920 } | 883 } |
| 921 | 884 |
| 922 // Test that NavigationEntries have the correct content state after opening | 885 // Test that NavigationEntries have the correct content state after opening |
| 923 // a new window to about:blank. Prevents regression for bug 1116137. | 886 // a new window to about:blank. Prevents regression for bug 1116137. |
| 924 TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) { | 887 TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) { |
| 925 TestRenderViewHost* orig_rvh = rvh(); | 888 TestRenderViewHost* orig_rvh = rvh(); |
| 926 | 889 |
| 927 // When opening a new window, it is navigated to about:blank internally. | 890 // When opening a new window, it is navigated to about:blank internally. |
| 928 // Currently, this results in two DidNavigate events. | 891 // Currently, this results in two DidNavigate events. |
| 929 const GURL url(chrome::kAboutBlankURL); | 892 const GURL url(chrome::kAboutBlankURL); |
| 930 ViewHostMsg_FrameNavigate_Params params1; | 893 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 931 InitNavigateParams(¶ms1, 1, url, content::PAGE_TRANSITION_TYPED); | 894 contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); |
| 932 contents()->TestDidNavigate(orig_rvh, params1); | |
| 933 contents()->TestDidNavigate(orig_rvh, params1); | |
| 934 | 895 |
| 935 // Should have a content state here. | 896 // Should have a content state here. |
| 936 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 897 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
| 937 EXPECT_FALSE(entry->content_state().empty()); | 898 EXPECT_FALSE(entry->content_state().empty()); |
| 938 } | 899 } |
| 939 | 900 |
| 940 // Tests to see that webkit preferences are properly loaded and copied over | 901 // Tests to see that webkit preferences are properly loaded and copied over |
| 941 // to a WebPreferences object. | 902 // to a WebPreferences object. |
| 942 TEST_F(TabContentsTest, WebKitPrefs) { | 903 TEST_F(TabContentsTest, WebKitPrefs) { |
| 943 WebPreferences webkit_prefs = contents()->TestGetWebkitPrefs(); | 904 WebPreferences webkit_prefs = contents()->TestGetWebkitPrefs(); |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 // Tests that Javascript messages are not shown while an interstitial is | 1648 // Tests that Javascript messages are not shown while an interstitial is |
| 1688 // showing. | 1649 // showing. |
| 1689 TEST_F(TabContentsTest, NoJSMessageOnInterstitials) { | 1650 TEST_F(TabContentsTest, NoJSMessageOnInterstitials) { |
| 1690 const char kUrl[] = "http://www.badguys.com/"; | 1651 const char kUrl[] = "http://www.badguys.com/"; |
| 1691 const GURL kGURL(kUrl); | 1652 const GURL kGURL(kUrl); |
| 1692 | 1653 |
| 1693 // Start a navigation to a page | 1654 // Start a navigation to a page |
| 1694 contents()->controller().LoadURL( | 1655 contents()->controller().LoadURL( |
| 1695 kGURL, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); | 1656 kGURL, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 1696 // DidNavigate from the page | 1657 // DidNavigate from the page |
| 1697 ViewHostMsg_FrameNavigate_Params params; | 1658 contents()->TestDidNavigate(rvh(), 1, kGURL, content::PAGE_TRANSITION_TYPED); |
| 1698 InitNavigateParams(¶ms, 1, kGURL, content::PAGE_TRANSITION_TYPED); | |
| 1699 contents()->TestDidNavigate(rvh(), params); | |
| 1700 | 1659 |
| 1701 // Simulate showing an interstitial while the page is showing. | 1660 // Simulate showing an interstitial while the page is showing. |
| 1702 TestInterstitialPage::InterstitialState state = | 1661 TestInterstitialPage::InterstitialState state = |
| 1703 TestInterstitialPage::UNDECIDED; | 1662 TestInterstitialPage::UNDECIDED; |
| 1704 bool deleted = false; | 1663 bool deleted = false; |
| 1705 TestInterstitialPage* interstitial = | 1664 TestInterstitialPage* interstitial = |
| 1706 new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); | 1665 new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); |
| 1707 TestInterstitialPageStateGuard state_guard(interstitial); | 1666 TestInterstitialPageStateGuard state_guard(interstitial); |
| 1708 interstitial->Show(); | 1667 interstitial->Show(); |
| 1709 interstitial->TestDidNavigate(1, kGURL); | 1668 interstitial->TestDidNavigate(1, kGURL); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1805 | 1764 |
| 1806 // It should have a transient entry. | 1765 // It should have a transient entry. |
| 1807 EXPECT_TRUE(other_controller.GetTransientEntry()); | 1766 EXPECT_TRUE(other_controller.GetTransientEntry()); |
| 1808 | 1767 |
| 1809 // And the interstitial should be showing. | 1768 // And the interstitial should be showing. |
| 1810 EXPECT_TRUE(other_contents->showing_interstitial_page()); | 1769 EXPECT_TRUE(other_contents->showing_interstitial_page()); |
| 1811 | 1770 |
| 1812 // And the interstitial should do a reload on don't proceed. | 1771 // And the interstitial should do a reload on don't proceed. |
| 1813 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed()); | 1772 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed()); |
| 1814 } | 1773 } |
| OLD | NEW |