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

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor_win_unittest.cc

Issue 12476026: Disable drive scan on startup to avoid spinning floppy drives (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DoNothing closure to spawn a thread early Created 7 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/storage_monitor/test_volume_mount_watcher_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 monitor_.reset(new TestStorageMonitorWin(volume_mount_watcher_, 90 monitor_.reset(new TestStorageMonitorWin(volume_mount_watcher_,
91 new TestPortableDeviceWatcherWin)); 91 new TestPortableDeviceWatcherWin));
92 monitor_->Init(); 92 monitor_->Init();
93 RunUntilIdle(); 93 RunUntilIdle();
94 monitor_->AddObserver(&observer_); 94 monitor_->AddObserver(&observer_);
95 } 95 }
96 96
97 void StorageMonitorWinTest::TearDown() { 97 void StorageMonitorWinTest::TearDown() {
98 RunUntilIdle(); 98 RunUntilIdle();
99 monitor_->RemoveObserver(&observer_); 99 monitor_->RemoveObserver(&observer_);
100 volume_mount_watcher_->ShutdownWorkerPool();
101 monitor_.reset(NULL);
100 } 102 }
101 103
102 void StorageMonitorWinTest::PreAttachDevices() { 104 void StorageMonitorWinTest::PreAttachDevices() {
103 monitor_.reset(); 105 monitor_.reset();
104 volume_mount_watcher_ = new TestVolumeMountWatcherWin; 106 volume_mount_watcher_ = new TestVolumeMountWatcherWin;
105 volume_mount_watcher_->SetAttachedDevicesFake(); 107 volume_mount_watcher_->SetAttachedDevicesFake();
106 108
107 int expect_attach_calls = 0; 109 int expect_attach_calls = 0;
108 std::vector<base::FilePath> initial_devices = 110 std::vector<base::FilePath> initial_devices =
109 volume_mount_watcher_->GetAttachedDevices(); 111 volume_mount_watcher_->GetAttachedDevices();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 TEST_F(StorageMonitorWinTest, DevicesAttachedAdjacentBits) { 315 TEST_F(StorageMonitorWinTest, DevicesAttachedAdjacentBits) {
314 DeviceIndices device_indices; 316 DeviceIndices device_indices;
315 device_indices.push_back(0); 317 device_indices.push_back(0);
316 device_indices.push_back(1); 318 device_indices.push_back(1);
317 device_indices.push_back(2); 319 device_indices.push_back(2);
318 device_indices.push_back(3); 320 device_indices.push_back(3);
319 321
320 DoMassStorageDeviceAttachedTest(device_indices); 322 DoMassStorageDeviceAttachedTest(device_indices);
321 } 323 }
322 324
323 TEST_F(StorageMonitorWinTest, DevicesDetached) { 325 TEST_F(StorageMonitorWinTest, DISABLED_DevicesDetached) {
324 PreAttachDevices(); 326 PreAttachDevices();
325 327
326 DeviceIndices device_indices; 328 DeviceIndices device_indices;
327 device_indices.push_back(1); 329 device_indices.push_back(1);
328 device_indices.push_back(5); 330 device_indices.push_back(5);
329 device_indices.push_back(7); 331 device_indices.push_back(7);
330 device_indices.push_back(13); 332 device_indices.push_back(13);
331 333
332 DoMassStorageDevicesDetachedTest(device_indices); 334 DoMassStorageDevicesDetachedTest(device_indices);
333 } 335 }
334 336
335 TEST_F(StorageMonitorWinTest, DevicesDetachedHighBoundary) { 337 TEST_F(StorageMonitorWinTest, DISABLED_DevicesDetachedHighBoundary) {
336 PreAttachDevices(); 338 PreAttachDevices();
337 339
338 DeviceIndices device_indices; 340 DeviceIndices device_indices;
339 device_indices.push_back(25); 341 device_indices.push_back(25);
340 342
341 DoMassStorageDevicesDetachedTest(device_indices); 343 DoMassStorageDevicesDetachedTest(device_indices);
342 } 344 }
343 345
344 TEST_F(StorageMonitorWinTest, DevicesDetachedLowBoundary) { 346 TEST_F(StorageMonitorWinTest, DISABLED_DevicesDetachedLowBoundary) {
345 PreAttachDevices(); 347 PreAttachDevices();
346 348
347 DeviceIndices device_indices; 349 DeviceIndices device_indices;
348 device_indices.push_back(0); 350 device_indices.push_back(0);
349 351
350 DoMassStorageDevicesDetachedTest(device_indices); 352 DoMassStorageDevicesDetachedTest(device_indices);
351 } 353 }
352 354
353 TEST_F(StorageMonitorWinTest, DevicesDetachedAdjacentBits) { 355 TEST_F(StorageMonitorWinTest, DISABLED_DevicesDetachedAdjacentBits) {
354 PreAttachDevices(); 356 PreAttachDevices();
355 357
356 DeviceIndices device_indices; 358 DeviceIndices device_indices;
357 device_indices.push_back(0); 359 device_indices.push_back(0);
358 device_indices.push_back(1); 360 device_indices.push_back(1);
359 device_indices.push_back(2); 361 device_indices.push_back(2);
360 device_indices.push_back(3); 362 device_indices.push_back(3);
361 363
362 DoMassStorageDevicesDetachedTest(device_indices); 364 DoMassStorageDevicesDetachedTest(device_indices);
363 } 365 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 volume_mount_watcher_->FlushWorkerPoolForTesting(); 406 volume_mount_watcher_->FlushWorkerPoolForTesting();
405 volume_mount_watcher_->ReleaseDeviceCheck(); 407 volume_mount_watcher_->ReleaseDeviceCheck();
406 RunUntilIdle(); 408 RunUntilIdle();
407 409
408 checked_devices = volume_mount_watcher_->devices_checked(); 410 checked_devices = volume_mount_watcher_->devices_checked();
409 ASSERT_EQ(2u, checked_devices.size()); 411 ASSERT_EQ(2u, checked_devices.size());
410 EXPECT_EQ(kAttachedDevicePath, checked_devices[0]); 412 EXPECT_EQ(kAttachedDevicePath, checked_devices[0]);
411 EXPECT_EQ(kAttachedDevicePath, checked_devices[1]); 413 EXPECT_EQ(kAttachedDevicePath, checked_devices[1]);
412 } 414 }
413 415
414 TEST_F(StorageMonitorWinTest, DeviceInfoForPath) { 416 TEST_F(StorageMonitorWinTest, DISABLED_DeviceInfoForPath) {
415 PreAttachDevices(); 417 PreAttachDevices();
416 418
417 // An invalid path. 419 // An invalid path.
418 EXPECT_FALSE(monitor_->GetStorageInfoForPath(base::FilePath(L"COM1:\\"), 420 EXPECT_FALSE(monitor_->GetStorageInfoForPath(base::FilePath(L"COM1:\\"),
419 NULL)); 421 NULL));
420 422
421 // An unconnected removable device. 423 // An unconnected removable device.
422 EXPECT_FALSE(monitor_->GetStorageInfoForPath(base::FilePath(L"E:\\"), NULL)); 424 EXPECT_FALSE(monitor_->GetStorageInfoForPath(base::FilePath(L"E:\\"), NULL));
423 425
424 // A connected removable device. 426 // A connected removable device.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 pnp_device_id); 508 pnp_device_id);
507 EXPECT_EQ(it->object_persistent_id, 509 EXPECT_EQ(it->object_persistent_id,
508 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId( 510 TestPortableDeviceWatcherWin::GetMTPStorageUniqueId(
509 pnp_device_id, storage_object_id)); 511 pnp_device_id, storage_object_id));
510 } 512 }
511 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false); 513 DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false);
512 } 514 }
513 515
514 } // namespace test 516 } // namespace test
515 } // namespace chrome 517 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/storage_monitor/test_volume_mount_watcher_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698