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_change_tracker.h" | 5 #include "webkit/browser/fileapi/syncable/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.h" | 13 #include "base/message_loop.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "webkit/browser/blob/mock_blob_url_request_context.h" | 17 #include "webkit/browser/blob/mock_blob_url_request_context.h" |
18 #include "webkit/browser/fileapi/file_system_context.h" | 18 #include "webkit/browser/fileapi/file_system_context.h" |
19 #include "webkit/browser/fileapi/file_system_task_runners.h" | 19 #include "webkit/browser/fileapi/file_system_task_runners.h" |
20 #include "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" | 20 #include "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" |
21 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" | 21 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" |
| 22 #include "webkit/browser/fileapi/syncable/sync_file_system_backend.h" |
22 #include "webkit/browser/fileapi/syncable/sync_status_code.h" | 23 #include "webkit/browser/fileapi/syncable/sync_status_code.h" |
23 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" | 24 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" |
24 #include "webkit/browser/quota/quota_manager.h" | 25 #include "webkit/browser/quota/quota_manager.h" |
25 | 26 |
26 using fileapi::FileSystemContext; | 27 using fileapi::FileSystemContext; |
27 using fileapi::FileSystemURL; | 28 using fileapi::FileSystemURL; |
28 using fileapi::FileSystemURLSet; | 29 using fileapi::FileSystemURLSet; |
29 using webkit_blob::MockBlobURLRequestContext; | 30 using webkit_blob::MockBlobURLRequestContext; |
30 using webkit_blob::ScopedTextBlob; | 31 using webkit_blob::ScopedTextBlob; |
31 | 32 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 protected: | 67 protected: |
67 FileSystemURL URL(const std::string& path) { | 68 FileSystemURL URL(const std::string& path) { |
68 return file_system_.URL(path); | 69 return file_system_.URL(path); |
69 } | 70 } |
70 | 71 |
71 FileSystemContext* file_system_context() { | 72 FileSystemContext* file_system_context() { |
72 return file_system_.file_system_context(); | 73 return file_system_.file_system_context(); |
73 } | 74 } |
74 | 75 |
75 LocalFileChangeTracker* change_tracker() { | 76 LocalFileChangeTracker* change_tracker() { |
76 return file_system_context()->change_tracker(); | 77 return file_system_.backend()->change_tracker(); |
77 } | 78 } |
78 | 79 |
79 void VerifyAndClearChange(const FileSystemURL& url, | 80 void VerifyAndClearChange(const FileSystemURL& url, |
80 const FileChange& expected_change) { | 81 const FileChange& expected_change) { |
81 SCOPED_TRACE(testing::Message() << url.DebugString() << | 82 SCOPED_TRACE(testing::Message() << url.DebugString() << |
82 " expecting:" << expected_change.DebugString()); | 83 " expecting:" << expected_change.DebugString()); |
83 // Get the changes for URL and verify. | 84 // Get the changes for URL and verify. |
84 FileChangeList changes; | 85 FileChangeList changes; |
85 change_tracker()->GetChangesForURL(url, &changes); | 86 change_tracker()->GetChangesForURL(url, &changes); |
86 ASSERT_EQ(1U, changes.size()); | 87 ASSERT_EQ(1U, changes.size()); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 ASSERT_EQ(2U, urls_to_process.size()); | 596 ASSERT_EQ(2U, urls_to_process.size()); |
596 | 597 |
597 // The exact order of recursive removal cannot be determined. | 598 // The exact order of recursive removal cannot be determined. |
598 EXPECT_TRUE(URL(kPath1) == urls_to_process[0] || | 599 EXPECT_TRUE(URL(kPath1) == urls_to_process[0] || |
599 URL(kPath2) == urls_to_process[0]); | 600 URL(kPath2) == urls_to_process[0]); |
600 EXPECT_TRUE(URL(kPath1) == urls_to_process[1] || | 601 EXPECT_TRUE(URL(kPath1) == urls_to_process[1] || |
601 URL(kPath2) == urls_to_process[1]); | 602 URL(kPath2) == urls_to_process[1]); |
602 } | 603 } |
603 | 604 |
604 } // namespace sync_file_system | 605 } // namespace sync_file_system |
OLD | NEW |