| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/fileapi/syncable/file_change.h" | 5 #include "webkit/fileapi/syncable/file_change.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace fileapi { | 11 namespace sync_file_system { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 FileChange AddOrUpdateFile() { | 15 FileChange AddOrUpdateFile() { |
| 16 return FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 16 return FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, SYNC_FILE_TYPE_FILE); |
| 17 SYNC_FILE_TYPE_FILE); | |
| 18 } | 17 } |
| 19 | 18 |
| 20 FileChange DeleteFile() { | 19 FileChange DeleteFile() { |
| 21 return FileChange(FileChange::FILE_CHANGE_DELETE, | 20 return FileChange(FileChange::FILE_CHANGE_DELETE, SYNC_FILE_TYPE_FILE); |
| 22 SYNC_FILE_TYPE_FILE); | |
| 23 } | 21 } |
| 24 | 22 |
| 25 FileChange AddDirectory() { | 23 FileChange AddDirectory() { |
| 26 return FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 24 return FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
| 27 SYNC_FILE_TYPE_DIRECTORY); | 25 SYNC_FILE_TYPE_DIRECTORY); |
| 28 } | 26 } |
| 29 | 27 |
| 30 FileChange DeleteDirectory() { | 28 FileChange DeleteDirectory() { |
| 31 return FileChange(FileChange::FILE_CHANGE_DELETE, | 29 return FileChange(FileChange::FILE_CHANGE_DELETE, SYNC_FILE_TYPE_DIRECTORY); |
| 32 SYNC_FILE_TYPE_DIRECTORY); | |
| 33 } | 30 } |
| 34 | 31 |
| 35 template <size_t INPUT_SIZE> | 32 template <size_t INPUT_SIZE> |
| 36 void CreateList(FileChangeList* list, const FileChange (&inputs)[INPUT_SIZE]) { | 33 void CreateList(FileChangeList* list, const FileChange (&inputs)[INPUT_SIZE]) { |
| 37 list->clear(); | 34 list->clear(); |
| 38 for (size_t i = 0; i < INPUT_SIZE; ++i) | 35 for (size_t i = 0; i < INPUT_SIZE; ++i) |
| 39 list->Update(inputs[i]); | 36 list->Update(inputs[i]); |
| 40 } | 37 } |
| 41 | 38 |
| 42 template <size_t EXPECTED_SIZE> | 39 template <size_t EXPECTED_SIZE> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 AddOrUpdateFile(), | 126 AddOrUpdateFile(), |
| 130 DeleteFile(), | 127 DeleteFile(), |
| 131 AddOrUpdateFile(), | 128 AddOrUpdateFile(), |
| 132 DeleteFile(), | 129 DeleteFile(), |
| 133 }; | 130 }; |
| 134 const FileChange kExpected4[] = { DeleteFile() }; | 131 const FileChange kExpected4[] = { DeleteFile() }; |
| 135 CreateList(&list, kInput4); | 132 CreateList(&list, kInput4); |
| 136 VerifyList(list, kExpected4); | 133 VerifyList(list, kExpected4); |
| 137 } | 134 } |
| 138 | 135 |
| 139 } // namespace fileapi | 136 } // namespace sync_file_system |
| OLD | NEW |