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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 10 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 file_system_.CreateFile(URL(kPath2))); // Creates a file. | 195 file_system_.CreateFile(URL(kPath2))); // Creates a file. |
196 EXPECT_EQ(base::File::FILE_OK, | 196 EXPECT_EQ(base::File::FILE_OK, |
197 file_system_.TruncateFile(URL(kPath2), 1)); // Modifies the file. | 197 file_system_.TruncateFile(URL(kPath2), 1)); // Modifies the file. |
198 EXPECT_EQ(base::File::FILE_OK, | 198 EXPECT_EQ(base::File::FILE_OK, |
199 file_system_.TruncateFile(URL(kPath2), 2)); // Modifies it again. | 199 file_system_.TruncateFile(URL(kPath2), 2)); // Modifies it again. |
200 | 200 |
201 FileSystemURLSet urls; | 201 FileSystemURLSet urls; |
202 file_system_.GetChangedURLsInTracker(&urls); | 202 file_system_.GetChangedURLsInTracker(&urls); |
203 | 203 |
204 EXPECT_EQ(3U, urls.size()); | 204 EXPECT_EQ(3U, urls.size()); |
205 EXPECT_TRUE(ContainsKey(urls, URL(kPath0))); | 205 EXPECT_TRUE(base::ContainsKey(urls, URL(kPath0))); |
206 EXPECT_TRUE(ContainsKey(urls, URL(kPath1))); | 206 EXPECT_TRUE(base::ContainsKey(urls, URL(kPath1))); |
207 EXPECT_TRUE(ContainsKey(urls, URL(kPath2))); | 207 EXPECT_TRUE(base::ContainsKey(urls, URL(kPath2))); |
208 | 208 |
209 VerifyAndClearChange(URL(kPath0), | 209 VerifyAndClearChange(URL(kPath0), |
210 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 210 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
211 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); | 211 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); |
212 VerifyAndClearChange(URL(kPath1), | 212 VerifyAndClearChange(URL(kPath1), |
213 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 213 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
214 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); | 214 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); |
215 VerifyAndClearChange(URL(kPath2), | 215 VerifyAndClearChange(URL(kPath2), |
216 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 216 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
217 sync_file_system::SYNC_FILE_TYPE_FILE)); | 217 sync_file_system::SYNC_FILE_TYPE_FILE)); |
(...skipping 11 matching lines...) Expand all Loading... |
229 | 229 |
230 // Recursively removes the kPath0 directory. | 230 // Recursively removes the kPath0 directory. |
231 EXPECT_EQ(base::File::FILE_OK, | 231 EXPECT_EQ(base::File::FILE_OK, |
232 file_system_.Remove(URL(kPath0), true /* recursive */)); | 232 file_system_.Remove(URL(kPath0), true /* recursive */)); |
233 | 233 |
234 urls.clear(); | 234 urls.clear(); |
235 file_system_.GetChangedURLsInTracker(&urls); | 235 file_system_.GetChangedURLsInTracker(&urls); |
236 | 236 |
237 // kPath0 and its all chidren (kPath1 and kPath2) must have been deleted. | 237 // kPath0 and its all chidren (kPath1 and kPath2) must have been deleted. |
238 EXPECT_EQ(3U, urls.size()); | 238 EXPECT_EQ(3U, urls.size()); |
239 EXPECT_TRUE(ContainsKey(urls, URL(kPath0))); | 239 EXPECT_TRUE(base::ContainsKey(urls, URL(kPath0))); |
240 EXPECT_TRUE(ContainsKey(urls, URL(kPath1))); | 240 EXPECT_TRUE(base::ContainsKey(urls, URL(kPath1))); |
241 EXPECT_TRUE(ContainsKey(urls, URL(kPath2))); | 241 EXPECT_TRUE(base::ContainsKey(urls, URL(kPath2))); |
242 | 242 |
243 VerifyAndClearChange(URL(kPath0), | 243 VerifyAndClearChange(URL(kPath0), |
244 FileChange(FileChange::FILE_CHANGE_DELETE, | 244 FileChange(FileChange::FILE_CHANGE_DELETE, |
245 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); | 245 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); |
246 VerifyAndClearChange(URL(kPath1), | 246 VerifyAndClearChange(URL(kPath1), |
247 FileChange(FileChange::FILE_CHANGE_DELETE, | 247 FileChange(FileChange::FILE_CHANGE_DELETE, |
248 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); | 248 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); |
249 VerifyAndClearChange(URL(kPath2), | 249 VerifyAndClearChange(URL(kPath2), |
250 FileChange(FileChange::FILE_CHANGE_DELETE, | 250 FileChange(FileChange::FILE_CHANGE_DELETE, |
251 sync_file_system::SYNC_FILE_TYPE_FILE)); | 251 sync_file_system::SYNC_FILE_TYPE_FILE)); |
252 } | 252 } |
253 | 253 |
254 } // namespace sync_file_system | 254 } // namespace sync_file_system |
OLD | NEW |