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 "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 class MetadataDatabaseTest : public testing::TestWithParam<bool> { | 172 class MetadataDatabaseTest : public testing::TestWithParam<bool> { |
173 public: | 173 public: |
174 MetadataDatabaseTest() | 174 MetadataDatabaseTest() |
175 : current_change_id_(kInitialChangeID), | 175 : current_change_id_(kInitialChangeID), |
176 next_tracker_id_(kSyncRootTrackerID + 1), | 176 next_tracker_id_(kSyncRootTrackerID + 1), |
177 next_file_id_number_(1), | 177 next_file_id_number_(1), |
178 next_md5_sequence_number_(1) {} | 178 next_md5_sequence_number_(1) {} |
179 | 179 |
180 virtual ~MetadataDatabaseTest() {} | 180 virtual ~MetadataDatabaseTest() {} |
181 | 181 |
182 virtual void SetUp() OVERRIDE { | 182 virtual void SetUp() override { |
183 ASSERT_TRUE(database_dir_.CreateUniqueTempDir()); | 183 ASSERT_TRUE(database_dir_.CreateUniqueTempDir()); |
184 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); | 184 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); |
185 } | 185 } |
186 | 186 |
187 virtual void TearDown() OVERRIDE { DropDatabase(); } | 187 virtual void TearDown() override { DropDatabase(); } |
188 | 188 |
189 protected: | 189 protected: |
190 std::string GenerateFileID() { | 190 std::string GenerateFileID() { |
191 return "file_id_" + base::Int64ToString(next_file_id_number_++); | 191 return "file_id_" + base::Int64ToString(next_file_id_number_++); |
192 } | 192 } |
193 | 193 |
194 int64 GetTrackerIDByFileID(const std::string& file_id) { | 194 int64 GetTrackerIDByFileID(const std::string& file_id) { |
195 TrackerIDSet trackers; | 195 TrackerIDSet trackers; |
196 if (metadata_database_->FindTrackersByFileID(file_id, &trackers)) { | 196 if (metadata_database_->FindTrackersByFileID(file_id, &trackers)) { |
197 EXPECT_FALSE(trackers.empty()); | 197 EXPECT_FALSE(trackers.empty()); |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 EXPECT_TRUE(file->HasKey("details")); | 1150 EXPECT_TRUE(file->HasKey("details")); |
1151 | 1151 |
1152 ASSERT_TRUE(files->GetDictionary(1, &file)); | 1152 ASSERT_TRUE(files->GetDictionary(1, &file)); |
1153 EXPECT_TRUE(file->GetString("title", &str) && str == "file_0"); | 1153 EXPECT_TRUE(file->GetString("title", &str) && str == "file_0"); |
1154 EXPECT_TRUE(file->GetString("type", &str) && str == "file"); | 1154 EXPECT_TRUE(file->GetString("type", &str) && str == "file"); |
1155 EXPECT_TRUE(file->HasKey("details")); | 1155 EXPECT_TRUE(file->HasKey("details")); |
1156 } | 1156 } |
1157 | 1157 |
1158 } // namespace drive_backend | 1158 } // namespace drive_backend |
1159 } // namespace sync_file_system | 1159 } // namespace sync_file_system |
OLD | NEW |