| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/leveldb_proto/proto_database_impl.h" | 5 #include "components/leveldb_proto/proto_database_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 EXPECT_TRUE(expected_it != expected.end()); | 76 EXPECT_TRUE(expected_it != expected.end()); |
| 77 std::string serialized_expected = expected_it->second.SerializeAsString(); | 77 std::string serialized_expected = expected_it->second.SerializeAsString(); |
| 78 std::string serialized_actual = actual[i].SerializeAsString(); | 78 std::string serialized_actual = actual[i].SerializeAsString(); |
| 79 EXPECT_EQ(serialized_expected, serialized_actual); | 79 EXPECT_EQ(serialized_expected, serialized_actual); |
| 80 expected.erase(expected_it); | 80 expected.erase(expected_it); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 class ProtoDatabaseImplTest : public testing::Test { | 84 class ProtoDatabaseImplTest : public testing::Test { |
| 85 public: | 85 public: |
| 86 virtual void SetUp() { | 86 void SetUp() override { |
| 87 main_loop_.reset(new MessageLoop()); | 87 main_loop_.reset(new MessageLoop()); |
| 88 db_.reset( | 88 db_.reset( |
| 89 new ProtoDatabaseImpl<TestProto>(main_loop_->message_loop_proxy())); | 89 new ProtoDatabaseImpl<TestProto>(main_loop_->message_loop_proxy())); |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual void TearDown() { | 92 void TearDown() override { |
| 93 db_.reset(); | 93 db_.reset(); |
| 94 base::RunLoop().RunUntilIdle(); | 94 base::RunLoop().RunUntilIdle(); |
| 95 main_loop_.reset(); | 95 main_loop_.reset(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 scoped_ptr<ProtoDatabaseImpl<TestProto> > db_; | 98 scoped_ptr<ProtoDatabaseImpl<TestProto> > db_; |
| 99 scoped_ptr<MessageLoop> main_loop_; | 99 scoped_ptr<MessageLoop> main_loop_; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 // Test that ProtoDatabaseImpl calls Init on the underlying database and that | 102 // Test that ProtoDatabaseImpl calls Init on the underlying database and that |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 388 |
| 389 TEST(ProtoDatabaseImplLevelDBTest, TestDBSaveAndLoad) { | 389 TEST(ProtoDatabaseImplLevelDBTest, TestDBSaveAndLoad) { |
| 390 TestLevelDBSaveAndLoad(false); | 390 TestLevelDBSaveAndLoad(false); |
| 391 } | 391 } |
| 392 | 392 |
| 393 TEST(ProtoDatabaseImplLevelDBTest, TestDBCloseAndReopen) { | 393 TEST(ProtoDatabaseImplLevelDBTest, TestDBCloseAndReopen) { |
| 394 TestLevelDBSaveAndLoad(true); | 394 TestLevelDBSaveAndLoad(true); |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace leveldb_proto | 397 } // namespace leveldb_proto |
| OLD | NEW |