| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_UNIT_TEST_H_ | 5 #ifndef VM_UNIT_TEST_H_ |
| 6 #define VM_UNIT_TEST_H_ | 6 #define VM_UNIT_TEST_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 virtual void Run(); | 166 virtual void Run(); |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 RunEntry* const run_; | 169 RunEntry* const run_; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 | 172 |
| 173 class TestIsolateScope { | 173 class TestIsolateScope { |
| 174 public: | 174 public: |
| 175 TestIsolateScope() { | 175 TestIsolateScope() { |
| 176 isolate_ = reinterpret_cast<Isolate*>(Dart_CreateIsolate(NULL, NULL)); | 176 isolate_ = reinterpret_cast<Isolate*>(Dart_CreateIsolate(NULL)); |
| 177 EXPECT(isolate_ != NULL); | 177 EXPECT(isolate_ != NULL); |
| 178 Dart_EnterScope(); // Create a Dart API scope for unit tests. | 178 Dart_EnterScope(); // Create a Dart API scope for unit tests. |
| 179 } | 179 } |
| 180 ~TestIsolateScope() { | 180 ~TestIsolateScope() { |
| 181 Dart_ExitScope(); // Exit the Dart API scope created for unit tests. | 181 Dart_ExitScope(); // Exit the Dart API scope created for unit tests. |
| 182 ASSERT(isolate_ == Isolate::Current()); | 182 ASSERT(isolate_ == Isolate::Current()); |
| 183 Dart_ShutdownIsolate(); | 183 Dart_ShutdownIsolate(); |
| 184 isolate_ = NULL; | 184 isolate_ = NULL; |
| 185 } | 185 } |
| 186 Isolate* isolate() const { return isolate_; } | 186 Isolate* isolate() const { return isolate_; } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 #define EXPECT_VALID(handle) \ | 255 #define EXPECT_VALID(handle) \ |
| 256 if (Dart_IsError((handle))) { \ | 256 if (Dart_IsError((handle))) { \ |
| 257 dart::Expect(__FILE__, __LINE__).Fail("invalid handle '%s':\n '%s'\n", \ | 257 dart::Expect(__FILE__, __LINE__).Fail("invalid handle '%s':\n '%s'\n", \ |
| 258 #handle, Dart_GetError(handle)); \ | 258 #handle, Dart_GetError(handle)); \ |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace dart | 261 } // namespace dart |
| 262 | 262 |
| 263 #endif // VM_UNIT_TEST_H_ | 263 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |