| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 TestingPlatformSupportWithMockScheduler::TestingPlatformSupportWithMockScheduler
(const Config& config) | 157 TestingPlatformSupportWithMockScheduler::TestingPlatformSupportWithMockScheduler
(const Config& config) |
| 158 : TestingPlatformSupport(config) | 158 : TestingPlatformSupport(config) |
| 159 , m_clock(new base::SimpleTestTickClock()) | 159 , m_clock(new base::SimpleTestTickClock()) |
| 160 , m_mockTaskRunner(new cc::OrderedSimpleTaskRunner(m_clock.get(), true)) | 160 , m_mockTaskRunner(new cc::OrderedSimpleTaskRunner(m_clock.get(), true)) |
| 161 , m_scheduler(new scheduler::RendererSchedulerImpl(scheduler::SchedulerTqmDe
legateForTest::Create(m_mockTaskRunner, base::WrapUnique(new scheduler::TestTime
Source(m_clock.get()))))) | 161 , m_scheduler(new scheduler::RendererSchedulerImpl(scheduler::SchedulerTqmDe
legateForTest::Create(m_mockTaskRunner, base::WrapUnique(new scheduler::TestTime
Source(m_clock.get()))))) |
| 162 , m_thread(m_scheduler->CreateMainThread()) | 162 , m_thread(m_scheduler->CreateMainThread()) |
| 163 { | 163 { |
| 164 // Set the work batch size to one so RunPendingTasks behaves as expected. | 164 // Set the work batch size to one so RunPendingTasks behaves as expected. |
| 165 m_scheduler->GetSchedulerHelperForTesting()->SetWorkBatchSizeForTesting(1); | 165 m_scheduler->GetSchedulerHelperForTesting()->SetWorkBatchSizeForTesting(1); |
| 166 | 166 |
| 167 WTF::setTimeFunctionsForTesting(getTestTime); | 167 WTF::setMonotonicallyIncreasingTimeFunctionForTesting(getTestTime); |
| 168 } | 168 } |
| 169 | 169 |
| 170 TestingPlatformSupportWithMockScheduler::~TestingPlatformSupportWithMockSchedule
r() | 170 TestingPlatformSupportWithMockScheduler::~TestingPlatformSupportWithMockSchedule
r() |
| 171 { | 171 { |
| 172 WTF::setTimeFunctionsForTesting(nullptr); | 172 WTF::setMonotonicallyIncreasingTimeFunctionForTesting(nullptr); |
| 173 m_scheduler->Shutdown(); | 173 m_scheduler->Shutdown(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 WebThread* TestingPlatformSupportWithMockScheduler::currentThread() | 176 WebThread* TestingPlatformSupportWithMockScheduler::currentThread() |
| 177 { | 177 { |
| 178 if (m_thread->isCurrentThread()) | 178 if (m_thread->isCurrentThread()) |
| 179 return m_thread.get(); | 179 return m_thread.get(); |
| 180 return TestingPlatformSupport::currentThread(); | 180 return TestingPlatformSupport::currentThread(); |
| 181 } | 181 } |
| 182 | 182 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 base::test::InitializeICUForTesting(); | 237 base::test::InitializeICUForTesting(); |
| 238 | 238 |
| 239 m_discardableMemoryAllocator = wrapUnique(new base::TestDiscardableMemoryAll
ocator); | 239 m_discardableMemoryAllocator = wrapUnique(new base::TestDiscardableMemoryAll
ocator); |
| 240 base::DiscardableMemoryAllocator::SetInstance(m_discardableMemoryAllocator.g
et()); | 240 base::DiscardableMemoryAllocator::SetInstance(m_discardableMemoryAllocator.g
et()); |
| 241 base::StatisticsRecorder::Initialize(); | 241 base::StatisticsRecorder::Initialize(); |
| 242 | 242 |
| 243 m_platform = wrapUnique(new DummyPlatform); | 243 m_platform = wrapUnique(new DummyPlatform); |
| 244 Platform::setCurrentPlatformForTesting(m_platform.get()); | 244 Platform::setCurrentPlatformForTesting(m_platform.get()); |
| 245 | 245 |
| 246 WTF::Partitions::initialize(nullptr); | 246 WTF::Partitions::initialize(nullptr); |
| 247 WTF::setTimeFunctionsForTesting(dummyCurrentTime); | 247 WTF::setMonotonicallyIncreasingTimeFunctionForTesting(dummyCurrentTime); |
| 248 WTF::setCurrentTimeFunctionForTesting(dummyCurrentTime); |
| 248 WTF::initialize(nullptr); | 249 WTF::initialize(nullptr); |
| 249 | 250 |
| 250 m_compositorSupport = wrapUnique(new cc_blink::WebCompositorSupportImpl); | 251 m_compositorSupport = wrapUnique(new cc_blink::WebCompositorSupportImpl); |
| 251 m_testingPlatformConfig.compositorSupport = m_compositorSupport.get(); | 252 m_testingPlatformConfig.compositorSupport = m_compositorSupport.get(); |
| 252 m_testingPlatformSupport = wrapUnique(new TestingPlatformSupport(m_testingPl
atformConfig)); | 253 m_testingPlatformSupport = wrapUnique(new TestingPlatformSupport(m_testingPl
atformConfig)); |
| 253 | 254 |
| 254 ProcessHeap::init(); | 255 ProcessHeap::init(); |
| 255 ThreadState::attachMainThread(); | 256 ThreadState::attachMainThread(); |
| 256 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr,
nullptr); | 257 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr,
nullptr); |
| 257 EventTracer::initialize(); | 258 EventTracer::initialize(); |
| 258 HTTPNames::init(); | 259 HTTPNames::init(); |
| 259 } | 260 } |
| 260 | 261 |
| 261 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() | 262 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() |
| 262 { | 263 { |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |