OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 ~HarmonyIsolate() { | 44 ~HarmonyIsolate() { |
45 isolate_->Exit(); | 45 isolate_->Exit(); |
46 isolate_->Dispose(); | 46 isolate_->Dispose(); |
47 } | 47 } |
48 | 48 |
49 v8::Isolate* GetIsolate() const { return isolate_; } | 49 v8::Isolate* GetIsolate() const { return isolate_; } |
50 | 50 |
51 private: | 51 private: |
52 v8::Isolate* isolate_; | 52 v8::Isolate* isolate_; |
53 }; | 53 }; |
54 } | 54 } // namespace |
55 | 55 |
56 | 56 |
57 TEST(MicrotaskDeliverySimple) { | 57 TEST(MicrotaskDeliverySimple) { |
58 HarmonyIsolate isolate; | 58 HarmonyIsolate isolate; |
59 v8::HandleScope scope(isolate.GetIsolate()); | 59 v8::HandleScope scope(isolate.GetIsolate()); |
60 LocalContext context(isolate.GetIsolate()); | 60 LocalContext context(isolate.GetIsolate()); |
61 CompileRun( | 61 CompileRun( |
62 "var ordering = [];" | 62 "var ordering = [];" |
63 "var resolver = {};" | 63 "var resolver = {};" |
64 "function handler(resolve) { resolver.resolve = resolve; }" | 64 "function handler(resolve) { resolver.resolve = resolve; }" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 "foo.id++;"); | 127 "foo.id++;"); |
128 } | 128 } |
129 { | 129 { |
130 LocalContext context4(isolate.GetIsolate()); | 130 LocalContext context4(isolate.GetIsolate()); |
131 context4->Global()->Set( | 131 context4->Global()->Set( |
132 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); | 132 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); |
133 isolate.GetIsolate()->RunMicrotasks(); | 133 isolate.GetIsolate()->RunMicrotasks(); |
134 CHECK_EQ(2, CompileRun("obj.calls")->Int32Value()); | 134 CHECK_EQ(2, CompileRun("obj.calls")->Int32Value()); |
135 } | 135 } |
136 } | 136 } |
OLD | NEW |