| 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 "webkit/browser/fileapi/syncable/local_file_sync_context.h" | 5 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 sync_context_ = | 222 sync_context_ = |
| 223 new LocalFileSyncContext(ui_task_runner_.get(), io_task_runner_.get()); | 223 new LocalFileSyncContext(ui_task_runner_.get(), io_task_runner_.get()); |
| 224 | 224 |
| 225 // Initializes file_system using |sync_context_|. | 225 // Initializes file_system using |sync_context_|. |
| 226 EXPECT_EQ(SYNC_STATUS_OK, | 226 EXPECT_EQ(SYNC_STATUS_OK, |
| 227 file_system.MaybeInitializeFileSystemContext(sync_context_.get())); | 227 file_system.MaybeInitializeFileSystemContext(sync_context_.get())); |
| 228 | 228 |
| 229 // Make sure everything's set up for file_system to be able to handle | 229 // Make sure everything's set up for file_system to be able to handle |
| 230 // syncable file system operations. | 230 // syncable file system operations. |
| 231 EXPECT_TRUE(file_system.file_system_context()->sync_context() != NULL); | 231 EXPECT_TRUE(file_system.mount_provider()->sync_context() != NULL); |
| 232 EXPECT_TRUE(file_system.file_system_context()->change_tracker() != NULL); | 232 EXPECT_TRUE(file_system.mount_provider()->change_tracker() != NULL); |
| 233 EXPECT_EQ(sync_context_.get(), | 233 EXPECT_EQ(sync_context_.get(), |
| 234 file_system.file_system_context()->sync_context()); | 234 file_system.mount_provider()->sync_context()); |
| 235 | 235 |
| 236 // Calling MaybeInitialize for the same context multiple times must be ok. | 236 // Calling MaybeInitialize for the same context multiple times must be ok. |
| 237 EXPECT_EQ(SYNC_STATUS_OK, | 237 EXPECT_EQ(SYNC_STATUS_OK, |
| 238 file_system.MaybeInitializeFileSystemContext(sync_context_.get())); | 238 file_system.MaybeInitializeFileSystemContext(sync_context_.get())); |
| 239 EXPECT_EQ(sync_context_.get(), | 239 EXPECT_EQ(sync_context_.get(), |
| 240 file_system.file_system_context()->sync_context()); | 240 file_system.mount_provider()->sync_context()); |
| 241 | 241 |
| 242 // Opens the file_system, perform some operation and see if the change tracker | 242 // Opens the file_system, perform some operation and see if the change tracker |
| 243 // correctly captures the change. | 243 // correctly captures the change. |
| 244 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem()); | 244 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem()); |
| 245 | 245 |
| 246 const FileSystemURL kURL(file_system.URL("foo")); | 246 const FileSystemURL kURL(file_system.URL("foo")); |
| 247 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kURL)); | 247 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kURL)); |
| 248 | 248 |
| 249 FileSystemURLSet urls; | 249 FileSystemURLSet urls; |
| 250 file_system.GetChangedURLsInTracker(&urls); | 250 file_system.GetChangedURLsInTracker(&urls); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 686 |
| 687 // Make sure kDir and kFile are created by ApplyRemoteChange. | 687 // Make sure kDir and kFile are created by ApplyRemoteChange. |
| 688 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile)); | 688 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile)); |
| 689 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir)); | 689 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir)); |
| 690 | 690 |
| 691 sync_context_->ShutdownOnUIThread(); | 691 sync_context_->ShutdownOnUIThread(); |
| 692 file_system.TearDown(); | 692 file_system.TearDown(); |
| 693 } | 693 } |
| 694 | 694 |
| 695 } // namespace sync_file_system | 695 } // namespace sync_file_system |
| OLD | NEW |