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 21603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21614 } | 21614 } |
21615 | 21615 |
21616 | 21616 |
21617 TEST(ExtrasExportsObject) { | 21617 TEST(ExtrasExportsObject) { |
21618 v8::Isolate* isolate = CcTest::isolate(); | 21618 v8::Isolate* isolate = CcTest::isolate(); |
21619 v8::HandleScope handle_scope(isolate); | 21619 v8::HandleScope handle_scope(isolate); |
21620 LocalContext env; | 21620 LocalContext env; |
21621 | 21621 |
21622 // standalone.gypi ensures we include the test-extra.js file, which should | 21622 // standalone.gypi ensures we include the test-extra.js file, which should |
21623 // export the tested functions. | 21623 // export the tested functions. |
21624 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); | 21624 v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); |
21625 | 21625 |
21626 auto func = | 21626 auto func = |
21627 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); | 21627 binding->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); |
21628 auto undefined = v8::Undefined(isolate); | 21628 auto undefined = v8::Undefined(isolate); |
21629 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); | 21629 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); |
21630 CHECK_EQ(5, result->Int32Value()); | 21630 CHECK_EQ(5, result->Int32Value()); |
21631 | 21631 |
21632 v8::Handle<v8::FunctionTemplate> runtimeFunction = | 21632 v8::Handle<v8::FunctionTemplate> runtimeFunction = |
21633 v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction); | 21633 v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction); |
21634 exports->Set(v8_str("runtime"), runtimeFunction->GetFunction()); | 21634 binding->Set(v8_str("runtime"), runtimeFunction->GetFunction()); |
21635 func = | 21635 func = |
21636 exports->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>(); | 21636 binding->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>(); |
21637 result = func->Call(undefined, 0, {}).As<v8::Number>(); | 21637 result = func->Call(undefined, 0, {}).As<v8::Number>(); |
21638 CHECK_EQ(7, result->Int32Value()); | 21638 CHECK_EQ(7, result->Int32Value()); |
21639 } | 21639 } |
21640 | 21640 |
21641 | 21641 |
21642 TEST(Map) { | 21642 TEST(Map) { |
21643 v8::Isolate* isolate = CcTest::isolate(); | 21643 v8::Isolate* isolate = CcTest::isolate(); |
21644 v8::HandleScope handle_scope(isolate); | 21644 v8::HandleScope handle_scope(isolate); |
21645 LocalContext env; | 21645 LocalContext env; |
21646 | 21646 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21811 CHECK(try_catch.HasTerminated()); | 21811 CHECK(try_catch.HasTerminated()); |
21812 } | 21812 } |
21813 | 21813 |
21814 | 21814 |
21815 TEST(EstimatedContextSize) { | 21815 TEST(EstimatedContextSize) { |
21816 v8::Isolate* isolate = CcTest::isolate(); | 21816 v8::Isolate* isolate = CcTest::isolate(); |
21817 v8::HandleScope scope(isolate); | 21817 v8::HandleScope scope(isolate); |
21818 LocalContext env; | 21818 LocalContext env; |
21819 CHECK(50000 < env->EstimatedSize()); | 21819 CHECK(50000 < env->EstimatedSize()); |
21820 } | 21820 } |
OLD | NEW |