OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/system_monitor.h" | 5 #include "ui/base/system_monitor/system_monitor.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
| 8 namespace ui { |
| 9 |
8 class PowerTest : public SystemMonitor::PowerObserver { | 10 class PowerTest : public SystemMonitor::PowerObserver { |
9 public: | 11 public: |
10 PowerTest() | 12 PowerTest() |
11 : battery_(false), | 13 : battery_(false), |
12 power_state_changes_(0), | 14 power_state_changes_(0), |
13 suspends_(0), | 15 suspends_(0), |
14 resumes_(0) { | 16 resumes_(0) { |
15 } | 17 } |
16 | 18 |
17 // PowerObserver callbacks. | 19 // PowerObserver callbacks. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Pretend we were awakened. | 80 // Pretend we were awakened. |
79 system_monitor.ProcessPowerMessage(SystemMonitor::RESUME_EVENT); | 81 system_monitor.ProcessPowerMessage(SystemMonitor::RESUME_EVENT); |
80 loop.RunAllPending(); | 82 loop.RunAllPending(); |
81 EXPECT_EQ(test[0].resumes(), 1); | 83 EXPECT_EQ(test[0].resumes(), 1); |
82 | 84 |
83 // Send a duplicate resume notification. This should be suppressed. | 85 // Send a duplicate resume notification. This should be suppressed. |
84 system_monitor.ProcessPowerMessage(SystemMonitor::RESUME_EVENT); | 86 system_monitor.ProcessPowerMessage(SystemMonitor::RESUME_EVENT); |
85 loop.RunAllPending(); | 87 loop.RunAllPending(); |
86 EXPECT_EQ(test[0].resumes(), 1); | 88 EXPECT_EQ(test[0].resumes(), 1); |
87 } | 89 } |
| 90 |
| 91 } // namespace ui |
OLD | NEW |