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/local/local_file_change_tracker.h" | 5 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 EXPECT_EQ(URL(kPath5), urls_to_process[1]); | 229 EXPECT_EQ(URL(kPath5), urls_to_process[1]); |
230 EXPECT_EQ(URL(kPath4), urls_to_process[2]); | 230 EXPECT_EQ(URL(kPath4), urls_to_process[2]); |
231 | 231 |
232 // Promote changes. | 232 // Promote changes. |
233 EXPECT_TRUE(change_tracker()->PromoteDemotedChanges()); | 233 EXPECT_TRUE(change_tracker()->PromoteDemotedChanges()); |
234 | 234 |
235 // Now we should have kPath1 and kPath3. | 235 // Now we should have kPath1 and kPath3. |
236 urls_to_process.clear(); | 236 urls_to_process.clear(); |
237 change_tracker()->GetNextChangedURLs(&urls_to_process, 0); | 237 change_tracker()->GetNextChangedURLs(&urls_to_process, 0); |
238 ASSERT_EQ(5U, urls_to_process.size()); | 238 ASSERT_EQ(5U, urls_to_process.size()); |
239 EXPECT_EQ(URL(kPath2), urls_to_process[0]); | 239 EXPECT_EQ(URL(kPath1), urls_to_process[0]); |
240 EXPECT_EQ(URL(kPath5), urls_to_process[1]); | 240 EXPECT_EQ(URL(kPath2), urls_to_process[1]); |
241 EXPECT_EQ(URL(kPath4), urls_to_process[2]); | 241 EXPECT_EQ(URL(kPath3), urls_to_process[2]); |
242 EXPECT_TRUE(URL(kPath1) == urls_to_process[3] || | 242 EXPECT_EQ(URL(kPath5), urls_to_process[3]); |
243 URL(kPath1) == urls_to_process[4]); | 243 EXPECT_EQ(URL(kPath4), urls_to_process[4]); |
244 EXPECT_TRUE(URL(kPath3) == urls_to_process[3] || | |
245 URL(kPath3) == urls_to_process[4]); | |
246 | 244 |
247 // No changes to promote any more. | 245 // No changes to promote any more. |
248 EXPECT_FALSE(change_tracker()->PromoteDemotedChanges()); | 246 EXPECT_FALSE(change_tracker()->PromoteDemotedChanges()); |
249 | 247 |
250 | 248 |
251 VerifyAndClearChange(URL(kPath1), | 249 VerifyAndClearChange(URL(kPath1), |
252 FileChange(FileChange::FILE_CHANGE_DELETE, | 250 FileChange(FileChange::FILE_CHANGE_DELETE, |
253 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); | 251 sync_file_system::SYNC_FILE_TYPE_DIRECTORY)); |
254 VerifyAndClearChange(URL(kPath2), | 252 VerifyAndClearChange(URL(kPath2), |
255 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 253 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 705 |
708 // Make sure they're gone from the database too. | 706 // Make sure they're gone from the database too. |
709 DropChangesInTracker(); | 707 DropChangesInTracker(); |
710 RestoreChangesFromTrackerDB(); | 708 RestoreChangesFromTrackerDB(); |
711 | 709 |
712 GetAllChangedURLs(&urls); | 710 GetAllChangedURLs(&urls); |
713 EXPECT_TRUE(urls.empty()); | 711 EXPECT_TRUE(urls.empty()); |
714 } | 712 } |
715 | 713 |
716 } // namespace sync_file_system | 714 } // namespace sync_file_system |
OLD | NEW |