chromium/chrome/browser/ui/browser_close_unittest.cc

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

#include <stddef.h>

#include "base/check_op.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_core_service.h"
#include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/test_browser_window.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/buildflags/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"

class TestingDownloadCoreService : public DownloadCoreService {};

static std::unique_ptr<KeyedService> CreateTestingDownloadCoreService(
    content::BrowserContext* browser_context) {}

class BrowserCloseTest : public testing::Test {};

// Last window close (incognito window) will trigger warning.
TEST_F(BrowserCloseTest, LastWindowIncognito) {}

// Last incognito window close triggers incognito warning.
TEST_F(BrowserCloseTest, LastIncognito) {}

// Last incognito window close with no downloads => no warning.
TEST_F(BrowserCloseTest, LastIncognitoNoDownloads) {}

// Last incognito window with window+download on another incognito profile
// => no warning.
TEST_F(BrowserCloseTest, NoIncognitoCrossChat) {}

// Non-last incognito window => no warning.
TEST_F(BrowserCloseTest, NonLastIncognito) {}

// Non-last regular window => no warning.
TEST_F(BrowserCloseTest, NonLastRegular) {}

// Last regular window triggers browser close warning.
TEST_F(BrowserCloseTest, LastRegular) {}

// Last regular window triggers browser close warning if download is on a
// different profile.
TEST_F(BrowserCloseTest, LastRegularDifferentProfile) {}

// Last regular + incognito window + download => no warning.
TEST_F(BrowserCloseTest, LastRegularPlusIncognito) {}

// Last regular window + window on other profile => no warning.
TEST_F(BrowserCloseTest, LastRegularPlusOtherProfile) {}

// Last regular window + window on other incognito profile => no warning.
TEST_F(BrowserCloseTest, LastRegularPlusOtherIncognito) {}

// Last regular + download + incognito window => no warning.
TEST_F(BrowserCloseTest, LastRegularPlusIncognito2) {}

// Multiple downloads are recognized.
TEST_F(BrowserCloseTest, Plural) {}

// Multiple downloads are recognized for incognito.
TEST_F(BrowserCloseTest, PluralIncognito) {}

// Last window close (guest window) will trigger warning.
TEST_F(BrowserCloseTest, LastWindowGuest) {}

// Last guest window close triggers download warning.
TEST_F(BrowserCloseTest, LastGuest) {}

// Last guest window close with no downloads => no warning.
TEST_F(BrowserCloseTest, LastGuestNoDownloads) {}

// Non-last guest window => no warning.
TEST_F(BrowserCloseTest, NonLastGuest) {}