1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280

content / public / test / test_storage_partition.cc [blame]

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

#include "content/public/test/test_storage_partition.h"

#include <tuple>

#include "components/leveldb_proto/public/proto_database_provider.h"
#include "content/public/browser/file_system_access_entry_factory.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"

namespace content {

TestStoragePartition::TestStoragePartition() {}
TestStoragePartition::~TestStoragePartition() {}

const StoragePartitionConfig& TestStoragePartition::GetConfig() const {
  return config_;
}

const base::FilePath& TestStoragePartition::GetPath() const {
  return file_path_;
}

network::mojom::NetworkContext* TestStoragePartition::GetNetworkContext() {
  return network_context_;
}
cert_verifier::mojom::CertVerifierServiceUpdater*
TestStoragePartition::GetCertVerifierServiceUpdater() {
  return nullptr;
}

storage::SharedStorageManager* TestStoragePartition::GetSharedStorageManager() {
  return nullptr;
}

scoped_refptr<network::SharedURLLoaderFactory>
TestStoragePartition::GetURLLoaderFactoryForBrowserProcess() {
  return nullptr;
}

std::unique_ptr<network::PendingSharedURLLoaderFactory>
TestStoragePartition::GetURLLoaderFactoryForBrowserProcessIOThread() {
  return nullptr;
}

network::mojom::CookieManager*
TestStoragePartition::GetCookieManagerForBrowserProcess() {
  return cookie_manager_for_browser_process_;
}

void TestStoragePartition::CreateTrustTokenQueryAnswerer(
    mojo::PendingReceiver<network::mojom::TrustTokenQueryAnswerer> receiver,
    const url::Origin& top_frame_origin) {
  NOTREACHED_IN_MIGRATION() << "Not implemented.";
}

mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
TestStoragePartition::CreateURLLoaderNetworkObserverForFrame(int process_id,
                                                             int routing_id) {
  return mojo::NullRemote();
}

mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
TestStoragePartition::CreateURLLoaderNetworkObserverForNavigationRequest(
    NavigationRequest& navigation_request) {
  return mojo::NullRemote();
}

storage::QuotaManager* TestStoragePartition::GetQuotaManager() {
  return quota_manager_;
}

BackgroundSyncContext* TestStoragePartition::GetBackgroundSyncContext() {
  return background_sync_context_;
}

storage::FileSystemContext* TestStoragePartition::GetFileSystemContext() {
  return file_system_context_;
}

storage::DatabaseTracker* TestStoragePartition::GetDatabaseTracker() {
  return database_tracker_;
}

DOMStorageContext* TestStoragePartition::GetDOMStorageContext() {
  return dom_storage_context_;
}

storage::mojom::LocalStorageControl*
TestStoragePartition::GetLocalStorageControl() {
  // Bind and throw away the receiver. If testing is required, then add a method
  // to set the remote.
  if (!local_storage_control_.is_bound())
    std::ignore = local_storage_control_.BindNewPipeAndPassReceiver();
  return local_storage_control_.get();
}

storage::mojom::IndexedDBControl& TestStoragePartition::GetIndexedDBControl() {
  // Bind and throw away the receiver. If testing is required, then add a method
  // to set the remote.
  if (!indexed_db_control_.is_bound())
    std::ignore = indexed_db_control_.BindNewPipeAndPassReceiver();
  return *indexed_db_control_;
}

FileSystemAccessEntryFactory*
TestStoragePartition::GetFileSystemAccessEntryFactory() {
  return nullptr;
}

ServiceWorkerContext* TestStoragePartition::GetServiceWorkerContext() {
  return service_worker_context_;
}

DedicatedWorkerService* TestStoragePartition::GetDedicatedWorkerService() {
  return dedicated_worker_service_;
}

SharedWorkerService* TestStoragePartition::GetSharedWorkerService() {
  return shared_worker_service_;
}

storage::mojom::CacheStorageControl*
TestStoragePartition::GetCacheStorageControl() {
  // Bind and throw away the receiver. If testing is required, then add a method
  // to set the remote.
  if (!cache_storage_control_.is_bound())
    std::ignore = cache_storage_control_.BindNewPipeAndPassReceiver();
  return cache_storage_control_.get();
}

GeneratedCodeCacheContext*
TestStoragePartition::GetGeneratedCodeCacheContext() {
  return generated_code_cache_context_;
}

PlatformNotificationContext*
TestStoragePartition::GetPlatformNotificationContext() {
  return platform_notification_context_;
}

InterestGroupManager* TestStoragePartition::GetInterestGroupManager() {
  return nullptr;
}

AttributionDataModel* TestStoragePartition::GetAttributionDataModel() {
  return nullptr;
}

PrivateAggregationDataModel*
TestStoragePartition::GetPrivateAggregationDataModel() {
  return nullptr;
}

CookieDeprecationLabelManager*
TestStoragePartition::GetCookieDeprecationLabelManager() {
  return nullptr;
}

#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
CdmStorageDataModel* TestStoragePartition::GetCdmStorageDataModel() {
  return nullptr;
}
#endif  // BUILDFLAG(ENABLE_LIBRARY_CDMS)

BrowsingTopicsSiteDataManager*
TestStoragePartition::GetBrowsingTopicsSiteDataManager() {
  return browsing_topics_site_data_manager_;
}

DevToolsBackgroundServicesContext*
TestStoragePartition::GetDevToolsBackgroundServicesContext() {
  return devtools_background_services_context_;
}

ContentIndexContext* TestStoragePartition::GetContentIndexContext() {
  return content_index_context_;
}

leveldb_proto::ProtoDatabaseProvider*
TestStoragePartition::GetProtoDatabaseProvider() {
  return nullptr;
}

void TestStoragePartition::SetProtoDatabaseProvider(
    std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> proto_db_provider) {}

leveldb_proto::ProtoDatabaseProvider*
TestStoragePartition::GetProtoDatabaseProviderForTesting() {
  return nullptr;
}

HostZoomMap* TestStoragePartition::GetHostZoomMap() {
  return host_zoom_map_;
}

HostZoomLevelContext* TestStoragePartition::GetHostZoomLevelContext() {
  return host_zoom_level_context_;
}

ZoomLevelDelegate* TestStoragePartition::GetZoomLevelDelegate() {
  return zoom_level_delegate_;
}

void TestStoragePartition::ClearDataForOrigin(
    uint32_t remove_mask,
    uint32_t quota_storage_remove_mask,
    const GURL& storage_origin,
    base::OnceClosure callback) {}

void TestStoragePartition::ClearDataForBuckets(
    const blink::StorageKey& storage_key,
    const std::set<std::string>& buckets,
    base::OnceClosure callback) {}

void TestStoragePartition::ClearData(uint32_t remove_mask,
                                     uint32_t quota_storage_remove_mask,
                                     const blink::StorageKey& storage_key,
                                     const base::Time begin,
                                     const base::Time end,
                                     base::OnceClosure callback) {}

void TestStoragePartition::ClearData(
    uint32_t remove_mask,
    uint32_t quota_storage_remove_mask,
    BrowsingDataFilterBuilder* filter_builder,
    StorageKeyPolicyMatcherFunction storage_key_policy_matcher,
    network::mojom::CookieDeletionFilterPtr cookie_deletion_filter,
    bool perform_storage_cleanup,
    const base::Time begin,
    const base::Time end,
    base::OnceClosure callback) {}

void TestStoragePartition::ClearCodeCaches(
    const base::Time begin,
    const base::Time end,
    const base::RepeatingCallback<bool(const GURL&)>& url_matcher,
    base::OnceClosure callback) {}

void TestStoragePartition::Flush() {}

void TestStoragePartition::ResetURLLoaderFactories() {}

void TestStoragePartition::AddObserver(DataRemovalObserver* observer) {
  data_removal_observer_count_++;
}

void TestStoragePartition::RemoveObserver(DataRemovalObserver* observer) {
  data_removal_observer_count_--;
}

int TestStoragePartition::GetDataRemovalObserverCount() {
  return data_removal_observer_count_;
}

void TestStoragePartition::ClearBluetoothAllowedDevicesMapForTesting() {}

void TestStoragePartition::FlushNetworkInterfaceForTesting() {}

void TestStoragePartition::FlushCertVerifierInterfaceForTesting() {}

void TestStoragePartition::WaitForDeletionTasksForTesting() {}

void TestStoragePartition::WaitForCodeCacheShutdownForTesting() {}

void TestStoragePartition::SetNetworkContextForTesting(
    mojo::PendingRemote<network::mojom::NetworkContext>
        network_context_remote) {}

base::WeakPtr<StoragePartition> TestStoragePartition::GetWeakPtr() {
  return weak_factory_.GetWeakPtr();
}

void TestStoragePartition::InvalidateWeakPtrs() {
  weak_factory_.InvalidateWeakPtrs();
}

}  // namespace content