chromium/chrome/browser/extensions/extension_garbage_collector_unittest.cc

// Copyright 2014 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/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_garbage_collector.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/install_tracker.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/pref_names.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "ppapi/buildflags/buildflags.h"

#if BUILDFLAG(ENABLE_PLUGINS)
#include "content/public/browser/plugin_service.h"
#endif

namespace extensions {

class ExtensionGarbageCollectorUnitTest : public ExtensionServiceTestBase {};

// Test that partially deleted extensions are cleaned up during startup.
TEST_F(ExtensionGarbageCollectorUnitTest, CleanupOnStartup) {}

// TODO(crbug.com/40875193): The test extension good_juKvIh seems to error on
// install with "Manifest file is missing or unreadable" despite the manifest
// being valid. This test case is still valid because we're only checking if the
// files get deleted. The files get copied to the install directory by the test
// infra despite the installation failure. So we should probably fix this in the
// future so that this test extension can be used in other tests.

// Test that partially deleted unpacked extensions (e.g. from .zips) are cleaned
// up during startup.
TEST_F(ExtensionGarbageCollectorUnitTest,
       CleanupUnpackedOnStartup_DeleteWhenNoLongerInstalled) {}

TEST_F(ExtensionGarbageCollectorUnitTest,
       CleanupUnpackedOnStartup_DoNotDeleteWhenStillInstalled) {}

// Test that garbage collection doesn't delete anything while a crx is being
// installed.
TEST_F(ExtensionGarbageCollectorUnitTest, NoCleanupDuringInstall) {}

// Test that GarbageCollectExtensions deletes the right versions of an
// extension.
TEST_F(ExtensionGarbageCollectorUnitTest, GarbageCollectWithPendingUpdates) {}

// Test that pending updates are properly handled on startup.
TEST_F(ExtensionGarbageCollectorUnitTest, UpdateOnStartup) {}

}  // namespace extensions