OLD | NEW |
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 Loading... |
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 kOfflinePageInfo = "persist=1 reason=download"; |
44 | 45 |
45 } // namespace test_data | 46 } // namespace test_data |
46 | 47 |
47 // static | 48 // static |
48 void SerializedNavigationEntryTestHelper::ExpectNavigationEquals( | 49 void SerializedNavigationEntryTestHelper::ExpectNavigationEquals( |
49 const SerializedNavigationEntry& expected, | 50 const SerializedNavigationEntry& expected, |
50 const SerializedNavigationEntry& actual) { | 51 const SerializedNavigationEntry& actual) { |
51 EXPECT_EQ(expected.referrer_url_, actual.referrer_url_); | 52 EXPECT_EQ(expected.referrer_url_, actual.referrer_url_); |
52 EXPECT_EQ(expected.referrer_policy_, actual.referrer_policy_); | 53 EXPECT_EQ(expected.referrer_policy_, actual.referrer_policy_); |
53 EXPECT_EQ(expected.virtual_url_, actual.virtual_url_); | 54 EXPECT_EQ(expected.virtual_url_, actual.virtual_url_); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 navigation.transition_type_ = test_data::kTransitionType; | 91 navigation.transition_type_ = test_data::kTransitionType; |
91 navigation.has_post_data_ = test_data::kHasPostData; | 92 navigation.has_post_data_ = test_data::kHasPostData; |
92 navigation.post_id_ = test_data::kPostID; | 93 navigation.post_id_ = test_data::kPostID; |
93 navigation.original_request_url_ = test_data::kOriginalRequestURL; | 94 navigation.original_request_url_ = test_data::kOriginalRequestURL; |
94 navigation.is_overriding_user_agent_ = test_data::kIsOverridingUserAgent; | 95 navigation.is_overriding_user_agent_ = test_data::kIsOverridingUserAgent; |
95 navigation.timestamp_ = test_data::kTimestamp; | 96 navigation.timestamp_ = test_data::kTimestamp; |
96 navigation.search_terms_ = test_data::kSearchTerms; | 97 navigation.search_terms_ = test_data::kSearchTerms; |
97 navigation.favicon_url_ = test_data::kFaviconURL; | 98 navigation.favicon_url_ = test_data::kFaviconURL; |
98 navigation.http_status_code_ = test_data::kHttpStatusCode; | 99 navigation.http_status_code_ = test_data::kHttpStatusCode; |
99 navigation.password_state_ = test_data::kPasswordState; | 100 navigation.password_state_ = test_data::kPasswordState; |
| 101 navigation.offline_page_info_ = test_data::kOfflinePageInfo; |
100 | 102 |
101 navigation.redirect_chain_.push_back(test_data::kRedirectURL0); | 103 navigation.redirect_chain_.push_back(test_data::kRedirectURL0); |
102 navigation.redirect_chain_.push_back(test_data::kRedirectURL1); | 104 navigation.redirect_chain_.push_back(test_data::kRedirectURL1); |
103 navigation.redirect_chain_.push_back(test_data::kVirtualURL); | 105 navigation.redirect_chain_.push_back(test_data::kVirtualURL); |
104 return navigation; | 106 return navigation; |
105 } | 107 } |
106 | 108 |
107 // static | 109 // static |
108 void SerializedNavigationEntryTestHelper::SetReferrerPolicy( | 110 void SerializedNavigationEntryTestHelper::SetReferrerPolicy( |
109 int policy, | 111 int policy, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 156 } |
155 | 157 |
156 // static | 158 // static |
157 void SerializedNavigationEntryTestHelper::SetTimestamp( | 159 void SerializedNavigationEntryTestHelper::SetTimestamp( |
158 base::Time timestamp, | 160 base::Time timestamp, |
159 SerializedNavigationEntry* navigation) { | 161 SerializedNavigationEntry* navigation) { |
160 navigation->timestamp_ = timestamp; | 162 navigation->timestamp_ = timestamp; |
161 } | 163 } |
162 | 164 |
163 } // namespace sessions | 165 } // namespace sessions |
OLD | NEW |