Commit bd822cb7 authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

mojo: Fix compiled bindings to expose the interface's namespace

Also adds more tests for compiled bindings

Bug: 968369
Change-Id: I66c3de4f35f13ef73b9fa540d4901b3bec5c0eb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696861Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676663}
parent c01e3a34
......@@ -13,6 +13,19 @@ mojom("test_mojom") {
"module_b_1.test-mojom",
"module_b_2.test-mojom",
]
use_old_js_lite_bindings_names = false
}
mojom("test_old_names_mojom") {
testonly = true
sources = [
"module_a_old_names.test-mojom",
"module_b_1_old_names.test-mojom",
"module_b_2_old_names.test-mojom",
]
use_old_js_lite_bindings_names = true
}
if (enable_mojom_closure_compile || closure_compile) {
......@@ -22,6 +35,7 @@ if (enable_mojom_closure_compile || closure_compile) {
]
deps = [
":test_mojom_js_library_for_compile",
":test_old_names_mojom_js_library_for_compile",
]
}
......@@ -32,6 +46,7 @@ if (enable_mojom_closure_compile || closure_compile) {
deps = [
":compile_test_sources",
":test_mojom_js_library_for_compile",
":test_old_names_mojom_js_library_for_compile",
]
closure_flags = strict_error_checking_closure_args + [
"compilation_level=ADVANCED_OPTIMIZATIONS",
......
......@@ -2,8 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
goog.require('moduleB.TestInterface');
goog.require('moduleBOldNames.TestInterface');
goog.require('moduleB.TestInterfaceRemote');
// This is not expected to do anything useful, but it must compile.
const proxy = moduleB.TestInterface.getProxy();
const proxy = moduleBOldNames.TestInterface.getProxy();
proxy.passA1({'q': '', 'r': '', 's': ''});
// This is not expected to do anything useful, but it must compile.
const remote = moduleB.TestInterface.getRemote();
remote.passA1({'q': '', 'r': '', 's': ''});
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module module_a_old_names;
struct TestStructA1 {
string q;
string r;
string s;
};
struct TestStructA2 {
enum NestedEnum {
A,
B,
};
TestStructA1 ax;
TestStructA1 ay;
NestedEnum enumField;
};
enum ModuleEnum {
THIRD,
};
interface ParentInterface {
enum NestedEnum {
FIRST,
SECOND,
};
SomeMethod(NestedEnum value);
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module module_b_old_names;
struct TestStructB1 {
int32 x;
int32 y;
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module module_b_old_names;
import "mojo/public/js/test/module_a_old_names.test-mojom";
import "mojo/public/js/test/module_b_1_old_names.test-mojom";
struct TestStructB2 {
module_a_old_names.TestStructA1 a1;
module_a_old_names.TestStructA2 a2;
TestStructB2 b2;
};
interface TestInterface {
PassA1(module_a_old_names.TestStructA1 a1);
PassB1(TestStructB1 b1);
PassB2(TestStructB2 b2);
};
......@@ -18,6 +18,9 @@
{% endmacro %}
{% if generate_closure_exports -%}
{% if not use_old_names -%}
goog.provide('{{module.namespace}}.{{interface.name}}');
{% endif %}
goog.provide('{{module.namespace}}.{{interface.name}}{{primitives_names.receiver}}');
goog.provide('{{module.namespace}}.{{interface.name}}CallbackRouter');
goog.provide('{{module.namespace}}.{{interface.name}}Interface');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment