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_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 private: | 226 private: |
227 static TestCaseBase* first_; | 227 static TestCaseBase* first_; |
228 static TestCaseBase* tail_; | 228 static TestCaseBase* tail_; |
229 | 229 |
230 TestCaseBase* next_; | 230 TestCaseBase* next_; |
231 const char* name_; | 231 const char* name_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(TestCaseBase); | 233 DISALLOW_COPY_AND_ASSIGN(TestCaseBase); |
234 }; | 234 }; |
235 | 235 |
| 236 #define USER_TEST_URI "test-lib" |
| 237 #define CORELIB_TEST_URI "dart:test-lib" |
236 | 238 |
237 class TestCase : TestCaseBase { | 239 class TestCase : TestCaseBase { |
238 public: | 240 public: |
239 typedef void (RunEntry)(); | 241 typedef void (RunEntry)(); |
240 | 242 |
241 TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) { } | 243 TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) { } |
242 | 244 |
243 static Dart_Handle LoadTestScript(const char* script, | 245 static Dart_Handle LoadTestScript(const char* script, |
244 Dart_NativeEntryResolver resolver); | 246 Dart_NativeEntryResolver resolver, |
| 247 const char* lib_uri = USER_TEST_URI); |
| 248 |
| 249 static Dart_Handle LoadCoreTestScript(const char* script, |
| 250 Dart_NativeEntryResolver resolver); |
245 static Dart_Handle lib(); | 251 static Dart_Handle lib(); |
246 static const char* url() { return "dart:test-lib"; } | 252 static const char* url() { return USER_TEST_URI; } |
247 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer) { | 253 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer) { |
248 return CreateIsolate(buffer); | 254 return CreateIsolate(buffer); |
249 } | 255 } |
250 static Dart_Isolate CreateTestIsolate() { | 256 static Dart_Isolate CreateTestIsolate() { |
251 return CreateIsolate(bin::snapshot_buffer); | 257 return CreateIsolate(bin::snapshot_buffer); |
252 } | 258 } |
253 static Dart_Handle library_handler(Dart_LibraryTag tag, | 259 static Dart_Handle library_handler(Dart_LibraryTag tag, |
254 Dart_Handle library, | 260 Dart_Handle library, |
255 Dart_Handle url); | 261 Dart_Handle url); |
256 | 262 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } \ | 404 } \ |
399 } else { \ | 405 } else { \ |
400 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 406 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
401 #handle); \ | 407 #handle); \ |
402 } \ | 408 } \ |
403 } while (0) | 409 } while (0) |
404 | 410 |
405 } // namespace dart | 411 } // namespace dart |
406 | 412 |
407 #endif // VM_UNIT_TEST_H_ | 413 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |