Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: chrome/browser/system_monitor/removable_device_notifications_window_win_unittest.cc

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typedef, init observer Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/system_monitor/system_monitor.h"
15 #include "base/test/mock_devices_changed_observer.h"
16 #include "chrome/browser/system_monitor/media_storage_util.h" 14 #include "chrome/browser/system_monitor/media_storage_util.h"
15 #include "chrome/browser/system_monitor/mock_removable_storage_observer.h"
17 #include "chrome/browser/system_monitor/portable_device_watcher_win.h" 16 #include "chrome/browser/system_monitor/portable_device_watcher_win.h"
18 #include "chrome/browser/system_monitor/removable_device_constants.h" 17 #include "chrome/browser/system_monitor/removable_device_constants.h"
19 #include "chrome/browser/system_monitor/test_portable_device_watcher_win.h" 18 #include "chrome/browser/system_monitor/test_portable_device_watcher_win.h"
20 #include "chrome/browser/system_monitor/test_removable_device_notifications_wind ow_win.h" 19 #include "chrome/browser/system_monitor/test_removable_device_notifications_wind ow_win.h"
21 #include "chrome/browser/system_monitor/test_volume_mount_watcher_win.h" 20 #include "chrome/browser/system_monitor/test_volume_mount_watcher_win.h"
22 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h" 21 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h"
23 #include "content/public/test/test_browser_thread.h" 22 #include "content/public/test/test_browser_thread.h"
24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
26 24
27 namespace chrome { 25 namespace chrome {
28 namespace test { 26 namespace test {
29 27
30 using content::BrowserThread; 28 using content::BrowserThread;
31 29
32 typedef std::vector<int> DeviceIndices; 30 typedef std::vector<int> DeviceIndices;
33 31
34 // RemovableDeviceNotificationsWindowWinTest ----------------------------------- 32 // RemovableDeviceNotificationsWindowWinTest -----------------------------------
35 33
36 class RemovableDeviceNotificationsWindowWinTest : public testing::Test { 34 class RemovableDeviceNotificationsWindowWinTest : public testing::Test {
37 public: 35 public:
38 RemovableDeviceNotificationsWindowWinTest(); 36 RemovableDeviceNotificationsWindowWinTest();
39 virtual ~RemovableDeviceNotificationsWindowWinTest(); 37 virtual ~RemovableDeviceNotificationsWindowWinTest();
40 38
41 protected: 39 protected:
42 // testing::Test: 40 // testing::Test:
43 virtual void SetUp() OVERRIDE; 41 virtual void SetUp() OVERRIDE;
44 virtual void TearDown() OVERRIDE; 42 virtual void TearDown() OVERRIDE;
45 43
46 void AddMassStorageDeviceAttachExpectation(const FilePath& drive);
47 void PreAttachDevices(); 44 void PreAttachDevices();
48 45
49 // Runs all the pending tasks on UI thread, FILE thread and blocking thread. 46 // Runs all the pending tasks on UI thread, FILE thread and blocking thread.
50 void RunUntilIdle(); 47 void RunUntilIdle();
51 48
52 void DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices); 49 void DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices);
53 void DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices); 50 void DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices);
54 51
55 // Injects a device attach or detach change (depending on the value of 52 // Injects a device attach or detach change (depending on the value of
56 // |test_attach|) and tests that the appropriate handler is called. 53 // |test_attach|) and tests that the appropriate handler is called.
57 void DoMTPDeviceTest(const string16& pnp_device_id, bool test_attach); 54 void DoMTPDeviceTest(const string16& pnp_device_id, bool test_attach);
58 55
59 // Gets the MTP details of the storage specified by the |storage_device_id|. 56 // 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 57 // On success, returns true and fills in |pnp_device_id| and
61 // |storage_object_id|. 58 // |storage_object_id|.
62 bool GetMTPStorageInfo(const std::string& storage_device_id, 59 bool GetMTPStorageInfo(const std::string& storage_device_id,
63 string16* pnp_device_id, 60 string16* pnp_device_id,
64 string16* storage_object_id); 61 string16* storage_object_id);
65 62
66 scoped_ptr<TestRemovableDeviceNotificationsWindowWin> window_; 63 scoped_ptr<TestRemovableDeviceNotificationsWindowWin> window_;
67 scoped_refptr<TestVolumeMountWatcherWin> volume_mount_watcher_; 64 scoped_refptr<TestVolumeMountWatcherWin> volume_mount_watcher_;
68 65
69 private: 66 private:
70 MessageLoopForUI message_loop_; 67 MessageLoopForUI message_loop_;
71 content::TestBrowserThread ui_thread_; 68 content::TestBrowserThread ui_thread_;
72 content::TestBrowserThread file_thread_; 69 content::TestBrowserThread file_thread_;
73 70
74 base::SystemMonitor system_monitor_; 71 MockRemovableStorageObserver observer_;
75 base::MockDevicesChangedObserver observer_;
76 }; 72 };
77 73
78 RemovableDeviceNotificationsWindowWinTest:: 74 RemovableDeviceNotificationsWindowWinTest::
79 RemovableDeviceNotificationsWindowWinTest() 75 RemovableDeviceNotificationsWindowWinTest()
80 : ui_thread_(BrowserThread::UI, &message_loop_), 76 : ui_thread_(BrowserThread::UI, &message_loop_),
81 file_thread_(BrowserThread::FILE, &message_loop_) { 77 file_thread_(BrowserThread::FILE, &message_loop_) {
82 } 78 }
83 79
84 RemovableDeviceNotificationsWindowWinTest:: 80 RemovableDeviceNotificationsWindowWinTest::
85 ~RemovableDeviceNotificationsWindowWinTest() { 81 ~RemovableDeviceNotificationsWindowWinTest() {
86 } 82 }
87 83
88 void RemovableDeviceNotificationsWindowWinTest::SetUp() { 84 void RemovableDeviceNotificationsWindowWinTest::SetUp() {
89 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); 85 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
90 volume_mount_watcher_ = new TestVolumeMountWatcherWin; 86 volume_mount_watcher_ = new TestVolumeMountWatcherWin;
91 window_.reset(new TestRemovableDeviceNotificationsWindowWin( 87 window_.reset(new TestRemovableDeviceNotificationsWindowWin(
92 volume_mount_watcher_.get(), new TestPortableDeviceWatcherWin)); 88 volume_mount_watcher_.get(), new TestPortableDeviceWatcherWin));
93 window_->InitWithTestData(false); 89 window_->InitWithTestData(false);
94 RunUntilIdle(); 90 RunUntilIdle();
95 system_monitor_.AddDevicesChangedObserver(&observer_); 91 window_->AddObserver(&observer_);
96 } 92 }
97 93
98 void RemovableDeviceNotificationsWindowWinTest::TearDown() { 94 void RemovableDeviceNotificationsWindowWinTest::TearDown() {
99 RunUntilIdle(); 95 RunUntilIdle();
100 system_monitor_.RemoveDevicesChangedObserver(&observer_); 96 window_->RemoveObserver(&observer_);
101 }
102
103 void RemovableDeviceNotificationsWindowWinTest::
104 AddMassStorageDeviceAttachExpectation(const FilePath& drive) {
105 std::string unique_id;
106 string16 device_name;
107 bool removable;
108 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(
109 drive, NULL, &unique_id, &device_name, &removable));
110 if (removable) {
111 MediaStorageUtil::Type type =
112 MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM;
113 std::string device_id = MediaStorageUtil::MakeDeviceId(type, unique_id);
114 EXPECT_CALL(observer_, OnRemovableStorageAttached(device_id, device_name,
115 drive.value()))
116 .Times(1);
117 }
118 } 97 }
119 98
120 void RemovableDeviceNotificationsWindowWinTest::PreAttachDevices() { 99 void RemovableDeviceNotificationsWindowWinTest::PreAttachDevices() {
121 window_.reset(); 100 window_.reset();
122 { 101
123 testing::InSequence sequence; 102 int expect_attach_calls = 0;
124 ASSERT_TRUE(volume_mount_watcher_.get()); 103 ASSERT_TRUE(volume_mount_watcher_.get());
125 volume_mount_watcher_->set_pre_attach_devices(true); 104 volume_mount_watcher_->set_pre_attach_devices(true);
126 std::vector<FilePath> initial_devices = 105 std::vector<FilePath> initial_devices =
127 volume_mount_watcher_->GetAttachedDevices(); 106 volume_mount_watcher_->GetAttachedDevices();
128 for (std::vector<FilePath>::const_iterator it = initial_devices.begin(); 107 for (std::vector<FilePath>::const_iterator it = initial_devices.begin();
129 it != initial_devices.end(); ++it) { 108 it != initial_devices.end(); ++it) {
130 AddMassStorageDeviceAttachExpectation(*it); 109 std::string unique_id;
131 } 110 string16 device_name;
111 bool removable;
112 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(
113 *it, NULL, &unique_id, &device_name, &removable));
114 if (removable)
115 expect_attach_calls++;
132 } 116 }
117
133 window_.reset(new TestRemovableDeviceNotificationsWindowWin( 118 window_.reset(new TestRemovableDeviceNotificationsWindowWin(
134 volume_mount_watcher_.get(), new TestPortableDeviceWatcherWin)); 119 volume_mount_watcher_.get(), new TestPortableDeviceWatcherWin));
135 window_->InitWithTestData(true); 120 window_->InitWithTestData(true);
121
136 RunUntilIdle(); 122 RunUntilIdle();
123 EXPECT_EQ(expect_attach_calls, observer_.attach_calls());
124 EXPECT_EQ(0, observer_.detach_calls());
137 } 125 }
138 126
139 void RemovableDeviceNotificationsWindowWinTest::RunUntilIdle() { 127 void RemovableDeviceNotificationsWindowWinTest::RunUntilIdle() {
140 message_loop_.RunUntilIdle(); 128 message_loop_.RunUntilIdle();
141 } 129 }
142 130
143 void RemovableDeviceNotificationsWindowWinTest:: 131 void RemovableDeviceNotificationsWindowWinTest::
144 DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices) { 132 DoMassStorageDeviceAttachedTest(const DeviceIndices& device_indices) {
145 DEV_BROADCAST_VOLUME volume_broadcast; 133 DEV_BROADCAST_VOLUME volume_broadcast;
146 volume_broadcast.dbcv_size = sizeof(volume_broadcast); 134 volume_broadcast.dbcv_size = sizeof(volume_broadcast);
147 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; 135 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME;
148 volume_broadcast.dbcv_unitmask = 0x0; 136 volume_broadcast.dbcv_unitmask = 0x0;
149 volume_broadcast.dbcv_flags = 0x0; 137 volume_broadcast.dbcv_flags = 0x0;
150 { 138
151 testing::InSequence sequence; 139 int expect_attach_calls = 0;
152 for (DeviceIndices::const_iterator it = device_indices.begin(); 140 for (DeviceIndices::const_iterator it = device_indices.begin();
153 it != device_indices.end(); ++it) { 141 it != device_indices.end(); ++it) {
154 volume_broadcast.dbcv_unitmask |= 0x1 << *it; 142 volume_broadcast.dbcv_unitmask |= 0x1 << *it;
155 AddMassStorageDeviceAttachExpectation( 143 std::string unique_id;
Lei Zhang 2013/01/26 01:27:49 Unlike the old code that expects an attachment for
Greg Billock 2013/01/26 01:42:07 Yeah, this is just to get 'removable' basically. I
156 VolumeMountWatcherWin::DriveNumberToFilePath(*it)); 144 string16 device_name;
157 } 145 bool removable;
146 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(
147 VolumeMountWatcherWin::DriveNumberToFilePath(*it),
148 NULL, &unique_id, &device_name, &removable));
149 if (removable)
150 expect_attach_calls++;
158 } 151 }
159 window_->InjectDeviceChange(DBT_DEVICEARRIVAL, 152 window_->InjectDeviceChange(DBT_DEVICEARRIVAL,
160 reinterpret_cast<DWORD>(&volume_broadcast)); 153 reinterpret_cast<DWORD>(&volume_broadcast));
154
161 RunUntilIdle(); 155 RunUntilIdle();
156 EXPECT_EQ(expect_attach_calls, observer_.attach_calls());
157 EXPECT_EQ(0, observer_.detach_calls());
162 } 158 }
163 159
164 void RemovableDeviceNotificationsWindowWinTest:: 160 void RemovableDeviceNotificationsWindowWinTest::
165 DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices) { 161 DoMassStorageDevicesDetachedTest(const DeviceIndices& device_indices) {
166 DEV_BROADCAST_VOLUME volume_broadcast; 162 DEV_BROADCAST_VOLUME volume_broadcast;
167 volume_broadcast.dbcv_size = sizeof(volume_broadcast); 163 volume_broadcast.dbcv_size = sizeof(volume_broadcast);
168 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; 164 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME;
169 volume_broadcast.dbcv_unitmask = 0x0; 165 volume_broadcast.dbcv_unitmask = 0x0;
170 volume_broadcast.dbcv_flags = 0x0; 166 volume_broadcast.dbcv_flags = 0x0;
171 { 167
172 testing::InSequence sequence; 168 int expect_detach_calls = 0;
173 for (DeviceIndices::const_iterator it = device_indices.begin(); 169 for (DeviceIndices::const_iterator it = device_indices.begin();
174 it != device_indices.end(); ++it) { 170 it != device_indices.end(); ++it) {
175 volume_broadcast.dbcv_unitmask |= 0x1 << *it; 171 volume_broadcast.dbcv_unitmask |= 0x1 << *it;
176 std::string unique_id; 172 std::string unique_id;
177 bool removable; 173 bool removable;
178 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( 174 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(
179 VolumeMountWatcherWin::DriveNumberToFilePath(*it), NULL, &unique_id, 175 VolumeMountWatcherWin::DriveNumberToFilePath(*it), NULL, &unique_id,
180 NULL, &removable)); 176 NULL, &removable));
181 if (removable) { 177 if (removable)
182 MediaStorageUtil::Type type = 178 expect_detach_calls++;
183 MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM;
184 std::string device_id = MediaStorageUtil::MakeDeviceId(type, unique_id);
185 EXPECT_CALL(observer_, OnRemovableStorageDetached(device_id)).Times(1);
186 }
187 }
188 } 179 }
189 window_->InjectDeviceChange(DBT_DEVICEREMOVECOMPLETE, 180 window_->InjectDeviceChange(DBT_DEVICEREMOVECOMPLETE,
190 reinterpret_cast<DWORD>(&volume_broadcast)); 181 reinterpret_cast<DWORD>(&volume_broadcast));
191 RunUntilIdle(); 182 RunUntilIdle();
183 EXPECT_EQ(0, observer_.attach_calls());
184 EXPECT_EQ(expect_detach_calls, observer_.detach_calls());
192 } 185 }
193 186
194 void RemovableDeviceNotificationsWindowWinTest::DoMTPDeviceTest( 187 void RemovableDeviceNotificationsWindowWinTest::DoMTPDeviceTest(
195 const string16& pnp_device_id, bool test_attach) { 188 const string16& pnp_device_id, bool test_attach) {
196 GUID guidDevInterface = GUID_NULL; 189 GUID guidDevInterface = GUID_NULL;
197 HRESULT hr = CLSIDFromString(kWPDDevInterfaceGUID, &guidDevInterface); 190 HRESULT hr = CLSIDFromString(kWPDDevInterfaceGUID, &guidDevInterface);
198 if (FAILED(hr)) 191 if (FAILED(hr))
199 return; 192 return;
200 193
201 size_t device_id_size = pnp_device_id.size() * sizeof(char16); 194 size_t device_id_size = pnp_device_id.size() * sizeof(char16);
202 size_t size = sizeof(DEV_BROADCAST_DEVICEINTERFACE) + device_id_size; 195 size_t size = sizeof(DEV_BROADCAST_DEVICEINTERFACE) + device_id_size;
203 scoped_ptr_malloc<DEV_BROADCAST_DEVICEINTERFACE> dev_interface_broadcast( 196 scoped_ptr_malloc<DEV_BROADCAST_DEVICEINTERFACE> dev_interface_broadcast(
204 static_cast<DEV_BROADCAST_DEVICEINTERFACE*>(malloc(size))); 197 static_cast<DEV_BROADCAST_DEVICEINTERFACE*>(malloc(size)));
205 DCHECK(dev_interface_broadcast.get()); 198 DCHECK(dev_interface_broadcast.get());
206 ZeroMemory(dev_interface_broadcast.get(), size); 199 ZeroMemory(dev_interface_broadcast.get(), size);
207 dev_interface_broadcast->dbcc_size = size; 200 dev_interface_broadcast->dbcc_size = size;
208 dev_interface_broadcast->dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; 201 dev_interface_broadcast->dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
209 dev_interface_broadcast->dbcc_classguid = guidDevInterface; 202 dev_interface_broadcast->dbcc_classguid = guidDevInterface;
210 memcpy(dev_interface_broadcast->dbcc_name, pnp_device_id.data(), 203 memcpy(dev_interface_broadcast->dbcc_name, pnp_device_id.data(),
211 device_id_size); 204 device_id_size);
212 { 205
213 testing::InSequence sequence; 206 int expect_attach_calls = observer_.attach_calls();
214 PortableDeviceWatcherWin::StorageObjectIDs storage_object_ids = 207 int expect_detach_calls = observer_.detach_calls();
215 TestPortableDeviceWatcherWin::GetMTPStorageObjectIds(pnp_device_id); 208 PortableDeviceWatcherWin::StorageObjectIDs storage_object_ids =
216 for (PortableDeviceWatcherWin::StorageObjectIDs::const_iterator it = 209 TestPortableDeviceWatcherWin::GetMTPStorageObjectIds(pnp_device_id);
217 storage_object_ids.begin(); it != storage_object_ids.end(); ++it) { 210 for (PortableDeviceWatcherWin::StorageObjectIDs::const_iterator it =
218 std::string unique_id; 211 storage_object_ids.begin(); it != storage_object_ids.end(); ++it) {
219 string16 name; 212 std::string unique_id;
220 string16 location; 213 string16 name;
221 TestPortableDeviceWatcherWin::GetMTPStorageDetails(pnp_device_id, *it, 214 string16 location;
222 &location, &unique_id, 215 TestPortableDeviceWatcherWin::GetMTPStorageDetails(pnp_device_id, *it,
223 &name); 216 &location, &unique_id,
224 if (test_attach) { 217 &name);
225 EXPECT_CALL(observer_, OnRemovableStorageAttached(unique_id, name, 218 if (test_attach && !name.empty() && !unique_id.empty())
226 location)) 219 expect_attach_calls++;
227 .Times((name.empty() || unique_id.empty()) ? 0 : 1); 220 else if (!name.empty() && !unique_id.empty())
228 } else { 221 expect_detach_calls++;
229 EXPECT_CALL(observer_, OnRemovableStorageDetached(unique_id))
230 .Times((name.empty() || unique_id.empty()) ? 0 : 1);
231 }
232 }
233 } 222 }
223
234 window_->InjectDeviceChange( 224 window_->InjectDeviceChange(
235 test_attach ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE, 225 test_attach ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE,
236 reinterpret_cast<DWORD>(dev_interface_broadcast.get())); 226 reinterpret_cast<DWORD>(dev_interface_broadcast.get()));
227
237 RunUntilIdle(); 228 RunUntilIdle();
229 EXPECT_EQ(expect_attach_calls, observer_.attach_calls());
230 EXPECT_EQ(expect_detach_calls, observer_.detach_calls());
238 } 231 }
239 232
240 bool RemovableDeviceNotificationsWindowWinTest::GetMTPStorageInfo( 233 bool RemovableDeviceNotificationsWindowWinTest::GetMTPStorageInfo(
241 const std::string& storage_device_id, 234 const std::string& storage_device_id,
242 string16* pnp_device_id, 235 string16* pnp_device_id,
243 string16* storage_object_id) { 236 string16* storage_object_id) {
244 return window_->GetMTPStorageInfoFromDeviceId(storage_device_id, 237 return window_->GetMTPStorageInfoFromDeviceId(storage_device_id,
245 pnp_device_id, 238 pnp_device_id,
246 storage_object_id); 239 storage_object_id);
247 } 240 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 PreAttachDevices(); 332 PreAttachDevices();
340 333
341 // An invalid path. 334 // An invalid path.
342 EXPECT_FALSE(window_->GetDeviceInfoForPath(FilePath(L"COM1:\\"), NULL)); 335 EXPECT_FALSE(window_->GetDeviceInfoForPath(FilePath(L"COM1:\\"), NULL));
343 336
344 // An unconnected removable device. 337 // An unconnected removable device.
345 EXPECT_FALSE(window_->GetDeviceInfoForPath(FilePath(L"E:\\"), NULL)); 338 EXPECT_FALSE(window_->GetDeviceInfoForPath(FilePath(L"E:\\"), NULL));
346 339
347 // A connected removable device. 340 // A connected removable device.
348 FilePath removable_device(L"F:\\"); 341 FilePath removable_device(L"F:\\");
349 base::SystemMonitor::RemovableStorageInfo device_info; 342 RemovableStorageNotifications::StorageInfo device_info;
350 EXPECT_TRUE(window_->GetDeviceInfoForPath(removable_device, &device_info)); 343 EXPECT_TRUE(window_->GetDeviceInfoForPath(removable_device, &device_info));
351 344
352 std::string unique_id; 345 std::string unique_id;
353 string16 device_name; 346 string16 device_name;
354 bool removable; 347 bool removable;
355 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo( 348 ASSERT_TRUE(volume_mount_watcher_->GetDeviceInfo(
356 removable_device, NULL, &unique_id, &device_name, &removable)); 349 removable_device, NULL, &unique_id, &device_name, &removable));
357 EXPECT_TRUE(removable); 350 EXPECT_TRUE(removable);
358 std::string device_id = MediaStorageUtil::MakeDeviceId( 351 std::string device_id = MediaStorageUtil::MakeDeviceId(
359 MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM, unique_id); 352 MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM, unique_id);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 pnp_device_id); 420 pnp_device_id);
428 EXPECT_EQ(it->object_persistent_id, 421 EXPECT_EQ(it->object_persistent_id,
429 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId( 422 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId(
430 pnp_device_id, storage_object_id)); 423 pnp_device_id, storage_object_id));
431 } 424 }
432 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); 425 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false);
433 } 426 }
434 427
435 } // namespace test 428 } // namespace test
436 } // namespace chrome 429 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698