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 | |
572 const int length = 5; | |
573 const unsigned char* raw_data = | |
574 reinterpret_cast<const unsigned char*>("d\n\0a2"); | |
575 std::vector<unsigned char> post_data_vector(raw_data, raw_data+length); | |
576 scoped_refptr<base::RefCountedBytes> data = | |
577 base::RefCountedBytes::TakeVector(&post_data_vector); | |
578 | |
579 controller.PostURL(url, content::Referrer(), data, true); | |
580 | |
581 NavigationEntryImpl* post_entry = | |
582 NavigationEntryImpl::FromNavigationEntry( | |
583 controller.GetPendingEntry()); | |
584 | |
585 EXPECT_TRUE(post_entry); | |
586 EXPECT_TRUE(post_entry->GetHasPostData()); | |
Charlie Reis
2012/07/30 20:36:38
That's an awkward name. Should it be HasPostData(
boliu
2012/07/30 21:53:45
This is an existing method in NavigationEntry; I'm
| |
587 EXPECT_EQ(data->front(), | |
588 post_entry->GetBrowserInitiatedPostData()->front()); | |
589 } | |
590 | |
566 TEST_F(NavigationControllerTest, Reload) { | 591 TEST_F(NavigationControllerTest, Reload) { |
567 NavigationControllerImpl& controller = controller_impl(); | 592 NavigationControllerImpl& controller = controller_impl(); |
568 TestNotificationTracker notifications; | 593 TestNotificationTracker notifications; |
569 RegisterForAllNavNotifications(¬ifications, &controller); | 594 RegisterForAllNavNotifications(¬ifications, &controller); |
570 | 595 |
571 const GURL url1("http://foo1"); | 596 const GURL url1("http://foo1"); |
572 | 597 |
573 controller.LoadURL( | 598 controller.LoadURL( |
574 url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); | 599 url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); |
575 EXPECT_EQ(0U, notifications.size()); | 600 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(), | 2655 TabNavigation nav(0, url0, GURL(), string16(), |
2631 webkit_glue::CreateHistoryStateForURL(url0), | 2656 webkit_glue::CreateHistoryStateForURL(url0), |
2632 content::PAGE_TRANSITION_LINK); | 2657 content::PAGE_TRANSITION_LINK); |
2633 session_helper_.AssertNavigationEquals(nav, | 2658 session_helper_.AssertNavigationEquals(nav, |
2634 windows_[0]->tabs[0]->navigations[0]); | 2659 windows_[0]->tabs[0]->navigations[0]); |
2635 nav.set_url(url2); | 2660 nav.set_url(url2); |
2636 session_helper_.AssertNavigationEquals(nav, | 2661 session_helper_.AssertNavigationEquals(nav, |
2637 windows_[0]->tabs[0]->navigations[1]); | 2662 windows_[0]->tabs[0]->navigations[1]); |
2638 } | 2663 } |
2639 */ | 2664 */ |
OLD | NEW |