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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp

Issue 2620463002: Show service worker navigation preload requests in DevTools Network tab (Closed)
Patch Set: fix crash Created 3 years, 10 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/workers/WorkerThread.h" 5 #include "core/workers/WorkerThread.h"
6 6
7 #include "core/workers/WorkerThreadTestHelper.h" 7 #include "core/workers/WorkerThreadTestHelper.h"
8 #include "platform/WaitableEvent.h" 8 #include "platform/WaitableEvent.h"
9 #include "platform/testing/UnitTestHelpers.h" 9 #include "platform/testing/UnitTestHelpers.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 // Specify PauseWorkerGlobalScopeOnStart so that the worker thread can pause 275 // Specify PauseWorkerGlobalScopeOnStart so that the worker thread can pause
276 // on initialziation to run debugger tasks. 276 // on initialziation to run debugger tasks.
277 std::unique_ptr<WorkerThreadStartupData> startupData = 277 std::unique_ptr<WorkerThreadStartupData> startupData =
278 WorkerThreadStartupData::create( 278 WorkerThreadStartupData::create(
279 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", 279 KURL(ParsedURLString, "http://fake.url/"), "fake user agent",
280 "//fake source code", nullptr, /* cachedMetaData */ 280 "//fake source code", nullptr, /* cachedMetaData */
281 PauseWorkerGlobalScopeOnStart, headers.get(), "", 281 PauseWorkerGlobalScopeOnStart, headers.get(), "",
282 m_securityOrigin.get(), nullptr, /* workerClients */ 282 m_securityOrigin.get(), nullptr, /* workerClients */
283 WebAddressSpaceLocal, nullptr /* originTrialToken */, 283 WebAddressSpaceLocal, nullptr /* originTrialToken */,
284 nullptr /* WorkerSettings */, WorkerV8Settings::Default()); 284 nullptr /* WorkerSettings */, WorkerV8Settings::Default(),
285 false /* inspectorNetworkCapability */);
285 m_workerThread->start(std::move(startupData)); 286 m_workerThread->start(std::move(startupData));
286 287
287 // Used to wait for worker thread termination in a debugger task on the 288 // Used to wait for worker thread termination in a debugger task on the
288 // worker thread. 289 // worker thread.
289 WaitableEvent waitableEvent; 290 WaitableEvent waitableEvent;
290 m_workerThread->appendDebuggerTask(crossThreadBind( 291 m_workerThread->appendDebuggerTask(crossThreadBind(
291 &waitForSignalTask, crossThreadUnretained(m_workerThread.get()), 292 &waitForSignalTask, crossThreadUnretained(m_workerThread.get()),
292 crossThreadUnretained(&waitableEvent))); 293 crossThreadUnretained(&waitableEvent)));
293 294
294 // Wait for the debugger task. 295 // Wait for the debugger task.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 356
356 // Resume the debugger task. Shutdown starts after that. 357 // Resume the debugger task. Shutdown starts after that.
357 waitableEvent.signal(); 358 waitableEvent.signal();
358 m_workerThread->waitForShutdownForTesting(); 359 m_workerThread->waitForShutdownForTesting();
359 EXPECT_EQ(ExitCode::GracefullyTerminated, getExitCode()); 360 EXPECT_EQ(ExitCode::GracefullyTerminated, getExitCode());
360 } 361 }
361 362
362 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. 363 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers.
363 364
364 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698