| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/system/chromeos/power/power_status.h" | 5 #include "ash/system/chromeos/power/power_status.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 PowerStatus* power_status_; // Not owned. | 62 PowerStatus* power_status_; // Not owned. |
| 63 scoped_ptr<TestObserver> test_observer_; | 63 scoped_ptr<TestObserver> test_observer_; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 DISALLOW_COPY_AND_ASSIGN(PowerStatusTest); | 66 DISALLOW_COPY_AND_ASSIGN(PowerStatusTest); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 TEST_F(PowerStatusTest, InitializeAndUpdate) { | 69 TEST_F(PowerStatusTest, InitializeAndUpdate) { |
| 70 // Test that the initial power supply state should be acquired after | 70 // Test that the initial power supply state should be acquired after |
| 71 // PowerStatus is instantiated. This depends on | 71 // PowerStatus is instantiated. This depends on |
| 72 // PowerManagerClientStubImpl, which responds to power status update | 72 // FakePowerManagerClient, which responds to power status update |
| 73 // requests, pretends there is a battery present, and generates some valid | 73 // requests, pretends there is a battery present, and generates some valid |
| 74 // power supply status data. | 74 // power supply status data. |
| 75 message_loop_.RunUntilIdle(); | 75 message_loop_.RunUntilIdle(); |
| 76 EXPECT_EQ(1, test_observer_->power_changed_count()); | 76 EXPECT_EQ(1, test_observer_->power_changed_count()); |
| 77 | 77 |
| 78 // Test RequestUpdate, test_obsever_ should be notified for power suuply | 78 // Test RequestUpdate, test_obsever_ should be notified for power suuply |
| 79 // status change. | 79 // status change. |
| 80 power_status_->RequestStatusUpdate(); | 80 power_status_->RequestStatusUpdate(); |
| 81 message_loop_.RunUntilIdle(); | 81 message_loop_.RunUntilIdle(); |
| 82 EXPECT_EQ(2, test_observer_->power_changed_count()); | 82 EXPECT_EQ(2, test_observer_->power_changed_count()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 EXPECT_EQ(4, minutes); | 137 EXPECT_EQ(4, minutes); |
| 138 | 138 |
| 139 PowerStatus::SplitTimeIntoHoursAndMinutes( | 139 PowerStatus::SplitTimeIntoHoursAndMinutes( |
| 140 base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 29), &hours, &minutes); | 140 base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 29), &hours, &minutes); |
| 141 EXPECT_EQ(2, hours); | 141 EXPECT_EQ(2, hours); |
| 142 EXPECT_EQ(3, minutes); | 142 EXPECT_EQ(3, minutes); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace internal | 145 } // namespace internal |
| 146 } // namespace ash | 146 } // namespace ash |
| OLD | NEW |