Chromium Code Reviews| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 mojo::StrongBinding<BatteryMonitor> binding_; | 83 mojo::StrongBinding<BatteryMonitor> binding_; |
| 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 } |
|
ppi
2015/01/21 01:08:32
nit: add a newline here
| |
| 94 #if defined(OS_ANDROID) | |
| 95 void GetAdditionalMappedFilesForChildProcess( | |
| 96 const base::CommandLine& command_line, | |
| 97 int child_process_id, | |
| 98 FileDescriptorInfo* mappings) override { | |
| 99 ShellContentBrowserClient::Get()->GetAdditionalMappedFilesForChildProcess( | |
| 100 command_line, child_process_id, mappings); | |
| 101 } | |
| 102 #endif // defined(OS_ANDROID) | |
| 94 }; | 103 }; |
| 95 | 104 |
| 96 class BatteryMonitorIntegrationTest : public ContentBrowserTest { | 105 class BatteryMonitorIntegrationTest : public ContentBrowserTest { |
| 97 public: | 106 public: |
| 98 BatteryMonitorIntegrationTest() {} | 107 BatteryMonitorIntegrationTest() {} |
| 99 | 108 |
| 100 void SetUpOnMainThread() override { | 109 void SetUpOnMainThread() override { |
| 101 old_client_ = SetBrowserClientForTesting(&test_client_); | 110 old_client_ = SetBrowserClientForTesting(&test_client_); |
| 102 } | 111 } |
| 103 | 112 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); | 167 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); |
| 159 status.level = 0.6; | 168 status.level = 0.6; |
| 160 UpdateBattery(status); | 169 UpdateBattery(status); |
| 161 same_tab_observer2.Wait(); | 170 same_tab_observer2.Wait(); |
| 162 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 171 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 163 } | 172 } |
| 164 | 173 |
| 165 } // namespace | 174 } // namespace |
| 166 | 175 |
| 167 } // namespace content | 176 } // namespace content |
| OLD | NEW |