From: ager@chromium.org Date: Mon, 17 Nov 2008 16:00:58 +0000 (+0000) Subject: Fix external string test. X-Git-Tag: upstream/4.7.83~25007 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=954bda3c46f4e2fc29769bbcbfa8d56aa505380a;p=platform%2Fupstream%2Fv8.git Fix external string test. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@773 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 38394fbc3..347195ebf 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -5237,7 +5237,8 @@ static String::ExternalStringResource* SymbolCallback(const char* chars, static v8::Handle ExternalSymbolGetter(Local name, const AccessorInfo& info) { - CHECK(name->IsExternal()); + ApiTestFuzzer::Fuzz(); + CHECK(!name->Equals(v8_str("externalSymbol722")) || name->IsExternal()); CHECK(name->IsExternal()); return v8::True(); } @@ -5245,7 +5246,8 @@ static v8::Handle ExternalSymbolGetter(Local name, static void ExternalSymbolSetter(Local name, Local value, const AccessorInfo&) { - CHECK(name->IsExternal()); + ApiTestFuzzer::Fuzz(); + CHECK(!name->Equals(v8_str("externalSymbol722")) || name->IsExternal()); } @@ -5255,12 +5257,20 @@ THREADED_TEST(ExternalSymbols) { v8::HandleScope scope; LocalContext context; Local templ = ObjectTemplate::New(); - templ->SetAccessor(v8_str("x"), ExternalSymbolGetter, ExternalSymbolSetter); - context->Global()->Set(v8_str("obj"), templ->NewInstance()); - Local value = CompileRun("var o = { x: 42 }; o.x"); + // Use a bizare name so that the name does not clash with names used + // in natives files. If running with snapshots enabled, variable + // names used in the native files will be normal symbols instead of + // external ones. Also, make sure that the bizare name is used from + // JavaScript code before using it from C++ code. + Local value = + CompileRun("var o = { externalSymbol722: 42 }; o.externalSymbol722"); CHECK_EQ(42, value->Int32Value()); - value = CompileRun("obj.x"); + templ->SetAccessor(v8_str("externalSymbol722"), + ExternalSymbolGetter, + ExternalSymbolSetter); + context->Global()->Set(v8_str("obj"), templ->NewInstance()); + value = CompileRun("obj.externalSymbol722"); CHECK_EQ(true, value->BooleanValue()); - value = CompileRun("obj.x = 42"); + value = CompileRun("obj.externalSymbol722 = 42"); v8::V8::SetExternalSymbolCallback(NULL); }