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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_MOCK_CALLBACK_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_CALLBACK_FACTORY_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/indexed_db/indexed_db_callbacks.h"
13
14 namespace content {
15
16 class IndexedDBConnection;
17 class IndexedDBDatabaseError;
18 struct IndexedDBDatabaseMetadata;
19
20 class MockCallbackFactory {
21 public:
22 MockCallbackFactory();
23 ~MockCallbackFactory();
24
25 DeleteResultCallback CreateDeleteCallback();
26 OpenResultCallback CreateOpenCallback();
27
28 IndexedDBConnection* connection() const { return connection_.get(); }
29
30 bool delete_result_called() const { return delete_result_called_; }
31 bool open_result_called() const { return open_result_called_; }
32
33 private:
34 base::WeakPtr<MockCallbackFactory> AsWeakPtr() {
35 return weak_factory_.GetWeakPtr();
36 }
37
38 void OnDeleteResult(int64_t version, const IndexedDBDatabaseError& error);
39 void OnOpenResult(std::unique_ptr<IndexedDBConnection> connection,
40 const IndexedDBDatabaseMetadata& metadata,
41 const IndexedDBDatabaseError& error);
42
43 std::unique_ptr<IndexedDBConnection> connection_;
44 bool delete_result_called_ = false;
45 bool open_result_called_ = false;
46 base::WeakPtrFactory<MockCallbackFactory> weak_factory_;
47
48 DISALLOW_COPY_AND_ASSIGN(MockCallbackFactory);
49 };
50
51 } // namespace content
52
53 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_CALLBACK_FACTORY_H_
OLDNEW
« 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