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 "media/capture/system_message_window_win.h" | 5 #include "media/capture/system_message_window_win.h" |
6 | 6 |
7 #include <dbt.h> | 7 #include <dbt.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" |
13 #include "base/system_monitor/system_monitor.h" | 14 #include "base/system_monitor/system_monitor.h" |
14 #include "base/test/mock_devices_changed_observer.h" | 15 #include "base/test/mock_devices_changed_observer.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 namespace media { | 19 namespace media { |
19 | 20 |
20 class SystemMessageWindowWinTest : public testing::Test { | 21 class SystemMessageWindowWinTest : public testing::Test { |
21 public: | 22 public: |
22 ~SystemMessageWindowWinTest() override {} | 23 ~SystemMessageWindowWinTest() override {} |
23 | 24 |
24 protected: | 25 protected: |
25 void SetUp() override { | 26 void SetUp() override { |
26 system_monitor_.AddDevicesChangedObserver(&observer_); | 27 system_monitor_.AddDevicesChangedObserver(&observer_); |
27 } | 28 } |
28 | 29 |
29 base::MessageLoop message_loop_; | 30 base::MessageLoop message_loop_; |
30 base::SystemMonitor system_monitor_; | 31 base::SystemMonitor system_monitor_; |
31 base::MockDevicesChangedObserver observer_; | 32 base::MockDevicesChangedObserver observer_; |
32 SystemMessageWindowWin window_; | 33 SystemMessageWindowWin window_; |
33 }; | 34 }; |
34 | 35 |
35 TEST_F(SystemMessageWindowWinTest, DevicesChanged) { | 36 TEST_F(SystemMessageWindowWinTest, DevicesChanged) { |
36 EXPECT_CALL(observer_, OnDevicesChanged(testing::_)).Times(1); | 37 EXPECT_CALL(observer_, OnDevicesChanged(testing::_)).Times(1); |
37 window_.OnDeviceChange(DBT_DEVNODES_CHANGED, NULL); | 38 window_.OnDeviceChange(DBT_DEVNODES_CHANGED, NULL); |
38 message_loop_.RunUntilIdle(); | 39 base::RunLoop().RunUntilIdle(); |
39 } | 40 } |
40 | 41 |
41 TEST_F(SystemMessageWindowWinTest, RandomMessage) { | 42 TEST_F(SystemMessageWindowWinTest, RandomMessage) { |
42 window_.OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); | 43 window_.OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); |
43 message_loop_.RunUntilIdle(); | 44 base::RunLoop().RunUntilIdle(); |
44 } | 45 } |
45 | 46 |
46 } // namespace media | 47 } // namespace media |
OLD | NEW |