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

Unified Diff: content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc

Issue 308103004: IndexedDB: Using a mock IndexedDBFactory for unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't use GoogleMock with std::pair types Created 6 years, 5 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 | « no previous file | content/browser/indexed_db/indexed_db_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc
diff --git a/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc b/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc
index a0e12dc6d0f91a8cb10559e1ff8caeecd8c52410..063f2ed9b0ca7e6bd327a9bfe66da76a2a05c21b 100644
--- a/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc
@@ -7,17 +7,17 @@
#include "base/test/test_simple_task_runner.h"
#include "content/browser/indexed_db/indexed_db_active_blob_registry.h"
#include "content/browser/indexed_db/indexed_db_backing_store.h"
-#include "content/browser/indexed_db/indexed_db_factory_impl.h"
#include "content/browser/indexed_db/indexed_db_fake_backing_store.h"
+#include "content/browser/indexed_db/mock_indexed_db_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
namespace {
-class MockIDBFactory : public IndexedDBFactoryImpl {
+class RegistryTestMockFactory : public MockIndexedDBFactory {
public:
- MockIDBFactory() : IndexedDBFactoryImpl(NULL), duplicate_calls_(false) {}
+ RegistryTestMockFactory() : duplicate_calls_(false) {}
virtual void ReportOutstandingBlobs(const GURL& origin_url,
bool blobs_outstanding) OVERRIDE {
@@ -39,18 +39,18 @@ class MockIDBFactory : public IndexedDBFactoryImpl {
bool CheckNoOriginsInUse() const {
return !duplicate_calls_ && !origins_.size();
}
+
bool CheckSingleOriginInUse(const GURL& origin) const {
return !duplicate_calls_ && origins_.size() == 1 && origins_.count(origin);
}
- protected:
- virtual ~MockIDBFactory() {}
-
private:
+ virtual ~RegistryTestMockFactory() {}
+
std::set<GURL> origins_;
bool duplicate_calls_;
- DISALLOW_COPY_AND_ASSIGN(MockIDBFactory);
+ DISALLOW_COPY_AND_ASSIGN(RegistryTestMockFactory);
};
class MockIDBBackingStore : public IndexedDBFakeBackingStore {
@@ -91,12 +91,12 @@ class IndexedDBActiveBlobRegistryTest : public testing::Test {
public:
IndexedDBActiveBlobRegistryTest()
: task_runner_(new base::TestSimpleTaskRunner),
- factory_(new MockIDBFactory),
+ factory_(new RegistryTestMockFactory),
backing_store_(new MockIDBBackingStore(factory_, task_runner_)),
registry_(new IndexedDBActiveBlobRegistry(backing_store_.get())) {}
void RunUntilIdle() { task_runner_->RunUntilIdle(); }
- MockIDBFactory* factory() const { return factory_.get(); }
+ RegistryTestMockFactory* factory() const { return factory_.get(); }
MockIDBBackingStore* backing_store() const { return backing_store_.get(); }
IndexedDBActiveBlobRegistry* registry() const { return registry_.get(); }
@@ -110,7 +110,7 @@ class IndexedDBActiveBlobRegistryTest : public testing::Test {
private:
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
- scoped_refptr<MockIDBFactory> factory_;
+ scoped_refptr<RegistryTestMockFactory> factory_;
scoped_refptr<MockIDBBackingStore> backing_store_;
scoped_ptr<IndexedDBActiveBlobRegistry> registry_;
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698