| 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 "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // We keep a raw pointer to the FakeBatteryManager, which we expect to | 82 // We keep a raw pointer to the FakeBatteryManager, which we expect to |
| 83 // remain valid for the lifetime of the BatteryStatusService. | 83 // remain valid for the lifetime of the BatteryStatusService. |
| 84 scoped_ptr<FakeBatteryManager> battery_manager(new FakeBatteryManager( | 84 scoped_ptr<FakeBatteryManager> battery_manager(new FakeBatteryManager( |
| 85 battery_service_->GetUpdateCallbackForTesting())); | 85 battery_service_->GetUpdateCallbackForTesting())); |
| 86 battery_manager_ = battery_manager.get(); | 86 battery_manager_ = battery_manager.get(); |
| 87 | 87 |
| 88 battery_service_->SetBatteryManagerForTesting( | 88 battery_service_->SetBatteryManagerForTesting( |
| 89 battery_manager.Pass()); | 89 battery_manager.Pass()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual void TearDown() override { | 92 void TearDown() override { |
| 93 battery_service_->SetBatteryManagerForTesting( | 93 battery_service_->SetBatteryManagerForTesting( |
| 94 scoped_ptr<device::BatteryStatusManager>()); | 94 scoped_ptr<device::BatteryStatusManager>()); |
| 95 battery_manager_ = NULL; | 95 battery_manager_ = NULL; |
| 96 } | 96 } |
| 97 | 97 |
| 98 FakeBatteryManager* battery_manager() { | 98 FakeBatteryManager* battery_manager() { |
| 99 return battery_manager_; | 99 return battery_manager_; |
| 100 } | 100 } |
| 101 | 101 |
| 102 private: | 102 private: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 battery_manager()->set_battery_status(status); | 158 battery_manager()->set_battery_status(status); |
| 159 battery_manager()->InvokeUpdateCallback(); | 159 battery_manager()->InvokeUpdateCallback(); |
| 160 same_tab_observer2.Wait(); | 160 same_tab_observer2.Wait(); |
| 161 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 161 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 162 EXPECT_TRUE(battery_manager()->started()); | 162 EXPECT_TRUE(battery_manager()->started()); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace | 165 } // namespace |
| 166 | 166 |
| 167 } // namespace content | 167 } // namespace content |
| OLD | NEW |