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 16 matching lines...) Expand all Loading... |
27 using fileapi::FileSystemURL; | 27 using fileapi::FileSystemURL; |
28 using fileapi::FileSystemURLSet; | 28 using fileapi::FileSystemURLSet; |
29 using webkit_blob::MockBlobURLRequestContext; | 29 using webkit_blob::MockBlobURLRequestContext; |
30 using webkit_blob::ScopedTextBlob; | 30 using webkit_blob::ScopedTextBlob; |
31 | 31 |
32 namespace sync_file_system { | 32 namespace sync_file_system { |
33 | 33 |
34 class LocalFileChangeTrackerTest : public testing::Test { | 34 class LocalFileChangeTrackerTest : public testing::Test { |
35 public: | 35 public: |
36 LocalFileChangeTrackerTest() | 36 LocalFileChangeTrackerTest() |
37 : message_loop_(base::MessageLoop::TYPE_IO), | 37 : file_system_(GURL("http://example.com"), |
38 file_system_(GURL("http://example.com"), | |
39 base::MessageLoopProxy::current().get(), | 38 base::MessageLoopProxy::current().get(), |
40 base::MessageLoopProxy::current().get()) {} | 39 base::MessageLoopProxy::current().get()) {} |
41 | 40 |
42 virtual void SetUp() OVERRIDE { | 41 virtual void SetUp() OVERRIDE { |
43 file_system_.SetUp(); | 42 file_system_.SetUp(); |
44 | 43 |
45 sync_context_ = | 44 sync_context_ = |
46 new LocalFileSyncContext(base::FilePath(), | 45 new LocalFileSyncContext(base::FilePath(), |
47 base::MessageLoopProxy::current().get(), | 46 base::MessageLoopProxy::current().get(), |
48 base::MessageLoopProxy::current().get()); | 47 base::MessageLoopProxy::current().get()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 98 |
100 void RestoreChangesFromTrackerDB() { | 99 void RestoreChangesFromTrackerDB() { |
101 change_tracker()->CollectLastDirtyChanges(file_system_context()); | 100 change_tracker()->CollectLastDirtyChanges(file_system_context()); |
102 } | 101 } |
103 | 102 |
104 void GetAllChangedURLs(fileapi::FileSystemURLSet* urls) { | 103 void GetAllChangedURLs(fileapi::FileSystemURLSet* urls) { |
105 change_tracker()->GetAllChangedURLs(urls); | 104 change_tracker()->GetAllChangedURLs(urls); |
106 } | 105 } |
107 | 106 |
108 ScopedEnableSyncFSDirectoryOperation enable_directory_operation_; | 107 ScopedEnableSyncFSDirectoryOperation enable_directory_operation_; |
109 base::MessageLoop message_loop_; | 108 base::MessageLoopForIO message_loop_; |
110 CannedSyncableFileSystem file_system_; | 109 CannedSyncableFileSystem file_system_; |
111 | 110 |
112 private: | 111 private: |
113 scoped_refptr<LocalFileSyncContext> sync_context_; | 112 scoped_refptr<LocalFileSyncContext> sync_context_; |
114 | 113 |
115 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTrackerTest); | 114 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTrackerTest); |
116 }; | 115 }; |
117 | 116 |
118 TEST_F(LocalFileChangeTrackerTest, GetChanges) { | 117 TEST_F(LocalFileChangeTrackerTest, GetChanges) { |
119 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); | 118 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 671 |
673 // Make sure they're gone from the database too. | 672 // Make sure they're gone from the database too. |
674 DropChangesInTracker(); | 673 DropChangesInTracker(); |
675 RestoreChangesFromTrackerDB(); | 674 RestoreChangesFromTrackerDB(); |
676 | 675 |
677 GetAllChangedURLs(&urls); | 676 GetAllChangedURLs(&urls); |
678 EXPECT_TRUE(urls.empty()); | 677 EXPECT_TRUE(urls.empty()); |
679 } | 678 } |
680 | 679 |
681 } // namespace sync_file_system | 680 } // namespace sync_file_system |
OLD | NEW |