chromium/chrome/browser/web_applications/isolated_web_apps/garbage_collect_storage_partitions_command_browsertest.cc

// Copyright 2023 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/web_applications/isolated_web_apps/garbage_collect_storage_partitions_command.h"

#include <optional>
#include <string>
#include <string_view>

#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/test/test_future.h"
#include "base/threading/thread_restrictions.h"
#include "base/types/expected.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/web_applications/test/isolated_web_app_test_utils.h"
#include "chrome/browser/web_applications/commands/web_app_uninstall_command.h"
#include "chrome/browser/web_applications/isolated_web_apps/get_controlled_frame_partition_command.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_install_source.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/browser/web_applications/jobs/uninstall/remove_web_app_job.h"
#include "chrome/browser/web_applications/web_app_command_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_test_utils.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "components/webapps/browser/uninstall_result_code.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/storage_partition_config.h"
#include "content/public/test/browser_test.h"
#include "url/gurl.h"

constexpr std::string_view kIwa1UrlString(
    "isolated-app://wiabxazz27gf4rgupuiogazvf3u4pszqgzp2tlocmvnhpkyzsvnaaaac/");
constexpr std::string_view kIwa2UrlString(
    "isolated-app://lcqmu3b7fzkmcev36j2slaxolx6edzzinw7n4xhppqsk4wo3hkfaaaac/");

const base::FilePath::CharType kStoragePartitionDirname[] =);
const base::FilePath::CharType kExtensionsDirname[] =);

namespace {

bool PathHasSubPath(base::FilePath absolute_parent,
                    base::FilePath relative_children) {}

std::u16string SubDirDebugValue(base::FilePath absolute_parent) {}

}  // namespace

namespace web_app {

class GarbageCollectStoragePartitionsCommandBrowserTest
    : public IsolatedWebAppBrowserTestHarness {};

// This test does the following
// - Install 2 IWAs.
// - Ensure all Storage Partitions exist.
// - Uninstall an IWA.
// - Run Garbage Collection.
// - Ensure uninstalled IWA Storage Partitions are cleaned up.
// - Ensure installed IWA Storage Partitions are not cleaned up.
IN_PROC_BROWSER_TEST_F(GarbageCollectStoragePartitionsCommandBrowserTest,
                       PRE_UninstalledAppsHaveStoragePartitionsCleanedUp) {}

IN_PROC_BROWSER_TEST_F(GarbageCollectStoragePartitionsCommandBrowserTest,
                       UninstalledAppsHaveStoragePartitionsCleanedUp) {}

}  // namespace web_app