OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/power/peripheral_battery_observer.h" | 5 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 protected: | 58 protected: |
59 scoped_ptr<PeripheralBatteryObserver> observer_; | 59 scoped_ptr<PeripheralBatteryObserver> observer_; |
60 | 60 |
61 private: | 61 private: |
62 DISALLOW_COPY_AND_ASSIGN(PeripheralBatteryObserverTest); | 62 DISALLOW_COPY_AND_ASSIGN(PeripheralBatteryObserverTest); |
63 }; | 63 }; |
64 | 64 |
65 IN_PROC_BROWSER_TEST_F(PeripheralBatteryObserverTest, Basic) { | 65 IN_PROC_BROWSER_TEST_F(PeripheralBatteryObserverTest, Basic) { |
66 base::SimpleTestTickClock clock; | 66 base::SimpleTestTickClock clock((base::TimeTicks())); |
67 observer_->set_testing_clock(&clock); | 67 observer_->set_testing_clock(&clock); |
68 | 68 |
69 NotificationUIManager* notification_manager = | 69 NotificationUIManager* notification_manager = |
70 g_browser_process->notification_ui_manager(); | 70 g_browser_process->notification_ui_manager(); |
71 | 71 |
72 // Level 50 at time 100, no low-battery notification. | 72 // Level 50 at time 100, no low-battery notification. |
73 clock.Advance(base::TimeDelta::FromSeconds(100)); | 73 clock.Advance(base::TimeDelta::FromSeconds(100)); |
74 observer_->PeripheralBatteryStatusReceived(kTestBatteryPath, | 74 observer_->PeripheralBatteryStatusReceived(kTestBatteryPath, |
75 kTestDeviceName, 50); | 75 kTestDeviceName, 50); |
76 EXPECT_EQ(observer_->batteries_.count(kTestBatteryAddress), 1u); | 76 EXPECT_EQ(observer_->batteries_.count(kTestBatteryAddress), 1u); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ProfileManager::GetPrimaryUserProfile())) != NULL); | 169 ProfileManager::GetPrimaryUserProfile())) != NULL); |
170 | 170 |
171 observer_->RemoveBattery(kTestBatteryAddress); | 171 observer_->RemoveBattery(kTestBatteryAddress); |
172 EXPECT_FALSE(notification_manager->FindById( | 172 EXPECT_FALSE(notification_manager->FindById( |
173 kTestBatteryAddress, | 173 kTestBatteryAddress, |
174 NotificationUIManager::GetProfileID( | 174 NotificationUIManager::GetProfileID( |
175 ProfileManager::GetPrimaryUserProfile())) != NULL); | 175 ProfileManager::GetPrimaryUserProfile())) != NULL); |
176 } | 176 } |
177 | 177 |
178 } // namespace chromeos | 178 } // namespace chromeos |
OLD | NEW |