| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <memory> |
| 10 #include <set> | 11 #include <set> |
| 11 | 12 |
| 12 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 18 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 18 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 19 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 19 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 20 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 20 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 21 #include "chrome/browser/sync_file_system/sync_status_code.h" | 21 #include "chrome/browser/sync_file_system/sync_status_code.h" |
| 22 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 22 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 23 #include "content/public/test/mock_blob_url_request_context.h" | 23 #include "content/public/test/mock_blob_url_request_context.h" |
| 24 #include "storage/browser/fileapi/file_system_context.h" | 24 #include "storage/browser/fileapi/file_system_context.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void RestoreChangesFromTrackerDB() { | 107 void RestoreChangesFromTrackerDB() { |
| 108 change_tracker()->CollectLastDirtyChanges(file_system_context()); | 108 change_tracker()->CollectLastDirtyChanges(file_system_context()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void GetAllChangedURLs(storage::FileSystemURLSet* urls) { | 111 void GetAllChangedURLs(storage::FileSystemURLSet* urls) { |
| 112 change_tracker()->GetAllChangedURLs(urls); | 112 change_tracker()->GetAllChangedURLs(urls); |
| 113 } | 113 } |
| 114 | 114 |
| 115 base::MessageLoopForIO message_loop_; | 115 base::MessageLoopForIO message_loop_; |
| 116 base::ScopedTempDir base_dir_; | 116 base::ScopedTempDir base_dir_; |
| 117 scoped_ptr<leveldb::Env> in_memory_env_; | 117 std::unique_ptr<leveldb::Env> in_memory_env_; |
| 118 CannedSyncableFileSystem file_system_; | 118 CannedSyncableFileSystem file_system_; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 scoped_refptr<LocalFileSyncContext> sync_context_; | 121 scoped_refptr<LocalFileSyncContext> sync_context_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTrackerTest); | 123 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTrackerTest); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 TEST_F(LocalFileChangeTrackerTest, DemoteAndPromote) { | 126 TEST_F(LocalFileChangeTrackerTest, DemoteAndPromote) { |
| 127 EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem()); | 127 EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem()); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 // Make sure they're gone from the database too. | 708 // Make sure they're gone from the database too. |
| 709 DropChangesInTracker(); | 709 DropChangesInTracker(); |
| 710 RestoreChangesFromTrackerDB(); | 710 RestoreChangesFromTrackerDB(); |
| 711 | 711 |
| 712 GetAllChangedURLs(&urls); | 712 GetAllChangedURLs(&urls); |
| 713 EXPECT_TRUE(urls.empty()); | 713 EXPECT_TRUE(urls.empty()); |
| 714 } | 714 } |
| 715 | 715 |
| 716 } // namespace sync_file_system | 716 } // namespace sync_file_system |
| OLD | NEW |