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

Unified Diff: content/browser/indexed_db/mock_callback_factory.h

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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/browser/indexed_db/manifest.json ('k') | content/browser/indexed_db/mock_callback_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/mock_callback_factory.h
diff --git a/content/browser/indexed_db/mock_callback_factory.h b/content/browser/indexed_db/mock_callback_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1ad3b70b7d56ceaed4a64214f28051e42c75eb9
--- /dev/null
+++ b/content/browser/indexed_db/mock_callback_factory.h
@@ -0,0 +1,53 @@
+// Copyright 2016 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_BROWSER_INDEXED_DB_MOCK_CALLBACK_FACTORY_H_
+#define CONTENT_BROWSER_INDEXED_DB_MOCK_CALLBACK_FACTORY_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/browser/indexed_db/indexed_db_callbacks.h"
+
+namespace content {
+
+class IndexedDBConnection;
+class IndexedDBDatabaseError;
+struct IndexedDBDatabaseMetadata;
+
+class MockCallbackFactory {
+ public:
+ MockCallbackFactory();
+ ~MockCallbackFactory();
+
+ DeleteResultCallback CreateDeleteCallback();
+ OpenResultCallback CreateOpenCallback();
+
+ IndexedDBConnection* connection() const { return connection_.get(); }
+
+ bool delete_result_called() const { return delete_result_called_; }
+ bool open_result_called() const { return open_result_called_; }
+
+ private:
+ base::WeakPtr<MockCallbackFactory> AsWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
+
+ void OnDeleteResult(int64_t version, const IndexedDBDatabaseError& error);
+ void OnOpenResult(std::unique_ptr<IndexedDBConnection> connection,
+ const IndexedDBDatabaseMetadata& metadata,
+ const IndexedDBDatabaseError& error);
+
+ std::unique_ptr<IndexedDBConnection> connection_;
+ bool delete_result_called_ = false;
+ bool open_result_called_ = false;
+ base::WeakPtrFactory<MockCallbackFactory> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockCallbackFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_INDEXED_DB_MOCK_CALLBACK_FACTORY_H_
« no previous file with comments | « content/browser/indexed_db/manifest.json ('k') | content/browser/indexed_db/mock_callback_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698