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

Side by Side Diff: components/sessions/content/content_serialized_navigation_builder_unittest.cc

Issue 2368183004: Move redirect_chain from NavigationEntry to FrameNavigationEntry. (Closed)
Patch Set: Created 4 years, 2 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/sessions/content/content_serialized_navigation_builder.h" 5 #include "components/sessions/content/content_serialized_navigation_builder.h"
6 6
7 #include "components/sessions/content/content_record_password_state.h" 7 #include "components/sessions/content/content_record_password_state.h"
8 #include "components/sessions/core/serialized_navigation_entry.h" 8 #include "components/sessions/core/serialized_navigation_entry.h"
9 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" 9 #include "components/sessions/core/serialized_navigation_entry_test_helper.h"
10 #include "content/public/browser/favicon_status.h" 10 #include "content/public/browser/favicon_status.h"
(...skipping 27 matching lines...) Expand all
38 test_data::kSearchTerms); 38 test_data::kSearchTerms);
39 SetPasswordStateInNavigation(test_data::kPasswordState, 39 SetPasswordStateInNavigation(test_data::kPasswordState,
40 navigation_entry.get()); 40 navigation_entry.get());
41 navigation_entry->GetFavicon().valid = true; 41 navigation_entry->GetFavicon().valid = true;
42 navigation_entry->GetFavicon().url = test_data::kFaviconURL; 42 navigation_entry->GetFavicon().url = test_data::kFaviconURL;
43 navigation_entry->SetHttpStatusCode(test_data::kHttpStatusCode); 43 navigation_entry->SetHttpStatusCode(test_data::kHttpStatusCode);
44 std::vector<GURL> redirect_chain; 44 std::vector<GURL> redirect_chain;
45 redirect_chain.push_back(test_data::kRedirectURL0); 45 redirect_chain.push_back(test_data::kRedirectURL0);
46 redirect_chain.push_back(test_data::kRedirectURL1); 46 redirect_chain.push_back(test_data::kRedirectURL1);
47 redirect_chain.push_back(test_data::kVirtualURL); 47 redirect_chain.push_back(test_data::kVirtualURL);
48 navigation_entry->SetRedirectChain(redirect_chain); 48 navigation_entry->SetMainFrameRedirectChain(redirect_chain);
49 return navigation_entry; 49 return navigation_entry;
50 } 50 }
51 51
52 } // namespace 52 } // namespace
53 53
54 54
55 // Create a SerializedNavigationEntry from a NavigationEntry. All its fields 55 // Create a SerializedNavigationEntry from a NavigationEntry. All its fields
56 // should match the NavigationEntry's. 56 // should match the NavigationEntry's.
57 TEST(ContentSerializedNavigationBuilderTest, FromNavigationEntry) { 57 TEST(ContentSerializedNavigationBuilderTest, FromNavigationEntry) {
58 const std::unique_ptr<content::NavigationEntry> navigation_entry( 58 const std::unique_ptr<content::NavigationEntry> navigation_entry(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 EXPECT_EQ(test_data::kPostID, new_navigation_entry->GetPostID()); 117 EXPECT_EQ(test_data::kPostID, new_navigation_entry->GetPostID());
118 EXPECT_EQ(test_data::kOriginalRequestURL, 118 EXPECT_EQ(test_data::kOriginalRequestURL,
119 new_navigation_entry->GetOriginalRequestURL()); 119 new_navigation_entry->GetOriginalRequestURL());
120 EXPECT_EQ(test_data::kIsOverridingUserAgent, 120 EXPECT_EQ(test_data::kIsOverridingUserAgent,
121 new_navigation_entry->GetIsOverridingUserAgent()); 121 new_navigation_entry->GetIsOverridingUserAgent());
122 base::string16 search_terms; 122 base::string16 search_terms;
123 new_navigation_entry->GetExtraData(kSearchTermsKey, &search_terms); 123 new_navigation_entry->GetExtraData(kSearchTermsKey, &search_terms);
124 EXPECT_EQ(test_data::kSearchTerms, search_terms); 124 EXPECT_EQ(test_data::kSearchTerms, search_terms);
125 EXPECT_EQ(test_data::kHttpStatusCode, 125 EXPECT_EQ(test_data::kHttpStatusCode,
126 new_navigation_entry->GetHttpStatusCode()); 126 new_navigation_entry->GetHttpStatusCode());
127 ASSERT_EQ(3U, new_navigation_entry->GetRedirectChain().size()); 127 ASSERT_EQ(3U, new_navigation_entry->GetMainFrameRedirectChain().size());
128 EXPECT_EQ(test_data::kRedirectURL0, 128 EXPECT_EQ(test_data::kRedirectURL0,
129 new_navigation_entry->GetRedirectChain()[0]); 129 new_navigation_entry->GetMainFrameRedirectChain()[0]);
130 EXPECT_EQ(test_data::kRedirectURL1, 130 EXPECT_EQ(test_data::kRedirectURL1,
131 new_navigation_entry->GetRedirectChain()[1]); 131 new_navigation_entry->GetMainFrameRedirectChain()[1]);
132 EXPECT_EQ(test_data::kVirtualURL, 132 EXPECT_EQ(test_data::kVirtualURL,
133 new_navigation_entry->GetRedirectChain()[2]); 133 new_navigation_entry->GetMainFrameRedirectChain()[2]);
134 } 134 }
135 135
136 TEST(ContentSerializedNavigationBuilderTest, SetPasswordState) { 136 TEST(ContentSerializedNavigationBuilderTest, SetPasswordState) {
137 std::unique_ptr<content::NavigationEntry> entry( 137 std::unique_ptr<content::NavigationEntry> entry(
138 content::NavigationEntry::Create()); 138 content::NavigationEntry::Create());
139 139
140 EXPECT_EQ(SerializedNavigationEntry::PASSWORD_STATE_UNKNOWN, 140 EXPECT_EQ(SerializedNavigationEntry::PASSWORD_STATE_UNKNOWN,
141 GetPasswordStateFromNavigation(*entry)); 141 GetPasswordStateFromNavigation(*entry));
142 SetPasswordStateInNavigation(SerializedNavigationEntry::NO_PASSWORD_FIELD, 142 SetPasswordStateInNavigation(SerializedNavigationEntry::NO_PASSWORD_FIELD,
143 entry.get()); 143 entry.get());
144 EXPECT_EQ(SerializedNavigationEntry::NO_PASSWORD_FIELD, 144 EXPECT_EQ(SerializedNavigationEntry::NO_PASSWORD_FIELD,
145 GetPasswordStateFromNavigation(*entry)); 145 GetPasswordStateFromNavigation(*entry));
146 } 146 }
147 147
148 } // namespace sessions 148 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698