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 "content/browser/browser_thread_impl.h" | 5 #include "content/browser/browser_thread_impl.h" |
6 #include "content/browser/browser_url_handler.h" | 6 #include "content/browser/browser_url_handler.h" |
7 #include "content/browser/mock_content_browser_client.h" | 7 #include "content/browser/mock_content_browser_client.h" |
8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/browser/site_instance.h" | 9 #include "content/browser/site_instance.h" |
10 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
11 #include "content/browser/tab_contents/navigation_entry.h" | 11 #include "content/browser/tab_contents/navigation_entry_impl.h" |
12 #include "content/browser/tab_contents/render_view_host_manager.h" | 12 #include "content/browser/tab_contents/render_view_host_manager.h" |
13 #include "content/browser/tab_contents/test_tab_contents.h" | 13 #include "content/browser/tab_contents/test_tab_contents.h" |
14 #include "content/browser/webui/empty_web_ui_factory.h" | 14 #include "content/browser/webui/empty_web_ui_factory.h" |
15 #include "content/common/test_url_constants.h" | 15 #include "content/common/test_url_constants.h" |
16 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
19 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
20 #include "content/public/common/page_transition_types.h" | 20 #include "content/public/common/page_transition_types.h" |
21 #include "content/public/common/url_constants.h" | 21 #include "content/public/common/url_constants.h" |
22 #include "content/test/test_browser_context.h" | 22 #include "content/test/test_browser_context.h" |
23 #include "content/test/test_notification_tracker.h" | 23 #include "content/test/test_notification_tracker.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "googleurl/src/url_util.h" | 25 #include "googleurl/src/url_util.h" |
26 #include "webkit/glue/webkit_glue.h" | 26 #include "webkit/glue/webkit_glue.h" |
27 | 27 |
28 using content::BrowserThread; | 28 using content::BrowserThread; |
29 using content::BrowserThreadImpl; | 29 using content::BrowserThreadImpl; |
| 30 using content::NavigationEntry; |
| 31 using content::NavigationEntryImpl; |
30 | 32 |
31 namespace { | 33 namespace { |
32 | 34 |
33 const char kChromeUISchemeButNotWebUIURL[] = "chrome://not-webui"; | 35 const char kChromeUISchemeButNotWebUIURL[] = "chrome://not-webui"; |
34 | 36 |
35 class RenderViewHostManagerTestWebUIFactory | 37 class RenderViewHostManagerTestWebUIFactory |
36 : public content::EmptyWebUIFactory { | 38 : public content::EmptyWebUIFactory { |
37 public: | 39 public: |
38 RenderViewHostManagerTestWebUIFactory() | 40 RenderViewHostManagerTestWebUIFactory() |
39 : should_create_webui_(false) { | 41 : should_create_webui_(false) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 contents()->GetMaxPageIDForSiteInstance(active_rvh()->site_instance()); | 134 contents()->GetMaxPageIDForSiteInstance(active_rvh()->site_instance()); |
133 active_rvh()->SendNavigate(max_page_id + 1, url); | 135 active_rvh()->SendNavigate(max_page_id + 1, url); |
134 | 136 |
135 // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation | 137 // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation |
136 // without making any network requests. | 138 // without making any network requests. |
137 if (old_rvh != active_rvh()) | 139 if (old_rvh != active_rvh()) |
138 old_rvh->OnSwapOutACK(); | 140 old_rvh->OnSwapOutACK(); |
139 } | 141 } |
140 | 142 |
141 bool ShouldSwapProcesses(RenderViewHostManager* manager, | 143 bool ShouldSwapProcesses(RenderViewHostManager* manager, |
142 const NavigationEntry* cur_entry, | 144 const NavigationEntryImpl* cur_entry, |
143 const NavigationEntry* new_entry) const { | 145 const NavigationEntryImpl* new_entry) const { |
144 return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry); | 146 return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry); |
145 } | 147 } |
146 | 148 |
147 private: | 149 private: |
148 RenderViewHostManagerTestBrowserClient browser_client_; | 150 RenderViewHostManagerTestBrowserClient browser_client_; |
149 content::ContentBrowserClient* old_browser_client_; | 151 content::ContentBrowserClient* old_browser_client_; |
150 }; | 152 }; |
151 | 153 |
152 // Tests that when you navigate from the New TabPage to another page, and | 154 // Tests that when you navigate from the New TabPage to another page, and |
153 // then do that same thing in another tab, that the two resulting pages have | 155 // then do that same thing in another tab, that the two resulting pages have |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 298 |
297 // Create. | 299 // Create. |
298 RenderViewHostManager manager(&tab_contents, &tab_contents); | 300 RenderViewHostManager manager(&tab_contents, &tab_contents); |
299 | 301 |
300 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); | 302 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); |
301 | 303 |
302 RenderViewHost* host; | 304 RenderViewHost* host; |
303 | 305 |
304 // 1) The first navigation. -------------------------- | 306 // 1) The first navigation. -------------------------- |
305 const GURL kUrl1("http://www.google.com/"); | 307 const GURL kUrl1("http://www.google.com/"); |
306 NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1, | 308 NavigationEntryImpl entry1( |
307 content::Referrer(), string16() /* title */, | 309 NULL /* instance */, -1 /* page_id */, kUrl1, content::Referrer(), |
308 content::PAGE_TRANSITION_TYPED, | 310 string16() /* title */, content::PAGE_TRANSITION_TYPED, |
309 false /* is_renderer_init */); | 311 false /* is_renderer_init */); |
310 host = manager.Navigate(entry1); | 312 host = manager.Navigate(entry1); |
311 | 313 |
312 // The RenderViewHost created in Init will be reused. | 314 // The RenderViewHost created in Init will be reused. |
313 EXPECT_TRUE(host == manager.current_host()); | 315 EXPECT_TRUE(host == manager.current_host()); |
314 EXPECT_FALSE(manager.pending_render_view_host()); | 316 EXPECT_FALSE(manager.pending_render_view_host()); |
315 | 317 |
316 // Commit. | 318 // Commit. |
317 manager.DidNavigateMainFrame(host); | 319 manager.DidNavigateMainFrame(host); |
318 // Commit to SiteInstance should be delayed until RenderView commit. | 320 // Commit to SiteInstance should be delayed until RenderView commit. |
319 EXPECT_TRUE(host == manager.current_host()); | 321 EXPECT_TRUE(host == manager.current_host()); |
320 ASSERT_TRUE(host); | 322 ASSERT_TRUE(host); |
321 EXPECT_FALSE(host->site_instance()->has_site()); | 323 EXPECT_FALSE(host->site_instance()->has_site()); |
322 host->site_instance()->SetSite(kUrl1); | 324 host->site_instance()->SetSite(kUrl1); |
323 | 325 |
324 // 2) Navigate to next site. ------------------------- | 326 // 2) Navigate to next site. ------------------------- |
325 const GURL kUrl2("http://www.google.com/foo"); | 327 const GURL kUrl2("http://www.google.com/foo"); |
326 NavigationEntry entry2( | 328 NavigationEntryImpl entry2( |
327 NULL /* instance */, -1 /* page_id */, kUrl2, | 329 NULL /* instance */, -1 /* page_id */, kUrl2, |
328 content::Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), | 330 content::Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), |
329 string16() /* title */, content::PAGE_TRANSITION_LINK, | 331 string16() /* title */, content::PAGE_TRANSITION_LINK, |
330 true /* is_renderer_init */); | 332 true /* is_renderer_init */); |
331 host = manager.Navigate(entry2); | 333 host = manager.Navigate(entry2); |
332 | 334 |
333 // The RenderViewHost created in Init will be reused. | 335 // The RenderViewHost created in Init will be reused. |
334 EXPECT_TRUE(host == manager.current_host()); | 336 EXPECT_TRUE(host == manager.current_host()); |
335 EXPECT_FALSE(manager.pending_render_view_host()); | 337 EXPECT_FALSE(manager.pending_render_view_host()); |
336 | 338 |
337 // Commit. | 339 // Commit. |
338 manager.DidNavigateMainFrame(host); | 340 manager.DidNavigateMainFrame(host); |
339 EXPECT_TRUE(host == manager.current_host()); | 341 EXPECT_TRUE(host == manager.current_host()); |
340 ASSERT_TRUE(host); | 342 ASSERT_TRUE(host); |
341 EXPECT_TRUE(host->site_instance()->has_site()); | 343 EXPECT_TRUE(host->site_instance()->has_site()); |
342 | 344 |
343 // 3) Cross-site navigate to next site. -------------- | 345 // 3) Cross-site navigate to next site. -------------- |
344 const GURL kUrl3("http://webkit.org/"); | 346 const GURL kUrl3("http://webkit.org/"); |
345 NavigationEntry entry3( | 347 NavigationEntryImpl entry3( |
346 NULL /* instance */, -1 /* page_id */, kUrl3, | 348 NULL /* instance */, -1 /* page_id */, kUrl3, |
347 content::Referrer(kUrl2, WebKit::WebReferrerPolicyDefault), | 349 content::Referrer(kUrl2, WebKit::WebReferrerPolicyDefault), |
348 string16() /* title */, content::PAGE_TRANSITION_LINK, | 350 string16() /* title */, content::PAGE_TRANSITION_LINK, |
349 false /* is_renderer_init */); | 351 false /* is_renderer_init */); |
350 host = manager.Navigate(entry3); | 352 host = manager.Navigate(entry3); |
351 | 353 |
352 // A new RenderViewHost should be created. | 354 // A new RenderViewHost should be created. |
353 EXPECT_TRUE(manager.pending_render_view_host()); | 355 EXPECT_TRUE(manager.pending_render_view_host()); |
354 ASSERT_EQ(host, manager.pending_render_view_host()); | 356 ASSERT_EQ(host, manager.pending_render_view_host()); |
355 | 357 |
(...skipping 26 matching lines...) Expand all Loading... |
382 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, | 384 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, |
383 content::Source<NavigationController>(&tab_contents.GetController())); | 385 content::Source<NavigationController>(&tab_contents.GetController())); |
384 | 386 |
385 // Create. | 387 // Create. |
386 RenderViewHostManager manager(&tab_contents, &tab_contents); | 388 RenderViewHostManager manager(&tab_contents, &tab_contents); |
387 | 389 |
388 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); | 390 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); |
389 | 391 |
390 // 1) The first navigation. -------------------------- | 392 // 1) The first navigation. -------------------------- |
391 const GURL kUrl1("http://www.google.com/"); | 393 const GURL kUrl1("http://www.google.com/"); |
392 NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1, | 394 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, |
393 content::Referrer(), string16() /* title */, | 395 content::Referrer(), string16() /* title */, |
394 content::PAGE_TRANSITION_TYPED, | 396 content::PAGE_TRANSITION_TYPED, |
395 false /* is_renderer_init */); | 397 false /* is_renderer_init */); |
396 RenderViewHost* host = manager.Navigate(entry1); | 398 RenderViewHost* host = manager.Navigate(entry1); |
397 | 399 |
398 // The RenderViewHost created in Init will be reused. | 400 // The RenderViewHost created in Init will be reused. |
399 EXPECT_TRUE(host == manager.current_host()); | 401 EXPECT_TRUE(host == manager.current_host()); |
400 EXPECT_FALSE(manager.pending_render_view_host()); | 402 EXPECT_FALSE(manager.pending_render_view_host()); |
401 | 403 |
402 // We should observe a notification. | 404 // We should observe a notification. |
403 EXPECT_TRUE(notifications.Check1AndReset( | 405 EXPECT_TRUE(notifications.Check1AndReset( |
404 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); | 406 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); |
405 notifications.Reset(); | 407 notifications.Reset(); |
406 | 408 |
407 // Commit. | 409 // Commit. |
408 manager.DidNavigateMainFrame(host); | 410 manager.DidNavigateMainFrame(host); |
409 | 411 |
410 // Commit to SiteInstance should be delayed until RenderView commit. | 412 // Commit to SiteInstance should be delayed until RenderView commit. |
411 EXPECT_TRUE(host == manager.current_host()); | 413 EXPECT_TRUE(host == manager.current_host()); |
412 ASSERT_TRUE(host); | 414 ASSERT_TRUE(host); |
413 EXPECT_FALSE(host->site_instance()->has_site()); | 415 EXPECT_FALSE(host->site_instance()->has_site()); |
414 host->site_instance()->SetSite(kUrl1); | 416 host->site_instance()->SetSite(kUrl1); |
415 | 417 |
416 // 2) Cross-site navigate to next site. ------------------------- | 418 // 2) Cross-site navigate to next site. ------------------------- |
417 const GURL kUrl2("http://www.example.com"); | 419 const GURL kUrl2("http://www.example.com"); |
418 NavigationEntry entry2(NULL /* instance */, -1 /* page_id */, kUrl2, | 420 NavigationEntryImpl entry2( |
419 content::Referrer(), string16() /* title */, | 421 NULL /* instance */, -1 /* page_id */, kUrl2, content::Referrer(), |
420 content::PAGE_TRANSITION_TYPED, | 422 string16() /* title */, content::PAGE_TRANSITION_TYPED, |
421 false /* is_renderer_init */); | 423 false /* is_renderer_init */); |
422 RenderViewHost* host2 = manager.Navigate(entry2); | 424 RenderViewHost* host2 = manager.Navigate(entry2); |
423 | 425 |
424 // A new RenderViewHost should be created. | 426 // A new RenderViewHost should be created. |
425 EXPECT_TRUE(manager.pending_render_view_host()); | 427 EXPECT_TRUE(manager.pending_render_view_host()); |
426 ASSERT_EQ(host2, manager.pending_render_view_host()); | 428 ASSERT_EQ(host2, manager.pending_render_view_host()); |
427 | 429 |
428 // Check that the navigation is still suspended because the old RVH | 430 // Check that the navigation is still suspended because the old RVH |
429 // is not swapped out, yet. | 431 // is not swapped out, yet. |
430 MockRenderProcessHost* test_process_host2 = | 432 MockRenderProcessHost* test_process_host2 = |
431 static_cast<MockRenderProcessHost*>(host2->process()); | 433 static_cast<MockRenderProcessHost*>(host2->process()); |
(...skipping 24 matching lines...) Expand all Loading... |
456 | 458 |
457 EXPECT_EQ(host, manager.current_host()); | 459 EXPECT_EQ(host, manager.current_host()); |
458 EXPECT_TRUE(manager.current_host()->is_swapped_out()); | 460 EXPECT_TRUE(manager.current_host()->is_swapped_out()); |
459 EXPECT_EQ(host2, manager.pending_render_view_host()); | 461 EXPECT_EQ(host2, manager.pending_render_view_host()); |
460 // There should be still no navigation messages being sent. | 462 // There should be still no navigation messages being sent. |
461 EXPECT_FALSE(test_process_host2->sink().GetUniqueMessageMatching( | 463 EXPECT_FALSE(test_process_host2->sink().GetUniqueMessageMatching( |
462 ViewMsg_Navigate::ID)); | 464 ViewMsg_Navigate::ID)); |
463 | 465 |
464 // 3) Cross-site navigate to next site before 2) has committed. -------------- | 466 // 3) Cross-site navigate to next site before 2) has committed. -------------- |
465 const GURL kUrl3("http://webkit.org/"); | 467 const GURL kUrl3("http://webkit.org/"); |
466 NavigationEntry entry3(NULL /* instance */, -1 /* page_id */, kUrl3, | 468 NavigationEntryImpl entry3(NULL /* instance */, -1 /* page_id */, kUrl3, |
467 content::Referrer(), string16() /* title */, | 469 content::Referrer(), string16() /* title */, |
468 content::PAGE_TRANSITION_TYPED, | 470 content::PAGE_TRANSITION_TYPED, |
469 false /* is_renderer_init */); | 471 false /* is_renderer_init */); |
470 RenderViewHost* host3 = manager.Navigate(entry3); | 472 RenderViewHost* host3 = manager.Navigate(entry3); |
471 | 473 |
472 // A new RenderViewHost should be created. | 474 // A new RenderViewHost should be created. |
473 EXPECT_TRUE(manager.pending_render_view_host()); | 475 EXPECT_TRUE(manager.pending_render_view_host()); |
474 ASSERT_EQ(host3, manager.pending_render_view_host()); | 476 ASSERT_EQ(host3, manager.pending_render_view_host()); |
475 | 477 |
476 EXPECT_EQ(host, manager.current_host()); | 478 EXPECT_EQ(host, manager.current_host()); |
477 EXPECT_TRUE(manager.current_host()->is_swapped_out()); | 479 EXPECT_TRUE(manager.current_host()->is_swapped_out()); |
478 | 480 |
479 // The navigation should not be suspended because the RVH |host| has been | 481 // The navigation should not be suspended because the RVH |host| has been |
(...skipping 28 matching lines...) Expand all Loading... |
508 set_should_create_webui(true); | 510 set_should_create_webui(true); |
509 BrowserThreadImpl ui_thread(BrowserThread::UI, MessageLoop::current()); | 511 BrowserThreadImpl ui_thread(BrowserThread::UI, MessageLoop::current()); |
510 SiteInstance* instance = SiteInstance::CreateSiteInstance(browser_context()); | 512 SiteInstance* instance = SiteInstance::CreateSiteInstance(browser_context()); |
511 | 513 |
512 TestTabContents tab_contents(browser_context(), instance); | 514 TestTabContents tab_contents(browser_context(), instance); |
513 RenderViewHostManager manager(&tab_contents, &tab_contents); | 515 RenderViewHostManager manager(&tab_contents, &tab_contents); |
514 | 516 |
515 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); | 517 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); |
516 | 518 |
517 const GURL kUrl(chrome::kTestNewTabURL); | 519 const GURL kUrl(chrome::kTestNewTabURL); |
518 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, kUrl, | 520 NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl, |
519 content::Referrer(), string16() /* title */, | 521 content::Referrer(), string16() /* title */, |
520 content::PAGE_TRANSITION_TYPED, | 522 content::PAGE_TRANSITION_TYPED, |
521 false /* is_renderer_init */); | 523 false /* is_renderer_init */); |
522 RenderViewHost* host = manager.Navigate(entry); | 524 RenderViewHost* host = manager.Navigate(entry); |
523 | 525 |
524 EXPECT_TRUE(host); | 526 EXPECT_TRUE(host); |
525 EXPECT_TRUE(host == manager.current_host()); | 527 EXPECT_TRUE(host == manager.current_host()); |
526 EXPECT_FALSE(manager.pending_render_view_host()); | 528 EXPECT_FALSE(manager.pending_render_view_host()); |
527 | 529 |
528 // It's important that the site instance get set on the Web UI page as soon | 530 // It's important that the site instance get set on the Web UI page as soon |
529 // as the navigation starts, rather than lazily after it commits, so we don't | 531 // as the navigation starts, rather than lazily after it commits, so we don't |
530 // try to re-use the SiteInstance/process for non DOM-UI things that may | 532 // try to re-use the SiteInstance/process for non DOM-UI things that may |
531 // get loaded in between. | 533 // get loaded in between. |
(...skipping 15 matching lines...) Expand all Loading... |
547 // Regression test for bug 46290. | 549 // Regression test for bug 46290. |
548 TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) { | 550 TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) { |
549 BrowserThreadImpl thread(BrowserThread::UI, &message_loop_); | 551 BrowserThreadImpl thread(BrowserThread::UI, &message_loop_); |
550 SiteInstance* instance = SiteInstance::CreateSiteInstance(browser_context()); | 552 SiteInstance* instance = SiteInstance::CreateSiteInstance(browser_context()); |
551 TestTabContents tab_contents(browser_context(), instance); | 553 TestTabContents tab_contents(browser_context(), instance); |
552 RenderViewHostManager manager(&tab_contents, &tab_contents); | 554 RenderViewHostManager manager(&tab_contents, &tab_contents); |
553 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); | 555 manager.Init(browser_context(), instance, MSG_ROUTING_NONE); |
554 | 556 |
555 // NTP is a Web UI page. | 557 // NTP is a Web UI page. |
556 const GURL kNtpUrl(chrome::kTestNewTabURL); | 558 const GURL kNtpUrl(chrome::kTestNewTabURL); |
557 NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl, | 559 NavigationEntryImpl ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl, |
558 content::Referrer(), string16() /* title */, | 560 content::Referrer(), string16() /* title */, |
559 content::PAGE_TRANSITION_TYPED, | 561 content::PAGE_TRANSITION_TYPED, |
560 false /* is_renderer_init */); | 562 false /* is_renderer_init */); |
561 | 563 |
562 // A URL with the Chrome UI scheme, that isn't handled by Web UI. | 564 // A URL with the Chrome UI scheme, that isn't handled by Web UI. |
563 GURL about_url(kChromeUISchemeButNotWebUIURL); | 565 GURL about_url(kChromeUISchemeButNotWebUIURL); |
564 NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url, | 566 NavigationEntryImpl about_entry( |
565 content::Referrer(), string16() /* title */, | 567 NULL /* instance */, -1 /* page_id */, about_url, |
566 content::PAGE_TRANSITION_TYPED, | 568 content::Referrer(), string16() /* title */, |
567 false /* is_renderer_init */); | 569 content::PAGE_TRANSITION_TYPED, false /* is_renderer_init */); |
568 | 570 |
569 EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry)); | 571 EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry)); |
570 } | 572 } |
571 | 573 |
572 // Tests that we don't end up in an inconsistent state if a page does a back and | 574 // Tests that we don't end up in an inconsistent state if a page does a back and |
573 // then reload. http://crbug.com/51680 | 575 // then reload. http://crbug.com/51680 |
574 TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { | 576 TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { |
575 const GURL kUrl1("http://www.google.com/"); | 577 const GURL kUrl1("http://www.google.com/"); |
576 const GURL kUrl2("http://www.evil-site.com/"); | 578 const GURL kUrl2("http://www.evil-site.com/"); |
577 | 579 |
(...skipping 25 matching lines...) Expand all Loading... |
603 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(kUrl2)); | 605 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(kUrl2)); |
604 contents()->DidNavigate(evil_rvh, params); | 606 contents()->DidNavigate(evil_rvh, params); |
605 | 607 |
606 // That should have cancelled the pending RVH, and the evil RVH should be the | 608 // That should have cancelled the pending RVH, and the evil RVH should be the |
607 // current one. | 609 // current one. |
608 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> | 610 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> |
609 pending_render_view_host() == NULL); | 611 pending_render_view_host() == NULL); |
610 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); | 612 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); |
611 | 613 |
612 // Also we should not have a pending navigation entry. | 614 // Also we should not have a pending navigation entry. |
613 content::NavigationEntry* entry = | 615 NavigationEntry* entry = contents()->GetController().GetActiveEntry(); |
614 contents()->GetController().GetActiveEntry(); | |
615 ASSERT_TRUE(entry != NULL); | 616 ASSERT_TRUE(entry != NULL); |
616 EXPECT_EQ(kUrl2, entry->GetURL()); | 617 EXPECT_EQ(kUrl2, entry->GetURL()); |
617 } | 618 } |
OLD | NEW |