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

Side by Side Diff: components/sessions/serialized_navigation_entry_unittest.cc

Issue 128193002: Include the referrer policy in sync'd tab navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/sessions/serialized_navigation_entry.h" 5 #include "components/sessions/serialized_navigation_entry.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 navigation_entry->GetFavicon().url = kFaviconURL; 71 navigation_entry->GetFavicon().url = kFaviconURL;
72 navigation_entry->SetHttpStatusCode(kHttpStatusCode); 72 navigation_entry->SetHttpStatusCode(kHttpStatusCode);
73 return navigation_entry.Pass(); 73 return navigation_entry.Pass();
74 } 74 }
75 75
76 // Create a sync_pb::TabNavigation from the constants above. 76 // Create a sync_pb::TabNavigation from the constants above.
77 sync_pb::TabNavigation MakeSyncDataForTest() { 77 sync_pb::TabNavigation MakeSyncDataForTest() {
78 sync_pb::TabNavigation sync_data; 78 sync_pb::TabNavigation sync_data;
79 sync_data.set_virtual_url(kVirtualURL.spec()); 79 sync_data.set_virtual_url(kVirtualURL.spec());
80 sync_data.set_referrer(kReferrer.url.spec()); 80 sync_data.set_referrer(kReferrer.url.spec());
81 sync_data.set_referrer_policy(blink::WebReferrerPolicyOrigin);
81 sync_data.set_title(base::UTF16ToUTF8(kTitle)); 82 sync_data.set_title(base::UTF16ToUTF8(kTitle));
82 sync_data.set_state(kPageState.ToEncodedData()); 83 sync_data.set_state(kPageState.ToEncodedData());
83 sync_data.set_page_transition( 84 sync_data.set_page_transition(
84 sync_pb::SyncEnums_PageTransition_AUTO_SUBFRAME); 85 sync_pb::SyncEnums_PageTransition_AUTO_SUBFRAME);
85 sync_data.set_unique_id(kUniqueID); 86 sync_data.set_unique_id(kUniqueID);
86 sync_data.set_timestamp_msec(syncer::TimeToProtoTime(kTimestamp)); 87 sync_data.set_timestamp_msec(syncer::TimeToProtoTime(kTimestamp));
87 sync_data.set_redirect_type(sync_pb::SyncEnums::CLIENT_REDIRECT); 88 sync_data.set_redirect_type(sync_pb::SyncEnums::CLIENT_REDIRECT);
88 sync_data.set_navigation_home_page(true); 89 sync_data.set_navigation_home_page(true);
89 sync_data.set_search_terms(base::UTF16ToUTF8(kSearchTerms)); 90 sync_data.set_search_terms(base::UTF16ToUTF8(kSearchTerms));
90 sync_data.set_favicon_url(kFaviconURL.spec()); 91 sync_data.set_favicon_url(kFaviconURL.spec());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // sbould be set to the default value otherwise. 147 // sbould be set to the default value otherwise.
147 TEST(SerializedNavigationEntryTest, FromSyncData) { 148 TEST(SerializedNavigationEntryTest, FromSyncData) {
148 const sync_pb::TabNavigation sync_data = MakeSyncDataForTest(); 149 const sync_pb::TabNavigation sync_data = MakeSyncDataForTest();
149 150
150 const SerializedNavigationEntry& navigation = 151 const SerializedNavigationEntry& navigation =
151 SerializedNavigationEntry::FromSyncData(kIndex, sync_data); 152 SerializedNavigationEntry::FromSyncData(kIndex, sync_data);
152 153
153 EXPECT_EQ(kIndex, navigation.index()); 154 EXPECT_EQ(kIndex, navigation.index());
154 EXPECT_EQ(kUniqueID, navigation.unique_id()); 155 EXPECT_EQ(kUniqueID, navigation.unique_id());
155 EXPECT_EQ(kReferrer.url, navigation.referrer().url); 156 EXPECT_EQ(kReferrer.url, navigation.referrer().url);
156 EXPECT_EQ(blink::WebReferrerPolicyDefault, navigation.referrer().policy); 157 EXPECT_EQ(blink::WebReferrerPolicyOrigin, navigation.referrer().policy);
157 EXPECT_EQ(kVirtualURL, navigation.virtual_url()); 158 EXPECT_EQ(kVirtualURL, navigation.virtual_url());
158 EXPECT_EQ(kTitle, navigation.title()); 159 EXPECT_EQ(kTitle, navigation.title());
159 EXPECT_EQ(kPageState, navigation.page_state()); 160 EXPECT_EQ(kPageState, navigation.page_state());
160 EXPECT_EQ(kTransitionType, navigation.transition_type()); 161 EXPECT_EQ(kTransitionType, navigation.transition_type());
161 EXPECT_FALSE(navigation.has_post_data()); 162 EXPECT_FALSE(navigation.has_post_data());
162 EXPECT_EQ(-1, navigation.post_id()); 163 EXPECT_EQ(-1, navigation.post_id());
163 EXPECT_EQ(GURL(), navigation.original_request_url()); 164 EXPECT_EQ(GURL(), navigation.original_request_url());
164 EXPECT_FALSE(navigation.is_overriding_user_agent()); 165 EXPECT_FALSE(navigation.is_overriding_user_agent());
165 EXPECT_TRUE(navigation.timestamp().is_null()); 166 EXPECT_TRUE(navigation.timestamp().is_null());
166 EXPECT_EQ(kSearchTerms, navigation.search_terms()); 167 EXPECT_EQ(kSearchTerms, navigation.search_terms());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 const content::PageTransition constructed_transition = 291 const content::PageTransition constructed_transition =
291 constructed_nav.transition_type(); 292 constructed_nav.transition_type();
292 293
293 EXPECT_EQ(transition, constructed_transition); 294 EXPECT_EQ(transition, constructed_transition);
294 } 295 }
295 } 296 }
296 } 297 }
297 298
298 } // namespace 299 } // namespace
299 } // namespace sessions 300 } // namespace sessions
OLDNEW
« no previous file with comments | « components/sessions/serialized_navigation_entry.cc ('k') | sync/protocol/proto_value_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698