| 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 RUNTIME_VM_UNIT_TEST_H_ | 5 #ifndef RUNTIME_VM_UNIT_TEST_H_ |
| 6 #define RUNTIME_VM_UNIT_TEST_H_ | 6 #define RUNTIME_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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 #define CORELIB_TEST_URI "dart:test-lib" | 282 #define CORELIB_TEST_URI "dart:test-lib" |
| 283 | 283 |
| 284 class TestCase : TestCaseBase { | 284 class TestCase : TestCaseBase { |
| 285 public: | 285 public: |
| 286 typedef void(RunEntry)(); | 286 typedef void(RunEntry)(); |
| 287 | 287 |
| 288 TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) {} | 288 TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) {} |
| 289 | 289 |
| 290 static char* CompileTestScriptWithDFE(const char* url, | 290 static char* CompileTestScriptWithDFE(const char* url, |
| 291 const char* source, | 291 const char* source, |
| 292 void** kernel_pgm, | 292 void** kernel_pgm); |
| 293 bool incrementally = false); | |
| 294 static char* CompileTestScriptWithDFE(const char* url, | |
| 295 int sourcefiles_count, | |
| 296 Dart_SourceFile sourcefiles[], | |
| 297 void** kernel_pgm, | |
| 298 bool incrementally = false); | |
| 299 static Dart_Handle LoadTestScript(const char* script, | 293 static Dart_Handle LoadTestScript(const char* script, |
| 300 Dart_NativeEntryResolver resolver, | 294 Dart_NativeEntryResolver resolver, |
| 301 const char* lib_uri = USER_TEST_URI, | 295 const char* lib_uri = USER_TEST_URI, |
| 302 bool finalize = true); | 296 bool finalize = true); |
| 303 static Dart_Handle LoadTestScriptWithDFE( | |
| 304 int sourcefiles_count, | |
| 305 Dart_SourceFile sourcefiles[], | |
| 306 Dart_NativeEntryResolver resolver = NULL, | |
| 307 bool finalize = true, | |
| 308 bool incrementally = false); | |
| 309 static Dart_Handle LoadCoreTestScript(const char* script, | 297 static Dart_Handle LoadCoreTestScript(const char* script, |
| 310 Dart_NativeEntryResolver resolver); | 298 Dart_NativeEntryResolver resolver); |
| 311 static Dart_Handle lib(); | 299 static Dart_Handle lib(); |
| 312 static const char* url(); | 300 static const char* url(); |
| 313 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer, | 301 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer, |
| 314 const char* name = NULL) { | 302 const char* name = NULL) { |
| 315 return CreateIsolate(buffer, name); | 303 return CreateIsolate(buffer, name); |
| 316 } | 304 } |
| 317 static Dart_Isolate CreateTestIsolate(const char* name = NULL) { | 305 static Dart_Isolate CreateTestIsolate(const char* name = NULL) { |
| 318 return CreateIsolate(bin::core_isolate_snapshot_data, name); | 306 return CreateIsolate(bin::core_isolate_snapshot_data, name); |
| 319 } | 307 } |
| 320 static Dart_Handle library_handler(Dart_LibraryTag tag, | 308 static Dart_Handle library_handler(Dart_LibraryTag tag, |
| 321 Dart_Handle library, | 309 Dart_Handle library, |
| 322 Dart_Handle url); | 310 Dart_Handle url); |
| 323 static char* BigintToHexValue(Dart_CObject* bigint); | 311 static char* BigintToHexValue(Dart_CObject* bigint); |
| 324 | 312 |
| 325 virtual void Run(); | 313 virtual void Run(); |
| 326 | 314 |
| 327 // Sets |script| to be the source used at next reload. | 315 // Sets |script| to be the source used at next reload. |
| 328 static void SetReloadTestScript(const char* script); | 316 static void SetReloadTestScript(const char* script); |
| 329 static void SetReloadTestKernel(const void* kernel); | |
| 330 | |
| 331 // Initiates the reload. | 317 // Initiates the reload. |
| 332 static Dart_Handle TriggerReload(); | 318 static Dart_Handle TriggerReload(); |
| 333 // Gets the result of a reload. | 319 // Gets the result of a reload. |
| 334 static Dart_Handle GetReloadErrorOrRootLibrary(); | 320 static Dart_Handle GetReloadErrorOrRootLibrary(); |
| 335 | 321 |
| 336 // Helper function which reloads the current isolate using |script|. | 322 // Helper function which reloads the current isolate using |script|. |
| 337 static Dart_Handle ReloadTestScript(const char* script); | 323 static Dart_Handle ReloadTestScript(const char* script); |
| 338 static Dart_Handle ReloadTestKernel(const void* kernel); | |
| 339 | 324 |
| 340 static void AddTestLib(const char* url, const char* source); | 325 static void AddTestLib(const char* url, const char* source); |
| 341 static const char* GetTestLib(const char* url); | 326 static const char* GetTestLib(const char* url); |
| 342 | 327 |
| 343 private: | 328 private: |
| 344 static Dart_Isolate CreateIsolate(const uint8_t* buffer, const char* name); | 329 static Dart_Isolate CreateIsolate(const uint8_t* buffer, const char* name); |
| 345 | 330 |
| 346 RunEntry* const run_; | 331 RunEntry* const run_; |
| 347 }; | 332 }; |
| 348 | 333 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 ~SetFlagScope() { *flag_ = original_value_; } | 629 ~SetFlagScope() { *flag_ = original_value_; } |
| 645 | 630 |
| 646 private: | 631 private: |
| 647 T* flag_; | 632 T* flag_; |
| 648 T original_value_; | 633 T original_value_; |
| 649 }; | 634 }; |
| 650 | 635 |
| 651 } // namespace dart | 636 } // namespace dart |
| 652 | 637 |
| 653 #endif // RUNTIME_VM_UNIT_TEST_H_ | 638 #endif // RUNTIME_VM_UNIT_TEST_H_ |
| OLD | NEW |