| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "platform/testing/TestingPlatformSupport.h" | 31 #include "platform/testing/TestingPlatformSupport.h" |
| 32 | 32 |
| 33 #if !OS(ANDROID) | |
| 34 #include "device/battery/battery_monitor_impl.h" | |
| 35 #endif | |
| 36 | |
| 37 namespace blink { | 33 namespace blink { |
| 38 | 34 |
| 39 TestingPlatformSupport::TestingPlatformSupport() | 35 TestingPlatformSupport::TestingPlatformSupport() |
| 40 : TestingPlatformSupport(TestingPlatformSupport::Config()) | 36 : TestingPlatformSupport(TestingPlatformSupport::Config()) |
| 41 { | 37 { |
| 42 } | 38 } |
| 43 | 39 |
| 44 TestingPlatformSupport::TestingPlatformSupport(const Config& config) | 40 TestingPlatformSupport::TestingPlatformSupport(const Config& config) |
| 45 : m_config(config) | 41 : m_config(config) |
| 46 , m_oldPlatform(Platform::current()) | 42 , m_oldPlatform(Platform::current()) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 return m_oldPlatform ? m_oldPlatform->currentThread() : nullptr; | 65 return m_oldPlatform ? m_oldPlatform->currentThread() : nullptr; |
| 70 } | 66 } |
| 71 | 67 |
| 72 WebUnitTestSupport* TestingPlatformSupport::unitTestSupport() | 68 WebUnitTestSupport* TestingPlatformSupport::unitTestSupport() |
| 73 { | 69 { |
| 74 return m_oldPlatform ? m_oldPlatform->unitTestSupport() : nullptr; | 70 return m_oldPlatform ? m_oldPlatform->unitTestSupport() : nullptr; |
| 75 } | 71 } |
| 76 | 72 |
| 77 void TestingPlatformSupport::connectToRemoteService(const char* name, mojo::Scop
edMessagePipeHandle handle) | 73 void TestingPlatformSupport::connectToRemoteService(const char* name, mojo::Scop
edMessagePipeHandle handle) |
| 78 { | 74 { |
| 79 #if !OS(ANDROID) | |
| 80 if (std::strcmp(name, device::BatteryMonitor::Name_) == 0) { | |
| 81 device::BatteryMonitorImpl::Create( | |
| 82 mojo::MakeRequest<device::BatteryMonitor>(std::move(handle))); | |
| 83 return; | |
| 84 } | |
| 85 #endif | |
| 86 | |
| 87 ASSERT_NOT_REACHED(); | 75 ASSERT_NOT_REACHED(); |
| 88 } | 76 } |
| 89 | 77 |
| 90 class TestingPlatformMockWebTaskRunner : public WebTaskRunner { | 78 class TestingPlatformMockWebTaskRunner : public WebTaskRunner { |
| 91 WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); | 79 WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); |
| 92 public: | 80 public: |
| 93 explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>
* tasks) : m_tasks(tasks) { } | 81 explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>
* tasks) : m_tasks(tasks) { } |
| 94 ~TestingPlatformMockWebTaskRunner() override { } | 82 ~TestingPlatformMockWebTaskRunner() override { } |
| 95 | 83 |
| 96 void postTask(const WebTraceLocation&, Task* task) override | 84 void postTask(const WebTraceLocation&, Task* task) override |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 { | 188 { |
| 201 return m_mockWebThread.get(); | 189 return m_mockWebThread.get(); |
| 202 } | 190 } |
| 203 | 191 |
| 204 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc
heduler() | 192 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc
heduler() |
| 205 { | 193 { |
| 206 return m_mockWebThread->mockWebScheduler(); | 194 return m_mockWebThread->mockWebScheduler(); |
| 207 } | 195 } |
| 208 | 196 |
| 209 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |