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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_common_utils_unittest.cc
diff --git a/chrome/browser/sessions/session_common_utils_unittest.cc b/chrome/browser/sessions/session_common_utils_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..94b2a0cc84972c0ae5c8162dd1f99d54db2cfd0a
--- /dev/null
+++ b/chrome/browser/sessions/session_common_utils_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sessions/session_common_utils.h"
+
+#include <memory>
+
+#include "components/sessions/content/content_serialized_navigation_builder.h"
+#include "components/sessions/core/serialized_navigation_entry.h"
+#include "components/sessions/core/session_types.h"
+#include "content/public/browser/navigation_entry.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+void AppendNavigations(sessions::SessionTab* tab,
+ content::NavigationEntry* entry) {
+ tab->navigations.push_back(
+ sessions::ContentSerializedNavigationBuilder::FromNavigationEntry(
+ 0, *entry));
+}
+
+} // namespace
+class SessionCommonUtilTest : public ::testing::Test {};
+
+TEST_F(SessionCommonUtilTest, GetSelectedIndex) {
+ const GURL settings_page("chrome://settings");
+ const GURL sign_out_page("chrome://settings/signOut");
+ sessions::SessionTab tab;
+
+ std::unique_ptr<content::NavigationEntry> entry1(
+ content::NavigationEntry::Create());
+ std::unique_ptr<content::NavigationEntry> entry2(
+ content::NavigationEntry::Create());
+ entry1->SetVirtualURL(settings_page);
+ entry2->SetVirtualURL(sign_out_page);
+
+ AppendNavigations(&tab, entry1.get());
+ AppendNavigations(&tab, entry2.get());
+
+ tab.current_navigation_index = 0;
+ ASSERT_EQ(0, GetNavigationIndexToSelect(tab));
+ tab.current_navigation_index = 1;
+ ASSERT_EQ(0, GetNavigationIndexToSelect(tab));
+}
« 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