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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp

Issue 1884083002: Revert of Rename Heap to ThreadHeap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | third_party/WebKit/Source/bindings/core/v8/V8GCController.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "bindings/core/v8/ScriptPromiseResolver.h" 5 #include "bindings/core/v8/ScriptPromiseResolver.h"
6 6
7 #include "bindings/core/v8/ScriptFunction.h" 7 #include "bindings/core/v8/ScriptFunction.h"
8 #include "bindings/core/v8/ScriptValue.h" 8 #include "bindings/core/v8/ScriptValue.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 TEST_F(ScriptPromiseResolverTest, keepAliveUntilResolved) 233 TEST_F(ScriptPromiseResolverTest, keepAliveUntilResolved)
234 { 234 {
235 ScriptPromiseResolverKeepAlive::reset(); 235 ScriptPromiseResolverKeepAlive::reset();
236 ScriptPromiseResolver* resolver = nullptr; 236 ScriptPromiseResolver* resolver = nullptr;
237 { 237 {
238 ScriptState::Scope scope(getScriptState()); 238 ScriptState::Scope scope(getScriptState());
239 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState()); 239 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState());
240 } 240 }
241 resolver->keepAliveWhilePending(); 241 resolver->keepAliveWhilePending();
242 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 242 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
243 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); 243 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive());
244 244
245 resolver->resolve("hello"); 245 resolver->resolve("hello");
246 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 246 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
247 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive()); 247 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive());
248 } 248 }
249 249
250 TEST_F(ScriptPromiseResolverTest, keepAliveUntilRejected) 250 TEST_F(ScriptPromiseResolverTest, keepAliveUntilRejected)
251 { 251 {
252 ScriptPromiseResolverKeepAlive::reset(); 252 ScriptPromiseResolverKeepAlive::reset();
253 ScriptPromiseResolver* resolver = nullptr; 253 ScriptPromiseResolver* resolver = nullptr;
254 { 254 {
255 ScriptState::Scope scope(getScriptState()); 255 ScriptState::Scope scope(getScriptState());
256 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState()); 256 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState());
257 } 257 }
258 resolver->keepAliveWhilePending(); 258 resolver->keepAliveWhilePending();
259 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 259 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
260 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); 260 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive());
261 261
262 resolver->reject("hello"); 262 resolver->reject("hello");
263 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 263 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
264 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive()); 264 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive());
265 } 265 }
266 266
267 TEST_F(ScriptPromiseResolverTest, keepAliveUntilStopped) 267 TEST_F(ScriptPromiseResolverTest, keepAliveUntilStopped)
268 { 268 {
269 ScriptPromiseResolverKeepAlive::reset(); 269 ScriptPromiseResolverKeepAlive::reset();
270 ScriptPromiseResolver* resolver = nullptr; 270 ScriptPromiseResolver* resolver = nullptr;
271 { 271 {
272 ScriptState::Scope scope(getScriptState()); 272 ScriptState::Scope scope(getScriptState());
273 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState()); 273 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState());
274 } 274 }
275 resolver->keepAliveWhilePending(); 275 resolver->keepAliveWhilePending();
276 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 276 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
277 EXPECT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); 277 EXPECT_TRUE(ScriptPromiseResolverKeepAlive::isAlive());
278 278
279 getExecutionContext()->stopActiveDOMObjects(); 279 getExecutionContext()->stopActiveDOMObjects();
280 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 280 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
281 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive()); 281 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive());
282 } 282 }
283 283
284 TEST_F(ScriptPromiseResolverTest, suspend) 284 TEST_F(ScriptPromiseResolverTest, suspend)
285 { 285 {
286 ScriptPromiseResolverKeepAlive::reset(); 286 ScriptPromiseResolverKeepAlive::reset();
287 ScriptPromiseResolver* resolver = nullptr; 287 ScriptPromiseResolver* resolver = nullptr;
288 { 288 {
289 ScriptState::Scope scope(getScriptState()); 289 ScriptState::Scope scope(getScriptState());
290 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState()); 290 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState());
291 } 291 }
292 resolver->keepAliveWhilePending(); 292 resolver->keepAliveWhilePending();
293 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 293 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
294 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); 294 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive());
295 295
296 getExecutionContext()->suspendActiveDOMObjects(); 296 getExecutionContext()->suspendActiveDOMObjects();
297 resolver->resolve("hello"); 297 resolver->resolve("hello");
298 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 298 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
299 EXPECT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); 299 EXPECT_TRUE(ScriptPromiseResolverKeepAlive::isAlive());
300 300
301 getExecutionContext()->stopActiveDOMObjects(); 301 getExecutionContext()->stopActiveDOMObjects();
302 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw eep, BlinkGC::ForcedGC); 302 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B linkGC::ForcedGC);
303 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive()); 303 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive());
304 } 304 }
305 305
306 TEST_F(ScriptPromiseResolverTest, resolveVoid) 306 TEST_F(ScriptPromiseResolverTest, resolveVoid)
307 { 307 {
308 ScriptPromiseResolver* resolver = nullptr; 308 ScriptPromiseResolver* resolver = nullptr;
309 ScriptPromise promise; 309 ScriptPromise promise;
310 { 310 {
311 ScriptState::Scope scope(getScriptState()); 311 ScriptState::Scope scope(getScriptState());
312 resolver = ScriptPromiseResolver::create(getScriptState()); 312 resolver = ScriptPromiseResolver::create(getScriptState());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 resolver->reject(); 347 resolver->reject();
348 v8::MicrotasksScope::PerformCheckpoint(isolate()); 348 v8::MicrotasksScope::PerformCheckpoint(isolate());
349 349
350 EXPECT_EQ(String(), onFulfilled); 350 EXPECT_EQ(String(), onFulfilled);
351 EXPECT_EQ("undefined", onRejected); 351 EXPECT_EQ("undefined", onRejected);
352 } 352 }
353 353
354 } // namespace 354 } // namespace
355 355
356 } // namespace blink 356 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698