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