| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" | 8 #include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 using chromeos::disks::DiskMountManager; | 22 using chromeos::disks::DiskMountManager; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 struct TestDiskInfo { | 26 struct TestDiskInfo { |
| 27 const char* system_path; | 27 const char* system_path; |
| 28 const char* file_path; | 28 const char* file_path; |
| 29 const char* device_label; | 29 const char* device_label; |
| 30 const char* drive_label; | 30 const char* drive_label; |
| 31 const char* fs_uuid; |
| 31 const char* system_path_prefix; | 32 const char* system_path_prefix; |
| 32 chromeos::DeviceType device_type; | 33 chromeos::DeviceType device_type; |
| 33 uint64 size_in_bytes; | 34 uint64 size_in_bytes; |
| 34 bool is_parent; | 35 bool is_parent; |
| 35 bool is_read_only; | 36 bool is_read_only; |
| 36 bool has_media; | 37 bool has_media; |
| 37 bool on_boot_device; | 38 bool on_boot_device; |
| 38 bool is_hidden; | 39 bool is_hidden; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 struct TestMountPoint { | 42 struct TestMountPoint { |
| 42 const char* source_path; | 43 const char* source_path; |
| 43 const char* mount_path; | 44 const char* mount_path; |
| 44 chromeos::MountType mount_type; | 45 chromeos::MountType mount_type; |
| 45 chromeos::disks::MountCondition mount_condition; | 46 chromeos::disks::MountCondition mount_condition; |
| 46 | 47 |
| 47 // -1 if there is no disk info. | 48 // -1 if there is no disk info. |
| 48 int disk_info_index; | 49 int disk_info_index; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 TestDiskInfo kTestDisks[] = { | 52 TestDiskInfo kTestDisks[] = { |
| 52 { | 53 { |
| 53 "system_path1", | 54 "system_path1", |
| 54 "file_path1", | 55 "file_path1", |
| 55 "device_label1", | 56 "device_label1", |
| 56 "drive_label1", | 57 "drive_label1", |
| 58 "FFFF-FFFF", |
| 57 "system_path_prefix1", | 59 "system_path_prefix1", |
| 58 chromeos::DEVICE_TYPE_USB, | 60 chromeos::DEVICE_TYPE_USB, |
| 59 1073741824, | 61 1073741824, |
| 60 false, | 62 false, |
| 61 false, | 63 false, |
| 62 false, | 64 false, |
| 63 false, | 65 false, |
| 64 false | 66 false |
| 65 }, | 67 }, |
| 66 { | 68 { |
| 67 "system_path2", | 69 "system_path2", |
| 68 "file_path2", | 70 "file_path2", |
| 69 "device_label2", | 71 "device_label2", |
| 70 "drive_label2", | 72 "drive_label2", |
| 73 "0FFF-FFFF", |
| 71 "system_path_prefix2", | 74 "system_path_prefix2", |
| 72 chromeos::DEVICE_TYPE_MOBILE, | 75 chromeos::DEVICE_TYPE_MOBILE, |
| 73 47723, | 76 47723, |
| 74 true, | 77 true, |
| 75 true, | 78 true, |
| 76 true, | 79 true, |
| 77 true, | 80 true, |
| 78 false | 81 false |
| 79 }, | 82 }, |
| 80 { | 83 { |
| 81 "system_path3", | 84 "system_path3", |
| 82 "file_path3", | 85 "file_path3", |
| 83 "device_label3", | 86 "device_label3", |
| 84 "drive_label3", | 87 "drive_label3", |
| 88 "00FF-FFFF", |
| 85 "system_path_prefix3", | 89 "system_path_prefix3", |
| 86 chromeos::DEVICE_TYPE_OPTICAL_DISC, | 90 chromeos::DEVICE_TYPE_OPTICAL_DISC, |
| 87 0, | 91 0, |
| 88 true, | 92 true, |
| 89 false, | 93 false, |
| 90 false, | 94 false, |
| 91 true, | 95 true, |
| 92 false | 96 false |
| 93 } | 97 } |
| 94 }; | 98 }; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 187 |
| 184 volumes_.insert(DiskMountManager::DiskMap::value_type( | 188 volumes_.insert(DiskMountManager::DiskMap::value_type( |
| 185 kTestMountPoints[i].source_path, | 189 kTestMountPoints[i].source_path, |
| 186 new DiskMountManager::Disk( | 190 new DiskMountManager::Disk( |
| 187 kTestMountPoints[i].source_path, | 191 kTestMountPoints[i].source_path, |
| 188 kTestMountPoints[i].mount_path, | 192 kTestMountPoints[i].mount_path, |
| 189 kTestDisks[disk_info_index].system_path, | 193 kTestDisks[disk_info_index].system_path, |
| 190 kTestDisks[disk_info_index].file_path, | 194 kTestDisks[disk_info_index].file_path, |
| 191 kTestDisks[disk_info_index].device_label, | 195 kTestDisks[disk_info_index].device_label, |
| 192 kTestDisks[disk_info_index].drive_label, | 196 kTestDisks[disk_info_index].drive_label, |
| 197 kTestDisks[disk_info_index].fs_uuid, |
| 193 kTestDisks[disk_info_index].system_path_prefix, | 198 kTestDisks[disk_info_index].system_path_prefix, |
| 194 kTestDisks[disk_info_index].device_type, | 199 kTestDisks[disk_info_index].device_type, |
| 195 kTestDisks[disk_info_index].size_in_bytes, | 200 kTestDisks[disk_info_index].size_in_bytes, |
| 196 kTestDisks[disk_info_index].is_parent, | 201 kTestDisks[disk_info_index].is_parent, |
| 197 kTestDisks[disk_info_index].is_read_only, | 202 kTestDisks[disk_info_index].is_read_only, |
| 198 kTestDisks[disk_info_index].has_media, | 203 kTestDisks[disk_info_index].has_media, |
| 199 kTestDisks[disk_info_index].on_boot_device, | 204 kTestDisks[disk_info_index].on_boot_device, |
| 200 kTestDisks[disk_info_index].is_hidden | 205 kTestDisks[disk_info_index].is_hidden |
| 201 ) | 206 ) |
| 202 )); | 207 )); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 224 UnmountPath(StrEq("/media/archive/archive_mount_path"))).Times(1); | 229 UnmountPath(StrEq("/media/archive/archive_mount_path"))).Times(1); |
| 225 | 230 |
| 226 EXPECT_CALL(*disk_mount_manager_mock_, disks()) | 231 EXPECT_CALL(*disk_mount_manager_mock_, disks()) |
| 227 .WillRepeatedly(ReturnRef(volumes_)); | 232 .WillRepeatedly(ReturnRef(volumes_)); |
| 228 | 233 |
| 229 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) | 234 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) |
| 230 .WillRepeatedly(ReturnRef(mount_points_)); | 235 .WillRepeatedly(ReturnRef(mount_points_)); |
| 231 | 236 |
| 232 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; | 237 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; |
| 233 } | 238 } |
| OLD | NEW |