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