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