Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1363)

Unified Diff: test/cctest/test-unscopables-hidden-prototype.cc

Issue 1331013003: Continuing removing deprecated functions from cctests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Continuing removing deprecated functions from cctest Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-unique.cc ('k') | test/cctest/test-utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-unscopables-hidden-prototype.cc
diff --git a/test/cctest/test-unscopables-hidden-prototype.cc b/test/cctest/test-unscopables-hidden-prototype.cc
index aef2ccf288c960de04c3a38687e451952f3e5ad2..acfc4266ae992df521840358da2106095b1c4e65 100644
--- a/test/cctest/test-unscopables-hidden-prototype.cc
+++ b/test/cctest/test-unscopables-hidden-prototype.cc
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(mythria): Remove this after this flag is turned on globally
+#define V8_IMMINENT_DEPRECATION_WARNINGS
+
#include <stdlib.h>
#include "src/v8.h"
@@ -23,81 +26,98 @@ TEST(Unscopables) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> current_context = isolate->GetCurrentContext();
v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
t1->SetHiddenPrototype(true);
- v8::Local<v8::Object> object = t0->GetFunction()->NewInstance();
- v8::Local<v8::Object> hidden_prototype = t1->GetFunction()->NewInstance();
-
- object->SetPrototype(hidden_prototype);
-
- context->Global()->Set(v8_str("object"), object);
- context->Global()->Set(v8_str("hidden_prototype"), hidden_prototype);
-
- CHECK_EQ(1, CompileRun(
- "var result;"
- "var x = 0;"
- "object.x = 1;"
- "with (object) {"
- " result = x;"
- "}"
- "result")->Int32Value());
+ v8::Local<v8::Object> object = t0->GetFunction(current_context)
+ .ToLocalChecked()
+ ->NewInstance(current_context)
+ .ToLocalChecked();
+ v8::Local<v8::Object> hidden_prototype = t1->GetFunction(current_context)
+ .ToLocalChecked()
+ ->NewInstance(current_context)
+ .ToLocalChecked();
+
+ CHECK(object->SetPrototype(current_context, hidden_prototype).FromJust());
+
+ context->Global()
+ ->Set(current_context, v8_str("object"), object)
+ .FromMaybe(false);
+ context->Global()
+ ->Set(current_context, v8_str("hidden_prototype"), hidden_prototype)
+ .FromMaybe(false);
+
+ CHECK_EQ(1, CompileRun("var result;"
+ "var x = 0;"
+ "object.x = 1;"
+ "with (object) {"
+ " result = x;"
+ "}"
+ "result")
+ ->Int32Value(current_context)
+ .FromJust());
Cleanup();
- CHECK_EQ(2, CompileRun(
- "var result;"
- "var x = 0;"
- "hidden_prototype.x = 2;"
- "with (object) {"
- " result = x;"
- "}"
- "result")->Int32Value());
+ CHECK_EQ(2, CompileRun("var result;"
+ "var x = 0;"
+ "hidden_prototype.x = 2;"
+ "with (object) {"
+ " result = x;"
+ "}"
+ "result")
+ ->Int32Value(current_context)
+ .FromJust());
Cleanup();
- CHECK_EQ(0, CompileRun(
- "var result;"
- "var x = 0;"
- "object.x = 3;"
- "object[Symbol.unscopables] = {x: true};"
- "with (object) {"
- " result = x;"
- "}"
- "result")->Int32Value());
+ CHECK_EQ(0, CompileRun("var result;"
+ "var x = 0;"
+ "object.x = 3;"
+ "object[Symbol.unscopables] = {x: true};"
+ "with (object) {"
+ " result = x;"
+ "}"
+ "result")
+ ->Int32Value(current_context)
+ .FromJust());
Cleanup();
- CHECK_EQ(0, CompileRun(
- "var result;"
- "var x = 0;"
- "hidden_prototype.x = 4;"
- "hidden_prototype[Symbol.unscopables] = {x: true};"
- "with (object) {"
- " result = x;"
- "}"
- "result")->Int32Value());
+ CHECK_EQ(0, CompileRun("var result;"
+ "var x = 0;"
+ "hidden_prototype.x = 4;"
+ "hidden_prototype[Symbol.unscopables] = {x: true};"
+ "with (object) {"
+ " result = x;"
+ "}"
+ "result")
+ ->Int32Value(current_context)
+ .FromJust());
Cleanup();
- CHECK_EQ(0, CompileRun(
- "var result;"
- "var x = 0;"
- "object.x = 5;"
- "hidden_prototype[Symbol.unscopables] = {x: true};"
- "with (object) {"
- " result = x;"
- "}"
- "result;")->Int32Value());
+ CHECK_EQ(0, CompileRun("var result;"
+ "var x = 0;"
+ "object.x = 5;"
+ "hidden_prototype[Symbol.unscopables] = {x: true};"
+ "with (object) {"
+ " result = x;"
+ "}"
+ "result;")
+ ->Int32Value(current_context)
+ .FromJust());
Cleanup();
- CHECK_EQ(0, CompileRun(
- "var result;"
- "var x = 0;"
- "hidden_prototype.x = 6;"
- "object[Symbol.unscopables] = {x: true};"
- "with (object) {"
- " result = x;"
- "}"
- "result")->Int32Value());
+ CHECK_EQ(0, CompileRun("var result;"
+ "var x = 0;"
+ "hidden_prototype.x = 6;"
+ "object[Symbol.unscopables] = {x: true};"
+ "with (object) {"
+ " result = x;"
+ "}"
+ "result")
+ ->Int32Value(current_context)
+ .FromJust());
}
}
« no previous file with comments | « test/cctest/test-unique.cc ('k') | test/cctest/test-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698