| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/peripheral_battery_observer.h" | 5 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class PeripheralBatteryObserverTest : public InProcessBrowserTest { | 35 class PeripheralBatteryObserverTest : public InProcessBrowserTest { |
| 36 public: | 36 public: |
| 37 PeripheralBatteryObserverTest() {} | 37 PeripheralBatteryObserverTest() {} |
| 38 ~PeripheralBatteryObserverTest() override {} | 38 ~PeripheralBatteryObserverTest() override {} |
| 39 | 39 |
| 40 void SetUp() override { | 40 void SetUp() override { |
| 41 InProcessBrowserTest::SetUp(); | 41 InProcessBrowserTest::SetUp(); |
| 42 chromeos::DBusThreadManager::Initialize(); | 42 chromeos::DBusThreadManager::Initialize(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void SetUpInProcessBrowserTestFixture() override { | |
| 46 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | |
| 47 } | |
| 48 | |
| 49 void SetUpOnMainThread() override { | 45 void SetUpOnMainThread() override { |
| 50 observer_.reset(new PeripheralBatteryObserver()); | 46 observer_.reset(new PeripheralBatteryObserver()); |
| 51 } | 47 } |
| 52 | 48 |
| 53 void TearDownOnMainThread() override { observer_.reset(); } | 49 void TearDownOnMainThread() override { observer_.reset(); } |
| 54 | 50 |
| 55 void TearDownInProcessBrowserTestFixture() override { | |
| 56 InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); | |
| 57 } | |
| 58 | |
| 59 protected: | 51 protected: |
| 60 std::unique_ptr<PeripheralBatteryObserver> observer_; | 52 std::unique_ptr<PeripheralBatteryObserver> observer_; |
| 61 | 53 |
| 62 private: | 54 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(PeripheralBatteryObserverTest); | 55 DISALLOW_COPY_AND_ASSIGN(PeripheralBatteryObserverTest); |
| 64 }; | 56 }; |
| 65 | 57 |
| 66 IN_PROC_BROWSER_TEST_F(PeripheralBatteryObserverTest, Basic) { | 58 IN_PROC_BROWSER_TEST_F(PeripheralBatteryObserverTest, Basic) { |
| 67 base::SimpleTestTickClock clock; | 59 base::SimpleTestTickClock clock; |
| 68 observer_->set_testing_clock(&clock); | 60 observer_->set_testing_clock(&clock); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ProfileManager::GetPrimaryUserProfile())) != NULL); | 162 ProfileManager::GetPrimaryUserProfile())) != NULL); |
| 171 | 163 |
| 172 observer_->RemoveBattery(kTestBatteryAddress); | 164 observer_->RemoveBattery(kTestBatteryAddress); |
| 173 EXPECT_FALSE(notification_manager->FindById( | 165 EXPECT_FALSE(notification_manager->FindById( |
| 174 kTestBatteryAddress, | 166 kTestBatteryAddress, |
| 175 NotificationUIManager::GetProfileID( | 167 NotificationUIManager::GetProfileID( |
| 176 ProfileManager::GetPrimaryUserProfile())) != NULL); | 168 ProfileManager::GetPrimaryUserProfile())) != NULL); |
| 177 } | 169 } |
| 178 | 170 |
| 179 } // namespace chromeos | 171 } // namespace chromeos |
| OLD | NEW |