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

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 12438033: Write the magic number 0xf5f5dcdc into a script snapshot file and use this to distinguish whether a… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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/dart_api_impl.cc ('k') | sdk/bin/dart2js » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 } 1123 }
1124 1124
1125 { 1125 {
1126 // Now Create an Isolate using the full snapshot and load the 1126 // Now Create an Isolate using the full snapshot and load the
1127 // script snapshot created above and execute it. 1127 // script snapshot created above and execute it.
1128 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); 1128 TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
1129 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1129 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1130 1130
1131 // Load the test library from the snapshot. 1131 // Load the test library from the snapshot.
1132 EXPECT(script_snapshot != NULL); 1132 EXPECT(script_snapshot != NULL);
1133 result = Dart_LoadScriptFromSnapshot(script_snapshot); 1133 result = Dart_LoadScriptFromSnapshot(script_snapshot, size);
1134 EXPECT_VALID(result); 1134 EXPECT_VALID(result);
1135 1135
1136 // Get list of library URLs loaded and compare with expected count. 1136 // Get list of library URLs loaded and compare with expected count.
1137 Dart_Handle libs = Dart_GetLibraryURLs(); 1137 Dart_Handle libs = Dart_GetLibraryURLs();
1138 EXPECT(Dart_IsList(libs)); 1138 EXPECT(Dart_IsList(libs));
1139 Dart_ListLength(libs, &actual_num_libs); 1139 Dart_ListLength(libs, &actual_num_libs);
1140 1140
1141 EXPECT_EQ(expected_num_libs, actual_num_libs); 1141 EXPECT_EQ(expected_num_libs, actual_num_libs);
1142 1142
1143 // Invoke a function which returns an object. 1143 // Invoke a function which returns an object.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1197 }
1198 1198
1199 { 1199 {
1200 // Now Create an Isolate using the full snapshot and load the 1200 // Now Create an Isolate using the full snapshot and load the
1201 // script snapshot created above and execute it. 1201 // script snapshot created above and execute it.
1202 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); 1202 TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
1203 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1203 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1204 1204
1205 // Load the test library from the snapshot. 1205 // Load the test library from the snapshot.
1206 EXPECT(script_snapshot != NULL); 1206 EXPECT(script_snapshot != NULL);
1207 result = Dart_LoadScriptFromSnapshot(script_snapshot); 1207 result = Dart_LoadScriptFromSnapshot(script_snapshot, size);
1208 EXPECT_VALID(result); 1208 EXPECT_VALID(result);
1209 } 1209 }
1210 Dart_ShutdownIsolate(); 1210 Dart_ShutdownIsolate();
1211 free(full_snapshot); 1211 free(full_snapshot);
1212 free(script_snapshot); 1212 free(script_snapshot);
1213 } 1213 }
1214 1214
1215 1215
1216 TEST_CASE(IntArrayMessage) { 1216 TEST_CASE(IntArrayMessage) {
1217 StackZone zone(Isolate::Current()); 1217 StackZone zone(Isolate::Current());
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 EXPECT(Dart_ErrorHasException(result)); 2199 EXPECT(Dart_ErrorHasException(result));
2200 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2200 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2201 Dart_GetError(result)); 2201 Dart_GetError(result));
2202 2202
2203 Dart_ExitScope(); 2203 Dart_ExitScope();
2204 } 2204 }
2205 2205
2206 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2206 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2207 2207
2208 } // namespace dart 2208 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | sdk/bin/dart2js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698