Chromium Code Reviews| Index: test/cctest/test-serialize.cc |
| =================================================================== |
| --- test/cctest/test-serialize.cc (revision 3115) |
| +++ test/cctest/test-serialize.cc (working copy) |
| @@ -185,6 +185,19 @@ |
| } |
| +static void Serialize2() { |
| + Serializer::Enable(); |
| + // We have to create one context. One reason for this is that the |
|
Mads Ager (chromium)
2009/10/26 11:14:05
One reason for this is so that the builtins ...
|
| + // so that the builtins can be loaded from v8natives.js and their |
| + // addresses can be processed. This will clear the pending fixups |
| + // array, which would otherwise contain GC roots that would confuse |
| + // the serialization/deserialization process. |
| + v8::Persistent<v8::Context> env = v8::Context::New(); |
| + env.Dispose(); |
| + Snapshot::WriteToFile2(FLAG_testing_serialization_file); |
| +} |
| + |
| + |
| // Test that the whole heap can be serialized when running from the |
| // internal snapshot. |
| // (Smoke test.) |
| @@ -203,6 +216,13 @@ |
| } |
| +// Test that the whole heap can be serialized. |
| +TEST(Serialize2) { |
| + v8::V8::Initialize(); |
| + Serialize2(); |
| +} |
| + |
| + |
| // Test that the heap isn't destroyed after a serialization. |
| TEST(SerializeNondestructive) { |
| if (Snapshot::IsEnabled()) return; |
| @@ -230,6 +250,11 @@ |
| } |
| +static void Deserialize2() { |
| + CHECK(Snapshot::Initialize2(FLAG_testing_serialization_file)); |
| +} |
| + |
| + |
| static void SanityCheck() { |
| v8::HandleScope scope; |
| #ifdef DEBUG |
| @@ -251,6 +276,21 @@ |
| SanityCheck(); |
| } |
| + |
| +DEPENDENT_TEST(Deserialize2, Serialize2) { |
| + v8::HandleScope scope; |
| + |
| + Deserialize2(); |
| + |
| + fflush(stdout); |
| + |
| + v8::Persistent<v8::Context> env = v8::Context::New(); |
| + env->Enter(); |
| + |
| + SanityCheck(); |
| +} |
| + |
| + |
| DEPENDENT_TEST(DeserializeAndRunScript, Serialize) { |
| v8::HandleScope scope; |
| @@ -263,6 +303,21 @@ |
| } |
| +DEPENDENT_TEST(DeserializeAndRunScript2, Serialize2) { |
| + v8::HandleScope scope; |
| + |
| + Deserialize2(); |
| + |
| + v8::Persistent<v8::Context> env = v8::Context::New(); |
| + env->Enter(); |
| + |
| + const char* c_source = "\"1234\".length"; |
| + v8::Local<v8::String> source = v8::String::New(c_source); |
| + v8::Local<v8::Script> script = v8::Script::Compile(source); |
| + CHECK_EQ(4, script->Run()->Int32Value()); |
| +} |
| + |
| + |
| DEPENDENT_TEST(DeserializeNatives, Serialize) { |
| v8::HandleScope scope; |
| @@ -288,9 +343,6 @@ |
| } |
| -extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); |
| - |
| - |
| TEST(TestThatAlwaysSucceeds) { |
| } |