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

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

Issue 1449393002: Remove deprecated functions the smaller half of the remaing tests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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-macro-assembler-mips.cc ('k') | no next file » | 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // TODO(jochen): Remove this after the setting is turned on globally.
29 #define V8_IMMINENT_DEPRECATION_WARNINGS
30
28 #include "src/v8.h" 31 #include "src/v8.h"
29 32
30 #include "test/cctest/cctest.h" 33 #include "test/cctest/cctest.h"
31 34
32 namespace i = v8::internal; 35 namespace i = v8::internal;
33 36
34 namespace { 37 namespace {
35 class HarmonyIsolate { 38 class HarmonyIsolate {
36 public: 39 public:
37 HarmonyIsolate() { 40 HarmonyIsolate() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 "ordering.push(3);" 78 "ordering.push(3);"
76 "obj.id++;" 79 "obj.id++;"
77 "return new Promise(handler);" 80 "return new Promise(handler);"
78 "}).then(function() {" 81 "}).then(function() {"
79 "ordering.push(5);" 82 "ordering.push(5);"
80 "}).then(function() {" 83 "}).then(function() {"
81 "ordering.push(6);" 84 "ordering.push(6);"
82 "});" 85 "});"
83 "Object.observe(obj, observer);" 86 "Object.observe(obj, observer);"
84 "obj.id = 1;"); 87 "obj.id = 1;");
85 CHECK_EQ(6, CompileRun("ordering.length")->Int32Value()); 88 CHECK_EQ(
86 CHECK_EQ(1, CompileRun("ordering[0]")->Int32Value()); 89 6, CompileRun("ordering.length")->Int32Value(context.local()).FromJust());
87 CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value()); 90 CHECK_EQ(1,
88 CHECK_EQ(3, CompileRun("ordering[2]")->Int32Value()); 91 CompileRun("ordering[0]")->Int32Value(context.local()).FromJust());
89 CHECK_EQ(4, CompileRun("ordering[3]")->Int32Value()); 92 CHECK_EQ(2,
90 CHECK_EQ(5, CompileRun("ordering[4]")->Int32Value()); 93 CompileRun("ordering[1]")->Int32Value(context.local()).FromJust());
91 CHECK_EQ(6, CompileRun("ordering[5]")->Int32Value()); 94 CHECK_EQ(3,
95 CompileRun("ordering[2]")->Int32Value(context.local()).FromJust());
96 CHECK_EQ(4,
97 CompileRun("ordering[3]")->Int32Value(context.local()).FromJust());
98 CHECK_EQ(5,
99 CompileRun("ordering[4]")->Int32Value(context.local()).FromJust());
100 CHECK_EQ(6,
101 CompileRun("ordering[5]")->Int32Value(context.local()).FromJust());
92 } 102 }
93 103
94 104
95 TEST(MicrotaskPerIsolateState) { 105 TEST(MicrotaskPerIsolateState) {
96 HarmonyIsolate isolate; 106 HarmonyIsolate isolate;
97 v8::HandleScope scope(isolate.GetIsolate()); 107 v8::HandleScope scope(isolate.GetIsolate());
98 LocalContext context1(isolate.GetIsolate()); 108 LocalContext context1(isolate.GetIsolate());
99 isolate.GetIsolate()->SetAutorunMicrotasks(false); 109 isolate.GetIsolate()->SetAutorunMicrotasks(false);
100 CompileRun( 110 CompileRun(
101 "var obj = { calls: 0 };"); 111 "var obj = { calls: 0 };");
102 v8::Handle<v8::Value> obj = CompileRun("obj"); 112 v8::Local<v8::Value> obj = CompileRun("obj");
103 { 113 {
104 LocalContext context2(isolate.GetIsolate()); 114 LocalContext context2(isolate.GetIsolate());
105 context2->Global()->Set( 115 context2->Global()
106 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); 116 ->Set(context2.local(),
117 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
118 v8::NewStringType::kNormal)
119 .ToLocalChecked(),
120 obj)
121 .FromJust();
107 CompileRun( 122 CompileRun(
108 "var resolver = {};" 123 "var resolver = {};"
109 "new Promise(function(resolve) {" 124 "new Promise(function(resolve) {"
110 "resolver.resolve = resolve;" 125 "resolver.resolve = resolve;"
111 "}).then(function() {" 126 "}).then(function() {"
112 "obj.calls++;" 127 "obj.calls++;"
113 "});" 128 "});"
114 "(function() {" 129 "(function() {"
115 "resolver.resolve();" 130 "resolver.resolve();"
116 "})();"); 131 "})();");
117 } 132 }
118 { 133 {
119 LocalContext context3(isolate.GetIsolate()); 134 LocalContext context3(isolate.GetIsolate());
120 context3->Global()->Set( 135 context3->Global()
121 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); 136 ->Set(context3.local(),
137 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
138 v8::NewStringType::kNormal)
139 .ToLocalChecked(),
140 obj)
141 .FromJust();
122 CompileRun( 142 CompileRun(
123 "var foo = { id: 1 };" 143 "var foo = { id: 1 };"
124 "Object.observe(foo, function() {" 144 "Object.observe(foo, function() {"
125 "obj.calls++;" 145 "obj.calls++;"
126 "});" 146 "});"
127 "foo.id++;"); 147 "foo.id++;");
128 } 148 }
129 { 149 {
130 LocalContext context4(isolate.GetIsolate()); 150 LocalContext context4(isolate.GetIsolate());
131 context4->Global()->Set( 151 context4->Global()
132 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); 152 ->Set(context4.local(),
153 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
154 v8::NewStringType::kNormal)
155 .ToLocalChecked(),
156 obj)
157 .FromJust();
133 isolate.GetIsolate()->RunMicrotasks(); 158 isolate.GetIsolate()->RunMicrotasks();
134 CHECK_EQ(2, CompileRun("obj.calls")->Int32Value()); 159 CHECK_EQ(2,
160 CompileRun("obj.calls")->Int32Value(context4.local()).FromJust());
135 } 161 }
136 } 162 }
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698