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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 using ::testing::_; | 27 using ::testing::_; |
28 using ::testing::ReturnRef; | 28 using ::testing::ReturnRef; |
29 | 29 |
30 using chromeos::disks::DiskMountManager; | 30 using chromeos::disks::DiskMountManager; |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 struct TestDiskInfo { | 34 struct TestDiskInfo { |
35 const char* system_path; | 35 const char* system_path; |
36 const char* file_path; | 36 const char* file_path; |
| 37 bool write_disabled_by_policy; |
37 const char* device_label; | 38 const char* device_label; |
38 const char* drive_label; | 39 const char* drive_label; |
39 const char* vendor_id; | 40 const char* vendor_id; |
40 const char* vendor_name; | 41 const char* vendor_name; |
41 const char* product_id; | 42 const char* product_id; |
42 const char* product_name; | 43 const char* product_name; |
43 const char* fs_uuid; | 44 const char* fs_uuid; |
44 const char* system_path_prefix; | 45 const char* system_path_prefix; |
45 chromeos::DeviceType device_type; | 46 chromeos::DeviceType device_type; |
46 uint64_t size_in_bytes; | 47 uint64_t size_in_bytes; |
(...skipping 12 matching lines...) Expand all Loading... |
59 chromeos::disks::MountCondition mount_condition; | 60 chromeos::disks::MountCondition mount_condition; |
60 | 61 |
61 // -1 if there is no disk info. | 62 // -1 if there is no disk info. |
62 int disk_info_index; | 63 int disk_info_index; |
63 }; | 64 }; |
64 | 65 |
65 TestDiskInfo kTestDisks[] = { | 66 TestDiskInfo kTestDisks[] = { |
66 { | 67 { |
67 "system_path1", | 68 "system_path1", |
68 "file_path1", | 69 "file_path1", |
| 70 false, |
69 "device_label1", | 71 "device_label1", |
70 "drive_label1", | 72 "drive_label1", |
71 "0123", | 73 "0123", |
72 "vendor1", | 74 "vendor1", |
73 "abcd", | 75 "abcd", |
74 "product1", | 76 "product1", |
75 "FFFF-FFFF", | 77 "FFFF-FFFF", |
76 "system_path_prefix1", | 78 "system_path_prefix1", |
77 chromeos::DEVICE_TYPE_USB, | 79 chromeos::DEVICE_TYPE_USB, |
78 1073741824, | 80 1073741824, |
79 false, | 81 false, |
80 false, | 82 false, |
81 false, | 83 false, |
82 false, | 84 false, |
83 false, | 85 false, |
84 false | 86 false |
85 }, | 87 }, |
86 { | 88 { |
87 "system_path2", | 89 "system_path2", |
88 "file_path2", | 90 "file_path2", |
| 91 false, |
89 "device_label2", | 92 "device_label2", |
90 "drive_label2", | 93 "drive_label2", |
91 "4567", | 94 "4567", |
92 "vendor2", | 95 "vendor2", |
93 "cdef", | 96 "cdef", |
94 "product2", | 97 "product2", |
95 "0FFF-FFFF", | 98 "0FFF-FFFF", |
96 "system_path_prefix2", | 99 "system_path_prefix2", |
97 chromeos::DEVICE_TYPE_MOBILE, | 100 chromeos::DEVICE_TYPE_MOBILE, |
98 47723, | 101 47723, |
99 true, | 102 true, |
100 true, | 103 true, |
101 true, | 104 true, |
102 true, | 105 true, |
103 false, | 106 false, |
104 false | 107 false |
105 }, | 108 }, |
106 { | 109 { |
107 "system_path3", | 110 "system_path3", |
108 "file_path3", | 111 "file_path3", |
| 112 false, |
109 "device_label3", | 113 "device_label3", |
110 "drive_label3", | 114 "drive_label3", |
111 "89ab", | 115 "89ab", |
112 "vendor3", | 116 "vendor3", |
113 "ef01", | 117 "ef01", |
114 "product3", | 118 "product3", |
115 "00FF-FFFF", | 119 "00FF-FFFF", |
116 "system_path_prefix3", | 120 "system_path_prefix3", |
117 chromeos::DEVICE_TYPE_OPTICAL_DISC, | 121 chromeos::DEVICE_TYPE_OPTICAL_DISC, |
118 0, | 122 0, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 int disk_info_index = kTestMountPoints[i].disk_info_index; | 268 int disk_info_index = kTestMountPoints[i].disk_info_index; |
265 if (kTestMountPoints[i].disk_info_index >= 0) { | 269 if (kTestMountPoints[i].disk_info_index >= 0) { |
266 EXPECT_GT(arraysize(kTestDisks), static_cast<size_t>(disk_info_index)); | 270 EXPECT_GT(arraysize(kTestDisks), static_cast<size_t>(disk_info_index)); |
267 if (static_cast<size_t>(disk_info_index) >= arraysize(kTestDisks)) | 271 if (static_cast<size_t>(disk_info_index) >= arraysize(kTestDisks)) |
268 return; | 272 return; |
269 | 273 |
270 volumes_.insert(DiskMountManager::DiskMap::value_type( | 274 volumes_.insert(DiskMountManager::DiskMap::value_type( |
271 kTestMountPoints[i].source_path, | 275 kTestMountPoints[i].source_path, |
272 base::MakeUnique<DiskMountManager::Disk>( | 276 base::MakeUnique<DiskMountManager::Disk>( |
273 kTestMountPoints[i].source_path, kTestMountPoints[i].mount_path, | 277 kTestMountPoints[i].source_path, kTestMountPoints[i].mount_path, |
| 278 kTestDisks[disk_info_index].write_disabled_by_policy, |
274 kTestDisks[disk_info_index].system_path, | 279 kTestDisks[disk_info_index].system_path, |
275 kTestDisks[disk_info_index].file_path, | 280 kTestDisks[disk_info_index].file_path, |
276 kTestDisks[disk_info_index].device_label, | 281 kTestDisks[disk_info_index].device_label, |
277 kTestDisks[disk_info_index].drive_label, | 282 kTestDisks[disk_info_index].drive_label, |
278 kTestDisks[disk_info_index].vendor_id, | 283 kTestDisks[disk_info_index].vendor_id, |
279 kTestDisks[disk_info_index].vendor_name, | 284 kTestDisks[disk_info_index].vendor_name, |
280 kTestDisks[disk_info_index].product_id, | 285 kTestDisks[disk_info_index].product_id, |
281 kTestDisks[disk_info_index].product_name, | 286 kTestDisks[disk_info_index].product_name, |
282 kTestDisks[disk_info_index].fs_uuid, | 287 kTestDisks[disk_info_index].fs_uuid, |
283 kTestDisks[disk_info_index].system_path_prefix, | 288 kTestDisks[disk_info_index].system_path_prefix, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 ->RegisterFileSystem( | 440 ->RegisterFileSystem( |
436 kLocalMountPointName, storage::kFileSystemTypeNativeLocal, | 441 kLocalMountPointName, storage::kFileSystemTypeNativeLocal, |
437 storage::FileSystemMountOption(), mount_point_dir)); | 442 storage::FileSystemMountOption(), mount_point_dir)); |
438 file_manager::VolumeManager::Get(browser()->profile()) | 443 file_manager::VolumeManager::Get(browser()->profile()) |
439 ->AddVolumeForTesting(mount_point_dir, file_manager::VOLUME_TYPE_TESTING, | 444 ->AddVolumeForTesting(mount_point_dir, file_manager::VOLUME_TYPE_TESTING, |
440 chromeos::DEVICE_TYPE_UNKNOWN, | 445 chromeos::DEVICE_TYPE_UNKNOWN, |
441 false /* read_only */); | 446 false /* read_only */); |
442 | 447 |
443 ASSERT_TRUE(RunComponentExtensionTest("file_browser/content_checksum_test")); | 448 ASSERT_TRUE(RunComponentExtensionTest("file_browser/content_checksum_test")); |
444 } | 449 } |
OLD | NEW |