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 <utility> |
| 6 |
5 #include "base/macros.h" | 7 #include "base/macros.h" |
6 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
7 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
8 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
9 #include "content/public/test/content_browser_test_utils.h" | 11 #include "content/public/test/content_browser_test_utils.h" |
10 #include "content/public/test/test_navigation_observer.h" | 12 #include "content/public/test/test_navigation_observer.h" |
11 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
12 #include "content/shell/browser/shell.h" | 14 #include "content/shell/browser/shell.h" |
13 #include "device/battery/battery_status_manager.h" | 15 #include "device/battery/battery_status_manager.h" |
14 #include "device/battery/battery_status_service.h" | 16 #include "device/battery/battery_status_service.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 72 |
71 void SetUpOnMainThread() override { | 73 void SetUpOnMainThread() override { |
72 battery_service_ = device::BatteryStatusService::GetInstance(); | 74 battery_service_ = device::BatteryStatusService::GetInstance(); |
73 | 75 |
74 // We keep a raw pointer to the FakeBatteryManager, which we expect to | 76 // We keep a raw pointer to the FakeBatteryManager, which we expect to |
75 // remain valid for the lifetime of the BatteryStatusService. | 77 // remain valid for the lifetime of the BatteryStatusService. |
76 scoped_ptr<FakeBatteryManager> battery_manager(new FakeBatteryManager( | 78 scoped_ptr<FakeBatteryManager> battery_manager(new FakeBatteryManager( |
77 battery_service_->GetUpdateCallbackForTesting())); | 79 battery_service_->GetUpdateCallbackForTesting())); |
78 battery_manager_ = battery_manager.get(); | 80 battery_manager_ = battery_manager.get(); |
79 | 81 |
80 battery_service_->SetBatteryManagerForTesting(battery_manager.Pass()); | 82 battery_service_->SetBatteryManagerForTesting(std::move(battery_manager)); |
81 } | 83 } |
82 | 84 |
83 void TearDown() override { | 85 void TearDown() override { |
84 battery_service_->SetBatteryManagerForTesting( | 86 battery_service_->SetBatteryManagerForTesting( |
85 scoped_ptr<device::BatteryStatusManager>()); | 87 scoped_ptr<device::BatteryStatusManager>()); |
86 battery_manager_ = NULL; | 88 battery_manager_ = NULL; |
87 } | 89 } |
88 | 90 |
89 FakeBatteryManager* battery_manager() { return battery_manager_; } | 91 FakeBatteryManager* battery_manager() { return battery_manager_; } |
90 | 92 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 battery_manager()->set_battery_status(status); | 149 battery_manager()->set_battery_status(status); |
148 battery_manager()->InvokeUpdateCallback(); | 150 battery_manager()->InvokeUpdateCallback(); |
149 same_tab_observer2.Wait(); | 151 same_tab_observer2.Wait(); |
150 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 152 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
151 EXPECT_TRUE(battery_manager()->started()); | 153 EXPECT_TRUE(battery_manager()->started()); |
152 } | 154 } |
153 | 155 |
154 } // namespace | 156 } // namespace |
155 | 157 |
156 } // namespace content | 158 } // namespace content |
OLD | NEW |