OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_view_host.h" | 6 #include "chrome/browser/renderer_host/render_view_host.h" |
7 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
8 #include "chrome/browser/renderer_host/test_render_view_host.h" | 8 #include "chrome/browser/renderer_host/test_render_view_host.h" |
9 #include "chrome/browser/tab_contents/interstitial_page.h" | 9 #include "chrome/browser/tab_contents/interstitial_page.h" |
10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 SiteInstance* instance1 = contents()->GetSiteInstance(); | 344 SiteInstance* instance1 = contents()->GetSiteInstance(); |
345 | 345 |
346 // Navigate to URL. First URL should use first RenderViewHost. | 346 // Navigate to URL. First URL should use first RenderViewHost. |
347 const GURL url("http://www.google.com"); | 347 const GURL url("http://www.google.com"); |
348 controller()->LoadURL(url, GURL(), PageTransition::TYPED); | 348 controller()->LoadURL(url, GURL(), PageTransition::TYPED); |
349 ViewHostMsg_FrameNavigate_Params params1; | 349 ViewHostMsg_FrameNavigate_Params params1; |
350 InitNavigateParams(¶ms1, 1, url); | 350 InitNavigateParams(¶ms1, 1, url); |
351 contents()->TestDidNavigate(orig_rvh, params1); | 351 contents()->TestDidNavigate(orig_rvh, params1); |
352 | 352 |
353 // Open a new tab with the same SiteInstance, navigated to the same site. | 353 // Open a new tab with the same SiteInstance, navigated to the same site. |
354 TestWebContents* contents2 = new TestWebContents(profile(), instance1, | 354 TestWebContents* contents2 = new TestWebContents(profile(), instance1); |
355 &rvh_factory_); | |
356 params1.page_id = 2; // Need this since the site instance is the same (which | 355 params1.page_id = 2; // Need this since the site instance is the same (which |
357 // is the scope of page IDs) and we want to consider | 356 // is the scope of page IDs) and we want to consider |
358 // this a new page. | 357 // this a new page. |
359 contents2->transition_cross_site = true; | 358 contents2->transition_cross_site = true; |
360 contents2->SetupController(profile()); | 359 contents2->SetupController(profile()); |
361 contents2->controller()->LoadURL(url, GURL(), PageTransition::TYPED); | 360 contents2->controller()->LoadURL(url, GURL(), PageTransition::TYPED); |
362 contents2->TestDidNavigate(contents2->render_view_host(), params1); | 361 contents2->TestDidNavigate(contents2->render_view_host(), params1); |
363 | 362 |
364 // Navigate first tab to a new site | 363 // Navigate first tab to a new site |
365 const GURL url2a("http://www.yahoo.com"); | 364 const GURL url2a("http://www.yahoo.com"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 SiteInstance* instance1 = contents()->GetSiteInstance(); | 401 SiteInstance* instance1 = contents()->GetSiteInstance(); |
403 | 402 |
404 // Navigate to URL. | 403 // Navigate to URL. |
405 const GURL url("http://www.google.com"); | 404 const GURL url("http://www.google.com"); |
406 controller()->LoadURL(url, GURL(), PageTransition::TYPED); | 405 controller()->LoadURL(url, GURL(), PageTransition::TYPED); |
407 ViewHostMsg_FrameNavigate_Params params1; | 406 ViewHostMsg_FrameNavigate_Params params1; |
408 InitNavigateParams(¶ms1, 1, url); | 407 InitNavigateParams(¶ms1, 1, url); |
409 contents()->TestDidNavigate(orig_rvh, params1); | 408 contents()->TestDidNavigate(orig_rvh, params1); |
410 | 409 |
411 // Open a related tab to a second site. | 410 // Open a related tab to a second site. |
412 TestWebContents* contents2 = new TestWebContents(profile(), instance1, | 411 TestWebContents* contents2 = new TestWebContents(profile(), instance1); |
413 &rvh_factory_); | |
414 contents2->transition_cross_site = true; | 412 contents2->transition_cross_site = true; |
415 contents2->SetupController(profile()); | 413 contents2->SetupController(profile()); |
416 const GURL url2("http://www.yahoo.com"); | 414 const GURL url2("http://www.yahoo.com"); |
417 contents2->controller()->LoadURL(url2, GURL(), PageTransition::TYPED); | 415 contents2->controller()->LoadURL(url2, GURL(), PageTransition::TYPED); |
418 // The first RVH in contents2 isn't live yet, so we shortcut the cross site | 416 // The first RVH in contents2 isn't live yet, so we shortcut the cross site |
419 // pending. | 417 // pending. |
420 TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( | 418 TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( |
421 contents2->render_view_host()); | 419 contents2->render_view_host()); |
422 EXPECT_FALSE(contents2->cross_navigation_pending()); | 420 EXPECT_FALSE(contents2->cross_navigation_pending()); |
423 ViewHostMsg_FrameNavigate_Params params2; | 421 ViewHostMsg_FrameNavigate_Params params2; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 interstitial = | 1097 interstitial = |
1100 new TestInterstitialPage(contents(), true, url, &state, &deleted); | 1098 new TestInterstitialPage(contents(), true, url, &state, &deleted); |
1101 interstitial->Show(); | 1099 interstitial->Show(); |
1102 interstitial->TestDidNavigate(1, url); | 1100 interstitial->TestDidNavigate(1, url); |
1103 // Simulate a renderer crash. | 1101 // Simulate a renderer crash. |
1104 interstitial->TestRenderViewGone(); | 1102 interstitial->TestRenderViewGone(); |
1105 // The interstitial should have been dismissed. | 1103 // The interstitial should have been dismissed. |
1106 EXPECT_TRUE(deleted); | 1104 EXPECT_TRUE(deleted); |
1107 EXPECT_EQ(TestInterstitialPage::CANCELED, state); | 1105 EXPECT_EQ(TestInterstitialPage::CANCELED, state); |
1108 } | 1106 } |
OLD | NEW |