OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 556 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
557 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 557 EXPECT_EQ(1, delegate->navigation_state_change_count()); |
558 | 558 |
559 // There should be no visible entry (resulting in about:blank in the | 559 // There should be no visible entry (resulting in about:blank in the |
560 // omnibox), ensuring no spoof is possible. | 560 // omnibox), ensuring no spoof is possible. |
561 EXPECT_FALSE(controller.GetVisibleEntry()); | 561 EXPECT_FALSE(controller.GetVisibleEntry()); |
562 | 562 |
563 contents()->SetDelegate(NULL); | 563 contents()->SetDelegate(NULL); |
564 } | 564 } |
565 | 565 |
| 566 // Test NavigationEntry is constructed correctly. No other logic tested. |
| 567 TEST_F(NavigationControllerTest, PostURL) { |
| 568 NavigationControllerImpl& controller = controller_impl(); |
| 569 |
| 570 const GURL url("http://foo1"); |
| 571 const char* raw_data = "d\n\0a2"; |
| 572 const int raw_data_length = 5; |
| 573 const std::vector<char> data(raw_data, raw_data + raw_data_length); |
| 574 |
| 575 controller.PostURL(url, content::Referrer(), data, true); |
| 576 |
| 577 NavigationEntryImpl* post_entry = |
| 578 NavigationEntryImpl::FromNavigationEntry( |
| 579 controller.GetPendingEntry()); |
| 580 |
| 581 EXPECT_TRUE(post_entry); |
| 582 EXPECT_TRUE(post_entry->GetHasPostData()); |
| 583 EXPECT_EQ(data, post_entry->GetBrowserInitiatedPostData()); |
| 584 } |
| 585 |
566 TEST_F(NavigationControllerTest, Reload) { | 586 TEST_F(NavigationControllerTest, Reload) { |
567 NavigationControllerImpl& controller = controller_impl(); | 587 NavigationControllerImpl& controller = controller_impl(); |
568 TestNotificationTracker notifications; | 588 TestNotificationTracker notifications; |
569 RegisterForAllNavNotifications(¬ifications, &controller); | 589 RegisterForAllNavNotifications(¬ifications, &controller); |
570 | 590 |
571 const GURL url1("http://foo1"); | 591 const GURL url1("http://foo1"); |
572 | 592 |
573 controller.LoadURL( | 593 controller.LoadURL( |
574 url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); | 594 url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); |
575 EXPECT_EQ(0U, notifications.size()); | 595 EXPECT_EQ(0U, notifications.size()); |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 TabNavigation nav(0, url0, GURL(), string16(), | 2650 TabNavigation nav(0, url0, GURL(), string16(), |
2631 webkit_glue::CreateHistoryStateForURL(url0), | 2651 webkit_glue::CreateHistoryStateForURL(url0), |
2632 content::PAGE_TRANSITION_LINK); | 2652 content::PAGE_TRANSITION_LINK); |
2633 session_helper_.AssertNavigationEquals(nav, | 2653 session_helper_.AssertNavigationEquals(nav, |
2634 windows_[0]->tabs[0]->navigations[0]); | 2654 windows_[0]->tabs[0]->navigations[0]); |
2635 nav.set_url(url2); | 2655 nav.set_url(url2); |
2636 session_helper_.AssertNavigationEquals(nav, | 2656 session_helper_.AssertNavigationEquals(nav, |
2637 windows_[0]->tabs[0]->navigations[1]); | 2657 windows_[0]->tabs[0]->navigations[1]); |
2638 } | 2658 } |
2639 */ | 2659 */ |
OLD | NEW |