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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 BrowserThread::FILE, FROM_HERE, | 112 BrowserThread::FILE, FROM_HERE, |
113 base::Bind(&MediaStorageUtilTest::CheckNonDCIMDeviceType, | 113 base::Bind(&MediaStorageUtilTest::CheckNonDCIMDeviceType, |
114 base::Unretained(this), mount_point)); | 114 base::Unretained(this), mount_point)); |
115 base::RunLoop().RunUntilIdle(); | 115 base::RunLoop().RunUntilIdle(); |
116 } | 116 } |
117 | 117 |
118 TEST_F(MediaStorageUtilTest, CanCreateFileSystemForImageCapture) { | 118 TEST_F(MediaStorageUtilTest, CanCreateFileSystemForImageCapture) { |
119 EXPECT_TRUE(MediaStorageUtil::CanCreateFileSystem(kImageCaptureDeviceId, | 119 EXPECT_TRUE(MediaStorageUtil::CanCreateFileSystem(kImageCaptureDeviceId, |
120 base::FilePath())); | 120 base::FilePath())); |
121 EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem( | 121 EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem( |
| 122 "dcim:xyz", base::FilePath())); |
| 123 EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem( |
122 "dcim:xyz", base::FilePath(FILE_PATH_LITERAL("relative")))); | 124 "dcim:xyz", base::FilePath(FILE_PATH_LITERAL("relative")))); |
123 EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem( | 125 EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem( |
124 "dcim:xyz", base::FilePath(FILE_PATH_LITERAL("../refparent")))); | 126 "dcim:xyz", base::FilePath(FILE_PATH_LITERAL("../refparent")))); |
125 } | 127 } |
126 | 128 |
127 TEST_F(MediaStorageUtilTest, DetectDeviceFiltered) { | 129 TEST_F(MediaStorageUtilTest, DetectDeviceFiltered) { |
128 MediaStorageUtil::DeviceIdSet devices; | 130 MediaStorageUtil::DeviceIdSet devices; |
129 devices.insert(kImageCaptureDeviceId); | 131 devices.insert(kImageCaptureDeviceId); |
130 | 132 |
131 base::WaitableEvent event(true, false); | 133 base::WaitableEvent event(true, false); |
(...skipping 13 matching lines...) Expand all Loading... |
145 event.Reset(); | 147 event.Reset(); |
146 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 148 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
147 base::Bind(&MediaStorageUtil::FilterAttachedDevices, | 149 base::Bind(&MediaStorageUtil::FilterAttachedDevices, |
148 base::Unretained(&devices), signal_event)); | 150 base::Unretained(&devices), signal_event)); |
149 event.Wait(); | 151 event.Wait(); |
150 | 152 |
151 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); | 153 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); |
152 } | 154 } |
153 | 155 |
154 } // namespace storage_monitor | 156 } // namespace storage_monitor |
OLD | NEW |