0
Files
src/content/test/storage_partition_test_helpers.h
Robbie McElrath 72958ea2af Reland "Remove ContentBrowserClient::GetStoragePartitionIdForSite"
This is a reland of 868f6b2621
The original CL didn't actually introduce the failures,
crrev.com/c/3088781 did. See crbug.com/1239355

Original change's description:
> Remove ContentBrowserClient::GetStoragePartitionIdForSite
>
> This removes ContentBrowserClient::GetStoragePartitionIdForSite, its
> overrides, and extensions::util::IsExtensionSiteWithIsolatedStorage,
> which was only used by
> ChromeContentBrowserClient::GetStoragePartitionIdForSite.
>
> Bug: 1229912
> Change-Id: I7ae73c78f8fa1071237b2f2b78b215b6bb48ac0c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3087996
> Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
> Reviewed-by: Reilly Grant <reillyg@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#911145}

Bug: 1229912
Change-Id: Ica9efabf9602afd609c52aa846223d04213927e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3091829
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/master@{#911578}
2021-08-13 00:08:34 +00:00

47 lines
1.7 KiB
C++

// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_TEST_STORAGE_PARTITION_TEST_HELPERS_H_
#define CONTENT_TEST_STORAGE_PARTITION_TEST_HELPERS_H_
#include "base/callback.h"
#include "content/test/test_content_browser_client.h"
namespace content {
class StoragePartition;
class StoragePartitionConfig;
// Replaces the SharedWorkerService implementation with a test-specific one that
// tracks running shared workers.
void InjectTestSharedWorkerService(StoragePartition* storage_partition);
// Terminates all workers and notifies when complete. This is used for
// testing when it is important to make sure that all shared worker activity
// has stopped. Can only be used if InjectTestSharedWorkerService() was called.
void TerminateAllSharedWorkers(StoragePartition* storage_partition,
base::OnceClosure callback);
StoragePartitionConfig CreateStoragePartitionConfigForTesting(
bool in_memory = false,
const std::string& partition_domain = "",
const std::string& partition_name = "");
// Class that requests that all pages belonging to the provided site get loaded
// in a non-default StoragePartition.
class CustomStoragePartitionForSomeSites : public TestContentBrowserClient {
public:
explicit CustomStoragePartitionForSomeSites(const GURL& site_to_isolate);
StoragePartitionConfig GetStoragePartitionConfigForSite(
BrowserContext* browser_context,
const GURL& site) override;
private:
GURL site_to_isolate_;
};
} // namespace content
#endif // CONTENT_TEST_STORAGE_PARTITION_TEST_HELPERS_H_