| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 static Dart_Handle LoadTestScript(const char* script, | 258 static Dart_Handle LoadTestScript(const char* script, |
| 259 Dart_NativeEntryResolver resolver, | 259 Dart_NativeEntryResolver resolver, |
| 260 const char* lib_uri = USER_TEST_URI, | 260 const char* lib_uri = USER_TEST_URI, |
| 261 bool finalize = true); | 261 bool finalize = true); |
| 262 | 262 |
| 263 static Dart_Handle LoadCoreTestScript(const char* script, | 263 static Dart_Handle LoadCoreTestScript(const char* script, |
| 264 Dart_NativeEntryResolver resolver); | 264 Dart_NativeEntryResolver resolver); |
| 265 static Dart_Handle lib(); | 265 static Dart_Handle lib(); |
| 266 static const char* url() { return USER_TEST_URI; } | 266 static const char* url() { return USER_TEST_URI; } |
| 267 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer) { | 267 static Dart_Isolate CreateTestIsolateFromSnapshot( |
| 268 return CreateIsolate(buffer); | 268 uint8_t* buffer, const char* name = NULL) { |
| 269 return CreateIsolate(buffer, name); |
| 269 } | 270 } |
| 270 static Dart_Isolate CreateTestIsolate() { | 271 static Dart_Isolate CreateTestIsolate(const char* name = NULL) { |
| 271 return CreateIsolate(bin::snapshot_buffer); | 272 return CreateIsolate(bin::snapshot_buffer, name); |
| 272 } | 273 } |
| 273 static Dart_Handle library_handler(Dart_LibraryTag tag, | 274 static Dart_Handle library_handler(Dart_LibraryTag tag, |
| 274 Dart_Handle library, | 275 Dart_Handle library, |
| 275 Dart_Handle url); | 276 Dart_Handle url); |
| 276 static char* BigintToHexValue(Dart_CObject* bigint); | 277 static char* BigintToHexValue(Dart_CObject* bigint); |
| 277 | 278 |
| 278 virtual void Run(); | 279 virtual void Run(); |
| 279 | 280 |
| 280 private: | 281 private: |
| 281 static Dart_Isolate CreateIsolate(const uint8_t* buffer) { | 282 static Dart_Isolate CreateIsolate(const uint8_t* buffer, |
| 283 const char* name) { |
| 282 char* err; | 284 char* err; |
| 283 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err); | 285 Dart_Isolate isolate = Dart_CreateIsolate(name, NULL, buffer, NULL, &err); |
| 284 if (isolate == NULL) { | 286 if (isolate == NULL) { |
| 285 OS::Print("Creation of isolate failed '%s'\n", err); | 287 OS::Print("Creation of isolate failed '%s'\n", err); |
| 286 free(err); | 288 free(err); |
| 287 } | 289 } |
| 288 EXPECT(isolate != NULL); | 290 EXPECT(isolate != NULL); |
| 289 return isolate; | 291 return isolate; |
| 290 } | 292 } |
| 291 | 293 |
| 292 RunEntry* const run_; | 294 RunEntry* const run_; |
| 293 }; | 295 }; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } \ | 419 } \ |
| 418 } else { \ | 420 } else { \ |
| 419 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 421 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 420 #handle); \ | 422 #handle); \ |
| 421 } \ | 423 } \ |
| 422 } while (0) | 424 } while (0) |
| 423 | 425 |
| 424 } // namespace dart | 426 } // namespace dart |
| 425 | 427 |
| 426 #endif // VM_UNIT_TEST_H_ | 428 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |