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_native_api.h" | 8 #include "include/dart_native_api.h" |
9 | 9 |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 return CreateIsolate(bin::isolate_snapshot_buffer, name); | 299 return CreateIsolate(bin::isolate_snapshot_buffer, name); |
300 } | 300 } |
301 static Dart_Handle library_handler(Dart_LibraryTag tag, | 301 static Dart_Handle library_handler(Dart_LibraryTag tag, |
302 Dart_Handle library, | 302 Dart_Handle library, |
303 Dart_Handle url); | 303 Dart_Handle url); |
304 static char* BigintToHexValue(Dart_CObject* bigint); | 304 static char* BigintToHexValue(Dart_CObject* bigint); |
305 | 305 |
306 virtual void Run(); | 306 virtual void Run(); |
307 | 307 |
308 private: | 308 private: |
309 static Dart_Isolate CreateIsolate(const uint8_t* buffer, | 309 static Dart_Isolate CreateIsolate(const uint8_t* buffer, const char* name); |
310 const char* name) { | |
311 char* err; | |
312 Dart_Isolate isolate = Dart_CreateIsolate( | |
313 name, NULL, buffer, NULL, NULL, &err); | |
314 if (isolate == NULL) { | |
315 OS::Print("Creation of isolate failed '%s'\n", err); | |
316 free(err); | |
317 } | |
318 EXPECT(isolate != NULL); | |
319 return isolate; | |
320 } | |
321 | 310 |
322 RunEntry* const run_; | 311 RunEntry* const run_; |
323 }; | 312 }; |
324 | 313 |
325 | 314 |
326 class TestIsolateScope { | 315 class TestIsolateScope { |
327 public: | 316 public: |
328 TestIsolateScope() { | 317 TestIsolateScope() { |
329 isolate_ = reinterpret_cast<Isolate*>(TestCase::CreateTestIsolate()); | 318 isolate_ = reinterpret_cast<Isolate*>(TestCase::CreateTestIsolate()); |
330 Dart_EnterScope(); // Create a Dart API scope for unit tests. | 319 Dart_EnterScope(); // Create a Dart API scope for unit tests. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // Yields: | 559 // Yields: |
571 // | 560 // |
572 // out = "\"id\":\"\"" | 561 // out = "\"id\":\"\"" |
573 // | 562 // |
574 void ElideJSONSubstring(const char* prefix, const char* in, char* out); | 563 void ElideJSONSubstring(const char* prefix, const char* in, char* out); |
575 | 564 |
576 | 565 |
577 } // namespace dart | 566 } // namespace dart |
578 | 567 |
579 #endif // VM_UNIT_TEST_H_ | 568 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |