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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // The redirect chain only syncs one way. | 100 // The redirect chain only syncs one way. |
101 } | 101 } |
102 | 102 |
103 // Create a SerializedNavigationEntry, pickle it, then create another one by | 103 // Create a SerializedNavigationEntry, pickle it, then create another one by |
104 // unpickling. The new one should match the old one except for fields | 104 // unpickling. The new one should match the old one except for fields |
105 // that aren't pickled, which should be set to default values. | 105 // that aren't pickled, which should be set to default values. |
106 TEST(SerializedNavigationEntryTest, Pickle) { | 106 TEST(SerializedNavigationEntryTest, Pickle) { |
107 const SerializedNavigationEntry old_navigation = | 107 const SerializedNavigationEntry old_navigation = |
108 SerializedNavigationEntryTestHelper::CreateNavigationForTest(); | 108 SerializedNavigationEntryTestHelper::CreateNavigationForTest(); |
109 | 109 |
110 Pickle pickle; | 110 base::Pickle pickle; |
111 old_navigation.WriteToPickle(30000, &pickle); | 111 old_navigation.WriteToPickle(30000, &pickle); |
112 | 112 |
113 SerializedNavigationEntry new_navigation; | 113 SerializedNavigationEntry new_navigation; |
114 PickleIterator pickle_iterator(pickle); | 114 base::PickleIterator pickle_iterator(pickle); |
115 EXPECT_TRUE(new_navigation.ReadFromPickle(&pickle_iterator)); | 115 EXPECT_TRUE(new_navigation.ReadFromPickle(&pickle_iterator)); |
116 | 116 |
117 // Fields that are written to the pickle. | 117 // Fields that are written to the pickle. |
118 EXPECT_EQ(test_data::kIndex, new_navigation.index()); | 118 EXPECT_EQ(test_data::kIndex, new_navigation.index()); |
119 EXPECT_EQ(test_data::kReferrerURL, new_navigation.referrer_url()); | 119 EXPECT_EQ(test_data::kReferrerURL, new_navigation.referrer_url()); |
120 EXPECT_EQ(test_data::kReferrerPolicy, new_navigation.referrer_policy()); | 120 EXPECT_EQ(test_data::kReferrerPolicy, new_navigation.referrer_policy()); |
121 EXPECT_EQ(test_data::kVirtualURL, new_navigation.virtual_url()); | 121 EXPECT_EQ(test_data::kVirtualURL, new_navigation.virtual_url()); |
122 EXPECT_EQ(test_data::kTitle, new_navigation.title()); | 122 EXPECT_EQ(test_data::kTitle, new_navigation.title()); |
123 EXPECT_EQ(test_data::kTransitionType, new_navigation.transition_type()); | 123 EXPECT_EQ(test_data::kTransitionType, new_navigation.transition_type()); |
124 EXPECT_EQ(test_data::kHasPostData, new_navigation.has_post_data()); | 124 EXPECT_EQ(test_data::kHasPostData, new_navigation.has_post_data()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 const ui::PageTransition constructed_transition = | 218 const ui::PageTransition constructed_transition = |
219 constructed_nav.transition_type(); | 219 constructed_nav.transition_type(); |
220 | 220 |
221 EXPECT_EQ(transition, constructed_transition); | 221 EXPECT_EQ(transition, constructed_transition); |
222 } | 222 } |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 } // namespace | 226 } // namespace |
227 } // namespace sessions | 227 } // namespace sessions |
OLD | NEW |