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