| 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" |
| 11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 12 #include "ui/base/l10n/time_format.h" | 12 #include "ui/base/l10n/time_format.h" |
| 13 #include "ui/gfx/image/image_skia.h" | |
| 14 #include "ui/views/controls/image_view.h" | |
| 15 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 16 | 14 |
| 17 using power_manager::PowerSupplyProperties; | 15 using power_manager::PowerSupplyProperties; |
| 18 | 16 |
| 19 namespace ash { | 17 namespace ash { |
| 20 | 18 |
| 21 class PowerStatusViewTest : public test::AshTestBase { | 19 class PowerStatusViewTest : public test::AshTestBase { |
| 22 public: | 20 public: |
| 23 PowerStatusViewTest() {} | 21 PowerStatusViewTest() {} |
| 24 ~PowerStatusViewTest() override {} | 22 ~PowerStatusViewTest() override {} |
| 25 | 23 |
| 26 // Overridden from testing::Test: | 24 // Overridden from testing::Test: |
| 27 void SetUp() override { | 25 void SetUp() override { |
| 28 test::AshTestBase::SetUp(); | 26 test::AshTestBase::SetUp(); |
| 29 view_.reset(new PowerStatusView(false)); | 27 view_.reset(new PowerStatusView()); |
| 30 } | 28 } |
| 31 | 29 |
| 32 void TearDown() override { | 30 void TearDown() override { |
| 33 view_.reset(); | 31 view_.reset(); |
| 34 test::AshTestBase::TearDown(); | 32 test::AshTestBase::TearDown(); |
| 35 } | 33 } |
| 36 | 34 |
| 37 protected: | 35 protected: |
| 38 void UpdatePowerStatus(const power_manager::PowerSupplyProperties& proto) { | 36 void UpdatePowerStatus(const power_manager::PowerSupplyProperties& proto) { |
| 39 PowerStatus::Get()->SetProtoForTesting(proto); | 37 PowerStatus::Get()->SetProtoForTesting(proto); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // on production though. | 106 // on production though. |
| 109 prop.set_external_power(PowerSupplyProperties::AC); | 107 prop.set_external_power(PowerSupplyProperties::AC); |
| 110 prop.set_battery_state(PowerSupplyProperties::DISCHARGING); | 108 prop.set_battery_state(PowerSupplyProperties::DISCHARGING); |
| 111 prop.set_battery_time_to_full_sec(120); | 109 prop.set_battery_time_to_full_sec(120); |
| 112 UpdatePowerStatus(prop); | 110 UpdatePowerStatus(prop); |
| 113 EXPECT_TRUE(IsPercentageVisible()); | 111 EXPECT_TRUE(IsPercentageVisible()); |
| 114 EXPECT_FALSE(IsTimeStatusVisible()); | 112 EXPECT_FALSE(IsTimeStatusVisible()); |
| 115 } | 113 } |
| 116 | 114 |
| 117 } // namespace ash | 115 } // namespace ash |
| OLD | NEW |