| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/status/power_menu_button.h" | 5 #include "chrome/browser/chromeos/status/power_menu_button.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
| 8 #include "chrome/browser/chromeos/cros/mock_power_library.h" | 8 #include "chrome/browser/chromeos/cros/mock_power_library.h" |
| 9 #include "chrome/browser/chromeos/frame/browser_view.h" | 9 #include "chrome/browser/chromeos/frame/browser_view.h" |
| 10 #include "chrome/browser/chromeos/status/status_area_view.h" | 10 #include "chrome/browser/chromeos/status/status_area_view.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 EXPECT_CALL(*mock_power_library_, IsLinePowerOn()) | 64 EXPECT_CALL(*mock_power_library_, IsLinePowerOn()) |
| 65 .WillOnce((Return(false))) | 65 .WillOnce((Return(false))) |
| 66 .RetiresOnSaturation(); | 66 .RetiresOnSaturation(); |
| 67 EXPECT_CALL(*mock_power_library_, GetBatteryTimeToEmpty()) | 67 EXPECT_CALL(*mock_power_library_, GetBatteryTimeToEmpty()) |
| 68 .WillOnce((Return(base::TimeDelta::FromMinutes(42)))) | 68 .WillOnce((Return(base::TimeDelta::FromMinutes(42)))) |
| 69 .RetiresOnSaturation(); | 69 .RetiresOnSaturation(); |
| 70 EXPECT_CALL(*mock_power_library_, GetBatteryTimeToFull()) | 70 EXPECT_CALL(*mock_power_library_, GetBatteryTimeToFull()) |
| 71 .WillOnce((Return(base::TimeDelta::FromMinutes(24)))) | 71 .WillOnce((Return(base::TimeDelta::FromMinutes(24)))) |
| 72 .RetiresOnSaturation(); | 72 .RetiresOnSaturation(); |
| 73 EXPECT_EQ(-1, CallPowerChangedAndGetBatteryIndex()); | 73 EXPECT_EQ(-1, CallPowerChangedAndGetBatteryIndex()); |
| 74 |
| 75 PowerMenuButton* power = GetPowerMenuButton(); |
| 76 |
| 77 EXPECT_FALSE(power->IsVisible()); |
| 74 } | 78 } |
| 75 | 79 |
| 76 IN_PROC_BROWSER_TEST_F(PowerMenuButtonTest, BatteryChargedTest) { | 80 IN_PROC_BROWSER_TEST_F(PowerMenuButtonTest, BatteryChargedTest) { |
| 77 EXPECT_CALL(*mock_power_library_, IsBatteryPresent()) | 81 EXPECT_CALL(*mock_power_library_, IsBatteryPresent()) |
| 78 .WillOnce((Return(true))) | 82 .WillOnce((Return(true))) |
| 79 .RetiresOnSaturation(); | 83 .RetiresOnSaturation(); |
| 80 EXPECT_CALL(*mock_power_library_, GetBatteryPercentage()) | 84 EXPECT_CALL(*mock_power_library_, GetBatteryPercentage()) |
| 81 .WillOnce((Return(42.0))) | 85 .WillOnce((Return(42.0))) |
| 82 .RetiresOnSaturation(); | 86 .RetiresOnSaturation(); |
| 83 EXPECT_CALL(*mock_power_library_, IsBatteryFullyCharged()) | 87 EXPECT_CALL(*mock_power_library_, IsBatteryFullyCharged()) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 for (float percent = 5.0; percent < 100.0; percent += 5.0) { | 159 for (float percent = 5.0; percent < 100.0; percent += 5.0) { |
| 156 EXPECT_CALL(*mock_power_library_, GetBatteryPercentage()) | 160 EXPECT_CALL(*mock_power_library_, GetBatteryPercentage()) |
| 157 .WillOnce((Return(percent))) | 161 .WillOnce((Return(percent))) |
| 158 .RetiresOnSaturation(); | 162 .RetiresOnSaturation(); |
| 159 EXPECT_EQ(index, CallPowerChangedAndGetBatteryIndex()); | 163 EXPECT_EQ(index, CallPowerChangedAndGetBatteryIndex()); |
| 160 index++; | 164 index++; |
| 161 } | 165 } |
| 162 } | 166 } |
| 163 | 167 |
| 164 } // namespace chromeos | 168 } // namespace chromeos |
| OLD | NEW |