| 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/callback_list.h" | 5 #include "base/callback_list.h" |
| 6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "content/public/browser/content_browser_client.h" | 8 #include "content/public/browser/content_browser_client.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 BatteryStatusCallback callback_; | 84 BatteryStatusCallback 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 OverrideRenderProcessMojoServices(ServiceRegistry* registry) override { | 91 void OverrideRenderProcessMojoServices(ServiceRegistry* registry) override { |
| 92 registry->AddService(base::Bind(&FakeBatteryMonitor::Create)); | 92 registry->AddService(base::Bind(&FakeBatteryMonitor::Create)); |
| 93 } | 93 } |
| 94 |
| 95 #if defined(OS_ANDROID) |
| 96 void GetAdditionalMappedFilesForChildProcess( |
| 97 const base::CommandLine& command_line, |
| 98 int child_process_id, |
| 99 FileDescriptorInfo* mappings) override { |
| 100 ShellContentBrowserClient::Get()->GetAdditionalMappedFilesForChildProcess( |
| 101 command_line, child_process_id, mappings); |
| 102 } |
| 103 #endif // defined(OS_ANDROID) |
| 94 }; | 104 }; |
| 95 | 105 |
| 96 class BatteryMonitorIntegrationTest : public ContentBrowserTest { | 106 class BatteryMonitorIntegrationTest : public ContentBrowserTest { |
| 97 public: | 107 public: |
| 98 BatteryMonitorIntegrationTest() {} | 108 BatteryMonitorIntegrationTest() {} |
| 99 | 109 |
| 100 void SetUpOnMainThread() override { | 110 void SetUpOnMainThread() override { |
| 101 old_client_ = SetBrowserClientForTesting(&test_client_); | 111 old_client_ = SetBrowserClientForTesting(&test_client_); |
| 102 } | 112 } |
| 103 | 113 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); | 168 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); |
| 159 status.level = 0.6; | 169 status.level = 0.6; |
| 160 UpdateBattery(status); | 170 UpdateBattery(status); |
| 161 same_tab_observer2.Wait(); | 171 same_tab_observer2.Wait(); |
| 162 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 172 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 163 } | 173 } |
| 164 | 174 |
| 165 } // namespace | 175 } // namespace |
| 166 | 176 |
| 167 } // namespace content | 177 } // namespace content |
| OLD | NEW |