chromium/chrome/browser/ui/startup/default_browser_prompt/default_browser_prompt_manager_unittest.cc

// Copyright 2024 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/default_browser_prompt/default_browser_prompt_manager.h"

#include <map>

#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/startup/default_browser_prompt/default_browser_prompt_prefs.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {
class DefaultBrowserPromptManagerObserver
    : public DefaultBrowserPromptManager::Observer {};

class InfoBarManagerObserver : public infobars::InfoBarManager::Observer {};
} // namespace

class DefaultBrowserPromptManagerTest : public BrowserWithTestWindowTest {};

TEST_F(DefaultBrowserPromptManagerTest, NotifiesAppMenuObservers) {}

TEST_F(DefaultBrowserPromptManagerTest, ShowsAppMenuItemWithParamEnabled) {}

TEST_F(DefaultBrowserPromptManagerTest, HidesAppMenuItemWithParamDisabled) {}

TEST_F(DefaultBrowserPromptManagerTest, AppMenuItemHiddenOnPromptAccept) {}

TEST_F(DefaultBrowserPromptManagerTest, AppMenuItemPersistsOnPromptDismissed) {}

TEST_F(DefaultBrowserPromptManagerTest, InfoBarMaxPromptCount) {}

TEST_F(DefaultBrowserPromptManagerTest, InfoBarRepromptDuration) {}

TEST_F(DefaultBrowserPromptManagerTest, PromptHiddenWhenFeatureParamDisabled) {}

TEST_F(DefaultBrowserPromptManagerTest, AppMenuFeatureParamFalse) {}

TEST_F(DefaultBrowserPromptManagerTest, ShowAppMenuFirstTime) {}

TEST_F(DefaultBrowserPromptManagerTest, DoNotShowIfPromptsShouldNotBeReshown) {}

TEST_F(DefaultBrowserPromptManagerTest, KeepShowingIfFirstShownTimeIsRecent) {}

TEST_F(DefaultBrowserPromptManagerTest, StopShowingIfFirstShownTimeTooOld) {}

// This is a regression test for a crash that occurred when the default prompt
// timer expired after a browser was closed.
TEST_F(DefaultBrowserPromptManagerTest, DoesNotWritePrefWhenBrowserIsClosed) {}