| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/leveldb_wrapper_impl.h" | 5 #include "content/browser/leveldb_wrapper_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "components/leveldb/public/cpp/util.h" | 9 #include "components/leveldb/public/cpp/util.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void Complete(bool success) override { | 46 void Complete(bool success) override { |
| 47 *m_result = success; | 47 *m_result = success; |
| 48 m_callback.Run(); | 48 m_callback.Run(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool* m_result; | 51 bool* m_result; |
| 52 base::Closure m_callback; | 52 base::Closure m_callback; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 void NoOp() {} | 55 void NoOp() {} |
| 56 std::vector<leveldb::mojom::BatchedOperationPtr> PrepareToCommitNoOp() { | 56 std::vector<leveldb::mojom::BatchedOperationPtr> PrepareToCommitNoOp( |
| 57 const LevelDBWrapperImpl&) { |
| 57 return std::vector<leveldb::mojom::BatchedOperationPtr>(); | 58 return std::vector<leveldb::mojom::BatchedOperationPtr>(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void GetCallback(const base::Closure& callback, | 61 void GetCallback(const base::Closure& callback, |
| 61 bool* success_out, | 62 bool* success_out, |
| 62 std::vector<uint8_t>* value_out, | 63 std::vector<uint8_t>* value_out, |
| 63 bool success, | 64 bool success, |
| 64 const std::vector<uint8_t>& value) { | 65 const std::vector<uint8_t>& value) { |
| 65 *success_out = success; | 66 *success_out = success; |
| 66 *value_out = value; | 67 *value_out = value; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 // Reducing size should also succeed. | 425 // Reducing size should also succeed. |
| 425 value.clear(); | 426 value.clear(); |
| 426 EXPECT_TRUE(PutSync(key, value)); | 427 EXPECT_TRUE(PutSync(key, value)); |
| 427 | 428 |
| 428 // Increasing size should fail. | 429 // Increasing size should fail. |
| 429 value.resize(1, 'a'); | 430 value.resize(1, 'a'); |
| 430 EXPECT_FALSE(PutSync(key, value)); | 431 EXPECT_FALSE(PutSync(key, value)); |
| 431 } | 432 } |
| 432 | 433 |
| 433 } // namespace content | 434 } // namespace content |
| OLD | NEW |