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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
7 #include "content/browser/battery_status/battery_status_manager.h" | 7 #include "content/browser/battery_status/battery_status_manager.h" |
8 #include "content/browser/battery_status/battery_status_service.h" | 8 #include "content/browser/battery_status/battery_status_service.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 void SetUpOnIOThread() { | 83 void SetUpOnIOThread() { |
84 battery_service_ = BatteryStatusService::GetInstance(); | 84 battery_service_ = BatteryStatusService::GetInstance(); |
85 battery_manager_ = new FakeBatteryManager( | 85 battery_manager_ = new FakeBatteryManager( |
86 battery_service_->GetUpdateCallbackForTesting()); | 86 battery_service_->GetUpdateCallbackForTesting()); |
87 battery_service_->SetBatteryManagerForTesting(battery_manager_); | 87 battery_service_->SetBatteryManagerForTesting(battery_manager_); |
88 io_loop_finished_event_.Signal(); | 88 io_loop_finished_event_.Signal(); |
89 } | 89 } |
90 | 90 |
91 virtual void TearDown() override { | 91 void TearDown() override { |
92 battery_service_->SetBatteryManagerForTesting(0); | 92 battery_service_->SetBatteryManagerForTesting(0); |
93 } | 93 } |
94 | 94 |
95 FakeBatteryManager* battery_manager() { | 95 FakeBatteryManager* battery_manager() { |
96 return battery_manager_; | 96 return battery_manager_; |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 FakeBatteryManager* battery_manager_; | 100 FakeBatteryManager* battery_manager_; |
101 BatteryStatusService* battery_service_; | 101 BatteryStatusService* battery_service_; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 battery_manager()->set_battery_status(status); | 156 battery_manager()->set_battery_status(status); |
157 battery_manager()->InvokeUpdateCallback(); | 157 battery_manager()->InvokeUpdateCallback(); |
158 same_tab_observer2.Wait(); | 158 same_tab_observer2.Wait(); |
159 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 159 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
160 EXPECT_TRUE(battery_manager()->started()); | 160 EXPECT_TRUE(battery_manager()->started()); |
161 } | 161 } |
162 | 162 |
163 } // namespace | 163 } // namespace |
164 | 164 |
165 } // namespace content | 165 } // namespace content |
OLD | NEW |