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

Side by Side Diff: components/sessions/core/serialized_navigation_entry_test_helper.cc

Issue 2310363002: Persist offline page info in a navigation entry if needed (Closed)
Patch Set: Fix win compiling error due to using unique_ptr map in SESSIONS_EXPORT class 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 (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/core/serialized_navigation_entry_test_helper.h" 5 #include "components/sessions/core/serialized_navigation_entry_test_helper.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "components/sessions/core/serialized_navigation_entry.h" 9 #include "components/sessions/core/serialized_navigation_entry.h"
10 #include "components/sync/base/time.h" 10 #include "components/sync/base/time.h"
(...skipping 23 matching lines...) Expand all
34 const base::Time kTimestamp = syncer::ProtoTimeToTime(100); 34 const base::Time kTimestamp = syncer::ProtoTimeToTime(100);
35 const base::string16 kSearchTerms = base::ASCIIToUTF16("my search terms"); 35 const base::string16 kSearchTerms = base::ASCIIToUTF16("my search terms");
36 const GURL kFaviconURL = GURL("http://virtual-url.com/favicon.ico"); 36 const GURL kFaviconURL = GURL("http://virtual-url.com/favicon.ico");
37 const int kHttpStatusCode = 404; 37 const int kHttpStatusCode = 404;
38 const GURL kRedirectURL0 = GURL("http://go/redirect0"); 38 const GURL kRedirectURL0 = GURL("http://go/redirect0");
39 const GURL kRedirectURL1 = GURL("http://go/redirect1"); 39 const GURL kRedirectURL1 = GURL("http://go/redirect1");
40 const GURL kOtherURL = GURL("http://other.com"); 40 const GURL kOtherURL = GURL("http://other.com");
41 const int kPageID = 10; 41 const int kPageID = 10;
42 const SerializedNavigationEntry::PasswordState kPasswordState = 42 const SerializedNavigationEntry::PasswordState kPasswordState =
43 SerializedNavigationEntry::HAS_PASSWORD_FIELD; 43 SerializedNavigationEntry::HAS_PASSWORD_FIELD;
44 const std::string kExtendedInfoKey1 = "key 1";
45 const std::string kExtendedInfoKey2 = "key 2";
46 const std::string kExtendedInfoValue1 = "value 1";
47 const std::string kExtendedInfoValue2 = "value 2";
44 48
45 } // namespace test_data 49 } // namespace test_data
46 50
47 // static 51 // static
48 void SerializedNavigationEntryTestHelper::ExpectNavigationEquals( 52 void SerializedNavigationEntryTestHelper::ExpectNavigationEquals(
49 const SerializedNavigationEntry& expected, 53 const SerializedNavigationEntry& expected,
50 const SerializedNavigationEntry& actual) { 54 const SerializedNavigationEntry& actual) {
51 EXPECT_EQ(expected.referrer_url_, actual.referrer_url_); 55 EXPECT_EQ(expected.referrer_url_, actual.referrer_url_);
52 EXPECT_EQ(expected.referrer_policy_, actual.referrer_policy_); 56 EXPECT_EQ(expected.referrer_policy_, actual.referrer_policy_);
53 EXPECT_EQ(expected.virtual_url_, actual.virtual_url_); 57 EXPECT_EQ(expected.virtual_url_, actual.virtual_url_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 navigation.has_post_data_ = test_data::kHasPostData; 95 navigation.has_post_data_ = test_data::kHasPostData;
92 navigation.post_id_ = test_data::kPostID; 96 navigation.post_id_ = test_data::kPostID;
93 navigation.original_request_url_ = test_data::kOriginalRequestURL; 97 navigation.original_request_url_ = test_data::kOriginalRequestURL;
94 navigation.is_overriding_user_agent_ = test_data::kIsOverridingUserAgent; 98 navigation.is_overriding_user_agent_ = test_data::kIsOverridingUserAgent;
95 navigation.timestamp_ = test_data::kTimestamp; 99 navigation.timestamp_ = test_data::kTimestamp;
96 navigation.search_terms_ = test_data::kSearchTerms; 100 navigation.search_terms_ = test_data::kSearchTerms;
97 navigation.favicon_url_ = test_data::kFaviconURL; 101 navigation.favicon_url_ = test_data::kFaviconURL;
98 navigation.http_status_code_ = test_data::kHttpStatusCode; 102 navigation.http_status_code_ = test_data::kHttpStatusCode;
99 navigation.password_state_ = test_data::kPasswordState; 103 navigation.password_state_ = test_data::kPasswordState;
100 104
105 navigation.extended_info_map_[test_data::kExtendedInfoKey1] =
106 test_data::kExtendedInfoValue1;
107 navigation.extended_info_map_[test_data::kExtendedInfoKey2] =
108 test_data::kExtendedInfoValue2;
109
101 navigation.redirect_chain_.push_back(test_data::kRedirectURL0); 110 navigation.redirect_chain_.push_back(test_data::kRedirectURL0);
102 navigation.redirect_chain_.push_back(test_data::kRedirectURL1); 111 navigation.redirect_chain_.push_back(test_data::kRedirectURL1);
103 navigation.redirect_chain_.push_back(test_data::kVirtualURL); 112 navigation.redirect_chain_.push_back(test_data::kVirtualURL);
104 return navigation; 113 return navigation;
105 } 114 }
106 115
107 // static 116 // static
108 void SerializedNavigationEntryTestHelper::SetReferrerPolicy( 117 void SerializedNavigationEntryTestHelper::SetReferrerPolicy(
109 int policy, 118 int policy,
110 SerializedNavigationEntry* navigation) { 119 SerializedNavigationEntry* navigation) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 163 }
155 164
156 // static 165 // static
157 void SerializedNavigationEntryTestHelper::SetTimestamp( 166 void SerializedNavigationEntryTestHelper::SetTimestamp(
158 base::Time timestamp, 167 base::Time timestamp,
159 SerializedNavigationEntry* navigation) { 168 SerializedNavigationEntry* navigation) {
160 navigation->timestamp_ = timestamp; 169 navigation->timestamp_ = timestamp;
161 } 170 }
162 171
163 } // namespace sessions 172 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698