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

Unified Diff: extensions/renderer/api_test_base.cc

Issue 2405093003: [WIP] Mojo native bindings interface.
Patch Set: cleanup 2 Created 4 years, 2 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
Index: extensions/renderer/api_test_base.cc
diff --git a/extensions/renderer/api_test_base.cc b/extensions/renderer/api_test_base.cc
index bbffee98c7dea4bf43489e5f6f336e61308af0aa..b51b503fb953d9ab6af616b22d65bbbb5e1467c9 100644
--- a/extensions/renderer/api_test_base.cc
+++ b/extensions/renderer/api_test_base.cc
@@ -16,15 +16,25 @@
#include "extensions/renderer/process_info_native_handler.h"
#include "gin/converter.h"
#include "gin/dictionary.h"
-#include "mojo/edk/js/core.h"
-#include "mojo/edk/js/handle.h"
-#include "mojo/edk/js/support.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/system/core.h"
+#include "third_party/WebKit/public/web/WebMojoBindings.h"
+
+namespace gin {
+template <>
+struct Converter<mojo::Handle> {
+ static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, mojo::Handle val) {
+ return blink::WebMojoBindings::wrap(isolate->GetCurrentContext(),
+ mojo::MakeScopedHandle(val));
+ }
+};
+} // namespace gin
namespace extensions {
namespace {
+const char kMojoModuleNameCore[] = "mojo/public/js/core";
+const char kMojoModuleNameFrameInterfaces[] =
+ "content/public/renderer/frame_interfaces";
+
// Natives for the implementation of the unit test version of chrome.test. Calls
// the provided |quit_closure| when either notifyPass or notifyFail is called.
class TestNatives : public gin::Wrappable<TestNatives> {
@@ -154,17 +164,14 @@ void ApiTestEnvironment::RegisterModules() {
"exports.$set('MatchAgainstEventFilter', function() { return [] });");
gin::ModuleRegistry::From(env()->context()->v8_context())
- ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName,
- mojo::edk::js::Core::GetModule(env()->isolate()));
- gin::ModuleRegistry::From(env()->context()->v8_context())
- ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName,
- mojo::edk::js::Support::GetModule(env()->isolate()));
+ ->AddBuiltinModule(
+ env()->isolate(), kMojoModuleNameCore,
+ blink::WebMojoBindings::create(env()->context()->v8_context()));
gin::Handle<TestInterfaceProvider> interface_provider =
TestInterfaceProvider::Create(env()->isolate());
interface_provider_ = interface_provider.get();
gin::ModuleRegistry::From(env()->context()->v8_context())
- ->AddBuiltinModule(env()->isolate(),
- "content/public/renderer/frame_interfaces",
+ ->AddBuiltinModule(env()->isolate(), kMojoModuleNameFrameInterfaces,
interface_provider.ToV8());
}

Powered by Google App Engine
This is Rietveld 408576698