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

Unified Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2891123002: [Extensions Bindings] Handle updating context permissions (Closed)
Patch Set: jbroman's Created 3 years, 7 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 | « extensions/renderer/api_bindings_system.cc ('k') | extensions/renderer/declarative_event_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_bindings_system_unittest.cc
diff --git a/extensions/renderer/api_bindings_system_unittest.cc b/extensions/renderer/api_bindings_system_unittest.cc
index ca35c5b85c3aabd4ec418694acd4aa893ca9666f..d4da67c3fc0ca4080b085a42f23a3c861582d311 100644
--- a/extensions/renderer/api_bindings_system_unittest.cc
+++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -91,7 +91,7 @@ const char kGammaAPISpec[] =
" }]"
"}";
-bool AllowAllAPIs(const std::string& name) {
+bool AllowAllAPIs(v8::Local<v8::Context> context, const std::string& name) {
return true;
}
@@ -115,6 +115,7 @@ void APIBindingsSystemTest::SetUp() {
base::Bind(&RunFunctionOnGlobalAndIgnoreResult),
base::Bind(&RunFunctionOnGlobalAndReturnHandle),
base::Bind(&APIBindingsSystemTest::GetAPISchema, base::Unretained(this)),
+ base::Bind(&AllowAllAPIs),
base::Bind(&APIBindingsSystemTest::OnAPIRequest, base::Unretained(this)),
base::Bind(&APIBindingsSystemTest::OnEventListenersChanged,
base::Unretained(this)),
@@ -205,11 +206,11 @@ TEST_F(APIBindingsSystemTest, TestInitializationAndCallbacks) {
v8::HandleScope handle_scope(isolate());
v8::Local<v8::Context> context = MainContext();
- v8::Local<v8::Object> alpha_api = bindings_system()->CreateAPIInstance(
- kAlphaAPIName, context, base::Bind(&AllowAllAPIs), nullptr);
+ v8::Local<v8::Object> alpha_api =
+ bindings_system()->CreateAPIInstance(kAlphaAPIName, context, nullptr);
ASSERT_FALSE(alpha_api.IsEmpty());
- v8::Local<v8::Object> beta_api = bindings_system()->CreateAPIInstance(
- kBetaAPIName, context, base::Bind(&AllowAllAPIs), nullptr);
+ v8::Local<v8::Object> beta_api =
+ bindings_system()->CreateAPIInstance(kBetaAPIName, context, nullptr);
ASSERT_FALSE(beta_api.IsEmpty());
{
@@ -339,8 +340,8 @@ TEST_F(APIBindingsSystemTest, TestCustomHooks) {
bindings_system()->GetHooksForAPI(kAlphaAPIName);
binding_hooks->SetDelegate(std::move(test_hooks));
- v8::Local<v8::Object> alpha_api = bindings_system()->CreateAPIInstance(
- kAlphaAPIName, context, base::Bind(&AllowAllAPIs), nullptr);
+ v8::Local<v8::Object> alpha_api =
+ bindings_system()->CreateAPIInstance(kAlphaAPIName, context, nullptr);
ASSERT_FALSE(alpha_api.IsEmpty());
{
@@ -377,8 +378,8 @@ TEST_F(APIBindingsSystemTest, TestSetCustomCallback) {
"})";
APIBindingHooks* hooks = nullptr;
- v8::Local<v8::Object> alpha_api = bindings_system()->CreateAPIInstance(
- kAlphaAPIName, context, base::Bind(&AllowAllAPIs), &hooks);
+ v8::Local<v8::Object> alpha_api =
+ bindings_system()->CreateAPIInstance(kAlphaAPIName, context, &hooks);
ASSERT_FALSE(alpha_api.IsEmpty());
ASSERT_TRUE(hooks);
v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context);
@@ -420,8 +421,8 @@ TEST_F(APIBindingsSystemTest, CrossAPIReferences) {
// Instantiate gamma API. Note: It's important that we haven't instantiated
// alpha API yet, since this tests that we can lazily populate the type
// information.
- v8::Local<v8::Object> gamma_api = bindings_system()->CreateAPIInstance(
- kGammaAPIName, context, base::Bind(&AllowAllAPIs), nullptr);
+ v8::Local<v8::Object> gamma_api =
+ bindings_system()->CreateAPIInstance(kGammaAPIName, context, nullptr);
ASSERT_FALSE(gamma_api.IsEmpty());
{
@@ -454,8 +455,8 @@ TEST_F(APIBindingsSystemTest, TestCustomEvent) {
bindings_system()->GetHooksForAPI(kAlphaAPIName);
binding_hooks->SetDelegate(std::move(test_hooks));
- v8::Local<v8::Object> api = bindings_system()->CreateAPIInstance(
- kAlphaAPIName, context, base::Bind(&AllowAllAPIs), nullptr);
+ v8::Local<v8::Object> api =
+ bindings_system()->CreateAPIInstance(kAlphaAPIName, context, nullptr);
v8::Local<v8::Value> event =
GetPropertyFromObject(api, context, "alphaEvent");
« no previous file with comments | « extensions/renderer/api_bindings_system.cc ('k') | extensions/renderer/declarative_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698