OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <windows.h> | 5 #include <windows.h> |
6 #include <dbt.h> | 6 #include <dbt.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 StorageInfo info2; | 288 StorageInfo info2; |
289 EXPECT_TRUE(monitor_->GetStorageInfoForPath( | 289 EXPECT_TRUE(monitor_->GetStorageInfoForPath( |
290 base::FilePath(ASCIIToUTF16("F:\\subdir\\sub")), &info2)); | 290 base::FilePath(ASCIIToUTF16("F:\\subdir\\sub")), &info2)); |
291 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info.storage_label()); | 291 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info.storage_label()); |
292 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info1.storage_label()); | 292 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info1.storage_label()); |
293 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info2.storage_label()); | 293 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info2.storage_label()); |
294 } | 294 } |
295 | 295 |
296 TEST_F(StorageMonitorWinTest, PathMountDevices) { | 296 TEST_F(StorageMonitorWinTest, PathMountDevices) { |
297 PreAttachDevices(); | 297 PreAttachDevices(); |
298 int init_storages = monitor_->GetAllAvailableStorages().size(); | 298 size_t init_storages = monitor_->GetAllAvailableStorages().size(); |
299 | 299 |
300 volume_mount_watcher_->AddDeviceForTesting( | 300 volume_mount_watcher_->AddDeviceForTesting( |
301 base::FilePath(FILE_PATH_LITERAL("F:\\mount1")), | 301 base::FilePath(FILE_PATH_LITERAL("F:\\mount1")), |
302 "dcim:mount1", L"mount1", 100); | 302 "dcim:mount1", L"mount1", 100); |
303 volume_mount_watcher_->AddDeviceForTesting( | 303 volume_mount_watcher_->AddDeviceForTesting( |
304 base::FilePath(FILE_PATH_LITERAL("F:\\mount1\\subdir")), | 304 base::FilePath(FILE_PATH_LITERAL("F:\\mount1\\subdir")), |
305 "dcim:mount1subdir", L"mount1subdir", 100); | 305 "dcim:mount1subdir", L"mount1subdir", 100); |
306 volume_mount_watcher_->AddDeviceForTesting( | 306 volume_mount_watcher_->AddDeviceForTesting( |
307 base::FilePath(FILE_PATH_LITERAL("F:\\mount2")), | 307 base::FilePath(FILE_PATH_LITERAL("F:\\mount2")), |
308 "dcim:mount2", L"mount2", 100); | 308 "dcim:mount2", L"mount2", 100); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // A connected removable device. | 468 // A connected removable device. |
469 base::FilePath removable_device(L"F:\\"); | 469 base::FilePath removable_device(L"F:\\"); |
470 EXPECT_TRUE(monitor_->GetStorageInfoForPath(removable_device, &device_info)); | 470 EXPECT_TRUE(monitor_->GetStorageInfoForPath(removable_device, &device_info)); |
471 | 471 |
472 StorageInfo info; | 472 StorageInfo info; |
473 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(removable_device, &info)); | 473 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(removable_device, &info)); |
474 EXPECT_TRUE(StorageInfo::IsRemovableDevice(info.device_id())); | 474 EXPECT_TRUE(StorageInfo::IsRemovableDevice(info.device_id())); |
475 EXPECT_EQ(info.device_id(), device_info.device_id()); | 475 EXPECT_EQ(info.device_id(), device_info.device_id()); |
476 EXPECT_EQ(info.GetDisplayName(false), device_info.GetDisplayName(false)); | 476 EXPECT_EQ(info.GetDisplayName(false), device_info.GetDisplayName(false)); |
477 EXPECT_EQ(info.location(), device_info.location()); | 477 EXPECT_EQ(info.location(), device_info.location()); |
478 EXPECT_EQ(1000000, info.total_size_in_bytes()); | 478 EXPECT_EQ(1000000u, info.total_size_in_bytes()); |
479 | 479 |
480 // A fixed device. | 480 // A fixed device. |
481 base::FilePath fixed_device(L"N:\\"); | 481 base::FilePath fixed_device(L"N:\\"); |
482 EXPECT_TRUE(monitor_->GetStorageInfoForPath(fixed_device, &device_info)); | 482 EXPECT_TRUE(monitor_->GetStorageInfoForPath(fixed_device, &device_info)); |
483 | 483 |
484 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( | 484 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( |
485 fixed_device, &info)); | 485 fixed_device, &info)); |
486 EXPECT_FALSE(StorageInfo::IsRemovableDevice(info.device_id())); | 486 EXPECT_FALSE(StorageInfo::IsRemovableDevice(info.device_id())); |
487 EXPECT_EQ(info.device_id(), device_info.device_id()); | 487 EXPECT_EQ(info.device_id(), device_info.device_id()); |
488 EXPECT_EQ(info.GetDisplayName(false), device_info.GetDisplayName(false)); | 488 EXPECT_EQ(info.GetDisplayName(false), device_info.GetDisplayName(false)); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo); | 539 TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo); |
540 EXPECT_EQ(expected, pnp_device_id); | 540 EXPECT_EQ(expected, pnp_device_id); |
541 EXPECT_EQ(it->object_persistent_id, | 541 EXPECT_EQ(it->object_persistent_id, |
542 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId( | 542 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId( |
543 pnp_device_id, storage_object_id)); | 543 pnp_device_id, storage_object_id)); |
544 } | 544 } |
545 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); | 545 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); |
546 } | 546 } |
547 | 547 |
548 } // namespace storage_monitor | 548 } // namespace storage_monitor |
OLD | NEW |