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 <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 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/storage_monitor/media_storage_util.h" | 16 #include "chrome/browser/storage_monitor/media_storage_util.h" |
17 #include "chrome/browser/storage_monitor/mock_removable_storage_observer.h" | 17 #include "chrome/browser/storage_monitor/mock_removable_storage_observer.h" |
18 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h" | 18 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h" |
19 #include "chrome/browser/storage_monitor/removable_device_constants.h" | 19 #include "chrome/browser/storage_monitor/removable_device_constants.h" |
20 #include "chrome/browser/storage_monitor/removable_device_notifications_window_w in.h" | 20 #include "chrome/browser/storage_monitor/storage_monitor_win.h" |
21 #include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h" | 21 #include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h" |
22 #include "chrome/browser/storage_monitor/test_removable_device_notifications_win dow_win.h" | 22 #include "chrome/browser/storage_monitor/test_storage_monitor_win.h" |
23 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" | 23 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" |
24 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" | 24 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" |
25 #include "content/public/test/test_browser_thread.h" | 25 #include "content/public/test/test_browser_thread.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 | 27 |
28 namespace chrome { | 28 namespace chrome { |
29 namespace test { | 29 namespace test { |
30 | 30 |
31 using content::BrowserThread; | 31 using content::BrowserThread; |
32 | 32 |
33 typedef std::vector<int> DeviceIndices; | 33 typedef std::vector<int> DeviceIndices; |
34 | 34 |
35 // RemovableDeviceNotificationsWindowWinTest ----------------------------------- | 35 // StorageMonitorWinTest ------------------------------------------------------- |
36 | 36 |
37 class RemovableDeviceNotificationsWindowWinTest : public testing::Test { | 37 class StorageMonitorWinTest : public testing::Test { |
38 public: | 38 public: |
39 RemovableDeviceNotificationsWindowWinTest(); | 39 StorageMonitorWinTest(); |
40 virtual ~RemovableDeviceNotificationsWindowWinTest(); | 40 virtual ~StorageMonitorWinTest(); |
41 | 41 |
42 protected: | 42 protected: |
43 // testing::Test: | 43 // testing::Test: |
44 virtual void SetUp() OVERRIDE; | 44 virtual void SetUp() OVERRIDE; |
45 virtual void TearDown() OVERRIDE; | 45 virtual void TearDown() OVERRIDE; |
46 | 46 |
47 void PreAttachDevices(); | 47 void PreAttachDevices(); |
48 | 48 |
49 // Runs all the pending tasks on UI thread, FILE thread and blocking thread. | 49 // Runs all the pending tasks on UI thread, FILE thread and blocking thread. |
50 void RunUntilIdle(); | 50 void RunUntilIdle(); |
51 | 51 |
52 void DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices); | 52 void DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices); |
53 void DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices); | 53 void DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices); |
54 | 54 |
55 // Injects a device attach or detach change (depending on the value of | 55 // Injects a device attach or detach change (depending on the value of |
56 // |test_attach|) and tests that the appropriate handler is called. | 56 // |test_attach|) and tests that the appropriate handler is called. |
57 void DoMTPDeviceTest(const string16& pnp_device_id, bool test_attach); | 57 void DoMTPDeviceTest(const string16& pnp_device_id, bool test_attach); |
58 | 58 |
59 // Gets the MTP details of the storage specified by the |storage_device_id|. | 59 // Gets the MTP details of the storage specified by the |storage_device_id|. |
60 // On success, returns true and fills in |pnp_device_id| and | 60 // On success, returns true and fills in |pnp_device_id| and |
61 // |storage_object_id|. | 61 // |storage_object_id|. |
62 bool GetMTPStorageInfo(const std::string& storage_device_id, | 62 bool GetMTPStorageInfo(const std::string& storage_device_id, |
63 string16* pnp_device_id, | 63 string16* pnp_device_id, |
64 string16* storage_object_id); | 64 string16* storage_object_id); |
65 | 65 |
66 scoped_ptr<TestRemovableDeviceNotificationsWindowWin> window_; | 66 scoped_ptr<TestStorageMonitorWin> monitor_; |
67 | 67 |
68 // Weak pointer; owned by the device notifications class. | 68 // Weak pointer; owned by the device notifications class. |
69 TestVolumeMountWatcherWin* volume_mount_watcher_; | 69 TestVolumeMountWatcherWin* volume_mount_watcher_; |
70 | 70 |
71 MockRemovableStorageObserver observer_; | 71 MockRemovableStorageObserver observer_; |
72 | 72 |
73 private: | 73 private: |
74 MessageLoopForUI message_loop_; | 74 MessageLoopForUI message_loop_; |
75 content::TestBrowserThread ui_thread_; | 75 content::TestBrowserThread ui_thread_; |
76 content::TestBrowserThread file_thread_; | 76 content::TestBrowserThread file_thread_; |
77 }; | 77 }; |
78 | 78 |
79 RemovableDeviceNotificationsWindowWinTest:: | 79 StorageMonitorWinTest::StorageMonitorWinTest() |
80 RemovableDeviceNotificationsWindowWinTest() | 80 : ui_thread_(BrowserThread::UI, &message_loop_), |
81 : ui_thread_(BrowserThread::UI, &message_loop_), | 81 file_thread_(BrowserThread::FILE, &message_loop_) { |
82 file_thread_(BrowserThread::FILE, &message_loop_) { | |
83 } | 82 } |
84 | 83 |
85 RemovableDeviceNotificationsWindowWinTest:: | 84 StorageMonitorWinTest::~StorageMonitorWinTest() { |
86 ~RemovableDeviceNotificationsWindowWinTest() { | |
87 } | 85 } |
88 | 86 |
89 void RemovableDeviceNotificationsWindowWinTest::SetUp() { | 87 void StorageMonitorWinTest::SetUp() { |
90 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 88 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
91 volume_mount_watcher_ = new TestVolumeMountWatcherWin; | 89 volume_mount_watcher_ = new TestVolumeMountWatcherWin; |
92 window_.reset(new TestRemovableDeviceNotificationsWindowWin( | 90 monitor_.reset( |
93 volume_mount_watcher_, new TestPortableDeviceWatcherWin)); | 91 new TestStorageMonitorWin(volume_mount_watcher_, |
vandebo (ex-Chrome)
2013/03/04 20:21:31
line 91 will fit on line 90 and line 92 will still
| |
94 window_->Init(); | 92 new TestPortableDeviceWatcherWin)); |
93 monitor_->Init(); | |
95 RunUntilIdle(); | 94 RunUntilIdle(); |
96 window_->AddObserver(&observer_); | 95 monitor_->AddObserver(&observer_); |
97 } | 96 } |
98 | 97 |
99 void RemovableDeviceNotificationsWindowWinTest::TearDown() { | 98 void StorageMonitorWinTest::TearDown() { |
100 RunUntilIdle(); | 99 RunUntilIdle(); |
101 window_->RemoveObserver(&observer_); | 100 monitor_->RemoveObserver(&observer_); |
102 } | 101 } |
103 | 102 |
104 void RemovableDeviceNotificationsWindowWinTest::PreAttachDevices() { | 103 void StorageMonitorWinTest::PreAttachDevices() { |
105 window_.reset(); | 104 monitor_.reset(); |
106 volume_mount_watcher_ = new TestVolumeMountWatcherWin; | 105 volume_mount_watcher_ = new TestVolumeMountWatcherWin; |
107 volume_mount_watcher_->SetAttachedDevicesFake(); | 106 volume_mount_watcher_->SetAttachedDevicesFake(); |
108 | 107 |
109 int expect_attach_calls = 0; | 108 int expect_attach_calls = 0; |
110 std::vector<base::FilePath> initial_devices = | 109 std::vector<base::FilePath> initial_devices = |
111 volume_mount_watcher_->GetAttachedDevices(); | 110 volume_mount_watcher_->GetAttachedDevices(); |
112 for (std::vector<base::FilePath>::const_iterator it = initial_devices.begin(); | 111 for (std::vector<base::FilePath>::const_iterator it = initial_devices.begin(); |
113 it != initial_devices.end(); ++it) { | 112 it != initial_devices.end(); ++it) { |
114 std::string unique_id; | 113 std::string unique_id; |
115 string16 device_name; | 114 string16 device_name; |
116 bool removable; | 115 bool removable; |
117 ASSERT_TRUE(volume_mount_watcher_->GetRawDeviceInfo( | 116 ASSERT_TRUE(volume_mount_watcher_->GetRawDeviceInfo( |
118 *it, NULL, &unique_id, &device_name, &removable, NULL)); | 117 *it, NULL, &unique_id, &device_name, &removable, NULL)); |
119 if (removable) | 118 if (removable) |
120 expect_attach_calls++; | 119 expect_attach_calls++; |
121 } | 120 } |
122 | 121 |
123 window_.reset(new TestRemovableDeviceNotificationsWindowWin( | 122 monitor_.reset( |
vandebo (ex-Chrome)
2013/03/04 20:21:31
same here
| |
124 volume_mount_watcher_, new TestPortableDeviceWatcherWin)); | 123 new TestStorageMonitorWin(volume_mount_watcher_, |
125 window_->AddObserver(&observer_); | 124 new TestPortableDeviceWatcherWin)); |
126 window_->Init(); | 125 monitor_->AddObserver(&observer_); |
126 monitor_->Init(); | |
127 | 127 |
128 EXPECT_EQ(0u, volume_mount_watcher_->devices_checked().size()); | 128 EXPECT_EQ(0u, volume_mount_watcher_->devices_checked().size()); |
129 | 129 |
130 // This dance is because attachment bounces through a couple of | 130 // This dance is because attachment bounces through a couple of |
131 // closures, which need to be executed to finish the process. | 131 // closures, which need to be executed to finish the process. |
132 RunUntilIdle(); | 132 RunUntilIdle(); |
133 volume_mount_watcher_->FlushWorkerPoolForTesting(); | 133 volume_mount_watcher_->FlushWorkerPoolForTesting(); |
134 RunUntilIdle(); | 134 RunUntilIdle(); |
135 | 135 |
136 std::vector<base::FilePath> checked_devices = | 136 std::vector<base::FilePath> checked_devices = |
137 volume_mount_watcher_->devices_checked(); | 137 volume_mount_watcher_->devices_checked(); |
138 sort(checked_devices.begin(), checked_devices.end()); | 138 sort(checked_devices.begin(), checked_devices.end()); |
139 EXPECT_EQ(initial_devices, checked_devices); | 139 EXPECT_EQ(initial_devices, checked_devices); |
140 EXPECT_EQ(expect_attach_calls, observer_.attach_calls()); | 140 EXPECT_EQ(expect_attach_calls, observer_.attach_calls()); |
141 EXPECT_EQ(0, observer_.detach_calls()); | 141 EXPECT_EQ(0, observer_.detach_calls()); |
142 } | 142 } |
143 | 143 |
144 void RemovableDeviceNotificationsWindowWinTest::RunUntilIdle() { | 144 void StorageMonitorWinTest::RunUntilIdle() { |
145 volume_mount_watcher_->FlushWorkerPoolForTesting(); | 145 volume_mount_watcher_->FlushWorkerPoolForTesting(); |
146 message_loop_.RunUntilIdle(); | 146 message_loop_.RunUntilIdle(); |
147 } | 147 } |
148 | 148 |
149 void RemovableDeviceNotificationsWindowWinTest:: | 149 void StorageMonitorWinTest::DoMassStorageDeviceAttachedTest( |
150 DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices) { | 150 const DeviceIndices& device_indices) { |
151 DEV_BROADCAST_VOLUME volume_broadcast; | 151 DEV_BROADCAST_VOLUME volume_broadcast; |
152 volume_broadcast.dbcv_size = sizeof(volume_broadcast); | 152 volume_broadcast.dbcv_size = sizeof(volume_broadcast); |
153 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; | 153 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; |
154 volume_broadcast.dbcv_unitmask = 0x0; | 154 volume_broadcast.dbcv_unitmask = 0x0; |
155 volume_broadcast.dbcv_flags = 0x0; | 155 volume_broadcast.dbcv_flags = 0x0; |
156 | 156 |
157 int expect_attach_calls = 0; | 157 int expect_attach_calls = 0; |
158 for (DeviceIndices::const_iterator it = device_indices.begin(); | 158 for (DeviceIndices::const_iterator it = device_indices.begin(); |
159 it != device_indices.end(); ++it) { | 159 it != device_indices.end(); ++it) { |
160 volume_broadcast.dbcv_unitmask |= 0x1 << *it; | 160 volume_broadcast.dbcv_unitmask |= 0x1 << *it; |
161 bool removable; | 161 bool removable; |
162 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( | 162 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( |
163 VolumeMountWatcherWin::DriveNumberToFilePath(*it), | 163 VolumeMountWatcherWin::DriveNumberToFilePath(*it), |
164 NULL, NULL, NULL, &removable, NULL)); | 164 NULL, NULL, NULL, &removable, NULL)); |
165 if (removable) | 165 if (removable) |
166 expect_attach_calls++; | 166 expect_attach_calls++; |
167 } | 167 } |
168 window_->InjectDeviceChange(DBT_DEVICEARRIVAL, | 168 monitor_->InjectDeviceChange(DBT_DEVICEARRIVAL, |
169 reinterpret_cast<DWORD>(&volume_broadcast)); | 169 reinterpret_cast<DWORD>(&volume_broadcast)); |
170 | 170 |
171 RunUntilIdle(); | 171 RunUntilIdle(); |
172 volume_mount_watcher_->FlushWorkerPoolForTesting(); | 172 volume_mount_watcher_->FlushWorkerPoolForTesting(); |
173 RunUntilIdle(); | 173 RunUntilIdle(); |
174 | 174 |
175 EXPECT_EQ(expect_attach_calls, observer_.attach_calls()); | 175 EXPECT_EQ(expect_attach_calls, observer_.attach_calls()); |
176 EXPECT_EQ(0, observer_.detach_calls()); | 176 EXPECT_EQ(0, observer_.detach_calls()); |
177 } | 177 } |
178 | 178 |
179 void RemovableDeviceNotificationsWindowWinTest:: | 179 void StorageMonitorWinTest::DoMassStorageDevicesDetachedTest( |
180 DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices) { | 180 const DeviceIndices& device_indices) { |
181 DEV_BROADCAST_VOLUME volume_broadcast; | 181 DEV_BROADCAST_VOLUME volume_broadcast; |
182 volume_broadcast.dbcv_size = sizeof(volume_broadcast); | 182 volume_broadcast.dbcv_size = sizeof(volume_broadcast); |
183 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; | 183 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; |
184 volume_broadcast.dbcv_unitmask = 0x0; | 184 volume_broadcast.dbcv_unitmask = 0x0; |
185 volume_broadcast.dbcv_flags = 0x0; | 185 volume_broadcast.dbcv_flags = 0x0; |
186 | 186 |
187 int pre_attach_calls = observer_.attach_calls(); | 187 int pre_attach_calls = observer_.attach_calls(); |
188 int expect_detach_calls = 0; | 188 int expect_detach_calls = 0; |
189 for (DeviceIndices::const_iterator it = device_indices.begin(); | 189 for (DeviceIndices::const_iterator it = device_indices.begin(); |
190 it != device_indices.end(); ++it) { | 190 it != device_indices.end(); ++it) { |
191 volume_broadcast.dbcv_unitmask |= 0x1 << *it; | 191 volume_broadcast.dbcv_unitmask |= 0x1 << *it; |
192 bool removable; | 192 bool removable; |
193 ASSERT_TRUE(volume_mount_watcher_->GetRawDeviceInfo( | 193 ASSERT_TRUE(volume_mount_watcher_->GetRawDeviceInfo( |
194 VolumeMountWatcherWin::DriveNumberToFilePath(*it), NULL, NULL, | 194 VolumeMountWatcherWin::DriveNumberToFilePath(*it), NULL, NULL, |
195 NULL, &removable, NULL)); | 195 NULL, &removable, NULL)); |
196 if (removable) | 196 if (removable) |
197 expect_detach_calls++; | 197 expect_detach_calls++; |
198 } | 198 } |
199 window_->InjectDeviceChange(DBT_DEVICEREMOVECOMPLETE, | 199 monitor_->InjectDeviceChange(DBT_DEVICEREMOVECOMPLETE, |
200 reinterpret_cast<DWORD>(&volume_broadcast)); | 200 reinterpret_cast<DWORD>(&volume_broadcast)); |
201 RunUntilIdle(); | 201 RunUntilIdle(); |
202 EXPECT_EQ(pre_attach_calls, observer_.attach_calls()); | 202 EXPECT_EQ(pre_attach_calls, observer_.attach_calls()); |
203 EXPECT_EQ(expect_detach_calls, observer_.detach_calls()); | 203 EXPECT_EQ(expect_detach_calls, observer_.detach_calls()); |
204 } | 204 } |
205 | 205 |
206 void RemovableDeviceNotificationsWindowWinTest::DoMTPDeviceTest( | 206 void StorageMonitorWinTest::DoMTPDeviceTest(const string16& pnp_device_id, |
207 const string16& pnp_device_id, bool test_attach) { | 207 bool test_attach) { |
208 GUID guidDevInterface = GUID_NULL; | 208 GUID guidDevInterface = GUID_NULL; |
209 HRESULT hr = CLSIDFromString(kWPDDevInterfaceGUID, &guidDevInterface); | 209 HRESULT hr = CLSIDFromString(kWPDDevInterfaceGUID, &guidDevInterface); |
210 if (FAILED(hr)) | 210 if (FAILED(hr)) |
211 return; | 211 return; |
212 | 212 |
213 size_t device_id_size = pnp_device_id.size() * sizeof(char16); | 213 size_t device_id_size = pnp_device_id.size() * sizeof(char16); |
214 size_t size = sizeof(DEV_BROADCAST_DEVICEINTERFACE) + device_id_size; | 214 size_t size = sizeof(DEV_BROADCAST_DEVICEINTERFACE) + device_id_size; |
215 scoped_ptr_malloc<DEV_BROADCAST_DEVICEINTERFACE> dev_interface_broadcast( | 215 scoped_ptr_malloc<DEV_BROADCAST_DEVICEINTERFACE> dev_interface_broadcast( |
216 static_cast<DEV_BROADCAST_DEVICEINTERFACE*>(malloc(size))); | 216 static_cast<DEV_BROADCAST_DEVICEINTERFACE*>(malloc(size))); |
217 DCHECK(dev_interface_broadcast.get()); | 217 DCHECK(dev_interface_broadcast.get()); |
(...skipping 15 matching lines...) Expand all Loading... | |
233 string16 location; | 233 string16 location; |
234 TestPortableDeviceWatcherWin::GetMTPStorageDetails(pnp_device_id, *it, | 234 TestPortableDeviceWatcherWin::GetMTPStorageDetails(pnp_device_id, *it, |
235 &location, &unique_id, | 235 &location, &unique_id, |
236 &name); | 236 &name); |
237 if (test_attach && !name.empty() && !unique_id.empty()) | 237 if (test_attach && !name.empty() && !unique_id.empty()) |
238 expect_attach_calls++; | 238 expect_attach_calls++; |
239 else if (!name.empty() && !unique_id.empty()) | 239 else if (!name.empty() && !unique_id.empty()) |
240 expect_detach_calls++; | 240 expect_detach_calls++; |
241 } | 241 } |
242 | 242 |
243 window_->InjectDeviceChange( | 243 monitor_->InjectDeviceChange( |
244 test_attach ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE, | 244 test_attach ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE, |
245 reinterpret_cast<DWORD>(dev_interface_broadcast.get())); | 245 reinterpret_cast<DWORD>(dev_interface_broadcast.get())); |
246 | 246 |
247 RunUntilIdle(); | 247 RunUntilIdle(); |
248 EXPECT_EQ(expect_attach_calls, observer_.attach_calls()); | 248 EXPECT_EQ(expect_attach_calls, observer_.attach_calls()); |
249 EXPECT_EQ(expect_detach_calls, observer_.detach_calls()); | 249 EXPECT_EQ(expect_detach_calls, observer_.detach_calls()); |
250 } | 250 } |
251 | 251 |
252 bool RemovableDeviceNotificationsWindowWinTest::GetMTPStorageInfo( | 252 bool StorageMonitorWinTest::GetMTPStorageInfo( |
253 const std::string& storage_device_id, | 253 const std::string& storage_device_id, |
254 string16* pnp_device_id, | 254 string16* pnp_device_id, |
255 string16* storage_object_id) { | 255 string16* storage_object_id) { |
256 return window_->GetMTPStorageInfoFromDeviceId(storage_device_id, | 256 return monitor_->GetMTPStorageInfoFromDeviceId(storage_device_id, |
257 pnp_device_id, | 257 pnp_device_id, |
258 storage_object_id); | 258 storage_object_id); |
259 } | 259 } |
260 | 260 |
261 TEST_F(RemovableDeviceNotificationsWindowWinTest, RandomMessage) { | 261 TEST_F(StorageMonitorWinTest, RandomMessage) { |
262 window_->InjectDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); | 262 monitor_->InjectDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); |
263 RunUntilIdle(); | 263 RunUntilIdle(); |
264 } | 264 } |
265 | 265 |
266 TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttached) { | 266 TEST_F(StorageMonitorWinTest, DevicesAttached) { |
267 DeviceIndices device_indices; | 267 DeviceIndices device_indices; |
268 device_indices.push_back(1); // B | 268 device_indices.push_back(1); // B |
269 device_indices.push_back(5); // F | 269 device_indices.push_back(5); // F |
270 device_indices.push_back(7); // H | 270 device_indices.push_back(7); // H |
271 device_indices.push_back(13); // N | 271 device_indices.push_back(13); // N |
272 DoMassStorageDeviceAttachedTest(device_indices); | 272 DoMassStorageDeviceAttachedTest(device_indices); |
273 | 273 |
274 string16 location; | 274 string16 location; |
275 std::string unique_id; | 275 std::string unique_id; |
276 string16 name; | 276 string16 name; |
277 bool removable; | 277 bool removable; |
278 EXPECT_TRUE(window_->volume_mount_watcher()->GetDeviceInfo( | 278 EXPECT_TRUE(monitor_->volume_mount_watcher()->GetDeviceInfo( |
279 base::FilePath(ASCIIToUTF16("F:\\")), | 279 base::FilePath(ASCIIToUTF16("F:\\")), |
280 &location, &unique_id, &name, &removable, NULL)); | 280 &location, &unique_id, &name, &removable, NULL)); |
281 EXPECT_EQ(ASCIIToUTF16("F:\\"), location); | 281 EXPECT_EQ(ASCIIToUTF16("F:\\"), location); |
282 EXPECT_EQ("\\\\?\\Volume{F0000000-0000-0000-0000-000000000000}\\", unique_id); | 282 EXPECT_EQ("\\\\?\\Volume{F0000000-0000-0000-0000-000000000000}\\", unique_id); |
283 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), name); | 283 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), name); |
284 | 284 |
285 StorageMonitor::StorageInfo info; | 285 StorageMonitor::StorageInfo info; |
286 EXPECT_FALSE(window_->GetStorageInfoForPath( | 286 EXPECT_FALSE(monitor_->GetStorageInfoForPath( |
287 base::FilePath(ASCIIToUTF16("G:\\")), &info)); | 287 base::FilePath(ASCIIToUTF16("G:\\")), &info)); |
288 EXPECT_TRUE(window_->GetStorageInfoForPath( | 288 EXPECT_TRUE(monitor_->GetStorageInfoForPath( |
289 base::FilePath(ASCIIToUTF16("F:\\")), &info)); | 289 base::FilePath(ASCIIToUTF16("F:\\")), &info)); |
290 StorageMonitor::StorageInfo info1; | 290 StorageMonitor::StorageInfo info1; |
291 EXPECT_TRUE(window_->GetStorageInfoForPath( | 291 EXPECT_TRUE(monitor_->GetStorageInfoForPath( |
292 base::FilePath(ASCIIToUTF16("F:\\subdir")), &info1)); | 292 base::FilePath(ASCIIToUTF16("F:\\subdir")), &info1)); |
293 StorageMonitor::StorageInfo info2; | 293 StorageMonitor::StorageInfo info2; |
294 EXPECT_TRUE(window_->GetStorageInfoForPath( | 294 EXPECT_TRUE(monitor_->GetStorageInfoForPath( |
295 base::FilePath(ASCIIToUTF16("F:\\subdir\\sub")), &info2)); | 295 base::FilePath(ASCIIToUTF16("F:\\subdir\\sub")), &info2)); |
296 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info.name); | 296 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info.name); |
297 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info1.name); | 297 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info1.name); |
298 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info2.name); | 298 EXPECT_EQ(ASCIIToUTF16("F:\\ Drive"), info2.name); |
299 } | 299 } |
300 | 300 |
301 TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedHighBoundary) { | 301 TEST_F(StorageMonitorWinTest, DevicesAttachedHighBoundary) { |
302 DeviceIndices device_indices; | 302 DeviceIndices device_indices; |
303 device_indices.push_back(25); | 303 device_indices.push_back(25); |
304 | 304 |
305 DoMassStorageDeviceAttachedTest(device_indices); | 305 DoMassStorageDeviceAttachedTest(device_indices); |
306 } | 306 } |
307 | 307 |
308 TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedLowBoundary) { | 308 TEST_F(StorageMonitorWinTest, DevicesAttachedLowBoundary) { |
309 DeviceIndices device_indices; | 309 DeviceIndices device_indices; |
310 device_indices.push_back(0); | 310 device_indices.push_back(0); |
311 | 311 |
312 DoMassStorageDeviceAttachedTest(device_indices); | 312 DoMassStorageDeviceAttachedTest(device_indices); |
313 } | 313 } |
314 | 314 |
315 TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesAttachedAdjacentBits) { | 315 TEST_F(StorageMonitorWinTest, DevicesAttachedAdjacentBits) { |
316 DeviceIndices device_indices; | 316 DeviceIndices device_indices; |
317 device_indices.push_back(0); | 317 device_indices.push_back(0); |
318 device_indices.push_back(1); | 318 device_indices.push_back(1); |
319 device_indices.push_back(2); | 319 device_indices.push_back(2); |
320 device_indices.push_back(3); | 320 device_indices.push_back(3); |
321 | 321 |
322 DoMassStorageDeviceAttachedTest(device_indices); | 322 DoMassStorageDeviceAttachedTest(device_indices); |
323 } | 323 } |
324 | 324 |
325 TEST_F(RemovableDeviceNotificationsWindowWinTest, DevicesDetached) { | 325 TEST_F(StorageMonitorWinTest, DevicesDetached) { |
326 PreAttachDevices(); | 326 PreAttachDevices(); |
327 | 327 |
328 DeviceIndices device_indices; | 328 DeviceIndices device_indices; |
329 device_indices.push_back(1); | 329 device_indices.push_back(1); |
330 device_indices.push_back(5); | 330 device_indices.push_back(5); |
331 device_indices.push_back(7); | 331 device_indices.push_back(7); |
332 device_indices.push_back(13); | 332 device_indices.push_back(13); |
333 | 333 |
334 DoMassStorageDevicesDetachedTest(device_indices); | 334 DoMassStorageDevicesDetachedTest(device_indices); |
335 } | 335 } |
336 | 336 |
337 TEST_F(RemovableDeviceNotificationsWindowWinTest, | 337 TEST_F(StorageMonitorWinTest, DevicesDetachedHighBoundary) { |
338 DevicesDetachedHighBoundary) { | |
339 PreAttachDevices(); | 338 PreAttachDevices(); |
340 | 339 |
341 DeviceIndices device_indices; | 340 DeviceIndices device_indices; |
342 device_indices.push_back(25); | 341 device_indices.push_back(25); |
343 | 342 |
344 DoMassStorageDevicesDetachedTest(device_indices); | 343 DoMassStorageDevicesDetachedTest(device_indices); |
345 } | 344 } |
346 | 345 |
347 TEST_F(RemovableDeviceNotificationsWindowWinTest, | 346 TEST_F(StorageMonitorWinTest, DevicesDetachedLowBoundary) { |
348 DevicesDetachedLowBoundary) { | |
349 PreAttachDevices(); | 347 PreAttachDevices(); |
350 | 348 |
351 DeviceIndices device_indices; | 349 DeviceIndices device_indices; |
352 device_indices.push_back(0); | 350 device_indices.push_back(0); |
353 | 351 |
354 DoMassStorageDevicesDetachedTest(device_indices); | 352 DoMassStorageDevicesDetachedTest(device_indices); |
355 } | 353 } |
356 | 354 |
357 TEST_F(RemovableDeviceNotificationsWindowWinTest, | 355 TEST_F(StorageMonitorWinTest, DevicesDetachedAdjacentBits) { |
358 DevicesDetachedAdjacentBits) { | |
359 PreAttachDevices(); | 356 PreAttachDevices(); |
360 | 357 |
361 DeviceIndices device_indices; | 358 DeviceIndices device_indices; |
362 device_indices.push_back(0); | 359 device_indices.push_back(0); |
363 device_indices.push_back(1); | 360 device_indices.push_back(1); |
364 device_indices.push_back(2); | 361 device_indices.push_back(2); |
365 device_indices.push_back(3); | 362 device_indices.push_back(3); |
366 | 363 |
367 DoMassStorageDevicesDetachedTest(device_indices); | 364 DoMassStorageDevicesDetachedTest(device_indices); |
368 } | 365 } |
369 | 366 |
370 TEST_F(RemovableDeviceNotificationsWindowWinTest, | 367 TEST_F(StorageMonitorWinTest, DuplicateAttachCheckSuppressed) { |
371 DuplicateAttachCheckSuppressed) { | |
372 volume_mount_watcher_->BlockDeviceCheckForTesting(); | 368 volume_mount_watcher_->BlockDeviceCheckForTesting(); |
373 base::FilePath kAttachedDevicePath = | 369 base::FilePath kAttachedDevicePath = |
374 VolumeMountWatcherWin::DriveNumberToFilePath(8); // I: | 370 VolumeMountWatcherWin::DriveNumberToFilePath(8); // I: |
375 | 371 |
376 DEV_BROADCAST_VOLUME volume_broadcast; | 372 DEV_BROADCAST_VOLUME volume_broadcast; |
377 volume_broadcast.dbcv_size = sizeof(volume_broadcast); | 373 volume_broadcast.dbcv_size = sizeof(volume_broadcast); |
378 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; | 374 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; |
379 volume_broadcast.dbcv_flags = 0x0; | 375 volume_broadcast.dbcv_flags = 0x0; |
380 volume_broadcast.dbcv_unitmask = 0x100; // I: drive | 376 volume_broadcast.dbcv_unitmask = 0x100; // I: drive |
381 window_->InjectDeviceChange(DBT_DEVICEARRIVAL, | 377 monitor_->InjectDeviceChange(DBT_DEVICEARRIVAL, |
382 reinterpret_cast<DWORD>(&volume_broadcast)); | 378 reinterpret_cast<DWORD>(&volume_broadcast)); |
383 | 379 |
384 EXPECT_EQ(0u, volume_mount_watcher_->devices_checked().size()); | 380 EXPECT_EQ(0u, volume_mount_watcher_->devices_checked().size()); |
385 | 381 |
386 // Re-attach the same volume. We haven't released the mock device check | 382 // Re-attach the same volume. We haven't released the mock device check |
387 // event, so there'll be pending calls in the UI thread to finish the | 383 // event, so there'll be pending calls in the UI thread to finish the |
388 // device check notification, blocking the duplicate device injection. | 384 // device check notification, blocking the duplicate device injection. |
389 window_->InjectDeviceChange(DBT_DEVICEARRIVAL, | 385 monitor_->InjectDeviceChange(DBT_DEVICEARRIVAL, |
390 reinterpret_cast<DWORD>(&volume_broadcast)); | 386 reinterpret_cast<DWORD>(&volume_broadcast)); |
391 | 387 |
392 EXPECT_EQ(0u, volume_mount_watcher_->devices_checked().size()); | 388 EXPECT_EQ(0u, volume_mount_watcher_->devices_checked().size()); |
393 volume_mount_watcher_->ReleaseDeviceCheck(); | 389 volume_mount_watcher_->ReleaseDeviceCheck(); |
394 RunUntilIdle(); | 390 RunUntilIdle(); |
395 volume_mount_watcher_->ReleaseDeviceCheck(); | 391 volume_mount_watcher_->ReleaseDeviceCheck(); |
396 | 392 |
397 // Now let all attach notifications finish running. We'll only get one | 393 // Now let all attach notifications finish running. We'll only get one |
398 // finish-attach call. | 394 // finish-attach call. |
399 volume_mount_watcher_->FlushWorkerPoolForTesting(); | 395 volume_mount_watcher_->FlushWorkerPoolForTesting(); |
400 RunUntilIdle(); | 396 RunUntilIdle(); |
401 | 397 |
402 std::vector<base::FilePath> checked_devices = | 398 std::vector<base::FilePath> checked_devices = |
403 volume_mount_watcher_->devices_checked(); | 399 volume_mount_watcher_->devices_checked(); |
404 ASSERT_EQ(1u, checked_devices.size()); | 400 ASSERT_EQ(1u, checked_devices.size()); |
405 EXPECT_EQ(kAttachedDevicePath, checked_devices[0]); | 401 EXPECT_EQ(kAttachedDevicePath, checked_devices[0]); |
406 | 402 |
407 // We'll receive a duplicate check now that the first check has fully cleared. | 403 // We'll receive a duplicate check now that the first check has fully cleared. |
408 window_->InjectDeviceChange(DBT_DEVICEARRIVAL, | 404 monitor_->InjectDeviceChange(DBT_DEVICEARRIVAL, |
409 reinterpret_cast<DWORD>(&volume_broadcast)); | 405 reinterpret_cast<DWORD>(&volume_broadcast)); |
410 volume_mount_watcher_->FlushWorkerPoolForTesting(); | 406 volume_mount_watcher_->FlushWorkerPoolForTesting(); |
411 volume_mount_watcher_->ReleaseDeviceCheck(); | 407 volume_mount_watcher_->ReleaseDeviceCheck(); |
412 RunUntilIdle(); | 408 RunUntilIdle(); |
413 | 409 |
414 checked_devices = volume_mount_watcher_->devices_checked(); | 410 checked_devices = volume_mount_watcher_->devices_checked(); |
415 ASSERT_EQ(2u, checked_devices.size()); | 411 ASSERT_EQ(2u, checked_devices.size()); |
416 EXPECT_EQ(kAttachedDevicePath, checked_devices[0]); | 412 EXPECT_EQ(kAttachedDevicePath, checked_devices[0]); |
417 EXPECT_EQ(kAttachedDevicePath, checked_devices[1]); | 413 EXPECT_EQ(kAttachedDevicePath, checked_devices[1]); |
418 } | 414 } |
419 | 415 |
420 TEST_F(RemovableDeviceNotificationsWindowWinTest, DeviceInfoForPath) { | 416 TEST_F(StorageMonitorWinTest, DeviceInfoForPath) { |
421 PreAttachDevices(); | 417 PreAttachDevices(); |
422 | 418 |
423 // An invalid path. | 419 // An invalid path. |
424 EXPECT_FALSE(window_->GetStorageInfoForPath(base::FilePath(L"COM1:\\"), | 420 EXPECT_FALSE(monitor_->GetStorageInfoForPath(base::FilePath(L"COM1:\\"), |
425 NULL)); | 421 NULL)); |
426 | 422 |
427 // An unconnected removable device. | 423 // An unconnected removable device. |
428 EXPECT_FALSE(window_->GetStorageInfoForPath(base::FilePath(L"E:\\"), NULL)); | 424 EXPECT_FALSE(monitor_->GetStorageInfoForPath(base::FilePath(L"E:\\"), NULL)); |
429 | 425 |
430 // A connected removable device. | 426 // A connected removable device. |
431 base::FilePath removable_device(L"F:\\"); | 427 base::FilePath removable_device(L"F:\\"); |
432 StorageMonitor::StorageInfo device_info; | 428 StorageMonitor::StorageInfo device_info; |
433 EXPECT_TRUE(window_->GetStorageInfoForPath(removable_device, &device_info)); | 429 EXPECT_TRUE(monitor_->GetStorageInfoForPath(removable_device, &device_info)); |
434 | 430 |
435 std::string unique_id; | 431 std::string unique_id; |
436 string16 device_name; | 432 string16 device_name; |
437 string16 location; | 433 string16 location; |
438 bool removable; | 434 bool removable; |
439 uint64 total_size_in_bytes; | 435 uint64 total_size_in_bytes; |
440 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( | 436 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( |
441 removable_device, &location, &unique_id, &device_name, &removable, | 437 removable_device, &location, &unique_id, &device_name, &removable, |
442 &total_size_in_bytes)); | 438 &total_size_in_bytes)); |
443 EXPECT_TRUE(removable); | 439 EXPECT_TRUE(removable); |
444 std::string device_id = MediaStorageUtil::MakeDeviceId( | 440 std::string device_id = MediaStorageUtil::MakeDeviceId( |
445 MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM, unique_id); | 441 MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM, unique_id); |
446 EXPECT_EQ(device_id, device_info.device_id); | 442 EXPECT_EQ(device_id, device_info.device_id); |
447 EXPECT_EQ(device_name, device_info.name); | 443 EXPECT_EQ(device_name, device_info.name); |
448 EXPECT_EQ(removable_device.value(), device_info.location); | 444 EXPECT_EQ(removable_device.value(), device_info.location); |
449 EXPECT_EQ(1000000, total_size_in_bytes); | 445 EXPECT_EQ(1000000, total_size_in_bytes); |
450 | 446 |
451 // A fixed device. | 447 // A fixed device. |
452 base::FilePath fixed_device(L"N:\\"); | 448 base::FilePath fixed_device(L"N:\\"); |
453 EXPECT_TRUE(window_->GetStorageInfoForPath(fixed_device, &device_info)); | 449 EXPECT_TRUE(monitor_->GetStorageInfoForPath(fixed_device, &device_info)); |
454 | 450 |
455 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( | 451 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( |
456 fixed_device, &location, &unique_id, &device_name, &removable, NULL)); | 452 fixed_device, &location, &unique_id, &device_name, &removable, NULL)); |
457 EXPECT_FALSE(removable); | 453 EXPECT_FALSE(removable); |
458 device_id = MediaStorageUtil::MakeDeviceId( | 454 device_id = MediaStorageUtil::MakeDeviceId( |
459 MediaStorageUtil::FIXED_MASS_STORAGE, unique_id); | 455 MediaStorageUtil::FIXED_MASS_STORAGE, unique_id); |
460 EXPECT_EQ(device_id, device_info.device_id); | 456 EXPECT_EQ(device_id, device_info.device_id); |
461 EXPECT_EQ(device_name, device_info.name); | 457 EXPECT_EQ(device_name, device_info.name); |
462 EXPECT_EQ(fixed_device.value(), device_info.location); | 458 EXPECT_EQ(fixed_device.value(), device_info.location); |
463 } | 459 } |
464 | 460 |
465 // Test to verify basic MTP storage attach and detach notifications. | 461 // Test to verify basic MTP storage attach and detach notifications. |
466 TEST_F(RemovableDeviceNotificationsWindowWinTest, MTPDeviceBasicAttachDetach) { | 462 TEST_F(StorageMonitorWinTest, MTPDeviceBasicAttachDetach) { |
467 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, true); | 463 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, true); |
468 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); | 464 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); |
469 } | 465 } |
470 | 466 |
471 // When a MTP storage device with invalid storage label and id is | 467 // When a MTP storage device with invalid storage label and id is |
472 // attached/detached, there should not be any device attach/detach | 468 // attached/detached, there should not be any device attach/detach |
473 // notifications. | 469 // notifications. |
474 TEST_F(RemovableDeviceNotificationsWindowWinTest, MTPDeviceWithInvalidInfo) { | 470 TEST_F(StorageMonitorWinTest, MTPDeviceWithInvalidInfo) { |
475 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithInvalidInfo, | 471 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithInvalidInfo, |
476 true); | 472 true); |
477 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithInvalidInfo, | 473 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithInvalidInfo, |
478 false); | 474 false); |
479 } | 475 } |
480 | 476 |
481 // Attach a device with two data partitions. Verify that attach/detach | 477 // Attach a device with two data partitions. Verify that attach/detach |
482 // notifications are sent out for each removable storage. | 478 // notifications are sent out for each removable storage. |
483 TEST_F(RemovableDeviceNotificationsWindowWinTest, | 479 TEST_F(StorageMonitorWinTest, MTPDeviceWithMultipleStorageObjects) { |
484 MTPDeviceWithMultipleStorageObjects) { | |
485 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithMultipleStorages, | 480 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithMultipleStorages, |
486 true); | 481 true); |
487 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithMultipleStorages, | 482 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithMultipleStorages, |
488 false); | 483 false); |
489 } | 484 } |
490 | 485 |
491 TEST_F(RemovableDeviceNotificationsWindowWinTest, DriveNumberToFilePath) { | 486 TEST_F(StorageMonitorWinTest, DriveNumberToFilePath) { |
492 EXPECT_EQ(L"A:\\", VolumeMountWatcherWin::DriveNumberToFilePath(0).value()); | 487 EXPECT_EQ(L"A:\\", VolumeMountWatcherWin::DriveNumberToFilePath(0).value()); |
493 EXPECT_EQ(L"Y:\\", VolumeMountWatcherWin::DriveNumberToFilePath(24).value()); | 488 EXPECT_EQ(L"Y:\\", VolumeMountWatcherWin::DriveNumberToFilePath(24).value()); |
494 EXPECT_EQ(L"", VolumeMountWatcherWin::DriveNumberToFilePath(-1).value()); | 489 EXPECT_EQ(L"", VolumeMountWatcherWin::DriveNumberToFilePath(-1).value()); |
495 EXPECT_EQ(L"", VolumeMountWatcherWin::DriveNumberToFilePath(199).value()); | 490 EXPECT_EQ(L"", VolumeMountWatcherWin::DriveNumberToFilePath(199).value()); |
496 } | 491 } |
497 | 492 |
498 // Given a MTP storage persistent id, GetMTPStorageInfo() should fetch the | 493 // Given a MTP storage persistent id, GetMTPStorageInfo() should fetch the |
499 // device interface path and local storage object identifier. | 494 // device interface path and local storage object identifier. |
500 TEST_F(RemovableDeviceNotificationsWindowWinTest, | 495 TEST_F(StorageMonitorWinTest, GetMTPStorageInfoFromDeviceId) { |
501 GetMTPStorageInfoFromDeviceId) { | |
502 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, true); | 496 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, true); |
503 PortableDeviceWatcherWin::StorageObjects storage_objects = | 497 PortableDeviceWatcherWin::StorageObjects storage_objects = |
504 TestPortableDeviceWatcherWin::GetDeviceStorageObjects( | 498 TestPortableDeviceWatcherWin::GetDeviceStorageObjects( |
505 TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo); | 499 TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo); |
506 for (PortableDeviceWatcherWin::StorageObjects::const_iterator it = | 500 for (PortableDeviceWatcherWin::StorageObjects::const_iterator it = |
507 storage_objects.begin(); | 501 storage_objects.begin(); |
508 it != storage_objects.end(); ++it) { | 502 it != storage_objects.end(); ++it) { |
509 string16 pnp_device_id; | 503 string16 pnp_device_id; |
510 string16 storage_object_id; | 504 string16 storage_object_id; |
511 ASSERT_TRUE(GetMTPStorageInfo(it->object_persistent_id, &pnp_device_id, | 505 ASSERT_TRUE(GetMTPStorageInfo(it->object_persistent_id, &pnp_device_id, |
512 &storage_object_id)); | 506 &storage_object_id)); |
513 EXPECT_EQ(string16(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo), | 507 EXPECT_EQ(string16(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo), |
514 pnp_device_id); | 508 pnp_device_id); |
515 EXPECT_EQ(it->object_persistent_id, | 509 EXPECT_EQ(it->object_persistent_id, |
516 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId( | 510 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId( |
517 pnp_device_id, storage_object_id)); | 511 pnp_device_id, storage_object_id)); |
518 } | 512 } |
519 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); | 513 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); |
520 } | 514 } |
521 | 515 |
522 } // namespace test | 516 } // namespace test |
523 } // namespace chrome | 517 } // namespace chrome |
OLD | NEW |