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

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

Issue 1316233004: Force running GC on the worker thread before the unit test exits (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix test Created 5 years, 3 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
« no previous file with comments | « no previous file | Source/modules/compositorworker/CompositorWorkerManagerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/workers/WorkerThread.h" 6 #include "core/workers/WorkerThread.h"
7 7
8 #include "core/inspector/ConsoleMessage.h" 8 #include "core/inspector/ConsoleMessage.h"
9 #include "core/workers/WorkerReportingProxy.h" 9 #include "core/workers/WorkerReportingProxy.h"
10 #include "core/workers/WorkerThreadStartupData.h" 10 #include "core/workers/WorkerThreadStartupData.h"
11 #include "platform/NotImplemented.h" 11 #include "platform/NotImplemented.h"
12 #include "platform/heap/Heap.h"
12 #include "public/platform/WebScheduler.h" 13 #include "public/platform/WebScheduler.h"
13 #include "public/platform/WebWaitableEvent.h" 14 #include "public/platform/WebWaitableEvent.h"
14 #include <gmock/gmock.h> 15 #include <gmock/gmock.h>
15 #include <gtest/gtest.h> 16 #include <gtest/gtest.h>
17 #include <v8.h>
16 18
17 using testing::_; 19 using testing::_;
18 using testing::AtMost; 20 using testing::AtMost;
19 using testing::Invoke; 21 using testing::Invoke;
20 using testing::Return; 22 using testing::Return;
21 using testing::Mock; 23 using testing::Mock;
22 24
23 namespace blink { 25 namespace blink {
24 26
25 namespace { 27 namespace {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 { 104 {
103 } 105 }
104 106
105 ~WorkerThreadForTest() override { } 107 ~WorkerThreadForTest() override { }
106 108
107 // WorkerThread implementation: 109 // WorkerThread implementation:
108 WebThreadSupportingGC& backingThread() override 110 WebThreadSupportingGC& backingThread() override
109 { 111 {
110 return *m_thread; 112 return *m_thread;
111 } 113 }
114 void willDestroyIsolate() override
115 {
116 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting(v8::Isolat e::kFullGarbageCollection);
117 Heap::collectAllGarbage();
118 WorkerThread::willDestroyIsolate();
119 }
112 120
113 MOCK_METHOD1(doIdleGc, bool(double deadlineSeconds)); 121 MOCK_METHOD1(doIdleGc, bool(double deadlineSeconds));
114 122
115 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr <WorkerThreadStartupData> startupData) override 123 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr <WorkerThreadStartupData> startupData) override
116 { 124 {
117 return adoptRefWillBeNoop(new FakeWorkerGlobalScope(startupData->m_scrip tURL, startupData->m_userAgent, this, startupData->m_starterOrigin, startupData- >m_workerClients.release())); 125 return adoptRefWillBeNoop(new FakeWorkerGlobalScope(startupData->m_scrip tURL, startupData->m_userAgent, this, startupData->m_starterOrigin, startupData- >m_workerClients.release()));
118 } 126 }
119 127
120 void waitUntilScriptLoaded() 128 void waitUntilScriptLoaded()
121 { 129 {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 339
332 completion->wait(); 340 completion->wait();
333 341
334 // Make sure doIdleGc has not been called by this stage. 342 // Make sure doIdleGc has not been called by this stage.
335 Mock::VerifyAndClearExpectations(m_workerThread.get()); 343 Mock::VerifyAndClearExpectations(m_workerThread.get());
336 344
337 m_workerThread->terminateAndWait(); 345 m_workerThread->terminateAndWait();
338 } 346 }
339 347
340 } // namespace blink 348 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/compositorworker/CompositorWorkerManagerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698