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

Side by Side Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2894923003: [Extensions Bindings] Include request id in a custom callback response (Closed)
Patch Set: really fix Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/api_bindings_system.h" 5 #include "extensions/renderer/api_bindings_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 EXPECT_EQ(ReplaceSingleQuotes(kResponseArgsJson), 289 EXPECT_EQ(ReplaceSingleQuotes(kResponseArgsJson),
290 GetStringPropertyFromObject(context->Global(), context, 290 GetStringPropertyFromObject(context->Global(), context,
291 "eventArguments")); 291 "eventArguments"));
292 } 292 }
293 293
294 { 294 {
295 // Test a call -> response on the second API. 295 // Test a call -> response on the second API.
296 const char kTestCall[] = "obj.simpleFunc(2)"; 296 const char kTestCall[] = "obj.simpleFunc(2)";
297 CallFunctionOnObject(context, beta_api, kTestCall); 297 CallFunctionOnObject(context, beta_api, kTestCall);
298 ValidateLastRequest("beta.simpleFunc", "[2]"); 298 ValidateLastRequest("beta.simpleFunc", "[2]");
299 EXPECT_EQ(-1, last_request()->request_id);
300 reset_last_request(); 299 reset_last_request();
301 } 300 }
302 } 301 }
303 302
304 // Tests adding a custom hook to an API. 303 // Tests adding a custom hook to an API.
305 TEST_F(APIBindingsSystemTest, TestCustomHooks) { 304 TEST_F(APIBindingsSystemTest, TestCustomHooks) {
306 v8::HandleScope handle_scope(isolate()); 305 v8::HandleScope handle_scope(isolate());
307 v8::Local<v8::Context> context = MainContext(); 306 v8::Local<v8::Context> context = MainContext();
308 307
309 bool did_call = false; 308 bool did_call = false;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 v8::Local<v8::Value> other_event = 469 v8::Local<v8::Value> other_event =
471 GetPropertyFromObject(api, context, "alphaOtherEvent"); 470 GetPropertyFromObject(api, context, "alphaOtherEvent");
472 ASSERT_TRUE(other_event->IsObject()); 471 ASSERT_TRUE(other_event->IsObject());
473 EXPECT_EQ("\"alpha.alphaOtherEvent\"", 472 EXPECT_EQ("\"alpha.alphaOtherEvent\"",
474 GetStringPropertyFromObject(other_event.As<v8::Object>(), context, 473 GetStringPropertyFromObject(other_event.As<v8::Object>(), context,
475 "name")); 474 "name"));
476 EXPECT_NE(event, other_event); 475 EXPECT_NE(event, other_event);
477 } 476 }
478 477
479 } // namespace extensions 478 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/page_capture_custom_bindings.js ('k') | extensions/renderer/api_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698