OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/indexed_db/indexed_db_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
6 | 6 |
7 #include <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 class MockIDBCallbacks : public IndexedDBCallbacks { | 39 class MockIDBCallbacks : public IndexedDBCallbacks { |
40 public: | 40 public: |
41 static scoped_refptr<MockIDBCallbacks> Create() { | 41 static scoped_refptr<MockIDBCallbacks> Create() { |
42 return make_scoped_refptr(new MockIDBCallbacks()); | 42 return make_scoped_refptr(new MockIDBCallbacks()); |
43 } | 43 } |
44 virtual void OnError(const IndexedDBDatabaseError& error) OVERRIDE {} | 44 virtual void OnError(const IndexedDBDatabaseError& error) OVERRIDE {} |
45 virtual void OnSuccess(const std::vector<string16>& value) OVERRIDE {} | 45 virtual void OnSuccess(const std::vector<string16>& value) OVERRIDE {} |
46 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, | 46 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, |
47 const IndexedDBKey& key, | 47 const IndexedDBKey& key, |
48 const IndexedDBKey& primary_key, | 48 const IndexedDBKey& primary_key, |
49 std::vector<char>* value) OVERRIDE {} | 49 std::string* value) OVERRIDE {} |
50 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, | 50 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
51 const IndexedDBDatabaseMetadata& metadata) OVERRIDE { | 51 const IndexedDBDatabaseMetadata& metadata) OVERRIDE { |
52 connection_ = connection.Pass(); | 52 connection_ = connection.Pass(); |
53 } | 53 } |
54 virtual void OnSuccess(const IndexedDBKey& key) OVERRIDE {} | 54 virtual void OnSuccess(const IndexedDBKey& key) OVERRIDE {} |
55 virtual void OnSuccess(std::vector<char>* value) OVERRIDE {} | 55 virtual void OnSuccess(std::string* value) OVERRIDE {} |
56 virtual void OnSuccess(std::vector<char>* value, | 56 virtual void OnSuccess(std::string* value, |
57 const IndexedDBKey& key, | 57 const IndexedDBKey& key, |
58 const IndexedDBKeyPath& key_path) OVERRIDE {} | 58 const IndexedDBKeyPath& key_path) OVERRIDE {} |
59 virtual void OnSuccess(int64 value) OVERRIDE {} | 59 virtual void OnSuccess(int64 value) OVERRIDE {} |
60 virtual void OnSuccess() OVERRIDE {} | 60 virtual void OnSuccess() OVERRIDE {} |
61 virtual void OnSuccess(const IndexedDBKey& key, | 61 virtual void OnSuccess(const IndexedDBKey& key, |
62 const IndexedDBKey& primary_key, | 62 const IndexedDBKey& primary_key, |
63 std::vector<char>* value) OVERRIDE {} | 63 std::string* value) OVERRIDE {} |
64 virtual void OnSuccessWithPrefetch( | 64 virtual void OnSuccessWithPrefetch( |
65 const std::vector<IndexedDBKey>& keys, | 65 const std::vector<IndexedDBKey>& keys, |
66 const std::vector<IndexedDBKey>& primary_keys, | 66 const std::vector<IndexedDBKey>& primary_keys, |
67 const std::vector<std::vector<char> >& values) OVERRIDE {} | 67 const std::vector<std::string>& values) OVERRIDE {} |
68 | 68 |
69 IndexedDBConnection* connection() { return connection_.get(); } | 69 IndexedDBConnection* connection() { return connection_.get(); } |
70 | 70 |
71 private: | 71 private: |
72 virtual ~MockIDBCallbacks() { EXPECT_TRUE(connection_); } | 72 virtual ~MockIDBCallbacks() { EXPECT_TRUE(connection_); } |
73 MockIDBCallbacks() : IndexedDBCallbacks(NULL, 0, 0) {} | 73 MockIDBCallbacks() : IndexedDBCallbacks(NULL, 0, 0) {} |
74 scoped_ptr<IndexedDBConnection> connection_; | 74 scoped_ptr<IndexedDBConnection> connection_; |
75 }; | 75 }; |
76 | 76 |
77 class FakeIDBDatabaseCallbacks : public IndexedDBDatabaseCallbacks { | 77 class FakeIDBDatabaseCallbacks : public IndexedDBDatabaseCallbacks { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 request->connection(), | 183 request->connection(), |
184 scope, | 184 scope, |
185 indexed_db::TRANSACTION_READ_ONLY); | 185 indexed_db::TRANSACTION_READ_ONLY); |
186 | 186 |
187 request->connection()->ForceClose(); | 187 request->connection()->ForceClose(); |
188 | 188 |
189 EXPECT_TRUE(backing_store->HasOneRef()); // local | 189 EXPECT_TRUE(backing_store->HasOneRef()); // local |
190 } | 190 } |
191 | 191 |
192 } // namespace content | 192 } // namespace content |
OLD | NEW |