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

Side by Side Diff: chrome/browser/sessions/session_common_utils_unittest.cc

Issue 2759333002: Move chrome-specific SerializedNavigation code to chrome/. (Closed)
Patch Set: Fix Android Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/sessions/session_common_utils.h" 5 #include "chrome/browser/sessions/session_common_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "components/sessions/content/content_serialized_navigation_builder.h" 9 #include "components/sessions/content/content_serialized_navigation_builder.h"
10 #include "components/sessions/core/serialized_navigation_entry.h" 10 #include "components/sessions/core/serialized_navigation_entry.h"
11 #include "components/sessions/core/session_types.h" 11 #include "components/sessions/core/session_types.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace { 15 namespace {
16 16
17 void AppendNavigations(sessions::SessionTab* tab, 17 void AppendNavigations(sessions::SessionTab* tab,
18 content::NavigationEntry* entry) { 18 content::NavigationEntry* entry) {
19 tab->navigations.push_back( 19 tab->navigations.push_back(
20 sessions::ContentSerializedNavigationBuilder::FromNavigationEntry( 20 sessions::ContentSerializedNavigationBuilder::FromNavigationEntry(
21 0, *entry)); 21 0, *entry));
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25
25 class SessionCommonUtilTest : public ::testing::Test {}; 26 class SessionCommonUtilTest : public ::testing::Test {};
26 27
27 TEST_F(SessionCommonUtilTest, GetSelectedIndex) { 28 TEST_F(SessionCommonUtilTest, GetSelectedIndex) {
28 const GURL settings_page("chrome://settings"); 29 const GURL settings_page("chrome://settings");
29 const GURL sign_out_page("chrome://settings/signOut"); 30 const GURL sign_out_page("chrome://settings/signOut");
30 sessions::SessionTab tab; 31 sessions::SessionTab tab;
31 32
32 std::unique_ptr<content::NavigationEntry> entry1( 33 std::unique_ptr<content::NavigationEntry> entry1(
33 content::NavigationEntry::Create()); 34 content::NavigationEntry::Create());
34 std::unique_ptr<content::NavigationEntry> entry2( 35 std::unique_ptr<content::NavigationEntry> entry2(
35 content::NavigationEntry::Create()); 36 content::NavigationEntry::Create());
36 entry1->SetVirtualURL(settings_page); 37 entry1->SetVirtualURL(settings_page);
37 entry2->SetVirtualURL(sign_out_page); 38 entry2->SetVirtualURL(sign_out_page);
38 39
39 AppendNavigations(&tab, entry1.get()); 40 AppendNavigations(&tab, entry1.get());
40 AppendNavigations(&tab, entry2.get()); 41 AppendNavigations(&tab, entry2.get());
41 42
42 tab.current_navigation_index = 0; 43 tab.current_navigation_index = 0;
43 ASSERT_EQ(0, GetNavigationIndexToSelect(tab)); 44 ASSERT_EQ(0, GetNavigationIndexToSelect(tab));
44 tab.current_navigation_index = 1; 45 tab.current_navigation_index = 1;
45 ASSERT_EQ(0, GetNavigationIndexToSelect(tab)); 46 ASSERT_EQ(0, GetNavigationIndexToSelect(tab));
46 } 47 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/chrome_serialized_navigation_driver_unittest.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698