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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 const GURL kNewURL("http://eh"); | 416 const GURL kNewURL("http://eh"); |
417 controller().LoadURL(kNewURL, GURL(), PageTransition::TYPED, std::string()); | 417 controller().LoadURL(kNewURL, GURL(), PageTransition::TYPED, std::string()); |
418 EXPECT_EQ(0U, notifications.size()); | 418 EXPECT_EQ(0U, notifications.size()); |
419 EXPECT_EQ(-1, controller().pending_entry_index()); | 419 EXPECT_EQ(-1, controller().pending_entry_index()); |
420 EXPECT_TRUE(controller().pending_entry()); | 420 EXPECT_TRUE(controller().pending_entry()); |
421 EXPECT_EQ(-1, controller().last_committed_entry_index()); | 421 EXPECT_EQ(-1, controller().last_committed_entry_index()); |
422 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 422 EXPECT_EQ(1, delegate->navigation_state_change_count()); |
423 | 423 |
424 // It may abort before committing, if it's a download or due to a stop or | 424 // It may abort before committing, if it's a download or due to a stop or |
425 // a new navigation from the user. | 425 // a new navigation from the user. |
426 rvh()->TestOnMessageReceived( | 426 { |
jam
2011/10/05 17:12:06
nit: here and below, no need for scoping
mkosiba (inactive)
2011/10/05 17:53:18
I can remove the scoping. I was trying to make the
| |
427 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 427 ViewHostMsg_DidFailProvisionalLoadWithError_Params ipc_params; |
428 1, // frame_id | 428 ipc_params.frame_id = 1; |
429 true, // is_main_frame | 429 ipc_params.is_main_frame = true; |
430 net::ERR_ABORTED, // error | 430 ipc_params.error_code = net::ERR_ABORTED; |
431 kNewURL, // url | 431 ipc_params.error_description = string16(); |
432 false)); // repost | 432 ipc_params.url = kNewURL; |
433 ipc_params.showing_repost_interstitial = false; | |
434 rvh()->TestOnMessageReceived( | |
435 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | |
436 ipc_params)); | |
437 } | |
433 | 438 |
434 // This should clear the pending entry and notify of a navigation state | 439 // This should clear the pending entry and notify of a navigation state |
435 // change, so that we do not keep displaying kNewURL. | 440 // change, so that we do not keep displaying kNewURL. |
436 EXPECT_EQ(-1, controller().pending_entry_index()); | 441 EXPECT_EQ(-1, controller().pending_entry_index()); |
437 EXPECT_FALSE(controller().pending_entry()); | 442 EXPECT_FALSE(controller().pending_entry()); |
438 EXPECT_EQ(-1, controller().last_committed_entry_index()); | 443 EXPECT_EQ(-1, controller().last_committed_entry_index()); |
439 EXPECT_EQ(2, delegate->navigation_state_change_count()); | 444 EXPECT_EQ(2, delegate->navigation_state_change_count()); |
440 | 445 |
441 contents()->set_delegate(NULL); | 446 contents()->set_delegate(NULL); |
442 } | 447 } |
(...skipping 29 matching lines...) Expand all Loading... | |
472 false, // opener | 477 false, // opener |
473 kNewURL, // old url | 478 kNewURL, // old url |
474 kRedirectURL)); // new url | 479 kRedirectURL)); // new url |
475 | 480 |
476 // We don't want to change the NavigationEntry's url, in case it cancels. | 481 // We don't want to change the NavigationEntry's url, in case it cancels. |
477 // Prevents regression of http://crbug.com/77786. | 482 // Prevents regression of http://crbug.com/77786. |
478 EXPECT_EQ(kNewURL, controller().pending_entry()->url()); | 483 EXPECT_EQ(kNewURL, controller().pending_entry()->url()); |
479 | 484 |
480 // It may abort before committing, if it's a download or due to a stop or | 485 // It may abort before committing, if it's a download or due to a stop or |
481 // a new navigation from the user. | 486 // a new navigation from the user. |
482 rvh()->TestOnMessageReceived( | 487 { |
483 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 488 ViewHostMsg_DidFailProvisionalLoadWithError_Params ipc_params; |
484 1, // frame_id | 489 ipc_params.frame_id = 1; |
485 true, // is_main_frame | 490 ipc_params.is_main_frame = true; |
486 net::ERR_ABORTED, // error | 491 ipc_params.error_code = net::ERR_ABORTED; |
487 kRedirectURL, // url | 492 ipc_params.error_description = string16(); |
488 false)); // repost | 493 ipc_params.url = kRedirectURL; |
494 ipc_params.showing_repost_interstitial = false; | |
495 rvh()->TestOnMessageReceived( | |
496 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | |
497 ipc_params)); | |
498 } | |
489 | 499 |
490 // This should clear the pending entry and notify of a navigation state | 500 // This should clear the pending entry and notify of a navigation state |
491 // change, so that we do not keep displaying kNewURL. | 501 // change, so that we do not keep displaying kNewURL. |
492 EXPECT_EQ(-1, controller().pending_entry_index()); | 502 EXPECT_EQ(-1, controller().pending_entry_index()); |
493 EXPECT_FALSE(controller().pending_entry()); | 503 EXPECT_FALSE(controller().pending_entry()); |
494 EXPECT_EQ(-1, controller().last_committed_entry_index()); | 504 EXPECT_EQ(-1, controller().last_committed_entry_index()); |
495 EXPECT_EQ(2, delegate->navigation_state_change_count()); | 505 EXPECT_EQ(2, delegate->navigation_state_change_count()); |
496 | 506 |
497 contents()->set_delegate(NULL); | 507 contents()->set_delegate(NULL); |
498 } | 508 } |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1522 our_controller.pending_entry()); | 1532 our_controller.pending_entry()); |
1523 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->page_id()); | 1533 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->page_id()); |
1524 EXPECT_EQ(NavigationEntry::RESTORE_NONE, | 1534 EXPECT_EQ(NavigationEntry::RESTORE_NONE, |
1525 our_controller.GetEntryAtIndex(0)->restore_type()); | 1535 our_controller.GetEntryAtIndex(0)->restore_type()); |
1526 EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); | 1536 EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); |
1527 | 1537 |
1528 // This pending navigation may have caused a different navigation to fail, | 1538 // This pending navigation may have caused a different navigation to fail, |
1529 // which causes the pending entry to be cleared. | 1539 // which causes the pending entry to be cleared. |
1530 TestRenderViewHost* rvh = | 1540 TestRenderViewHost* rvh = |
1531 static_cast<TestRenderViewHost*>(our_contents.render_view_host()); | 1541 static_cast<TestRenderViewHost*>(our_contents.render_view_host()); |
1532 rvh->TestOnMessageReceived( | 1542 { |
1533 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 1543 ViewHostMsg_DidFailProvisionalLoadWithError_Params ipc_params; |
1534 1, // frame_id | 1544 ipc_params.frame_id = 1; |
1535 true, // is_main_frame | 1545 ipc_params.is_main_frame = true; |
1536 net::ERR_ABORTED, // error | 1546 ipc_params.error_code = net::ERR_ABORTED; |
1537 url, // url | 1547 ipc_params.error_description = string16(); |
1538 false)); // repost | 1548 ipc_params.url = url; |
1549 ipc_params.showing_repost_interstitial = false; | |
1550 rvh->TestOnMessageReceived( | |
1551 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | |
1552 ipc_params)); | |
1553 } | |
1539 | 1554 |
1540 // Now the pending restored entry commits. | 1555 // Now the pending restored entry commits. |
1541 ViewHostMsg_FrameNavigate_Params params; | 1556 ViewHostMsg_FrameNavigate_Params params; |
1542 params.page_id = 0; | 1557 params.page_id = 0; |
1543 params.url = url; | 1558 params.url = url; |
1544 params.transition = PageTransition::LINK; | 1559 params.transition = PageTransition::LINK; |
1545 params.should_update_history = false; | 1560 params.should_update_history = false; |
1546 params.gesture = NavigationGestureUser; | 1561 params.gesture = NavigationGestureUser; |
1547 params.is_post = false; | 1562 params.is_post = false; |
1548 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); | 1563 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2307 TabNavigation nav(0, url0, GURL(), string16(), | 2322 TabNavigation nav(0, url0, GURL(), string16(), |
2308 webkit_glue::CreateHistoryStateForURL(url0), | 2323 webkit_glue::CreateHistoryStateForURL(url0), |
2309 PageTransition::LINK); | 2324 PageTransition::LINK); |
2310 session_helper_.AssertNavigationEquals(nav, | 2325 session_helper_.AssertNavigationEquals(nav, |
2311 windows_[0]->tabs[0]->navigations[0]); | 2326 windows_[0]->tabs[0]->navigations[0]); |
2312 nav.set_url(url2); | 2327 nav.set_url(url2); |
2313 session_helper_.AssertNavigationEquals(nav, | 2328 session_helper_.AssertNavigationEquals(nav, |
2314 windows_[0]->tabs[0]->navigations[1]); | 2329 windows_[0]->tabs[0]->navigations[1]); |
2315 } | 2330 } |
2316 */ | 2331 */ |
OLD | NEW |