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 "chrome/browser/chromeos/power/power_data_collector.h" | 5 #include "chrome/browser/chromeos/power/power_data_collector.h" |
6 #include "chromeos/dbus/dbus_thread_manager.h" | 6 #include "chromeos/dbus/dbus_thread_manager.h" |
7 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" | 7 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
11 | 11 |
12 class PowerDataCollectorTest : public testing::Test { | 12 class PowerDataCollectorTest : public testing::Test { |
13 public: | 13 public: |
14 PowerDataCollectorTest() : power_data_collector_(NULL) {} | 14 PowerDataCollectorTest() : power_data_collector_(NULL) {} |
15 virtual ~PowerDataCollectorTest() {} | 15 virtual ~PowerDataCollectorTest() {} |
16 | 16 |
17 virtual void SetUp() OVERRIDE { | 17 virtual void SetUp() override { |
18 DBusThreadManager::Initialize(); | 18 DBusThreadManager::Initialize(); |
19 PowerDataCollector::InitializeForTesting(); | 19 PowerDataCollector::InitializeForTesting(); |
20 power_data_collector_ = PowerDataCollector::Get(); | 20 power_data_collector_ = PowerDataCollector::Get(); |
21 } | 21 } |
22 | 22 |
23 virtual void TearDown() OVERRIDE { | 23 virtual void TearDown() override { |
24 PowerDataCollector::Shutdown(); | 24 PowerDataCollector::Shutdown(); |
25 DBusThreadManager::Shutdown(); | 25 DBusThreadManager::Shutdown(); |
26 power_data_collector_ = NULL; | 26 power_data_collector_ = NULL; |
27 } | 27 } |
28 | 28 |
29 protected: | 29 protected: |
30 PowerDataCollector* power_data_collector_; | 30 PowerDataCollector* power_data_collector_; |
31 }; | 31 }; |
32 | 32 |
33 TEST_F(PowerDataCollectorTest, PowerChanged) { | 33 TEST_F(PowerDataCollectorTest, PowerChanged) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 AddSample(&sample_deque, sample1); | 76 AddSample(&sample_deque, sample1); |
77 ASSERT_EQ(static_cast<size_t>(1), sample_deque.size()); | 77 ASSERT_EQ(static_cast<size_t>(1), sample_deque.size()); |
78 | 78 |
79 AddSample(&sample_deque, sample2); | 79 AddSample(&sample_deque, sample2); |
80 ASSERT_EQ(static_cast<size_t>(1), sample_deque.size()); | 80 ASSERT_EQ(static_cast<size_t>(1), sample_deque.size()); |
81 EXPECT_EQ(sample2.time.ToInternalValue(), | 81 EXPECT_EQ(sample2.time.ToInternalValue(), |
82 sample_deque[0].time.ToInternalValue()); | 82 sample_deque[0].time.ToInternalValue()); |
83 } | 83 } |
84 | 84 |
85 } // namespace chromeos | 85 } // namespace chromeos |
OLD | NEW |