Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: runtime/vm/unit_test.h

Issue 15736011: Create test isolates using a snapshot, this ensures that we do not depend (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "vm/ast.h" 10 #include "vm/ast.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 182
183 namespace dart { 183 namespace dart {
184 184
185 // Forward declarations. 185 // Forward declarations.
186 class Assembler; 186 class Assembler;
187 class CodeGenerator; 187 class CodeGenerator;
188 class VirtualMemory; 188 class VirtualMemory;
189 189
190 190
191 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise
192 // it is initialized to NULL.
193 namespace bin {
194 extern const uint8_t* snapshot_buffer;
195 }
196
197
191 class TestCaseBase { 198 class TestCaseBase {
192 public: 199 public:
193 explicit TestCaseBase(const char* name); 200 explicit TestCaseBase(const char* name);
194 virtual ~TestCaseBase() { } 201 virtual ~TestCaseBase() { }
195 202
196 const char* name() const { return name_; } 203 const char* name() const { return name_; }
197 204
198 virtual void Run() = 0; 205 virtual void Run() = 0;
199 void RunTest(); 206 void RunTest();
200 207
(...skipping 17 matching lines...) Expand all
218 TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) { } 225 TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) { }
219 226
220 static Dart_Handle LoadTestScript(const char* script, 227 static Dart_Handle LoadTestScript(const char* script,
221 Dart_NativeEntryResolver resolver); 228 Dart_NativeEntryResolver resolver);
222 static Dart_Handle lib(); 229 static Dart_Handle lib();
223 static const char* url() { return "dart:test-lib"; } 230 static const char* url() { return "dart:test-lib"; }
224 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer) { 231 static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer) {
225 return CreateIsolate(buffer); 232 return CreateIsolate(buffer);
226 } 233 }
227 static Dart_Isolate CreateTestIsolate() { 234 static Dart_Isolate CreateTestIsolate() {
228 return CreateIsolate(NULL); 235 return CreateIsolate(bin::snapshot_buffer);
229 } 236 }
230 static Dart_Handle library_handler(Dart_LibraryTag tag, 237 static Dart_Handle library_handler(Dart_LibraryTag tag,
231 Dart_Handle library, 238 Dart_Handle library,
232 Dart_Handle url); 239 Dart_Handle url);
233 240
234 virtual void Run(); 241 virtual void Run();
235 242
236 private: 243 private:
237 static Dart_Isolate CreateIsolate(uint8_t* buffer) { 244 static Dart_Isolate CreateIsolate(const uint8_t* buffer) {
238 char* err; 245 char* err;
239 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err); 246 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err);
240 if (isolate == NULL) { 247 if (isolate == NULL) {
241 OS::Print("Creation of isolate failed '%s'\n", err); 248 OS::Print("Creation of isolate failed '%s'\n", err);
242 free(err); 249 free(err);
243 } 250 }
244 EXPECT(isolate != NULL); 251 EXPECT(isolate != NULL);
245 return isolate; 252 return isolate;
246 } 253 }
247 254
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } \ 382 } \
376 } else { \ 383 } else { \
377 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ 384 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \
378 #handle); \ 385 #handle); \
379 } \ 386 } \
380 } while (0) 387 } while (0)
381 388
382 } // namespace dart 389 } // namespace dart
383 390
384 #endif // VM_UNIT_TEST_H_ 391 #endif // VM_UNIT_TEST_H_
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698