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 <set> | 7 #include <set> |
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 EXPECT_TRUE(callbacks->abort_called()); | 151 EXPECT_TRUE(callbacks->abort_called()); |
152 } | 152 } |
153 | 153 |
154 class MockDeleteCallbacks : public IndexedDBCallbacks { | 154 class MockDeleteCallbacks : public IndexedDBCallbacks { |
155 public: | 155 public: |
156 MockDeleteCallbacks() | 156 MockDeleteCallbacks() |
157 : IndexedDBCallbacks(NULL, 0, 0), | 157 : IndexedDBCallbacks(NULL, 0, 0), |
158 blocked_called_(false), | 158 blocked_called_(false), |
159 success_called_(false) {} | 159 success_called_(false) {} |
160 | 160 |
161 virtual void OnBlocked(int64 existing_version) override { | 161 void OnBlocked(int64 existing_version) override { blocked_called_ = true; } |
162 blocked_called_ = true; | 162 void OnSuccess(int64 result) override { success_called_ = true; } |
163 } | |
164 virtual void OnSuccess(int64 result) override { success_called_ = true; } | |
165 | 163 |
166 bool blocked_called() const { return blocked_called_; } | 164 bool blocked_called() const { return blocked_called_; } |
167 bool success_called() const { return success_called_; } | 165 bool success_called() const { return success_called_; } |
168 | 166 |
169 private: | 167 private: |
170 virtual ~MockDeleteCallbacks() {} | 168 ~MockDeleteCallbacks() override {} |
171 | 169 |
172 bool blocked_called_; | 170 bool blocked_called_; |
173 bool success_called_; | 171 bool success_called_; |
174 | 172 |
175 DISALLOW_COPY_AND_ASSIGN(MockDeleteCallbacks); | 173 DISALLOW_COPY_AND_ASSIGN(MockDeleteCallbacks); |
176 }; | 174 }; |
177 | 175 |
178 TEST(IndexedDBDatabaseTest, PendingDelete) { | 176 TEST(IndexedDBDatabaseTest, PendingDelete) { |
179 scoped_refptr<IndexedDBFakeBackingStore> backing_store = | 177 scoped_refptr<IndexedDBFakeBackingStore> backing_store = |
180 new IndexedDBFakeBackingStore(); | 178 new IndexedDBFakeBackingStore(); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); | 410 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); |
413 | 411 |
414 // This will execute the Put then Delete. | 412 // This will execute the Put then Delete. |
415 RunPostedTasks(); | 413 RunPostedTasks(); |
416 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); | 414 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); |
417 | 415 |
418 transaction_->Commit(); // Cleans up the object hierarchy. | 416 transaction_->Commit(); // Cleans up the object hierarchy. |
419 } | 417 } |
420 | 418 |
421 } // namespace content | 419 } // namespace content |
OLD | NEW |