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

Unified Diff: test/cctest/test-object-observe.cc

Issue 118523003: More API cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback Created 7 years 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-heap-profiler.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-object-observe.cc
diff --git a/test/cctest/test-object-observe.cc b/test/cctest/test-object-observe.cc
index 26afa51e64ba4df03621987acbb28ac50aa92aea..8e927b0b4f1d8ad06776af4cf5b8b60156f148e5 100644
--- a/test/cctest/test-object-observe.cc
+++ b/test/cctest/test-object-observe.cc
@@ -332,27 +332,30 @@ static void ExpectRecords(v8::Isolate* isolate,
TEST(APITestBasicMutation) {
HarmonyIsolate isolate;
- HandleScope scope(isolate.GetIsolate());
- LocalContext context(isolate.GetIsolate());
+ v8::Isolate* v8_isolate = isolate.GetIsolate();
+ HandleScope scope(v8_isolate);
+ LocalContext context(v8_isolate);
Handle<Object> obj = Handle<Object>::Cast(CompileRun(
"var records = [];"
"var obj = {};"
"function observer(r) { [].push.apply(records, r); };"
"Object.observe(obj, observer);"
"obj"));
- obj->Set(String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(7));
- obj->Set(1, Number::New(2));
+ obj->Set(String::NewFromUtf8(v8_isolate, "foo"),
+ Number::New(v8_isolate, 7));
+ obj->Set(1, Number::New(v8_isolate, 2));
// ForceSet should work just as well as Set
- obj->ForceSet(String::NewFromUtf8(isolate.GetIsolate(), "foo"),
- Number::New(3));
- obj->ForceSet(Number::New(1), Number::New(4));
+ obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"),
+ Number::New(v8_isolate, 3));
+ obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4));
// Setting an indexed element via the property setting method
- obj->Set(Number::New(1), Number::New(5));
+ obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5));
// Setting with a non-String, non-uint32 key
- obj->Set(Number::New(1.1), Number::New(6), DontDelete);
- obj->Delete(String::NewFromUtf8(isolate.GetIsolate(), "foo"));
+ obj->Set(Number::New(v8_isolate, 1.1),
+ Number::New(v8_isolate, 6), DontDelete);
+ obj->Delete(String::NewFromUtf8(v8_isolate, "foo"));
obj->Delete(1);
- obj->ForceDelete(Number::New(1.1));
+ obj->ForceDelete(Number::New(v8_isolate, 1.1));
// Force delivery
// TODO(adamk): Should the above set methods trigger delivery themselves?
@@ -363,13 +366,13 @@ TEST(APITestBasicMutation) {
{ obj, "add", "1", Handle<Value>() },
// Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler bug
// where instead of 1.0, a garbage value would be passed into Number::New.
- { obj, "update", "foo", Number::New(7) },
- { obj, "update", "1", Number::New(2) },
- { obj, "update", "1", Number::New(4) },
+ { obj, "update", "foo", Number::New(v8_isolate, 7) },
+ { obj, "update", "1", Number::New(v8_isolate, 2) },
+ { obj, "update", "1", Number::New(v8_isolate, 4) },
{ obj, "add", "1.1", Handle<Value>() },
- { obj, "delete", "foo", Number::New(3) },
- { obj, "delete", "1", Number::New(5) },
- { obj, "delete", "1.1", Number::New(6) }
+ { obj, "delete", "foo", Number::New(v8_isolate, 3) },
+ { obj, "delete", "1", Number::New(v8_isolate, 5) },
+ { obj, "delete", "1.1", Number::New(v8_isolate, 6) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
}
@@ -377,17 +380,18 @@ TEST(APITestBasicMutation) {
TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate;
- HandleScope scope(isolate.GetIsolate());
- LocalContext context(isolate.GetIsolate());
- Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate());
+ v8::Isolate* v8_isolate = isolate.GetIsolate();
+ HandleScope scope(v8_isolate);
+ LocalContext context(v8_isolate);
+ Handle<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate);
tmpl->SetHiddenPrototype(true);
tmpl->InstanceTemplate()->Set(
- String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75));
+ String::NewFromUtf8(v8_isolate, "foo"), Number::New(v8_isolate, 75));
Handle<Object> proto = tmpl->GetFunction()->NewInstance();
- Handle<Object> obj = Object::New();
+ Handle<Object> obj = Object::New(v8_isolate);
obj->SetPrototype(proto);
- context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
- context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"),
+ context->Global()->Set(String::NewFromUtf8(v8_isolate, "obj"), obj);
+ context->Global()->Set(String::NewFromUtf8(v8_isolate, "proto"),
proto);
CompileRun(
"var records;"
@@ -396,10 +400,10 @@ TEST(HiddenPrototypeObservation) {
"obj.foo = 41;" // triggers a notification
"proto.foo = 42;"); // does not trigger a notification
const RecordExpectation expected_records[] = {
- { obj, "update", "foo", Number::New(75) }
+ { obj, "update", "foo", Number::New(v8_isolate, 75) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
- obj->SetPrototype(Null(isolate.GetIsolate()));
+ obj->SetPrototype(Null(v8_isolate));
CompileRun("obj.foo = 43");
const RecordExpectation expected_records2[] = {
{ obj, "add", "foo", Handle<Value>() }
@@ -561,7 +565,8 @@ TEST(NamedAccessCheck) {
{ instance, "add", "foo", Handle<Value>() },
{ instance, "update", "foo",
String::NewFromUtf8(isolate.GetIsolate(), "bar") },
- { instance, "reconfigure", "foo", Number::New(5) },
+ { instance, "reconfigure", "foo",
+ Number::New(isolate.GetIsolate(), 5) },
{ instance, "add", "bar", Handle<Value>() },
{ obj_no_check, "add", "baz", Handle<Value>() },
};
@@ -585,7 +590,7 @@ TEST(IndexedAccessCheck) {
g_access_block_type = types[i];
Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed,
- IndexedAccessAllowUnlessBlocked, Number::New(7));
+ IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 7));
CompileRun("var records = null;"
"var objNoCheck = {};"
"var observer = function(r) { records = r };"
@@ -612,7 +617,7 @@ TEST(IndexedAccessCheck) {
{ instance, "add", "7", Handle<Value>() },
{ instance, "update", "7",
String::NewFromUtf8(isolate.GetIsolate(), "foo") },
- { instance, "reconfigure", "7", Number::New(5) },
+ { instance, "reconfigure", "7", Number::New(isolate.GetIsolate(), 5) },
{ instance, "add", "8", Handle<Value>() },
{ obj_no_check, "add", "42", Handle<Value>() }
};
@@ -634,7 +639,7 @@ TEST(SpliceAccessCheck) {
g_access_block_type = ACCESS_GET;
Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed,
- IndexedAccessAllowUnlessBlocked, Number::New(1));
+ IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 1));
CompileRun("var records = null;"
"obj[1] = 'foo';"
"obj.length = 2;"
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698