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 "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 | 74 |
75 private: | 75 private: |
76 void InitializeLevelDB() { | 76 void InitializeLevelDB() { |
77 leveldb::DB* db = nullptr; | 77 leveldb::DB* db = nullptr; |
78 leveldb::Options options; | 78 leveldb::Options options; |
79 options.create_if_missing = true; | 79 options.create_if_missing = true; |
80 options.max_open_files = 0; // Use minimum. | 80 options.max_open_files = 0; // Use minimum. |
81 options.env = in_memory_env_.get(); | 81 options.env = in_memory_env_.get(); |
82 leveldb::Status status = | 82 leveldb::Status status = |
83 leveldb::DB::Open(options, database_dir_.path().AsUTF8Unsafe(), &db); | 83 leveldb::DB::Open(options, database_dir_.GetPath().AsUTF8Unsafe(), &db); |
84 ASSERT_TRUE(status.ok()); | 84 ASSERT_TRUE(status.ok()); |
85 | 85 |
86 db_.reset(new LevelDBWrapper(base::WrapUnique(db))); | 86 db_.reset(new LevelDBWrapper(base::WrapUnique(db))); |
87 } | 87 } |
88 | 88 |
89 base::ScopedTempDir database_dir_; | 89 base::ScopedTempDir database_dir_; |
90 std::unique_ptr<leveldb::Env> in_memory_env_; | 90 std::unique_ptr<leveldb::Env> in_memory_env_; |
91 std::unique_ptr<LevelDBWrapper> db_; | 91 std::unique_ptr<LevelDBWrapper> db_; |
92 }; | 92 }; |
93 | 93 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 EXPECT_EQ(0, GetDB()->num_puts()); | 237 EXPECT_EQ(0, GetDB()->num_puts()); |
238 EXPECT_EQ(0, GetDB()->num_deletes()); | 238 EXPECT_EQ(0, GetDB()->num_deletes()); |
239 | 239 |
240 SCOPED_TRACE("DeleteTest_Commit"); | 240 SCOPED_TRACE("DeleteTest_Commit"); |
241 CheckDBContents(merged_data, arraysize(merged_data)); | 241 CheckDBContents(merged_data, arraysize(merged_data)); |
242 } | 242 } |
243 | 243 |
244 } // namespace drive_backend | 244 } // namespace drive_backend |
245 } // namespace sync_file_system | 245 } // namespace sync_file_system |
OLD | NEW |