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

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

Issue 2493573002: Make sure that the browser will always restore settings page instead of sign out page after user si… (Closed)
Patch Set: rebase from master Created 4 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sessions/session_common_utils.h"
6
7 #include <memory>
8
9 #include "components/sessions/content/content_serialized_navigation_builder.h"
10 #include "components/sessions/core/serialized_navigation_entry.h"
11 #include "components/sessions/core/session_types.h"
12 #include "content/public/browser/navigation_entry.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace {
16
17 void AppendNavigations(sessions::SessionTab* tab,
18 content::NavigationEntry* entry) {
19 tab->navigations.push_back(
20 sessions::ContentSerializedNavigationBuilder::FromNavigationEntry(
21 0, *entry));
22 }
23
24 } // namespace
25 class SessionCommonUtilTest : public ::testing::Test {};
26
27 TEST_F(SessionCommonUtilTest, GetSelectedIndex) {
28 const GURL settings_page("chrome://settings");
29 const GURL sign_out_page("chrome://settings/signOut");
30 sessions::SessionTab tab;
31
32 std::unique_ptr<content::NavigationEntry> entry1(
33 content::NavigationEntry::Create());
34 std::unique_ptr<content::NavigationEntry> entry2(
35 content::NavigationEntry::Create());
36 entry1->SetVirtualURL(settings_page);
37 entry2->SetVirtualURL(sign_out_page);
38
39 AppendNavigations(&tab, entry1.get());
40 AppendNavigations(&tab, entry2.get());
41
42 tab.current_navigation_index = 0;
43 ASSERT_EQ(0, GetNavigationIndexToSelect(tab));
44 tab.current_navigation_index = 1;
45 ASSERT_EQ(0, GetNavigationIndexToSelect(tab));
46 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_common_utils.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698