| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/system/chromeos/power/power_status_view.h" | 5 #include "ash/common/system/chromeos/power/power_status_view.h" |
| 6 | 6 |
| 7 #include "ash/common/system/chromeos/power/power_status.h" | 7 #include "ash/common/system/chromeos/power/power_status.h" |
| 8 #include "ash/strings/grit/ash_strings.h" | 8 #include "ash/strings/grit/ash_strings.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" | 10 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool IsTimeStatusVisible() const { | 47 bool IsTimeStatusVisible() const { |
| 48 return view_->time_status_label_->visible(); | 48 return view_->time_status_label_->visible(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 base::string16 RemainingTimeInView() const { | 51 base::string16 RemainingTimeInView() const { |
| 52 return view_->time_status_label_->text(); | 52 return view_->time_status_label_->text(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 gfx::ImageSkia GetBatteryImage() const { return view_->icon_->GetImage(); } | |
| 56 | |
| 57 private: | 55 private: |
| 58 std::unique_ptr<PowerStatusView> view_; | 56 std::unique_ptr<PowerStatusView> view_; |
| 59 | 57 |
| 60 DISALLOW_COPY_AND_ASSIGN(PowerStatusViewTest); | 58 DISALLOW_COPY_AND_ASSIGN(PowerStatusViewTest); |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 TEST_F(PowerStatusViewTest, Basic) { | 61 TEST_F(PowerStatusViewTest, Basic) { |
| 64 EXPECT_FALSE(IsPercentageVisible()); | 62 EXPECT_FALSE(IsPercentageVisible()); |
| 65 EXPECT_TRUE(IsTimeStatusVisible()); | 63 EXPECT_TRUE(IsTimeStatusVisible()); |
| 66 | 64 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // on production though. | 108 // on production though. |
| 111 prop.set_external_power(PowerSupplyProperties::AC); | 109 prop.set_external_power(PowerSupplyProperties::AC); |
| 112 prop.set_battery_state(PowerSupplyProperties::DISCHARGING); | 110 prop.set_battery_state(PowerSupplyProperties::DISCHARGING); |
| 113 prop.set_battery_time_to_full_sec(120); | 111 prop.set_battery_time_to_full_sec(120); |
| 114 UpdatePowerStatus(prop); | 112 UpdatePowerStatus(prop); |
| 115 EXPECT_TRUE(IsPercentageVisible()); | 113 EXPECT_TRUE(IsPercentageVisible()); |
| 116 EXPECT_FALSE(IsTimeStatusVisible()); | 114 EXPECT_FALSE(IsTimeStatusVisible()); |
| 117 } | 115 } |
| 118 | 116 |
| 119 } // namespace ash | 117 } // namespace ash |
| OLD | NEW |