| 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 EXPECT_CALL(observer_, OnMediaDeviceDetached(base::IntToString(*it))) |
| 129 .Times(0); |
| 129 } | 130 } |
| 130 } | 131 } |
| 131 window_->OnDeviceChange(DBT_DEVICEREMOVECOMPLETE, | 132 window_->OnDeviceChange(DBT_DEVICEREMOVECOMPLETE, |
| 132 reinterpret_cast<DWORD>(&volume_broadcast)); | 133 reinterpret_cast<DWORD>(&volume_broadcast)); |
| 133 message_loop_.RunAllPending(); | 134 message_loop_.RunAllPending(); |
| 134 } | 135 } |
| 135 | 136 |
| 136 TEST_F(MediaDeviceNotificationsWindowWinTest, RandomMessage) { | 137 TEST_F(MediaDeviceNotificationsWindowWinTest, RandomMessage) { |
| 137 window_->OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); | 138 window_->OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); |
| 138 message_loop_.RunAllPending(); | 139 message_loop_.RunAllPending(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 197 |
| 197 TEST_F(MediaDeviceNotificationsWindowWinTest, DevicesDetachedAdjacentBits) { | 198 TEST_F(MediaDeviceNotificationsWindowWinTest, DevicesDetachedAdjacentBits) { |
| 198 std::vector<int> device_indices; | 199 std::vector<int> device_indices; |
| 199 device_indices.push_back(0); | 200 device_indices.push_back(0); |
| 200 device_indices.push_back(1); | 201 device_indices.push_back(1); |
| 201 device_indices.push_back(2); | 202 device_indices.push_back(2); |
| 202 device_indices.push_back(3); | 203 device_indices.push_back(3); |
| 203 | 204 |
| 204 DoDevicesDetachedTest(device_indices); | 205 DoDevicesDetachedTest(device_indices); |
| 205 } | 206 } |
| OLD | NEW |