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" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 16 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
17 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 17 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
18 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 18 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
19 #include "chrome/browser/sync_file_system/sync_status_code.h" | 19 #include "chrome/browser/sync_file_system/sync_status_code.h" |
20 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 20 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
21 #include "content/public/test/mock_blob_url_request_context.h" | 21 #include "content/public/test/mock_blob_url_request_context.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 23 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
24 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 24 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
25 #include "webkit/browser/fileapi/file_system_context.h" | 25 #include "storage/browser/fileapi/file_system_context.h" |
26 #include "webkit/browser/quota/quota_manager.h" | 26 #include "storage/browser/quota/quota_manager.h" |
27 | 27 |
28 using fileapi::FileSystemContext; | 28 using storage::FileSystemContext; |
29 using fileapi::FileSystemURL; | 29 using storage::FileSystemURL; |
30 using fileapi::FileSystemURLSet; | 30 using storage::FileSystemURLSet; |
31 using content::MockBlobURLRequestContext; | 31 using content::MockBlobURLRequestContext; |
32 using content::ScopedTextBlob; | 32 using content::ScopedTextBlob; |
33 | 33 |
34 namespace sync_file_system { | 34 namespace sync_file_system { |
35 | 35 |
36 class LocalFileChangeTrackerTest : public testing::Test { | 36 class LocalFileChangeTrackerTest : public testing::Test { |
37 public: | 37 public: |
38 LocalFileChangeTrackerTest() | 38 LocalFileChangeTrackerTest() |
39 : in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())), | 39 : in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())), |
40 file_system_(GURL("http://example.com"), | 40 file_system_(GURL("http://example.com"), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 void DropChangesInTracker() { | 101 void DropChangesInTracker() { |
102 change_tracker()->DropAllChanges(); | 102 change_tracker()->DropAllChanges(); |
103 } | 103 } |
104 | 104 |
105 void RestoreChangesFromTrackerDB() { | 105 void RestoreChangesFromTrackerDB() { |
106 change_tracker()->CollectLastDirtyChanges(file_system_context()); | 106 change_tracker()->CollectLastDirtyChanges(file_system_context()); |
107 } | 107 } |
108 | 108 |
109 void GetAllChangedURLs(fileapi::FileSystemURLSet* urls) { | 109 void GetAllChangedURLs(storage::FileSystemURLSet* urls) { |
110 change_tracker()->GetAllChangedURLs(urls); | 110 change_tracker()->GetAllChangedURLs(urls); |
111 } | 111 } |
112 | 112 |
113 base::MessageLoopForIO message_loop_; | 113 base::MessageLoopForIO message_loop_; |
114 base::ScopedTempDir base_dir_; | 114 base::ScopedTempDir base_dir_; |
115 scoped_ptr<leveldb::Env> in_memory_env_; | 115 scoped_ptr<leveldb::Env> in_memory_env_; |
116 CannedSyncableFileSystem file_system_; | 116 CannedSyncableFileSystem file_system_; |
117 | 117 |
118 private: | 118 private: |
119 scoped_refptr<LocalFileSyncContext> sync_context_; | 119 scoped_refptr<LocalFileSyncContext> sync_context_; |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 | 705 |
706 // Make sure they're gone from the database too. | 706 // Make sure they're gone from the database too. |
707 DropChangesInTracker(); | 707 DropChangesInTracker(); |
708 RestoreChangesFromTrackerDB(); | 708 RestoreChangesFromTrackerDB(); |
709 | 709 |
710 GetAllChangedURLs(&urls); | 710 GetAllChangedURLs(&urls); |
711 EXPECT_TRUE(urls.empty()); | 711 EXPECT_TRUE(urls.empty()); |
712 } | 712 } |
713 | 713 |
714 } // namespace sync_file_system | 714 } // namespace sync_file_system |
OLD | NEW |