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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 TestingPlatformSupportWithMockScheduler:: | 210 TestingPlatformSupportWithMockScheduler:: |
211 TestingPlatformSupportWithMockScheduler(const Config& config) | 211 TestingPlatformSupportWithMockScheduler(const Config& config) |
212 : TestingPlatformSupport(config), | 212 : TestingPlatformSupport(config), |
213 m_clock(new base::SimpleTestTickClock()), | 213 m_clock(new base::SimpleTestTickClock()), |
214 m_mockTaskRunner(new cc::OrderedSimpleTaskRunner(m_clock.get(), true)), | 214 m_mockTaskRunner(new cc::OrderedSimpleTaskRunner(m_clock.get(), true)), |
215 m_scheduler(new scheduler::RendererSchedulerImpl( | 215 m_scheduler(new scheduler::RendererSchedulerImpl( |
216 scheduler::SchedulerTqmDelegateForTest::Create( | 216 scheduler::SchedulerTqmDelegateForTest::Create( |
217 m_mockTaskRunner, | 217 m_mockTaskRunner, |
218 base::WrapUnique(new scheduler::TestTimeSource(m_clock.get()))))), | 218 base::WrapUnique(new scheduler::TestTimeSource(m_clock.get()))))), |
219 m_thread(m_scheduler->CreateMainThread()) { | 219 m_thread(m_scheduler->CreateMainThread()) { |
220 // We need a non-zero start time because LazyNow in the blink scheduler can't | |
221 // be initialized with time t = 0; | |
222 m_clock->Advance(base::TimeDelta::FromSeconds(1)); | |
223 | |
224 // Set the work batch size to one so RunPendingTasks behaves as expected. | 220 // Set the work batch size to one so RunPendingTasks behaves as expected. |
225 m_scheduler->GetSchedulerHelperForTesting()->SetWorkBatchSizeForTesting(1); | 221 m_scheduler->GetSchedulerHelperForTesting()->SetWorkBatchSizeForTesting(1); |
226 | 222 |
227 WTF::setTimeFunctionsForTesting(getTestTime); | 223 WTF::setTimeFunctionsForTesting(getTestTime); |
228 } | 224 } |
229 | 225 |
230 TestingPlatformSupportWithMockScheduler:: | 226 TestingPlatformSupportWithMockScheduler:: |
231 ~TestingPlatformSupportWithMockScheduler() { | 227 ~TestingPlatformSupportWithMockScheduler() { |
232 WTF::setTimeFunctionsForTesting(nullptr); | 228 WTF::setTimeFunctionsForTesting(nullptr); |
233 m_scheduler->Shutdown(); | 229 m_scheduler->Shutdown(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 ProcessHeap::init(); | 338 ProcessHeap::init(); |
343 ThreadState::attachMainThread(); | 339 ThreadState::attachMainThread(); |
344 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr, | 340 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr, |
345 nullptr); | 341 nullptr); |
346 HTTPNames::init(); | 342 HTTPNames::init(); |
347 } | 343 } |
348 | 344 |
349 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() {} | 345 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() {} |
350 | 346 |
351 } // namespace blink | 347 } // namespace blink |
OLD | NEW |