| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 v8::Handle<v8::Array> result = | 123 v8::Handle<v8::Array> result = |
| 124 v8::Array::New(args.GetIsolate(), args.Length()); | 124 v8::Array::New(args.GetIsolate(), args.Length()); |
| 125 for (int i = 0; i < args.Length(); i++) { | 125 for (int i = 0; i < args.Length(); i++) { |
| 126 result->Set(v8::Integer::New(args.GetIsolate(), i), args[i]); | 126 result->Set(v8::Integer::New(args.GetIsolate(), i), args[i]); |
| 127 } | 127 } |
| 128 args.GetReturnValue().Set(result); | 128 args.GetReturnValue().Set(result); |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 // Tests that call v8::V8::Dispose() cannot be threaded. | 132 // Tests that call v8::V8::Dispose() cannot be threaded. |
| 133 TEST(InitializeAndDisposeOnce) { | 133 UNINITIALIZED_TEST(InitializeAndDisposeOnce) { |
| 134 CHECK(v8::V8::Initialize()); | 134 CHECK(v8::V8::Initialize()); |
| 135 CHECK(v8::V8::Dispose()); | 135 CHECK(v8::V8::Dispose()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 // Tests that call v8::V8::Dispose() cannot be threaded. | 139 // Tests that call v8::V8::Dispose() cannot be threaded. |
| 140 TEST(InitializeAndDisposeMultiple) { | 140 UNINITIALIZED_TEST(InitializeAndDisposeMultiple) { |
| 141 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); | 141 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); |
| 142 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize()); | 142 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize()); |
| 143 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); | 143 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); |
| 144 // TODO(mstarzinger): This should fail gracefully instead of asserting. | 144 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize()); |
| 145 // for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize()); | |
| 146 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); | 145 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); |
| 147 } | 146 } |
| 148 | 147 |
| 149 | 148 |
| 150 THREADED_TEST(Handles) { | 149 THREADED_TEST(Handles) { |
| 151 v8::HandleScope scope(CcTest::isolate()); | 150 v8::HandleScope scope(CcTest::isolate()); |
| 152 Local<Context> local_env; | 151 Local<Context> local_env; |
| 153 { | 152 { |
| 154 LocalContext env; | 153 LocalContext env; |
| 155 local_env = env.local(); | 154 local_env = env.local(); |
| (...skipping 22838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22994 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22993 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
| 22995 Local<Function> set = | 22994 Local<Function> set = |
| 22996 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22995 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
| 22997 Local<Function> get = | 22996 Local<Function> get = |
| 22998 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22997 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
| 22999 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22998 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
| 23000 Handle<Value> args[] = { v8_num(14) }; | 22999 Handle<Value> args[] = { v8_num(14) }; |
| 23001 set->Call(x, 1, args); | 23000 set->Call(x, 1, args); |
| 23002 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 23001 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
| 23003 } | 23002 } |
| OLD | NEW |