Chromium Code Reviews| Index: test/cctest/test-api.cc |
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
| index 9769fb79ab5a04410343a424cbfc64095054c639..a0e7e674fd5a8cd370fc02ae114d45d3c6825d4c 100644 |
| --- a/test/cctest/test-api.cc |
| +++ b/test/cctest/test-api.cc |
| @@ -6969,53 +6969,32 @@ THREADED_TEST(SetPrototype) { |
| } |
| -THREADED_TEST(SetPrototypeProperties) { |
| +THREADED_TEST(FunctionReadOnlyPrototype) { |
| v8::HandleScope handle_scope; |
| LocalContext context; |
| Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); |
| - t1->SetPrototypeAttributes(v8::DontDelete); |
| + t1->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(42)); |
| + t1->ReadOnlyPrototype(); |
| context->Global()->Set(v8_str("func1"), t1->GetFunction()); |
| + // Configured value of ReadOnly flag. |
| CHECK(CompileRun( |
| "(function() {" |
| " descriptor = Object.getOwnPropertyDescriptor(func1, 'prototype');" |
| - " return (descriptor['writable'] == true) &&" |
| - " (descriptor['enumerable'] == true) &&" |
| - " (descriptor['configurable'] == false);" |
| + " return (descriptor['writable'] == false);" |
| "})()")->BooleanValue()); |
| + CHECK_EQ(42, CompileRun("func1.prototype.x")->Int32Value()); |
| Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(); |
| - t2->SetPrototypeAttributes(v8::DontEnum); |
| + t2->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(42)); |
| context->Global()->Set(v8_str("func2"), t2->GetFunction()); |
| + // Default value of ReadOnly flag. |
| CHECK(CompileRun( |
| "(function() {" |
| " descriptor = Object.getOwnPropertyDescriptor(func2, 'prototype');" |
| - " return (descriptor['writable'] == true) &&" |
| - " (descriptor['enumerable'] == false) &&" |
| - " (descriptor['configurable'] == true);" |
| - "})()")->BooleanValue()); |
| - |
| - Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(); |
| - t3->SetPrototypeAttributes(v8::ReadOnly); |
| - context->Global()->Set(v8_str("func3"), t3->GetFunction()); |
| - CHECK(CompileRun( |
| - "(function() {" |
| - " descriptor = Object.getOwnPropertyDescriptor(func3, 'prototype');" |
| - " return (descriptor['writable'] == false) &&" |
| - " (descriptor['enumerable'] == true) &&" |
| - " (descriptor['configurable'] == true);" |
| - "})()")->BooleanValue()); |
| - |
| - Local<v8::FunctionTemplate> t4 = v8::FunctionTemplate::New(); |
| - t4->SetPrototypeAttributes(v8::ReadOnly | v8::DontEnum | v8::DontDelete); |
| - context->Global()->Set(v8_str("func4"), t4->GetFunction()); |
| - CHECK(CompileRun( |
| - "(function() {" |
| - " descriptor = Object.getOwnPropertyDescriptor(func4, 'prototype');" |
| - " return (descriptor['writable'] == false) &&" |
| - " (descriptor['enumerable'] == false) &&" |
| - " (descriptor['configurable'] == false);" |
| + " return (descriptor['writable'] == true);" |
| "})()")->BooleanValue()); |
| + CHECK_EQ(42, CompileRun("func2.prototype.x")->Int32Value()); |
|
Rico
2011/07/25 13:05:42
We could also add a check that when we actually wr
Jakob Kummerow
2011/07/25 14:57:05
Done.
|
| } |