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

Unified Diff: vm/unit_test.h

Issue 8673002: - Refactor the isolate callback mechanism to also include creation of the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« vm/dart_api_impl.cc ('K') | « vm/thread_win.cc ('k') | vm/vm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/unit_test.h
===================================================================
--- vm/unit_test.h (revision 1818)
+++ vm/unit_test.h (working copy)
@@ -162,10 +162,27 @@
Dart_NativeEntryResolver resolver);
static Dart_Handle lib();
static const char* url() { return "dart:test-lib"; }
+ static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer) {
+ return CreateIsolate(buffer);
+ }
+ static Dart_Isolate CreateTestIsolate() {
+ return CreateIsolate(NULL);
+ }
virtual void Run();
private:
+ static Dart_Isolate CreateIsolate(uint8_t* buffer) {
+ Dart_ErrorBuffer err;
+ static const int kErrorMsgLength = 256;
+ err.buffer = reinterpret_cast<char*>(malloc(kErrorMsgLength));
+ err.length = kErrorMsgLength;
+ Dart_Isolate isolate = Dart_CreateIsolate(buffer, NULL, err);
turnidge 2011/11/28 18:39:58 You might as well add an if that prints the isolat
siva 2011/11/29 00:54:25 Done.
+ free(err.buffer);
+ EXPECT(isolate != NULL);
+ return isolate;
+ }
+
RunEntry* const run_;
};
@@ -173,8 +190,7 @@
class TestIsolateScope {
public:
TestIsolateScope() {
- isolate_ = reinterpret_cast<Isolate*>(Dart_CreateIsolate(NULL, NULL));
- EXPECT(isolate_ != NULL);
+ isolate_ = reinterpret_cast<Isolate*>(TestCase::CreateTestIsolate());
Dart_EnterScope(); // Create a Dart API scope for unit tests.
}
~TestIsolateScope() {
« vm/dart_api_impl.cc ('K') | « vm/thread_win.cc ('k') | vm/vm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698