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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 11364134: Merge libv1. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error Created 8 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
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index 3e84b599c12e8a6afad5d6173c3c61ef4955ff6e..d0e57def9851c648dc2ae602cda810289685717c 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -1140,6 +1140,67 @@ UNIT_TEST_CASE(ScriptSnapshot) {
}
+UNIT_TEST_CASE(ScriptSnapshot1) {
+ const char* kScriptChars =
+ "class _SimpleNumEnumerable<T extends num> {"
+ "final Iterable<T> _source;"
+ "const _SimpleNumEnumerable(this._source) : super();"
+ "}";
+
+ Dart_Handle result;
+ uint8_t* buffer;
+ intptr_t size;
+ uint8_t* full_snapshot = NULL;
+ uint8_t* script_snapshot = NULL;
+
+ {
+ // Start an Isolate, and create a full snapshot of it.
+ TestIsolateScope __test_isolate__;
+ Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
+
+ // Write out the script snapshot.
+ result = Dart_CreateSnapshot(&buffer, &size);
+ EXPECT_VALID(result);
+ full_snapshot = reinterpret_cast<uint8_t*>(malloc(size));
+ memmove(full_snapshot, buffer, size);
+ Dart_ExitScope();
+ }
+
+ {
+ // Create an Isolate using the full snapshot, load a script and create
+ // a script snapshot of the script.
+ TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
+ Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
+
+ // Create a test library and Load up a test script in it.
+ TestCase::LoadTestScript(kScriptChars, NULL);
+
+ // Write out the script snapshot.
+ result = Dart_CreateScriptSnapshot(&buffer, &size);
+ EXPECT_VALID(result);
+ script_snapshot = reinterpret_cast<uint8_t*>(malloc(size));
+ memmove(script_snapshot, buffer, size);
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ }
+
+ {
+ // Now Create an Isolate using the full snapshot and load the
+ // script snapshot created above and execute it.
+ TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
+ Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
+
+ // Load the test library from the snapshot.
+ EXPECT(script_snapshot != NULL);
+ result = Dart_LoadScriptFromSnapshot(script_snapshot);
+ EXPECT_VALID(result);
+ }
+ Dart_ShutdownIsolate();
+ free(full_snapshot);
+ free(script_snapshot);
+}
+
+
TEST_CASE(IntArrayMessage) {
StackZone zone(Isolate::Current());
uint8_t* buffer = NULL;
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698