Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(851)

Unified Diff: content/public/test/mock_storage_client.h

Issue 2368913003: Populate storage_unittests target. (Closed)
Patch Set: Removed unnecessary include from storage/browser/blob/blob_storage_context_unittest.cc. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/mock_special_storage_policy.cc ('k') | content/public/test/mock_storage_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/mock_storage_client.h
diff --git a/content/public/test/mock_storage_client.h b/content/public/test/mock_storage_client.h
deleted file mode 100644
index a6950278693765db0999a35a983fca1d08220d96..0000000000000000000000000000000000000000
--- a/content/public/test/mock_storage_client.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 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_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_
-#define CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <map>
-#include <set>
-#include <string>
-#include <utility>
-
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/time/time.h"
-#include "storage/browser/quota/quota_client.h"
-#include "url/gurl.h"
-
-namespace storage {
-class QuotaManagerProxy;
-}
-
-using storage::QuotaClient;
-using storage::QuotaManagerProxy;
-using storage::StorageType;
-
-namespace content {
-
-struct MockOriginData {
- const char* origin;
- StorageType type;
- int64_t usage;
-};
-
-// Mock storage class for testing.
-class MockStorageClient : public QuotaClient {
- public:
- MockStorageClient(QuotaManagerProxy* quota_manager_proxy,
- const MockOriginData* mock_data,
- QuotaClient::ID id,
- size_t mock_data_size);
- ~MockStorageClient() override;
-
- // To add or modify mock data in this client.
- void AddOriginAndNotify(const GURL& origin_url,
- StorageType type,
- int64_t size);
- void ModifyOriginAndNotify(const GURL& origin_url,
- StorageType type,
- int64_t delta);
- void TouchAllOriginsAndNotify();
-
- void AddOriginToErrorSet(const GURL& origin_url, StorageType type);
-
- base::Time IncrementMockTime();
-
- // QuotaClient methods.
- QuotaClient::ID id() const override;
- void OnQuotaManagerDestroyed() override;
- void GetOriginUsage(const GURL& origin_url,
- StorageType type,
- const GetUsageCallback& callback) override;
- void GetOriginsForType(StorageType type,
- const GetOriginsCallback& callback) override;
- void GetOriginsForHost(StorageType type,
- const std::string& host,
- const GetOriginsCallback& callback) override;
- void DeleteOriginData(const GURL& origin,
- StorageType type,
- const DeletionCallback& callback) override;
- bool DoesSupport(storage::StorageType type) const override;
-
- private:
- void RunGetOriginUsage(const GURL& origin_url,
- StorageType type,
- const GetUsageCallback& callback);
- void RunGetOriginsForType(StorageType type,
- const GetOriginsCallback& callback);
- void RunGetOriginsForHost(StorageType type,
- const std::string& host,
- const GetOriginsCallback& callback);
- void RunDeleteOriginData(const GURL& origin_url,
- StorageType type,
- const DeletionCallback& callback);
-
- void Populate(const MockOriginData* mock_data, size_t mock_data_size);
-
- scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
- const ID id_;
-
- typedef std::map<std::pair<GURL, StorageType>, int64_t> OriginDataMap;
- OriginDataMap origin_data_;
- typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet;
- ErrorOriginSet error_origins_;
-
- int mock_time_counter_;
-
- base::WeakPtrFactory<MockStorageClient> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(MockStorageClient);
-};
-
-} // namespace content
-
-#endif // CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_
« no previous file with comments | « content/public/test/mock_special_storage_policy.cc ('k') | content/public/test/mock_storage_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698