| 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 #include <cstring> |
| 38 |
| 33 namespace blink { | 39 namespace blink { |
| 34 | 40 |
| 35 TestingDiscardableMemory::TestingDiscardableMemory(size_t size) : m_data(size),
m_isLocked(true) | 41 TestingDiscardableMemory::TestingDiscardableMemory(size_t size) : m_data(size),
m_isLocked(true) |
| 36 { | 42 { |
| 37 } | 43 } |
| 38 | 44 |
| 39 TestingDiscardableMemory::~TestingDiscardableMemory() | 45 TestingDiscardableMemory::~TestingDiscardableMemory() |
| 40 { | 46 { |
| 41 } | 47 } |
| 42 | 48 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 WebString TestingPlatformSupport::defaultLocale() | 98 WebString TestingPlatformSupport::defaultLocale() |
| 93 { | 99 { |
| 94 return WebString::fromUTF8("en-US"); | 100 return WebString::fromUTF8("en-US"); |
| 95 } | 101 } |
| 96 | 102 |
| 97 WebCompositorSupport* TestingPlatformSupport::compositorSupport() | 103 WebCompositorSupport* TestingPlatformSupport::compositorSupport() |
| 98 { | 104 { |
| 99 return m_config.compositorSupport; | 105 return m_config.compositorSupport; |
| 100 } | 106 } |
| 101 | 107 |
| 108 WebThread* TestingPlatformSupport::currentThread() |
| 109 { |
| 110 return m_oldPlatform ? m_oldPlatform->currentThread() : nullptr; |
| 111 } |
| 112 |
| 102 WebUnitTestSupport* TestingPlatformSupport::unitTestSupport() | 113 WebUnitTestSupport* TestingPlatformSupport::unitTestSupport() |
| 103 { | 114 { |
| 104 return m_oldPlatform ? m_oldPlatform->unitTestSupport() : nullptr; | 115 return m_oldPlatform ? m_oldPlatform->unitTestSupport() : nullptr; |
| 105 } | 116 } |
| 106 | 117 |
| 107 WebThread* TestingPlatformSupport::currentThread() | 118 void TestingPlatformSupport::connectToRemoteService(const char* name, mojo::Scop
edMessagePipeHandle handle) |
| 108 { | 119 { |
| 109 return m_oldPlatform ? m_oldPlatform->currentThread() : nullptr; | 120 #if !OS(ANDROID) |
| 121 if (std::strcmp(name, device::BatteryMonitor::Name_) == 0) { |
| 122 device::BatteryMonitorImpl::Create( |
| 123 mojo::MakeRequest<device::BatteryMonitor>(std::move(handle))); |
| 124 return; |
| 125 } |
| 126 #endif |
| 127 |
| 128 ASSERT_NOT_REACHED(); |
| 110 } | 129 } |
| 111 | 130 |
| 112 class TestingPlatformMockWebTaskRunner : public WebTaskRunner { | 131 class TestingPlatformMockWebTaskRunner : public WebTaskRunner { |
| 113 WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); | 132 WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); |
| 114 public: | 133 public: |
| 115 explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>
* tasks) : m_tasks(tasks) { } | 134 explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>
* tasks) : m_tasks(tasks) { } |
| 116 ~TestingPlatformMockWebTaskRunner() override { } | 135 ~TestingPlatformMockWebTaskRunner() override { } |
| 117 | 136 |
| 118 void postTask(const WebTraceLocation&, Task* task) override | 137 void postTask(const WebTraceLocation&, Task* task) override |
| 119 { | 138 { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 { | 241 { |
| 223 return m_mockWebThread.get(); | 242 return m_mockWebThread.get(); |
| 224 } | 243 } |
| 225 | 244 |
| 226 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc
heduler() | 245 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc
heduler() |
| 227 { | 246 { |
| 228 return m_mockWebThread->mockWebScheduler(); | 247 return m_mockWebThread->mockWebScheduler(); |
| 229 } | 248 } |
| 230 | 249 |
| 231 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |