| 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 // MediaFileSystemRegistry unit tests. | 5 // MediaFileSystemRegistry unit tests. |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 FSInfoMap galleries_info; | 871 FSInfoMap galleries_info; |
| 872 InitForGalleriesInfoTest(&galleries_info); | 872 InitForGalleriesInfoTest(&galleries_info); |
| 873 | 873 |
| 874 for (FSInfoMap::const_iterator it = galleries_info.begin(); | 874 for (FSInfoMap::const_iterator it = galleries_info.begin(); |
| 875 it != galleries_info.end(); | 875 it != galleries_info.end(); |
| 876 ++it) { | 876 ++it) { |
| 877 CheckGalleryJSONName(it->second.name, false /*not removable*/); | 877 CheckGalleryJSONName(it->second.name, false /*not removable*/); |
| 878 } | 878 } |
| 879 } | 879 } |
| 880 | 880 |
| 881 // TODO(gbillock): Put the platform-specific parts of this test in tests |
| 882 // for those classes, not here. This test, internally, ends up creating an |
| 883 // MTP delegate. |
| 881 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 884 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
| 885 #if !defined(OS_MACOSX) |
| 882 TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) { | 886 TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) { |
| 883 FSInfoMap galleries_info; | 887 FSInfoMap galleries_info; |
| 884 InitForGalleriesInfoTest(&galleries_info); | 888 InitForGalleriesInfoTest(&galleries_info); |
| 885 | 889 |
| 886 #if defined(OS_WIN) | 890 #if defined(OS_WIN) |
| 887 base::FilePath location( | 891 base::FilePath location( |
| 888 PortableDeviceWatcherWin::GetStoragePathFromStorageId( | 892 PortableDeviceWatcherWin::GetStoragePathFromStorageId( |
| 889 test::TestPortableDeviceWatcherWin::kStorageUniqueIdA)); | 893 test::TestPortableDeviceWatcherWin::kStorageUniqueIdA)); |
| 890 #else | 894 #else |
| 891 base::FilePath location(FILE_PATH_LITERAL("/mtp_bogus")); | 895 base::FilePath location(FILE_PATH_LITERAL("/mtp_bogus")); |
| 892 #endif | 896 #endif |
| 893 AttachDevice(MediaStorageUtil::MTP_OR_PTP, "mtp_fake_id", location); | 897 AttachDevice(MediaStorageUtil::MTP_OR_PTP, "mtp_fake_id", location); |
| 894 CheckNewGalleryInfo(GetProfileState(0U), galleries_info, location, | 898 CheckNewGalleryInfo(GetProfileState(0U), galleries_info, location, |
| 895 true /*removable*/, true /* media device */); | 899 true /*removable*/, true /* media device */); |
| 896 } | 900 } |
| 897 #endif | 901 #endif |
| 902 #endif |
| 898 | 903 |
| 899 TEST_F(MediaFileSystemRegistryTest, GalleryNameDCIM) { | 904 TEST_F(MediaFileSystemRegistryTest, GalleryNameDCIM) { |
| 900 FSInfoMap galleries_info; | 905 FSInfoMap galleries_info; |
| 901 InitForGalleriesInfoTest(&galleries_info); | 906 InitForGalleriesInfoTest(&galleries_info); |
| 902 | 907 |
| 903 AttachDevice(MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, | 908 AttachDevice(MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, |
| 904 "removable_dcim_fake_id", | 909 "removable_dcim_fake_id", |
| 905 dcim_dir()); | 910 dcim_dir()); |
| 906 CheckNewGalleryInfo(GetProfileState(0U), galleries_info, dcim_dir(), | 911 CheckNewGalleryInfo(GetProfileState(0U), galleries_info, dcim_dir(), |
| 907 true /*removable*/, true /* media device */); | 912 true /*removable*/, true /* media device */); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 pref_info_with_relpath.device_id = device_id; | 968 pref_info_with_relpath.device_id = device_id; |
| 964 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), | 969 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), |
| 965 pref_info_with_relpath.AbsolutePath().value()); | 970 pref_info_with_relpath.AbsolutePath().value()); |
| 966 | 971 |
| 967 DetachDevice(device_id); | 972 DetachDevice(device_id); |
| 968 EXPECT_TRUE(pref_info.AbsolutePath().empty()); | 973 EXPECT_TRUE(pref_info.AbsolutePath().empty()); |
| 969 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); | 974 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); |
| 970 } | 975 } |
| 971 | 976 |
| 972 } // namespace chrome | 977 } // namespace chrome |
| OLD | NEW |