Chromium Code Reviews| 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.h" | 5 #include "components/sessions/core/serialized_navigation_entry.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 EXPECT_EQ(test_data::kFaviconURL.spec(), sync_data.favicon_url()); | 160 EXPECT_EQ(test_data::kFaviconURL.spec(), sync_data.favicon_url()); |
| 161 EXPECT_EQ(test_data::kHttpStatusCode, sync_data.http_status_code()); | 161 EXPECT_EQ(test_data::kHttpStatusCode, sync_data.http_status_code()); |
| 162 // The proto navigation redirects don't include the final chain entry | 162 // The proto navigation redirects don't include the final chain entry |
| 163 // (because it didn't redirect) so the lengths should differ by 1. | 163 // (because it didn't redirect) so the lengths should differ by 1. |
| 164 ASSERT_EQ(3, sync_data.navigation_redirect_size() + 1); | 164 ASSERT_EQ(3, sync_data.navigation_redirect_size() + 1); |
| 165 EXPECT_EQ(test_data::kRedirectURL0.spec(), | 165 EXPECT_EQ(test_data::kRedirectURL0.spec(), |
| 166 sync_data.navigation_redirect(0).url()); | 166 sync_data.navigation_redirect(0).url()); |
| 167 EXPECT_EQ(test_data::kRedirectURL1.spec(), | 167 EXPECT_EQ(test_data::kRedirectURL1.spec(), |
| 168 sync_data.navigation_redirect(1).url()); | 168 sync_data.navigation_redirect(1).url()); |
| 169 EXPECT_FALSE(sync_data.has_last_navigation_redirect_url()); | 169 EXPECT_FALSE(sync_data.has_last_navigation_redirect_url()); |
| 170 EXPECT_FALSE(sync_data.has_navigation_ignore_for_ntp_tiles()); | |
| 170 } | 171 } |
| 171 | 172 |
| 172 // Test that the last_navigation_redirect_url is set when needed. This test is | 173 // Test that the last_navigation_redirect_url is set when needed. This test is |
| 173 // just like the above, but with a different virtual_url. Create a | 174 // just like the above, but with a different virtual_url. Create a |
| 174 // SerializedNavigationEntry, then create a sync protocol buffer from it. The | 175 // SerializedNavigationEntry, then create a sync protocol buffer from it. The |
| 175 // protocol buffer should have a last_navigation_redirect_url. | 176 // protocol buffer should have a last_navigation_redirect_url. |
| 176 TEST(SerializedNavigationEntryTest, LastNavigationRedirectUrl) { | 177 TEST(SerializedNavigationEntryTest, LastNavigationRedirectUrl) { |
| 177 SerializedNavigationEntry navigation = | 178 SerializedNavigationEntry navigation = |
| 178 SerializedNavigationEntryTestHelper::CreateNavigationForTest(); | 179 SerializedNavigationEntryTestHelper::CreateNavigationForTest(); |
| 179 SerializedNavigationEntryTestHelper::SetVirtualURL( | 180 SerializedNavigationEntryTestHelper::SetVirtualURL( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 SerializedNavigationEntry::FromSyncData(test_data::kIndex, sync_data); | 219 SerializedNavigationEntry::FromSyncData(test_data::kIndex, sync_data); |
| 219 const ui::PageTransition constructed_transition = | 220 const ui::PageTransition constructed_transition = |
| 220 constructed_nav.transition_type(); | 221 constructed_nav.transition_type(); |
| 221 | 222 |
| 222 EXPECT_TRUE(ui::PageTransitionTypeIncludingQualifiersIs( | 223 EXPECT_TRUE(ui::PageTransitionTypeIncludingQualifiersIs( |
| 223 constructed_transition, transition)); | 224 constructed_transition, transition)); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 | 228 |
| 229 TEST(SerializedNavigationEntryTest, IgnoreForNtpTiles) { | |
|
Bernhard Bauer
2016/09/13 15:17:38
Probably for a followup, but what would be more in
| |
| 230 SerializedNavigationEntry navigation = | |
| 231 SerializedNavigationEntryTestHelper::CreateNavigationForTest(); | |
| 232 SerializedNavigationEntryTestHelper::SetTransitionType( | |
| 233 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_AUTO_BOOKMARK | | |
| 234 ui::PAGE_TRANSITION_IGNORE_FOR_NTP_TILES), | |
| 235 &navigation); | |
| 236 const sync_pb::TabNavigation sync_data = navigation.ToSyncData(); | |
| 237 EXPECT_TRUE(sync_data.navigation_ignore_for_ntp_tiles()); | |
| 238 } | |
| 239 | |
| 228 } // namespace | 240 } // namespace |
| 229 } // namespace sessions | 241 } // namespace sessions |
| OLD | NEW |