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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 TestingPlatformMockScheduler::TestingPlatformMockScheduler() {} | 134 TestingPlatformMockScheduler::TestingPlatformMockScheduler() {} |
135 TestingPlatformMockScheduler::~TestingPlatformMockScheduler() {} | 135 TestingPlatformMockScheduler::~TestingPlatformMockScheduler() {} |
136 | 136 |
137 TestingPlatformSupport::TestingPlatformSupport() | 137 TestingPlatformSupport::TestingPlatformSupport() |
138 : TestingPlatformSupport(TestingPlatformSupport::Config()) {} | 138 : TestingPlatformSupport(TestingPlatformSupport::Config()) {} |
139 | 139 |
140 TestingPlatformSupport::TestingPlatformSupport(const Config& config) | 140 TestingPlatformSupport::TestingPlatformSupport(const Config& config) |
141 : m_config(config), | 141 : m_config(config), |
142 m_oldPlatform(Platform::current()), | 142 m_oldPlatform(Platform::current()), |
143 m_interfaceProvider(new TestingInterfaceProvider) { | 143 m_interfaceProvider(new TestingInterfaceProvider) { |
144 ASSERT(m_oldPlatform); | 144 DCHECK(m_oldPlatform); |
145 Platform::setCurrentPlatformForTesting(this); | |
146 } | 145 } |
147 | 146 |
148 TestingPlatformSupport::~TestingPlatformSupport() { | 147 TestingPlatformSupport::~TestingPlatformSupport() { |
149 Platform::setCurrentPlatformForTesting(m_oldPlatform); | 148 // Checks if Platform::setCurrentPlatformForTesting() was correctly called |
149 // after the construction. | |
150 DCHECK_NE(m_oldPlatform, Platform::current()); | |
Takashi Toyoshima
2016/12/22 06:29:06
I confirm that this check actually works to catch
| |
150 } | 151 } |
151 | 152 |
152 WebString TestingPlatformSupport::defaultLocale() { | 153 WebString TestingPlatformSupport::defaultLocale() { |
153 return WebString::fromUTF8("en-US"); | 154 return WebString::fromUTF8("en-US"); |
154 } | 155 } |
155 | 156 |
156 WebCompositorSupport* TestingPlatformSupport::compositorSupport() { | 157 WebCompositorSupport* TestingPlatformSupport::compositorSupport() { |
157 if (m_config.compositorSupport) | 158 if (m_config.compositorSupport) |
158 return m_config.compositorSupport; | 159 return m_config.compositorSupport; |
159 | 160 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 | 326 |
326 m_platform = WTF::wrapUnique(new DummyPlatform); | 327 m_platform = WTF::wrapUnique(new DummyPlatform); |
327 Platform::setCurrentPlatformForTesting(m_platform.get()); | 328 Platform::setCurrentPlatformForTesting(m_platform.get()); |
328 | 329 |
329 WTF::Partitions::initialize(nullptr); | 330 WTF::Partitions::initialize(nullptr); |
330 WTF::setTimeFunctionsForTesting(dummyCurrentTime); | 331 WTF::setTimeFunctionsForTesting(dummyCurrentTime); |
331 WTF::initialize(nullptr); | 332 WTF::initialize(nullptr); |
332 | 333 |
333 m_compositorSupport = WTF::wrapUnique(new cc_blink::WebCompositorSupportImpl); | 334 m_compositorSupport = WTF::wrapUnique(new cc_blink::WebCompositorSupportImpl); |
334 m_testingPlatformConfig.compositorSupport = m_compositorSupport.get(); | 335 m_testingPlatformConfig.compositorSupport = m_compositorSupport.get(); |
335 m_testingPlatformSupport = | 336 m_testingPlatformSupport.reset( |
336 WTF::makeUnique<TestingPlatformSupport>(m_testingPlatformConfig); | 337 new TestingPlatformSupport(m_testingPlatformConfig)); |
337 | 338 |
338 ProcessHeap::init(); | 339 ProcessHeap::init(); |
339 ThreadState::attachMainThread(); | 340 ThreadState::attachMainThread(); |
340 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr, | 341 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr, |
341 nullptr); | 342 nullptr); |
342 HTTPNames::init(); | 343 HTTPNames::init(); |
343 } | 344 } |
344 | 345 |
345 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() {} | 346 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() {} |
346 | 347 |
347 } // namespace blink | 348 } // namespace blink |
OLD | NEW |