chromium/chrome/browser/profiles/profile_destroyer_unittest.cc

// Copyright 2012 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/profiles/profile_destroyer.h"

#include <vector>
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "build/buildflag.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.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 "content/public/browser/render_process_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gtest/include/gtest/gtest.h"

class ProfileDestroyerTest : public testing::Test,
                             public testing::WithParamInterface<bool> {};

TEST_P(ProfileDestroyerTest, DestroyOriginalProfileImmediately) {}

TEST_P(ProfileDestroyerTest, DestroyOriginalProfileDeferedByRenderProcessHost) {}

TEST_P(ProfileDestroyerTest,
       DestroyOriginalProfileDeferedByOffTheRecordRenderProcessHost) {}

TEST_P(ProfileDestroyerTest,
       DetroyBothProfileDeferedByMultipleRenderProcessHost) {}

// Expect immediate OTR profile destruction when requested.
TEST_P(ProfileDestroyerTest, ImmediateOTRProfileDestructionNowWithNoHost) {}

#if defined(GTEST_HAS_DEATH_TEST)
// Expect immediate OTR profile destruction when requested.
TEST_P(ProfileDestroyerTest, CrashOTRProfileDestructionNowWithHosts) {}
#endif  // defined(GTEST_HAS_DEATH_TEST)

// Expect immediate OTR profile destruction when no pending renderer
// process host exists.
TEST_P(ProfileDestroyerTest, ImmediateOTRProfileDestructionWithNoHosts) {}

// Expect pending renderer process hosts delay OTR profile destruction.
TEST_P(ProfileDestroyerTest, DelayedOTRProfileDestruction) {}

TEST_P(ProfileDestroyerTest, RenderProcessAddedAfterDestroyRequested) {}

// Regression test for:
// https://crbug.com/1337388#c11
TEST_P(ProfileDestroyerTest, DestructionRequestedTwiceWhileDelayedOTRProfile) {}

// Regression for: https://crbug.com/1357476
// When two OTR profile are associated with the same original profile,
// requesting the destruction of one, was incorrectly causing the
// ProfileDestroyer to wait for the destruction of the RenderProcessHost of the
// second OTR profile.
TEST_P(ProfileDestroyerTest, MultipleOTRPRofile) {}

#if defined(GTEST_HAS_DEATH_TEST)
// Crash if original profile has hosts at shutdown.
TEST_P(ProfileDestroyerTest, CrashShutdownAllPendingProfilesOriginalWithHosts) {}

// Crash if off-the-record profile has hosts at shutdown.
TEST_P(ProfileDestroyerTest, CrashShutdownAllPendingProfilesOTRWithHosts) {}
#endif  // defined(GTEST_HAS_DEATH_TEST)

INSTANTIATE_TEST_SUITE_P();