| 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));
|
| +}
|
|
|