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

Unified Diff: test/cctest/test-api.cc

Issue 1218123003: Revert of [strong] Add tests for loading from proxy, super, with access checks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | test/mjsunit/strong/load-builtins.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 03968871f389bac54139c1041851de87d98bf5d7..1433b7bed6b86a6a1a664818e34bb47c786618de 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -21424,164 +21424,6 @@
}
-static bool access_was_called = false;
-
-
-static bool AccessAlwaysAllowedWithFlag(Local<v8::Object> global,
- Local<Value> name, v8::AccessType type,
- Local<Value> data) {
- access_was_called = true;
- return true;
-}
-
-
-static bool AccessAlwaysBlockedWithFlag(Local<v8::Object> global,
- Local<Value> name, v8::AccessType type,
- Local<Value> data) {
- access_was_called = true;
- return false;
-}
-
-
-TEST(StrongModeAccessCheckAllowed) {
- i::FLAG_strong_mode = true;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope handle_scope(isolate);
- v8::Handle<Value> value;
- access_was_called = false;
-
- v8::Handle<v8::ObjectTemplate> obj_template =
- v8::ObjectTemplate::New(isolate);
-
- obj_template->Set(v8_str("x"), v8::Integer::New(isolate, 42));
- obj_template->SetAccessCheckCallbacks(AccessAlwaysAllowedWithFlag, NULL);
-
- // Create an environment
- v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template);
- context0->Enter();
- v8::Handle<v8::Object> global0 = context0->Global();
- global0->Set(v8_str("object"), obj_template->NewInstance());
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.x");
- CHECK(!try_catch.HasCaught());
- CHECK(!access_was_called);
- CHECK_EQ(42, value->Int32Value());
- }
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.foo");
- CHECK(try_catch.HasCaught());
- CHECK(!access_was_called);
- }
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object[10]");
- CHECK(try_catch.HasCaught());
- CHECK(!access_was_called);
- }
-
- // Create an environment
- v8::Local<Context> context1 = Context::New(isolate);
- context1->Enter();
- v8::Handle<v8::Object> global1 = context1->Global();
- global1->Set(v8_str("object"), obj_template->NewInstance());
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.x");
- CHECK(!try_catch.HasCaught());
- CHECK(access_was_called);
- CHECK_EQ(42, value->Int32Value());
- }
- access_was_called = false;
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.foo");
- CHECK(try_catch.HasCaught());
- CHECK(access_was_called);
- }
- access_was_called = false;
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object[10]");
- CHECK(try_catch.HasCaught());
- CHECK(access_was_called);
- }
-
- context1->Exit();
- context0->Exit();
-}
-
-
-TEST(StrongModeAccessCheckBlocked) {
- i::FLAG_strong_mode = true;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope handle_scope(isolate);
- v8::Handle<Value> value;
- access_was_called = false;
-
- v8::Handle<v8::ObjectTemplate> obj_template =
- v8::ObjectTemplate::New(isolate);
-
- obj_template->Set(v8_str("x"), v8::Integer::New(isolate, 42));
- obj_template->SetAccessCheckCallbacks(AccessAlwaysBlockedWithFlag, NULL);
-
- // Create an environment
- v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template);
- context0->Enter();
- v8::Handle<v8::Object> global0 = context0->Global();
- global0->Set(v8_str("object"), obj_template->NewInstance());
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.x");
- CHECK(!try_catch.HasCaught());
- CHECK(!access_was_called);
- CHECK_EQ(42, value->Int32Value());
- }
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.foo");
- CHECK(try_catch.HasCaught());
- CHECK(!access_was_called);
- }
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object[10]");
- CHECK(try_catch.HasCaught());
- CHECK(!access_was_called);
- }
-
- // Create an environment
- v8::Local<Context> context1 = Context::New(isolate);
- context1->Enter();
- v8::Handle<v8::Object> global1 = context1->Global();
- global1->Set(v8_str("object"), obj_template->NewInstance());
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.x");
- CHECK(try_catch.HasCaught());
- CHECK(access_was_called);
- }
- access_was_called = false;
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object.foo");
- CHECK(try_catch.HasCaught());
- CHECK(access_was_called);
- }
- access_was_called = false;
- {
- v8::TryCatch try_catch(isolate);
- value = CompileRun("'use strong'; object[10]");
- CHECK(try_catch.HasCaught());
- CHECK(access_was_called);
- }
-
- context1->Exit();
- context0->Exit();
-}
-
-
TEST(StrongModeArityCallFromApi) {
i::FLAG_strong_mode = true;
LocalContext env;
« no previous file with comments | « no previous file | test/mjsunit/strong/load-builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698