Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 1440573003: Remove ScopedVector from NavigationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 2755
2756 NavigationControllerImpl::set_max_entry_count_for_testing(original_count); 2756 NavigationControllerImpl::set_max_entry_count_for_testing(original_count);
2757 } 2757 }
2758 2758
2759 // Tests that we can do a restore and navigate to the restored entries and 2759 // Tests that we can do a restore and navigate to the restored entries and
2760 // everything is updated properly. This can be tricky since there is no 2760 // everything is updated properly. This can be tricky since there is no
2761 // SiteInstance for the entries created initially. 2761 // SiteInstance for the entries created initially.
2762 TEST_F(NavigationControllerTest, RestoreNavigate) { 2762 TEST_F(NavigationControllerTest, RestoreNavigate) {
2763 // Create a NavigationController with a restored set of tabs. 2763 // Create a NavigationController with a restored set of tabs.
2764 GURL url("http://foo"); 2764 GURL url("http://foo");
2765 ScopedVector<NavigationEntry> entries; 2765 std::vector<scoped_ptr<NavigationEntry>> entries;
2766 scoped_ptr<NavigationEntry> entry = 2766 scoped_ptr<NavigationEntry> entry =
2767 NavigationControllerImpl::CreateNavigationEntry( 2767 NavigationControllerImpl::CreateNavigationEntry(
2768 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), 2768 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(),
2769 browser_context()); 2769 browser_context());
2770 entry->SetPageID(0); 2770 entry->SetPageID(0);
2771 entry->SetTitle(base::ASCIIToUTF16("Title")); 2771 entry->SetTitle(base::ASCIIToUTF16("Title"));
2772 entry->SetPageState(PageState::CreateFromEncodedData("state")); 2772 entry->SetPageState(PageState::CreateFromEncodedData("state"));
2773 const base::Time timestamp = base::Time::Now(); 2773 const base::Time timestamp = base::Time::Now();
2774 entry->SetTimestamp(timestamp); 2774 entry->SetTimestamp(timestamp);
2775 entries.push_back(entry.Pass()); 2775 entries.push_back(entry.Pass());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 2828
2829 // Timestamp should have been updated. 2829 // Timestamp should have been updated.
2830 EXPECT_GE(our_controller.GetEntryAtIndex(0)->GetTimestamp(), timestamp); 2830 EXPECT_GE(our_controller.GetEntryAtIndex(0)->GetTimestamp(), timestamp);
2831 } 2831 }
2832 2832
2833 // Tests that we can still navigate to a restored entry after a different 2833 // Tests that we can still navigate to a restored entry after a different
2834 // navigation fails and clears the pending entry. http://crbug.com/90085 2834 // navigation fails and clears the pending entry. http://crbug.com/90085
2835 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { 2835 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
2836 // Create a NavigationController with a restored set of tabs. 2836 // Create a NavigationController with a restored set of tabs.
2837 GURL url("http://foo"); 2837 GURL url("http://foo");
2838 ScopedVector<NavigationEntry> entries; 2838 std::vector<scoped_ptr<NavigationEntry>> entries;
2839 scoped_ptr<NavigationEntry> new_entry = 2839 scoped_ptr<NavigationEntry> new_entry =
2840 NavigationControllerImpl::CreateNavigationEntry( 2840 NavigationControllerImpl::CreateNavigationEntry(
2841 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), 2841 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(),
2842 browser_context()); 2842 browser_context());
2843 new_entry->SetPageID(0); 2843 new_entry->SetPageID(0);
2844 new_entry->SetTitle(base::ASCIIToUTF16("Title")); 2844 new_entry->SetTitle(base::ASCIIToUTF16("Title"));
2845 new_entry->SetPageState(PageState::CreateFromEncodedData("state")); 2845 new_entry->SetPageState(PageState::CreateFromEncodedData("state"));
2846 entries.push_back(new_entry.Pass()); 2846 entries.push_back(new_entry.Pass());
2847 scoped_ptr<WebContentsImpl> our_contents(static_cast<WebContentsImpl*>( 2847 scoped_ptr<WebContentsImpl> our_contents(static_cast<WebContentsImpl*>(
2848 WebContents::Create(WebContents::CreateParams(browser_context())))); 2848 WebContents::Create(WebContents::CreateParams(browser_context()))));
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
4338 4338
4339 // Tests that we can navigate to the restored entries 4339 // Tests that we can navigate to the restored entries
4340 // imported by CopyStateFromAndPrune. 4340 // imported by CopyStateFromAndPrune.
4341 TEST_F(NavigationControllerTest, CopyRestoredStateAndNavigate) { 4341 TEST_F(NavigationControllerTest, CopyRestoredStateAndNavigate) {
4342 const GURL kRestoredUrls[] = { 4342 const GURL kRestoredUrls[] = {
4343 GURL("http://site1.com"), 4343 GURL("http://site1.com"),
4344 GURL("http://site2.com"), 4344 GURL("http://site2.com"),
4345 }; 4345 };
4346 const GURL kInitialUrl("http://site3.com"); 4346 const GURL kInitialUrl("http://site3.com");
4347 4347
4348 ScopedVector<NavigationEntry> entries; 4348 std::vector<scoped_ptr<NavigationEntry>> entries;
4349 for (size_t i = 0; i < arraysize(kRestoredUrls); ++i) { 4349 for (size_t i = 0; i < arraysize(kRestoredUrls); ++i) {
4350 scoped_ptr<NavigationEntry> entry = 4350 scoped_ptr<NavigationEntry> entry =
4351 NavigationControllerImpl::CreateNavigationEntry( 4351 NavigationControllerImpl::CreateNavigationEntry(
4352 kRestoredUrls[i], Referrer(), ui::PAGE_TRANSITION_RELOAD, false, 4352 kRestoredUrls[i], Referrer(), ui::PAGE_TRANSITION_RELOAD, false,
4353 std::string(), browser_context()); 4353 std::string(), browser_context());
4354 entry->SetPageID(static_cast<int>(i)); 4354 entry->SetPageID(static_cast<int>(i));
4355 entries.push_back(entry.Pass()); 4355 entries.push_back(entry.Pass());
4356 } 4356 }
4357 4357
4358 // Create a WebContents with restored entries. 4358 // Create a WebContents with restored entries.
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
5051 EXPECT_EQ(default_ssl_status.connection_status, 5051 EXPECT_EQ(default_ssl_status.connection_status,
5052 details.ssl_status.connection_status); 5052 details.ssl_status.connection_status);
5053 EXPECT_EQ(default_ssl_status.content_status, 5053 EXPECT_EQ(default_ssl_status.content_status,
5054 details.ssl_status.content_status); 5054 details.ssl_status.content_status);
5055 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); 5055 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size());
5056 5056
5057 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); 5057 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count());
5058 } 5058 }
5059 5059
5060 } // namespace content 5060 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698