chromium/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/startup/startup_browser_creator_impl.h"

#include "base/command_line.h"
#include "build/build_config.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/ui/startup/startup_tab_provider.h"
#include "chrome/common/url_constants.h"
#include "components/signin/public/base/signin_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

Creator;

namespace {

// Bits for FakeStartupTabProvider options.
constexpr uint32_t kOnboardingTabs =;
constexpr uint32_t kDistributionFirstRunTabs =;
constexpr uint32_t kResetTriggerTabs =;
constexpr uint32_t kPinnedTabs =;
constexpr uint32_t kPreferencesTabs =;
constexpr uint32_t kNewTabPageTabs =;
constexpr uint32_t kPostCrashTabs =;
constexpr uint32_t kCommandLineTabs =;
#if !BUILDFLAG(IS_ANDROID)
constexpr uint32_t kNewFeaturesTabs =;
constexpr uint32_t kPrivacySandboxTabs =;
#endif  // !BUILDFLAG(IS_ANDROID)

class FakeStartupTabProvider : public StartupTabProvider {};

}  // namespace

// Comparing a `StartupTab` with a string will compare the tab's host with that
// string. This is used to compare lists more easily via
// `testing::ElementsAreArray`.
bool operator==(const StartupTab& actual_tab,
                const std::string& expected_host) {}

class StartupBrowserCreatorImplTest : public testing::Test {};

// "Standard" case: Tabs specified in onboarding, reset trigger, pinned tabs, or
// preferences shouldn't interfere with each other. Nothing specified on the
// command line. Reset trigger always appears first.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs) {}

// Only the New Tab Page should appear in Incognito mode, skipping all the usual
// tabs.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_Incognito) {}

// Also only show the New Tab Page after a crash, except if there is a
// problem application.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_Crash) {}

// If initial preferences specify content, this should block all other
// policies. The only exception is command line URLs, tested below.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_InitialPrefs) {}

// URLs specified on the command line should always appear, and should block
// all other tabs except the Reset Trigger tab.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_CommandLine) {}

// New Tab Page should appear alongside pinned tabs and the reset trigger, but
// should be superseded by onboarding tabs and by tabs specified in preferences.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_NewTabPage) {}

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
// If the user's preferences satisfy the conditions, show the What's New page
// upon startup.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_NewFeaturesPage) {}
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

#if !BUILDFLAG(IS_ANDROID)
// If required, a tab for the Privacy Sandbox dialog should be added.
TEST_F(StartupBrowserCreatorImplTest, DetermineStartupTabs_PrivacySandbox) {}

#endif  // !BUILDFLAG(IS_ANDROID)

TEST_F(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_Startup) {}

TEST_F(StartupBrowserCreatorImplTest,
       DetermineBrowserOpenBehavior_CmdLineTabs) {}

TEST_F(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_PostCrash) {}

TEST_F(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_NotStartup) {}