| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 namespace chromeos { | 32 namespace chromeos { |
| 33 | 33 |
| 34 class PeripheralBatteryObserverTest : public InProcessBrowserTest { | 34 class PeripheralBatteryObserverTest : public InProcessBrowserTest { |
| 35 public: | 35 public: |
| 36 PeripheralBatteryObserverTest () {} | 36 PeripheralBatteryObserverTest () {} |
| 37 virtual ~PeripheralBatteryObserverTest () {} | 37 virtual ~PeripheralBatteryObserverTest () {} |
| 38 | 38 |
| 39 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 39 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 40 FakeDBusThreadManager* fake_dbus_thread_manager = | 40 FakeDBusThreadManager* fake_dbus_thread_manager = |
| 41 new FakeDBusThreadManager; | 41 new FakeDBusThreadManager; |
| 42 fake_dbus_thread_manager->SetFakeClients(); |
| 42 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); | 43 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); |
| 43 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 44 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 virtual void SetUpOnMainThread() OVERRIDE { | 47 virtual void SetUpOnMainThread() OVERRIDE { |
| 47 observer_.reset(new PeripheralBatteryObserver()); | 48 observer_.reset(new PeripheralBatteryObserver()); |
| 48 } | 49 } |
| 49 | 50 |
| 50 virtual void CleanUpOnMainThread() OVERRIDE { | 51 virtual void CleanUpOnMainThread() OVERRIDE { |
| 51 observer_.reset(); | 52 observer_.reset(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 observer_->PeripheralBatteryStatusReceived(kTestBatteryPath, | 150 observer_->PeripheralBatteryStatusReceived(kTestBatteryPath, |
| 150 kTestDeviceName, 5); | 151 kTestDeviceName, 5); |
| 151 EXPECT_EQ(observer_->batteries_.count(kTestBatteryAddress), 1u); | 152 EXPECT_EQ(observer_->batteries_.count(kTestBatteryAddress), 1u); |
| 152 EXPECT_TRUE(notification_manager->FindById(kTestBatteryAddress) != NULL); | 153 EXPECT_TRUE(notification_manager->FindById(kTestBatteryAddress) != NULL); |
| 153 | 154 |
| 154 observer_->RemoveBattery(kTestBatteryAddress); | 155 observer_->RemoveBattery(kTestBatteryAddress); |
| 155 EXPECT_FALSE(notification_manager->FindById(kTestBatteryAddress) != NULL); | 156 EXPECT_FALSE(notification_manager->FindById(kTestBatteryAddress) != NULL); |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace chromeos | 159 } // namespace chromeos |
| OLD | NEW |