Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/power_manager.h" |
| 6 | |
| 7 | #include <string> |
| 8 | |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 9 | #include <base/bind.h> |
| 10 | #include <base/memory/scoped_ptr.h> |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 11 | #include <gmock/gmock.h> |
| 12 | #include <gtest/gtest.h> |
| 13 | |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 14 | #include "shill/mock_event_dispatcher.h" |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 15 | #include "shill/mock_power_manager_proxy.h" |
| 16 | #include "shill/power_manager_proxy_interface.h" |
| 17 | #include "shill/proxy_factory.h" |
| 18 | |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 19 | using base::Bind; |
| 20 | using base::Unretained; |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 21 | using std::map; |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 22 | using std::string; |
| 23 | using testing::_; |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 24 | using testing::Return; |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 25 | using testing::Test; |
| 26 | |
| 27 | namespace shill { |
| 28 | |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 29 | namespace { |
| 30 | |
| 31 | class FakeProxyFactory : public ProxyFactory { |
| 32 | public: |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 33 | FakeProxyFactory() |
| 34 | : delegate_(NULL), |
| 35 | proxy_(new MockPowerManagerProxy) {} |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 36 | |
| 37 | virtual PowerManagerProxyInterface *CreatePowerManagerProxy( |
| 38 | PowerManagerProxyDelegate *delegate) { |
| 39 | delegate_ = delegate; |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 40 | return proxy_; |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 41 | } |
| 42 | PowerManagerProxyDelegate *delegate() const { return delegate_; } |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 43 | MockPowerManagerProxy *proxy() const { return proxy_; } |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 44 | |
| 45 | private: |
| 46 | PowerManagerProxyDelegate *delegate_; |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 47 | MockPowerManagerProxy *const proxy_; |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | } // namespace |
| 51 | |
| 52 | class PowerManagerTest : public Test { |
| 53 | public: |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 54 | static const char kKey1[]; |
| 55 | static const char kKey2[]; |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 56 | static const int kSuspendId1 = 123; |
| 57 | static const int kSuspendId2 = 456; |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 58 | |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 59 | PowerManagerTest() |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 60 | : power_manager_(&dispatcher_, &factory_), |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 61 | delegate_(factory_.delegate()) { |
| 62 | state_change_callback1_ = |
| 63 | Bind(&PowerManagerTest::StateChangeAction1, Unretained(this)); |
| 64 | state_change_callback2_ = |
| 65 | Bind(&PowerManagerTest::StateChangeAction2, Unretained(this)); |
| 66 | suspend_delay_callback1_ = |
| 67 | Bind(&PowerManagerTest::SuspendDelayAction1, Unretained(this)); |
| 68 | suspend_delay_callback2_ = |
| 69 | Bind(&PowerManagerTest::SuspendDelayAction2, Unretained(this)); |
| 70 | } |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 71 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 72 | MOCK_METHOD1(StateChangeAction1, void(PowerManager::SuspendState)); |
| 73 | MOCK_METHOD1(StateChangeAction2, void(PowerManager::SuspendState)); |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 74 | MOCK_METHOD1(SuspendDelayAction1, void(int)); |
| 75 | MOCK_METHOD1(SuspendDelayAction2, void(int)); |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 76 | |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 77 | protected: |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 78 | void OnSuspendImminent(int suspend_id) { |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 79 | EXPECT_CALL(dispatcher_, |
| 80 | PostDelayedTask(_, PowerManager::kSuspendTimeoutMilliseconds)); |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 81 | factory_.delegate()->OnSuspendImminent(suspend_id); |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 82 | EXPECT_EQ(PowerManagerProxyDelegate::kSuspending, |
| 83 | power_manager_.power_state()); |
| 84 | } |
| 85 | |
| 86 | void OnSuspendTimeout() { |
| 87 | power_manager_.OnSuspendTimeout(); |
| 88 | } |
| 89 | |
| 90 | MockEventDispatcher dispatcher_; |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 91 | FakeProxyFactory factory_; |
| 92 | PowerManager power_manager_; |
| 93 | PowerManagerProxyDelegate *const delegate_; |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 94 | PowerManager::PowerStateCallback state_change_callback1_; |
| 95 | PowerManager::PowerStateCallback state_change_callback2_; |
| 96 | PowerManager::SuspendDelayCallback suspend_delay_callback1_; |
| 97 | PowerManager::SuspendDelayCallback suspend_delay_callback2_; |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 98 | }; |
| 99 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 100 | const char PowerManagerTest::kKey1[] = "Zaphod"; |
| 101 | const char PowerManagerTest::kKey2[] = "Beeblebrox"; |
| 102 | |
Darin Petkov | ca62154 | 2012-07-25 14:25:56 +0200 | [diff] [blame] | 103 | TEST_F(PowerManagerTest, OnPowerStateChanged) { |
| 104 | EXPECT_EQ(PowerManagerProxyDelegate::kUnknown, power_manager_.power_state()); |
| 105 | power_manager_.OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
| 106 | EXPECT_EQ(PowerManagerProxyDelegate::kOn, power_manager_.power_state()); |
| 107 | } |
| 108 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 109 | TEST_F(PowerManagerTest, AddStateChangeCallback) { |
| 110 | EXPECT_CALL(*this, StateChangeAction1(PowerManagerProxyDelegate::kOn)); |
| 111 | power_manager_.AddStateChangeCallback(kKey1, state_change_callback1_); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 112 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 113 | power_manager_.RemoveStateChangeCallback(kKey1); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 114 | } |
| 115 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 116 | TEST_F(PowerManagerTest, AddSuspendDelayCallback) { |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 117 | EXPECT_CALL(*this, SuspendDelayAction1(kSuspendId1)); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 118 | power_manager_.AddSuspendDelayCallback(kKey1, suspend_delay_callback1_); |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 119 | EXPECT_EQ(PowerManagerProxyDelegate::kUnknown, power_manager_.power_state()); |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 120 | OnSuspendImminent(kSuspendId1); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 121 | power_manager_.RemoveSuspendDelayCallback(kKey1); |
| 122 | } |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 123 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 124 | TEST_F(PowerManagerTest, AddMultipleStateChangeRunMultiple) { |
| 125 | EXPECT_CALL(*this, StateChangeAction1(PowerManagerProxyDelegate::kOn)); |
| 126 | EXPECT_CALL(*this, StateChangeAction1(PowerManagerProxyDelegate::kMem)); |
| 127 | power_manager_.AddStateChangeCallback(kKey1, state_change_callback1_); |
| 128 | |
| 129 | EXPECT_CALL(*this, StateChangeAction2(PowerManagerProxyDelegate::kOn)); |
| 130 | EXPECT_CALL(*this, StateChangeAction2(PowerManagerProxyDelegate::kMem)); |
| 131 | power_manager_.AddStateChangeCallback(kKey2, state_change_callback2_); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 132 | |
| 133 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
| 134 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kMem); |
| 135 | } |
| 136 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 137 | TEST_F(PowerManagerTest, AddMultipleSuspendDelayRunMultiple) { |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 138 | EXPECT_CALL(*this, SuspendDelayAction1(kSuspendId1)); |
| 139 | EXPECT_CALL(*this, SuspendDelayAction1(kSuspendId2)); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 140 | power_manager_.AddSuspendDelayCallback(kKey1, suspend_delay_callback1_); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 141 | |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 142 | EXPECT_CALL(*this, SuspendDelayAction2(kSuspendId1)); |
| 143 | EXPECT_CALL(*this, SuspendDelayAction2(kSuspendId2)); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 144 | power_manager_.AddSuspendDelayCallback(kKey2, suspend_delay_callback2_); |
| 145 | |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 146 | OnSuspendImminent(kSuspendId1); |
| 147 | OnSuspendImminent(kSuspendId2); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | TEST_F(PowerManagerTest, RemoveStateChangeCallback) { |
| 151 | EXPECT_CALL(*this, StateChangeAction1(PowerManagerProxyDelegate::kOn)); |
| 152 | EXPECT_CALL(*this, StateChangeAction1(PowerManagerProxyDelegate::kMem)); |
| 153 | power_manager_.AddStateChangeCallback(kKey1, state_change_callback1_); |
| 154 | |
| 155 | EXPECT_CALL(*this, StateChangeAction2(PowerManagerProxyDelegate::kOn)); |
| 156 | EXPECT_CALL(*this, StateChangeAction2(PowerManagerProxyDelegate::kMem)) |
| 157 | .Times(0); |
| 158 | power_manager_.AddStateChangeCallback(kKey2, state_change_callback2_); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 159 | |
| 160 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
| 161 | |
| 162 | power_manager_.RemoveStateChangeCallback(kKey2); |
| 163 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kMem); |
| 164 | |
| 165 | power_manager_.RemoveStateChangeCallback(kKey1); |
| 166 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
| 167 | } |
| 168 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 169 | TEST_F(PowerManagerTest, RemoveSuspendDelayCallback) { |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 170 | EXPECT_CALL(*this, SuspendDelayAction1(kSuspendId1)); |
| 171 | EXPECT_CALL(*this, SuspendDelayAction1(kSuspendId2)); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 172 | power_manager_.AddSuspendDelayCallback(kKey1, suspend_delay_callback1_); |
| 173 | |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 174 | EXPECT_CALL(*this, SuspendDelayAction2(kSuspendId1)); |
| 175 | EXPECT_CALL(*this, SuspendDelayAction2(kSuspendId2)).Times(0); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 176 | power_manager_.AddSuspendDelayCallback(kKey2, suspend_delay_callback2_); |
| 177 | |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 178 | OnSuspendImminent(kSuspendId1); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 179 | |
| 180 | power_manager_.RemoveSuspendDelayCallback(kKey2); |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 181 | OnSuspendImminent(kSuspendId2); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 182 | |
| 183 | power_manager_.RemoveSuspendDelayCallback(kKey1); |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 184 | OnSuspendImminent(kSuspendId1); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | typedef PowerManagerTest PowerManagerDeathTest; |
| 188 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 189 | TEST_F(PowerManagerDeathTest, AddStateChangeCallbackDuplicateKey) { |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 190 | power_manager_.AddStateChangeCallback( |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 191 | kKey1, Bind(&PowerManagerTest::StateChangeAction1, Unretained(this))); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 192 | |
| 193 | #ifndef NDEBUG |
| 194 | // Adding another callback with the same key is an error and causes a crash in |
| 195 | // debug mode. |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 196 | EXPECT_DEATH(power_manager_.AddStateChangeCallback( |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 197 | kKey1, Bind(&PowerManagerTest::StateChangeAction2, Unretained(this))), |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 198 | "Inserting duplicate key"); |
| 199 | #else // NDEBUG |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 200 | EXPECT_CALL(*this, StateChangeAction2(PowerManagerProxyDelegate::kOn)); |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 201 | power_manager_.AddStateChangeCallback( |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 202 | kKey1, Bind(&PowerManagerTest::StateChangeAction2, Unretained(this))); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 203 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
| 204 | #endif // NDEBUG |
| 205 | } |
| 206 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 207 | TEST_F(PowerManagerDeathTest, RemoveStateChangeCallbackUnknownKey) { |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 208 | power_manager_.AddStateChangeCallback( |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 209 | kKey1, Bind(&PowerManagerTest::StateChangeAction1, Unretained(this))); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 210 | |
| 211 | #ifndef NDEBUG |
| 212 | // Attempting to remove a callback key that was not added is an error and |
| 213 | // crashes in debug mode. |
| 214 | EXPECT_DEATH(power_manager_.RemoveStateChangeCallback(kKey2), |
| 215 | "Removing unknown key"); |
| 216 | #else // NDEBUG |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 217 | EXPECT_CALL(*this, StateChangeAction1(PowerManagerProxyDelegate::kOn)); |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 218 | |
| 219 | // In non-debug mode, removing an unknown key does nothing. |
| 220 | power_manager_.RemoveStateChangeCallback(kKey2); |
| 221 | factory_.delegate()->OnPowerStateChanged(PowerManagerProxyDelegate::kOn); |
| 222 | #endif // NDEBUG |
| 223 | } |
| 224 | |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 225 | TEST_F(PowerManagerTest, RegisterSuspendDelay) { |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 226 | const base::TimeDelta kTimeout = base::TimeDelta::FromMilliseconds(100); |
Daniel Erat | f975367 | 2013-01-24 10:17:02 -0800 | [diff] [blame] | 227 | const char kDescription[] = "description"; |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 228 | int delay_id = 0; |
Daniel Erat | f975367 | 2013-01-24 10:17:02 -0800 | [diff] [blame] | 229 | EXPECT_CALL(*factory_.proxy(), RegisterSuspendDelay(kTimeout, kDescription, |
| 230 | &delay_id)) |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 231 | .WillOnce(Return(true)); |
Daniel Erat | f975367 | 2013-01-24 10:17:02 -0800 | [diff] [blame] | 232 | EXPECT_TRUE(power_manager_.RegisterSuspendDelay(kTimeout, kDescription, |
| 233 | &delay_id)); |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 234 | } |
| 235 | |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 236 | TEST_F(PowerManagerTest, UnregisterSuspendDelay) { |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 237 | const int kDelayId = 123; |
| 238 | EXPECT_CALL(*factory_.proxy(), UnregisterSuspendDelay(kDelayId)) |
| 239 | .WillOnce(Return(true)); |
| 240 | EXPECT_TRUE(power_manager_.UnregisterSuspendDelay(kDelayId)); |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 241 | } |
| 242 | |
Daniel Erat | 0818cca | 2012-12-14 10:16:21 -0800 | [diff] [blame] | 243 | TEST_F(PowerManagerTest, ReportSuspendReadiness) { |
| 244 | const int kDelayId = 678; |
| 245 | const int kSuspendId = 12345; |
| 246 | EXPECT_CALL(*factory_.proxy(), ReportSuspendReadiness(kDelayId, kSuspendId)) |
| 247 | .WillOnce(Return(true)); |
| 248 | EXPECT_TRUE(power_manager_.ReportSuspendReadiness(kDelayId, kSuspendId)); |
Darin Petkov | 3ec5534 | 2012-09-28 14:04:44 +0200 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | TEST_F(PowerManagerTest, OnSuspendTimeout) { |
| 252 | EXPECT_EQ(PowerManagerProxyDelegate::kUnknown, power_manager_.power_state()); |
| 253 | OnSuspendTimeout(); |
| 254 | EXPECT_EQ(PowerManagerProxyDelegate::kOn, power_manager_.power_state()); |
| 255 | } |
Gary Morain | 52fabab | 2012-08-22 09:27:31 -0700 | [diff] [blame] | 256 | |
Gary Morain | 43bc627 | 2012-01-30 14:01:15 -0800 | [diff] [blame] | 257 | } // namespace shill |