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

Side by Side Diff: test/cctest/test-microtask-delivery.cc

Issue 1741893003: Introduce v8::MicrotasksScope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: SetAutorunMicrotasks fix Created 4 years, 9 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 | « test/cctest/test-api.cc ('k') | test/cctest/test-thread-termination.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 CHECK_EQ(6, 98 CHECK_EQ(6,
99 CompileRun("ordering[5]")->Int32Value(context.local()).FromJust()); 99 CompileRun("ordering[5]")->Int32Value(context.local()).FromJust());
100 } 100 }
101 101
102 102
103 TEST(MicrotaskPerIsolateState) { 103 TEST(MicrotaskPerIsolateState) {
104 i::FLAG_harmony_object_observe = true; 104 i::FLAG_harmony_object_observe = true;
105 HarmonyIsolate isolate; 105 HarmonyIsolate isolate;
106 v8::HandleScope scope(isolate.GetIsolate()); 106 v8::HandleScope scope(isolate.GetIsolate());
107 LocalContext context1(isolate.GetIsolate()); 107 LocalContext context1(isolate.GetIsolate());
108 isolate.GetIsolate()->SetAutorunMicrotasks(false); 108 isolate.GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
109 CompileRun( 109 CompileRun(
110 "var obj = { calls: 0 };"); 110 "var obj = { calls: 0 };");
111 v8::Local<v8::Value> obj = CompileRun("obj"); 111 v8::Local<v8::Value> obj = CompileRun("obj");
112 { 112 {
113 LocalContext context2(isolate.GetIsolate()); 113 LocalContext context2(isolate.GetIsolate());
114 context2->Global() 114 context2->Global()
115 ->Set(context2.local(), 115 ->Set(context2.local(),
116 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", 116 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
117 v8::NewStringType::kNormal) 117 v8::NewStringType::kNormal)
118 .ToLocalChecked(), 118 .ToLocalChecked(),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", 152 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
153 v8::NewStringType::kNormal) 153 v8::NewStringType::kNormal)
154 .ToLocalChecked(), 154 .ToLocalChecked(),
155 obj) 155 obj)
156 .FromJust(); 156 .FromJust();
157 isolate.GetIsolate()->RunMicrotasks(); 157 isolate.GetIsolate()->RunMicrotasks();
158 CHECK_EQ(2, 158 CHECK_EQ(2,
159 CompileRun("obj.calls")->Int32Value(context4.local()).FromJust()); 159 CompileRun("obj.calls")->Int32Value(context4.local()).FromJust());
160 } 160 }
161 } 161 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698