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> | 5 #include <utility> |
6 | 6 |
7 #include "base/callback_list.h" | 7 #include "base/callback_list.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 std::unique_ptr<BatteryUpdateSubscription> subscription_; | 83 std::unique_ptr<BatteryUpdateSubscription> subscription_; |
84 QueryNextStatusCallback callback_; | 84 QueryNextStatusCallback callback_; |
85 }; | 85 }; |
86 | 86 |
87 // Overrides the default service implementation with the test implementation | 87 // Overrides the default service implementation with the test implementation |
88 // declared above. | 88 // declared above. |
89 class TestContentBrowserClient : public ContentBrowserClient { | 89 class TestContentBrowserClient : public ContentBrowserClient { |
90 public: | 90 public: |
91 void ExposeInterfacesToRenderer( | 91 void ExposeInterfacesToRenderer( |
92 shell::InterfaceRegistry* registry, | 92 service_manager::InterfaceRegistry* registry, |
93 RenderProcessHost* render_process_host) override { | 93 RenderProcessHost* render_process_host) override { |
94 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = | 94 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
95 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); | 95 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); |
96 registry->AddInterface(base::Bind(&FakeBatteryMonitor::Create), | 96 registry->AddInterface(base::Bind(&FakeBatteryMonitor::Create), |
97 ui_task_runner); | 97 ui_task_runner); |
98 } | 98 } |
99 | 99 |
100 void AppendExtraCommandLineSwitches(base::CommandLine* command_line, | 100 void AppendExtraCommandLineSwitches(base::CommandLine* command_line, |
101 int child_process_id) override { | 101 int child_process_id) override { |
102 // Necessary for passing kIsolateSitesForTesting flag to the renderer. | 102 // Necessary for passing kIsolateSitesForTesting flag to the renderer. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); | 181 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); |
182 status.level = 0.6; | 182 status.level = 0.6; |
183 UpdateBattery(status); | 183 UpdateBattery(status); |
184 same_tab_observer2.Wait(); | 184 same_tab_observer2.Wait(); |
185 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 185 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
186 } | 186 } |
187 | 187 |
188 } // namespace | 188 } // namespace |
189 | 189 |
190 } // namespace content | 190 } // namespace content |
OLD | NEW |