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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 volume_broadcast.dbcv_size = sizeof(volume_broadcast); | 118 volume_broadcast.dbcv_size = sizeof(volume_broadcast); |
119 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; | 119 volume_broadcast.dbcv_devicetype = DBT_DEVTYP_VOLUME; |
120 volume_broadcast.dbcv_unitmask = 0x0; | 120 volume_broadcast.dbcv_unitmask = 0x0; |
121 volume_broadcast.dbcv_flags = 0x0; | 121 volume_broadcast.dbcv_flags = 0x0; |
122 { | 122 { |
123 testing::InSequence sequence; | 123 testing::InSequence sequence; |
124 for (std::vector<int>::const_iterator it = device_indices.begin(); | 124 for (std::vector<int>::const_iterator it = device_indices.begin(); |
125 it != device_indices.end(); | 125 it != device_indices.end(); |
126 ++it) { | 126 ++it) { |
127 volume_broadcast.dbcv_unitmask |= 0x1 << *it; | 127 volume_broadcast.dbcv_unitmask |= 0x1 << *it; |
128 EXPECT_CALL(observer_, OnMediaDeviceDetached(base::IntToString(*it))); | 128 std::wstring drive(L"_:\\"); |
| 129 drive[0] = 'A' + *it; |
| 130 EXPECT_CALL(observer_, OnMediaDeviceDetached(base::IntToString(*it), |
| 131 drive)).Times(0); |
129 } | 132 } |
130 } | 133 } |
131 window_->OnDeviceChange(DBT_DEVICEREMOVECOMPLETE, | 134 window_->OnDeviceChange(DBT_DEVICEREMOVECOMPLETE, |
132 reinterpret_cast<DWORD>(&volume_broadcast)); | 135 reinterpret_cast<DWORD>(&volume_broadcast)); |
133 message_loop_.RunAllPending(); | 136 message_loop_.RunAllPending(); |
134 } | 137 } |
135 | 138 |
136 TEST_F(MediaDeviceNotificationsWindowWinTest, RandomMessage) { | 139 TEST_F(MediaDeviceNotificationsWindowWinTest, RandomMessage) { |
137 window_->OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); | 140 window_->OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); |
138 message_loop_.RunAllPending(); | 141 message_loop_.RunAllPending(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 199 |
197 TEST_F(MediaDeviceNotificationsWindowWinTest, DevicesDetachedAdjacentBits) { | 200 TEST_F(MediaDeviceNotificationsWindowWinTest, DevicesDetachedAdjacentBits) { |
198 std::vector<int> device_indices; | 201 std::vector<int> device_indices; |
199 device_indices.push_back(0); | 202 device_indices.push_back(0); |
200 device_indices.push_back(1); | 203 device_indices.push_back(1); |
201 device_indices.push_back(2); | 204 device_indices.push_back(2); |
202 device_indices.push_back(3); | 205 device_indices.push_back(3); |
203 | 206 |
204 DoDevicesDetachedTest(device_indices); | 207 DoDevicesDetachedTest(device_indices); |
205 } | 208 } |
OLD | NEW |