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 "chrome/browser/media_gallery/media_device_notifications_window_win.h" | 5 #include "chrome/browser/media_gallery/media_device_notifications_window_win.h" |
6 | 6 |
7 #include <dbt.h> | 7 #include <dbt.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 { | 93 { |
94 testing::InSequence sequence; | 94 testing::InSequence sequence; |
95 for (std::vector<int>::const_iterator it = device_indices.begin(); | 95 for (std::vector<int>::const_iterator it = device_indices.begin(); |
96 it != device_indices.end(); | 96 it != device_indices.end(); |
97 ++it) { | 97 ++it) { |
98 volume_broadcast.dbcv_unitmask |= 0x1 << *it; | 98 volume_broadcast.dbcv_unitmask |= 0x1 << *it; |
99 std::wstring drive(L"_:\\"); | 99 std::wstring drive(L"_:\\"); |
100 drive[0] = 'A' + *it; | 100 drive[0] = 'A' + *it; |
101 std::string name("V"); | 101 std::string name("V"); |
102 name.append(base::SysWideToUTF8(drive)); | 102 name.append(base::SysWideToUTF8(drive)); |
103 EXPECT_CALL(observer_, OnMediaDeviceAttached(*it, name, FilePath(drive))). | 103 EXPECT_CALL(observer_, |
104 Times(0); | 104 OnMediaDeviceAttached(*it, |
| 105 name, |
| 106 base::SystemMonitor::TYPE_PATH, |
| 107 drive)) |
| 108 .Times(0); |
105 } | 109 } |
106 } | 110 } |
107 window_->OnDeviceChange(DBT_DEVICEARRIVAL, | 111 window_->OnDeviceChange(DBT_DEVICEARRIVAL, |
108 reinterpret_cast<DWORD>(&volume_broadcast)); | 112 reinterpret_cast<DWORD>(&volume_broadcast)); |
109 message_loop_.RunAllPending(); | 113 message_loop_.RunAllPending(); |
110 } | 114 } |
111 | 115 |
112 void MediaDeviceNotificationsWindowWinTest::DoDevicesDetachedTest( | 116 void MediaDeviceNotificationsWindowWinTest::DoDevicesDetachedTest( |
113 const std::vector<int>& device_indices) { | 117 const std::vector<int>& device_indices) { |
114 DEV_BROADCAST_VOLUME volume_broadcast; | 118 DEV_BROADCAST_VOLUME volume_broadcast; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 197 |
194 TEST_F(MediaDeviceNotificationsWindowWinTest, DevicesDetachedAdjacentBits) { | 198 TEST_F(MediaDeviceNotificationsWindowWinTest, DevicesDetachedAdjacentBits) { |
195 std::vector<int> device_indices; | 199 std::vector<int> device_indices; |
196 device_indices.push_back(0); | 200 device_indices.push_back(0); |
197 device_indices.push_back(1); | 201 device_indices.push_back(1); |
198 device_indices.push_back(2); | 202 device_indices.push_back(2); |
199 device_indices.push_back(3); | 203 device_indices.push_back(3); |
200 | 204 |
201 DoDevicesDetachedTest(device_indices); | 205 DoDevicesDetachedTest(device_indices); |
202 } | 206 } |
OLD | NEW |