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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp

Issue 2025783002: Worker: Introduce an observation mechanism for WorkerThread termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delayed_task
Patch Set: Stop tracing CrossThread(Weak)Persistents Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
index 1290e91b990e6f295f9942adb98e976b1adfec25..087b1fb7900b0539461efc0e83e9c39c48d5018b 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -24,6 +24,7 @@ public:
m_workerThread = adoptPtr(new WorkerThreadForTest(
m_mockWorkerLoaderProxyProvider.get(),
*m_mockWorkerReportingProxy));
+ m_mockWorkerThreadLifecycleObserver = new MockWorkerThreadLifecycleObserver(m_workerThread->workerThreadContext());
}
void TearDown() override
@@ -65,6 +66,7 @@ protected:
EXPECT_CALL(*m_mockWorkerReportingProxy, didEvaluateWorkerScript(true)).Times(1);
EXPECT_CALL(*m_mockWorkerReportingProxy, workerThreadTerminated()).Times(1);
EXPECT_CALL(*m_mockWorkerReportingProxy, willDestroyWorkerGlobalScope()).Times(1);
+ EXPECT_CALL(*m_mockWorkerThreadLifecycleObserver, contextDestroyed()).Times(1);
}
void expectReportingCallsForWorkerPossiblyTerminatedBeforeInitialization()
@@ -73,6 +75,7 @@ protected:
EXPECT_CALL(*m_mockWorkerReportingProxy, didEvaluateWorkerScript(_)).Times(AtMost(1));
EXPECT_CALL(*m_mockWorkerReportingProxy, workerThreadTerminated()).Times(1);
EXPECT_CALL(*m_mockWorkerReportingProxy, willDestroyWorkerGlobalScope()).Times(AtMost(1));
+ EXPECT_CALL(*m_mockWorkerThreadLifecycleObserver, contextDestroyed()).Times(1);
}
void expectReportingCallsForWorkerForciblyTerminated()
@@ -81,12 +84,14 @@ protected:
EXPECT_CALL(*m_mockWorkerReportingProxy, didEvaluateWorkerScript(false)).Times(1);
EXPECT_CALL(*m_mockWorkerReportingProxy, workerThreadTerminated()).Times(1);
EXPECT_CALL(*m_mockWorkerReportingProxy, willDestroyWorkerGlobalScope()).Times(1);
+ EXPECT_CALL(*m_mockWorkerThreadLifecycleObserver, contextDestroyed()).Times(1);
}
RefPtr<SecurityOrigin> m_securityOrigin;
OwnPtr<MockWorkerLoaderProxyProvider> m_mockWorkerLoaderProxyProvider;
OwnPtr<MockWorkerReportingProxy> m_mockWorkerReportingProxy;
OwnPtr<WorkerThreadForTest> m_workerThread;
+ Persistent<MockWorkerThreadLifecycleObserver> m_mockWorkerThreadLifecycleObserver;
};
TEST_F(WorkerThreadTest, StartAndTerminate_AsyncTerminate)

Powered by Google App Engine
This is Rietveld 408576698