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

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

Issue 1936853002: Assert event timestamp to be monotonic and not from future Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to histogram Created 4 years, 2 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/PlatformEvent.h ('k') | third_party/WebKit/Source/web/WebTestingSupport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698