Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp

Issue 1830883002: Add blink::ServiceRegistry and expose it from LocalFrame and Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 20 matching lines...) Expand all
67 WebThread* TestingPlatformSupport::currentThread() 63 WebThread* TestingPlatformSupport::currentThread()
68 { 64 {
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)
78 {
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();
88 }
89
90 class TestingPlatformMockWebTaskRunner : public WebTaskRunner { 73 class TestingPlatformMockWebTaskRunner : public WebTaskRunner {
91 WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); 74 WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner);
92 public: 75 public:
93 explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>> * tasks) : m_tasks(tasks) { } 76 explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>> * tasks) : m_tasks(tasks) { }
94 ~TestingPlatformMockWebTaskRunner() override { } 77 ~TestingPlatformMockWebTaskRunner() override { }
95 78
96 void postTask(const WebTraceLocation&, Task* task) override 79 void postTask(const WebTraceLocation&, Task* task) override
97 { 80 {
98 m_tasks->append(adoptPtr(task)); 81 m_tasks->append(adoptPtr(task));
99 } 82 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 { 183 {
201 return m_mockWebThread.get(); 184 return m_mockWebThread.get();
202 } 185 }
203 186
204 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc heduler() 187 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc heduler()
205 { 188 {
206 return m_mockWebThread->mockWebScheduler(); 189 return m_mockWebThread->mockWebScheduler();
207 } 190 }
208 191
209 } // namespace blink 192 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698