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