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