Rename MojoLayoutTestHelper to MojoWebTestHelper
mojo_layouttest_test.mojom is renamed to
mojo_web_test_helper_test.mojom. It keeps _test suffix indicating it
affects only tests.
Bug: 843412
Change-Id: Iddfdfcbfd87228fb9ee8abd2777f4838c4b66801
Reviewed-on: https://chromium-review.googlesource.com/c/1362717
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614302}
diff --git a/BUILD.gn b/BUILD.gn
index a22dc57..dc26b7d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -979,7 +979,7 @@
":layout_test_data_mojo_bindings",
":layout_test_data_mojo_bindings_lite",
"//content/shell:content_shell",
- "//content/test:mojo_layouttest_bindings_js_data_deps",
+ "//content/test:mojo_web_test_bindings_js_data_deps",
"//device/bluetooth/public/mojom:fake_bluetooth_interfaces_js_data_deps",
"//device/usb/public/mojom:mojom_js_data_deps",
"//device/vr/public/mojom:mojom_js_data_deps",
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
index a547dfe..95f45380 100644
--- a/content/shell/BUILD.gn
+++ b/content/shell/BUILD.gn
@@ -291,7 +291,7 @@
"//content/shell/test_runner:test_runner",
"//content/test:content_test_mojo_bindings",
"//content/test:layouttest_support",
- "//content/test:mojo_layouttest_bindings",
+ "//content/test:mojo_web_test_bindings",
"//content/test:test_support",
"//device/bluetooth",
"//device/bluetooth:fake_bluetooth",
diff --git a/content/shell/browser/content_shell_browser_manifest_overlay.json b/content/shell/browser/content_shell_browser_manifest_overlay.json
index 98f8dd0..48bf90c 100644
--- a/content/shell/browser/content_shell_browser_manifest_overlay.json
+++ b/content/shell/browser/content_shell_browser_manifest_overlay.json
@@ -4,7 +4,7 @@
"service_manager:connector": {
"provides": {
"renderer": [
- "content.mojom.MojoLayoutTestHelper",
+ "content.mojom.MojoWebTestHelper",
"content.mojom.FakeBluetoothChooser",
"content.mojom.WebTestBluetoothFakeAdapterSetter",
"bluetooth.mojom.FakeBluetooth"
@@ -21,7 +21,7 @@
"navigation:frame": {
"provides": {
"renderer": [
- "content.mojom.MojoLayoutTestHelper"
+ "content.mojom.MojoWebTestHelper"
]
}
}
diff --git a/content/shell/browser/web_test/mojo_web_test_helper.cc b/content/shell/browser/web_test/mojo_web_test_helper.cc
index 833bd29..9e9682c 100644
--- a/content/shell/browser/web_test/mojo_web_test_helper.cc
+++ b/content/shell/browser/web_test/mojo_web_test_helper.cc
@@ -13,7 +13,7 @@
MojoWebTestHelper::~MojoWebTestHelper() {}
// static
-void MojoWebTestHelper::Create(mojom::MojoLayoutTestHelperRequest request) {
+void MojoWebTestHelper::Create(mojom::MojoWebTestHelperRequest request) {
mojo::MakeStrongBinding(std::make_unique<MojoWebTestHelper>(),
std::move(request));
}
diff --git a/content/shell/browser/web_test/mojo_web_test_helper.h b/content/shell/browser/web_test/mojo_web_test_helper.h
index eebb2c6..aa2d2456 100644
--- a/content/shell/browser/web_test/mojo_web_test_helper.h
+++ b/content/shell/browser/web_test/mojo_web_test_helper.h
@@ -6,18 +6,18 @@
#define CONTENT_SHELL_BROWSER_WEB_TEST_MOJO_WEB_TEST_HELPER_H_
#include "base/macros.h"
-#include "content/test/data/mojo_layouttest_test.mojom.h"
+#include "content/test/data/mojo_web_test_helper_test.mojom.h"
namespace content {
-class MojoWebTestHelper : public mojom::MojoLayoutTestHelper {
+class MojoWebTestHelper : public mojom::MojoWebTestHelper {
public:
MojoWebTestHelper();
~MojoWebTestHelper() override;
- static void Create(mojom::MojoLayoutTestHelperRequest request);
+ static void Create(mojom::MojoWebTestHelperRequest request);
- // mojom::MojoLayoutTestHelper:
+ // mojom::MojoWebTestHelper:
void Reverse(const std::string& message, ReverseCallback callback) override;
private:
diff --git a/content/shell/browser/web_test/web_test_content_browser_client.cc b/content/shell/browser/web_test/web_test_content_browser_client.cc
index 6cf0559..052cae5 100644
--- a/content/shell/browser/web_test/web_test_content_browser_client.cc
+++ b/content/shell/browser/web_test/web_test_content_browser_client.cc
@@ -47,7 +47,7 @@
WebTestContentBrowserClient* g_layout_test_browser_client;
-void BindWebTestHelper(mojom::MojoLayoutTestHelperRequest request,
+void BindWebTestHelper(mojom::MojoWebTestHelperRequest request,
RenderFrameHost* render_frame_host) {
MojoWebTestHelper::Create(std::move(request));
}
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 80d8043..b11d40d 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -588,14 +588,14 @@
]
}
-mojom("mojo_layouttest_bindings") {
+mojom("mojo_web_test_bindings") {
testonly = true
sources = [
"data/lite_js_test.mojom",
- "data/mojo_layouttest_test.mojom",
+ "data/mojo_web_test_helper_test.mojom",
]
- # This mojom interface is exposed publicly to layout tests which use
+ # This mojom interface is exposed publicly to web tests which use
# prepackaged redistributable JS bindings. It is therefore not desirable to
# scramble these messages.
scramble_message_ids = false
diff --git a/content/test/data/mojo_layouttest_test.mojom b/content/test/data/mojo_web_test_helper_test.mojom
similarity index 87%
rename from content/test/data/mojo_layouttest_test.mojom
rename to content/test/data/mojo_web_test_helper_test.mojom
index 4f6ec84a..ad5b88a 100644
--- a/content/test/data/mojo_layouttest_test.mojom
+++ b/content/test/data/mojo_web_test_helper_test.mojom
@@ -4,7 +4,7 @@
module content.mojom;
-interface MojoLayoutTestHelper {
+interface MojoWebTestHelper {
Reverse(string message) => (string reversed);
};
diff --git a/third_party/blink/web_tests/external/wpt/bluetooth/resources/bluetooth-helpers.js b/third_party/blink/web_tests/external/wpt/bluetooth/resources/bluetooth-helpers.js
index 9b23d65..c4e2607 100644
--- a/third_party/blink/web_tests/external/wpt/bluetooth/resources/bluetooth-helpers.js
+++ b/third_party/blink/web_tests/external/wpt/bluetooth/resources/bluetooth-helpers.js
@@ -40,7 +40,7 @@
}
return loadScripts([
`${prefix}/mojo_bindings.js`,
- `${prefix}/mojo_layouttest_test.mojom.js`,
+ `${prefix}/mojo_web_test_helper_test.mojom.js`,
`${prefix}/uuid.mojom.js`,
`${prefix}/fake_bluetooth.mojom.js`,
`${prefix}/fake_bluetooth_chooser.mojom.js`,
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_layouttest_test.mojom.js b/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_layouttest_test.mojom.js
deleted file mode 100644
index babaeda..0000000
--- a/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_layouttest_test.mojom.js
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright 2014 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.
-
-'use strict';
-
-(function() {
- var mojomId = 'content/test/data/mojo_layouttest_test.mojom';
- if (mojo.internal.isMojomLoaded(mojomId)) {
- console.warn('The following mojom is loaded multiple times: ' + mojomId);
- return;
- }
- mojo.internal.markMojomLoaded(mojomId);
-
- // TODO(yzshen): Define these aliases to minimize the differences between the
- // old/new modes. Remove them when the old mode goes away.
- var bindings = mojo;
- var associatedBindings = mojo;
- var codec = mojo.internal;
- var validator = mojo.internal;
-
- var exports = mojo.internal.exposeNamespace('content.mojom');
-
-
-
- function MojoLayoutTestHelper_Reverse_Params(values) {
- this.initDefaults_();
- this.initFields_(values);
- }
-
-
- MojoLayoutTestHelper_Reverse_Params.prototype.initDefaults_ = function() {
- this.message = null;
- };
- MojoLayoutTestHelper_Reverse_Params.prototype.initFields_ = function(fields) {
- for(var field in fields) {
- if (this.hasOwnProperty(field))
- this[field] = fields[field];
- }
- };
-
- MojoLayoutTestHelper_Reverse_Params.validate = function(messageValidator, offset) {
- var err;
- err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
- if (err !== validator.validationError.NONE)
- return err;
-
- var kVersionSizes = [
- {version: 0, numBytes: 16}
- ];
- err = messageValidator.validateStructVersion(offset, kVersionSizes);
- if (err !== validator.validationError.NONE)
- return err;
-
-
- // validate MojoLayoutTestHelper_Reverse_Params.message
- err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
- if (err !== validator.validationError.NONE)
- return err;
-
- return validator.validationError.NONE;
- };
-
- MojoLayoutTestHelper_Reverse_Params.encodedSize = codec.kStructHeaderSize + 8;
-
- MojoLayoutTestHelper_Reverse_Params.decode = function(decoder) {
- var packed;
- var val = new MojoLayoutTestHelper_Reverse_Params();
- var numberOfBytes = decoder.readUint32();
- var version = decoder.readUint32();
- val.message = decoder.decodeStruct(codec.String);
- return val;
- };
-
- MojoLayoutTestHelper_Reverse_Params.encode = function(encoder, val) {
- var packed;
- encoder.writeUint32(MojoLayoutTestHelper_Reverse_Params.encodedSize);
- encoder.writeUint32(0);
- encoder.encodeStruct(codec.String, val.message);
- };
- function MojoLayoutTestHelper_Reverse_ResponseParams(values) {
- this.initDefaults_();
- this.initFields_(values);
- }
-
-
- MojoLayoutTestHelper_Reverse_ResponseParams.prototype.initDefaults_ = function() {
- this.reversed = null;
- };
- MojoLayoutTestHelper_Reverse_ResponseParams.prototype.initFields_ = function(fields) {
- for(var field in fields) {
- if (this.hasOwnProperty(field))
- this[field] = fields[field];
- }
- };
-
- MojoLayoutTestHelper_Reverse_ResponseParams.validate = function(messageValidator, offset) {
- var err;
- err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
- if (err !== validator.validationError.NONE)
- return err;
-
- var kVersionSizes = [
- {version: 0, numBytes: 16}
- ];
- err = messageValidator.validateStructVersion(offset, kVersionSizes);
- if (err !== validator.validationError.NONE)
- return err;
-
-
- // validate MojoLayoutTestHelper_Reverse_ResponseParams.reversed
- err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
- if (err !== validator.validationError.NONE)
- return err;
-
- return validator.validationError.NONE;
- };
-
- MojoLayoutTestHelper_Reverse_ResponseParams.encodedSize = codec.kStructHeaderSize + 8;
-
- MojoLayoutTestHelper_Reverse_ResponseParams.decode = function(decoder) {
- var packed;
- var val = new MojoLayoutTestHelper_Reverse_ResponseParams();
- var numberOfBytes = decoder.readUint32();
- var version = decoder.readUint32();
- val.reversed = decoder.decodeStruct(codec.String);
- return val;
- };
-
- MojoLayoutTestHelper_Reverse_ResponseParams.encode = function(encoder, val) {
- var packed;
- encoder.writeUint32(MojoLayoutTestHelper_Reverse_ResponseParams.encodedSize);
- encoder.writeUint32(0);
- encoder.encodeStruct(codec.String, val.reversed);
- };
- var kMojoLayoutTestHelper_Reverse_Name = 0;
-
- function MojoLayoutTestHelperPtr(handleOrPtrInfo) {
- this.ptr = new bindings.InterfacePtrController(MojoLayoutTestHelper,
- handleOrPtrInfo);
- }
-
- function MojoLayoutTestHelperAssociatedPtr(associatedInterfacePtrInfo) {
- this.ptr = new associatedBindings.AssociatedInterfacePtrController(
- MojoLayoutTestHelper, associatedInterfacePtrInfo);
- }
-
- MojoLayoutTestHelperAssociatedPtr.prototype =
- Object.create(MojoLayoutTestHelperPtr.prototype);
- MojoLayoutTestHelperAssociatedPtr.prototype.constructor =
- MojoLayoutTestHelperAssociatedPtr;
-
- function MojoLayoutTestHelperProxy(receiver) {
- this.receiver_ = receiver;
- }
- MojoLayoutTestHelperPtr.prototype.reverse = function() {
- return MojoLayoutTestHelperProxy.prototype.reverse
- .apply(this.ptr.getProxy(), arguments);
- };
-
- MojoLayoutTestHelperProxy.prototype.reverse = function(message) {
- var params = new MojoLayoutTestHelper_Reverse_Params();
- params.message = message;
- return new Promise(function(resolve, reject) {
- var builder = new codec.MessageV1Builder(
- kMojoLayoutTestHelper_Reverse_Name,
- codec.align(MojoLayoutTestHelper_Reverse_Params.encodedSize),
- codec.kMessageExpectsResponse, 0);
- builder.encodeStruct(MojoLayoutTestHelper_Reverse_Params, params);
- var message = builder.finish();
- this.receiver_.acceptAndExpectResponse(message).then(function(message) {
- var reader = new codec.MessageReader(message);
- var responseParams =
- reader.decodeStruct(MojoLayoutTestHelper_Reverse_ResponseParams);
- resolve(responseParams);
- }).catch(function(result) {
- reject(Error("Connection error: " + result));
- });
- }.bind(this));
- };
-
- function MojoLayoutTestHelperStub(delegate) {
- this.delegate_ = delegate;
- }
- MojoLayoutTestHelperStub.prototype.reverse = function(message) {
- return this.delegate_ && this.delegate_.reverse && this.delegate_.reverse(message);
- }
-
- MojoLayoutTestHelperStub.prototype.accept = function(message) {
- var reader = new codec.MessageReader(message);
- switch (reader.messageName) {
- default:
- return false;
- }
- };
-
- MojoLayoutTestHelperStub.prototype.acceptWithResponder =
- function(message, responder) {
- var reader = new codec.MessageReader(message);
- switch (reader.messageName) {
- case kMojoLayoutTestHelper_Reverse_Name:
- var params = reader.decodeStruct(MojoLayoutTestHelper_Reverse_Params);
- this.reverse(params.message).then(function(response) {
- var responseParams =
- new MojoLayoutTestHelper_Reverse_ResponseParams();
- responseParams.reversed = response.reversed;
- var builder = new codec.MessageV1Builder(
- kMojoLayoutTestHelper_Reverse_Name,
- codec.align(MojoLayoutTestHelper_Reverse_ResponseParams.encodedSize),
- codec.kMessageIsResponse, reader.requestID);
- builder.encodeStruct(MojoLayoutTestHelper_Reverse_ResponseParams,
- responseParams);
- var message = builder.finish();
- responder.accept(message);
- });
- return true;
- default:
- return false;
- }
- };
-
- function validateMojoLayoutTestHelperRequest(messageValidator) {
- var message = messageValidator.message;
- var paramsClass = null;
- switch (message.getName()) {
- case kMojoLayoutTestHelper_Reverse_Name:
- if (message.expectsResponse())
- paramsClass = MojoLayoutTestHelper_Reverse_Params;
- break;
- }
- if (paramsClass === null)
- return validator.validationError.NONE;
- return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
- }
-
- function validateMojoLayoutTestHelperResponse(messageValidator) {
- var message = messageValidator.message;
- var paramsClass = null;
- switch (message.getName()) {
- case kMojoLayoutTestHelper_Reverse_Name:
- if (message.isResponse())
- paramsClass = MojoLayoutTestHelper_Reverse_ResponseParams;
- break;
- }
- if (paramsClass === null)
- return validator.validationError.NONE;
- return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
- }
-
- var MojoLayoutTestHelper = {
- name: 'content.mojom.MojoLayoutTestHelper',
- kVersion: 0,
- ptrClass: MojoLayoutTestHelperPtr,
- proxyClass: MojoLayoutTestHelperProxy,
- stubClass: MojoLayoutTestHelperStub,
- validateRequest: validateMojoLayoutTestHelperRequest,
- validateResponse: validateMojoLayoutTestHelperResponse,
- };
- MojoLayoutTestHelperStub.prototype.validator = validateMojoLayoutTestHelperRequest;
- MojoLayoutTestHelperProxy.prototype.validator = validateMojoLayoutTestHelperResponse;
- exports.MojoLayoutTestHelper = MojoLayoutTestHelper;
- exports.MojoLayoutTestHelperPtr = MojoLayoutTestHelperPtr;
- exports.MojoLayoutTestHelperAssociatedPtr = MojoLayoutTestHelperAssociatedPtr;
-})();
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_web_test_helper_test.mojom.js b/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_web_test_helper_test.mojom.js
new file mode 100644
index 0000000..cfbad08
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_web_test_helper_test.mojom.js
@@ -0,0 +1,264 @@
+// Copyright 2014 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.
+
+'use strict';
+
+(function() {
+ var mojomId = 'content/test/data/mojo_web_test_helper_test.mojom';
+ if (mojo.internal.isMojomLoaded(mojomId)) {
+ console.warn('The following mojom is loaded multiple times: ' + mojomId);
+ return;
+ }
+ mojo.internal.markMojomLoaded(mojomId);
+
+ // TODO(yzshen): Define these aliases to minimize the differences between the
+ // old/new modes. Remove them when the old mode goes away.
+ var bindings = mojo;
+ var associatedBindings = mojo;
+ var codec = mojo.internal;
+ var validator = mojo.internal;
+
+ var exports = mojo.internal.exposeNamespace('content.mojom');
+
+
+
+ function MojoWebTestHelper_Reverse_Params(values) {
+ this.initDefaults_();
+ this.initFields_(values);
+ }
+
+
+ MojoWebTestHelper_Reverse_Params.prototype.initDefaults_ = function() {
+ this.message = null;
+ };
+ MojoWebTestHelper_Reverse_Params.prototype.initFields_ = function(fields) {
+ for(var field in fields) {
+ if (this.hasOwnProperty(field))
+ this[field] = fields[field];
+ }
+ };
+
+ MojoWebTestHelper_Reverse_Params.validate = function(messageValidator, offset) {
+ var err;
+ err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
+ if (err !== validator.validationError.NONE)
+ return err;
+
+ var kVersionSizes = [
+ {version: 0, numBytes: 16}
+ ];
+ err = messageValidator.validateStructVersion(offset, kVersionSizes);
+ if (err !== validator.validationError.NONE)
+ return err;
+
+
+ // validate MojoWebTestHelper_Reverse_Params.message
+ err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
+ if (err !== validator.validationError.NONE)
+ return err;
+
+ return validator.validationError.NONE;
+ };
+
+ MojoWebTestHelper_Reverse_Params.encodedSize = codec.kStructHeaderSize + 8;
+
+ MojoWebTestHelper_Reverse_Params.decode = function(decoder) {
+ var packed;
+ var val = new MojoWebTestHelper_Reverse_Params();
+ var numberOfBytes = decoder.readUint32();
+ var version = decoder.readUint32();
+ val.message = decoder.decodeStruct(codec.String);
+ return val;
+ };
+
+ MojoWebTestHelper_Reverse_Params.encode = function(encoder, val) {
+ var packed;
+ encoder.writeUint32(MojoWebTestHelper_Reverse_Params.encodedSize);
+ encoder.writeUint32(0);
+ encoder.encodeStruct(codec.String, val.message);
+ };
+ function MojoWebTestHelper_Reverse_ResponseParams(values) {
+ this.initDefaults_();
+ this.initFields_(values);
+ }
+
+
+ MojoWebTestHelper_Reverse_ResponseParams.prototype.initDefaults_ = function() {
+ this.reversed = null;
+ };
+ MojoWebTestHelper_Reverse_ResponseParams.prototype.initFields_ = function(fields) {
+ for(var field in fields) {
+ if (this.hasOwnProperty(field))
+ this[field] = fields[field];
+ }
+ };
+
+ MojoWebTestHelper_Reverse_ResponseParams.validate = function(messageValidator, offset) {
+ var err;
+ err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
+ if (err !== validator.validationError.NONE)
+ return err;
+
+ var kVersionSizes = [
+ {version: 0, numBytes: 16}
+ ];
+ err = messageValidator.validateStructVersion(offset, kVersionSizes);
+ if (err !== validator.validationError.NONE)
+ return err;
+
+
+ // validate MojoWebTestHelper_Reverse_ResponseParams.reversed
+ err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
+ if (err !== validator.validationError.NONE)
+ return err;
+
+ return validator.validationError.NONE;
+ };
+
+ MojoWebTestHelper_Reverse_ResponseParams.encodedSize = codec.kStructHeaderSize + 8;
+
+ MojoWebTestHelper_Reverse_ResponseParams.decode = function(decoder) {
+ var packed;
+ var val = new MojoWebTestHelper_Reverse_ResponseParams();
+ var numberOfBytes = decoder.readUint32();
+ var version = decoder.readUint32();
+ val.reversed = decoder.decodeStruct(codec.String);
+ return val;
+ };
+
+ MojoWebTestHelper_Reverse_ResponseParams.encode = function(encoder, val) {
+ var packed;
+ encoder.writeUint32(MojoWebTestHelper_Reverse_ResponseParams.encodedSize);
+ encoder.writeUint32(0);
+ encoder.encodeStruct(codec.String, val.reversed);
+ };
+ var kMojoWebTestHelper_Reverse_Name = 0;
+
+ function MojoWebTestHelperPtr(handleOrPtrInfo) {
+ this.ptr = new bindings.InterfacePtrController(MojoWebTestHelper,
+ handleOrPtrInfo);
+ }
+
+ function MojoWebTestHelperAssociatedPtr(associatedInterfacePtrInfo) {
+ this.ptr = new associatedBindings.AssociatedInterfacePtrController(
+ MojoWebTestHelper, associatedInterfacePtrInfo);
+ }
+
+ MojoWebTestHelperAssociatedPtr.prototype =
+ Object.create(MojoWebTestHelperPtr.prototype);
+ MojoWebTestHelperAssociatedPtr.prototype.constructor =
+ MojoWebTestHelperAssociatedPtr;
+
+ function MojoWebTestHelperProxy(receiver) {
+ this.receiver_ = receiver;
+ }
+ MojoWebTestHelperPtr.prototype.reverse = function() {
+ return MojoWebTestHelperProxy.prototype.reverse
+ .apply(this.ptr.getProxy(), arguments);
+ };
+
+ MojoWebTestHelperProxy.prototype.reverse = function(message) {
+ var params = new MojoWebTestHelper_Reverse_Params();
+ params.message = message;
+ return new Promise(function(resolve, reject) {
+ var builder = new codec.MessageV1Builder(
+ kMojoWebTestHelper_Reverse_Name,
+ codec.align(MojoWebTestHelper_Reverse_Params.encodedSize),
+ codec.kMessageExpectsResponse, 0);
+ builder.encodeStruct(MojoWebTestHelper_Reverse_Params, params);
+ var message = builder.finish();
+ this.receiver_.acceptAndExpectResponse(message).then(function(message) {
+ var reader = new codec.MessageReader(message);
+ var responseParams =
+ reader.decodeStruct(MojoWebTestHelper_Reverse_ResponseParams);
+ resolve(responseParams);
+ }).catch(function(result) {
+ reject(Error("Connection error: " + result));
+ });
+ }.bind(this));
+ };
+
+ function MojoWebTestHelperStub(delegate) {
+ this.delegate_ = delegate;
+ }
+ MojoWebTestHelperStub.prototype.reverse = function(message) {
+ return this.delegate_ && this.delegate_.reverse && this.delegate_.reverse(message);
+ }
+
+ MojoWebTestHelperStub.prototype.accept = function(message) {
+ var reader = new codec.MessageReader(message);
+ switch (reader.messageName) {
+ default:
+ return false;
+ }
+ };
+
+ MojoWebTestHelperStub.prototype.acceptWithResponder =
+ function(message, responder) {
+ var reader = new codec.MessageReader(message);
+ switch (reader.messageName) {
+ case kMojoWebTestHelper_Reverse_Name:
+ var params = reader.decodeStruct(MojoWebTestHelper_Reverse_Params);
+ this.reverse(params.message).then(function(response) {
+ var responseParams =
+ new MojoWebTestHelper_Reverse_ResponseParams();
+ responseParams.reversed = response.reversed;
+ var builder = new codec.MessageV1Builder(
+ kMojoWebTestHelper_Reverse_Name,
+ codec.align(MojoWebTestHelper_Reverse_ResponseParams.encodedSize),
+ codec.kMessageIsResponse, reader.requestID);
+ builder.encodeStruct(MojoWebTestHelper_Reverse_ResponseParams,
+ responseParams);
+ var message = builder.finish();
+ responder.accept(message);
+ });
+ return true;
+ default:
+ return false;
+ }
+ };
+
+ function validateMojoWebTestHelperRequest(messageValidator) {
+ var message = messageValidator.message;
+ var paramsClass = null;
+ switch (message.getName()) {
+ case kMojoWebTestHelper_Reverse_Name:
+ if (message.expectsResponse())
+ paramsClass = MojoWebTestHelper_Reverse_Params;
+ break;
+ }
+ if (paramsClass === null)
+ return validator.validationError.NONE;
+ return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
+ }
+
+ function validateMojoWebTestHelperResponse(messageValidator) {
+ var message = messageValidator.message;
+ var paramsClass = null;
+ switch (message.getName()) {
+ case kMojoWebTestHelper_Reverse_Name:
+ if (message.isResponse())
+ paramsClass = MojoWebTestHelper_Reverse_ResponseParams;
+ break;
+ }
+ if (paramsClass === null)
+ return validator.validationError.NONE;
+ return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
+ }
+
+ var MojoWebTestHelper = {
+ name: 'content.mojom.MojoWebTestHelper',
+ kVersion: 0,
+ ptrClass: MojoWebTestHelperPtr,
+ proxyClass: MojoWebTestHelperProxy,
+ stubClass: MojoWebTestHelperStub,
+ validateRequest: validateMojoWebTestHelperRequest,
+ validateResponse: validateMojoWebTestHelperResponse,
+ };
+ MojoWebTestHelperStub.prototype.validator = validateMojoWebTestHelperRequest;
+ MojoWebTestHelperProxy.prototype.validator = validateMojoWebTestHelperResponse;
+ exports.MojoWebTestHelper = MojoWebTestHelper;
+ exports.MojoWebTestHelperPtr = MojoWebTestHelperPtr;
+ exports.MojoWebTestHelperAssociatedPtr = MojoWebTestHelperAssociatedPtr;
+})();
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_layouttest_test.mojom.js.headers b/third_party/blink/web_tests/external/wpt/resources/chromium/mojo_web_test_helper_test.mojom.js.headers
similarity index 100%
rename from third_party/blink/web_tests/external/wpt/resources/chromium/mojo_layouttest_test.mojom.js.headers
rename to third_party/blink/web_tests/external/wpt/resources/chromium/mojo_web_test_helper_test.mojom.js.headers
diff --git a/third_party/blink/web_tests/mojo/bind-interface.html b/third_party/blink/web_tests/mojo/bind-interface.html
index f068eac2..c11e1e8 100644
--- a/third_party/blink/web_tests/mojo/bind-interface.html
+++ b/third_party/blink/web_tests/mojo/bind-interface.html
@@ -2,13 +2,13 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
-<script src="file:///gen/content/test/data/mojo_layouttest_test.mojom.js"></script>
+<script src="file:///gen/content/test/data/mojo_web_test_helper_test.mojom.js"></script>
<script src="resources/helpers.js"></script>
<script>
promise_test(() => {
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ let helper = new content.mojom.MojoWebTestHelperPtr;
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle);
const kTestMessage = "hello world.";
@@ -21,14 +21,14 @@
promise_test(() => {
let helperImpl = new TestHelperImpl;
let interceptor =
- new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
+ new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
interceptor. => {
helperImpl.bindRequest(e.handle);
};
interceptor.start();
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ let helper = new content.mojom.MojoWebTestHelperPtr;
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle);
interceptor.stop();
@@ -42,14 +42,14 @@
// requested at "process" scope.
let helperImpl = new TestHelperImpl;
let interceptor =
- new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
+ new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
interceptor. => {
helperImpl.bindRequest(e.handle);
};
interceptor.start();
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ let helper = new content.mojom.MojoWebTestHelperPtr;
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle,
"process");
@@ -65,14 +65,14 @@
promise_test(() => {
let helperImpl = new TestHelperImpl;
let interceptor = new MojoInterfaceInterceptor(
- content.mojom.MojoLayoutTestHelper.name, "process");
+ content.mojom.MojoWebTestHelper.name, "process");
interceptor. => {
helperImpl.bindRequest(e.handle);
};
interceptor.start();
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ let helper = new content.mojom.MojoWebTestHelperPtr;
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle,
"process");
interceptor.stop();
@@ -83,8 +83,8 @@
}, "can intercept interfaces at process scope");
test(() => {
- let a = new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
- let b = new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
+ let a = new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
+ let b = new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
a. => {};
b. => {};
a.start();
@@ -93,9 +93,9 @@
}, "interface interceptors are mutually exclusive");
test(() => {
- let a = new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name,
+ let a = new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name,
"process");
- let b = new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name,
+ let b = new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name,
"process");
a. => {};
b. => {};
@@ -107,7 +107,7 @@
promise_test(async t => {
// First check that the interceptor can be started and intercepts requests.
let interceptor =
- new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
+ new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
let promise = new Promise(resolve => {
interceptor. => {
resolve(e.handle);
@@ -116,7 +116,7 @@
interceptor.start();
let pipe = Mojo.createMessagePipe();
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name, pipe.handle0);
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name, pipe.handle0);
let interceptedHandle = await promise;
assert_true(interceptedHandle instanceof MojoHandle);
interceptedHandle.close();
@@ -125,11 +125,11 @@
// Stop the interceptor and make another request.
interceptor.stop();
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
+ let helper = new content.mojom.MojoWebTestHelperPtr;
interceptor. => {
assert_unreached("unexpected 'interfacerequest' event after stop");
});
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle);
// Enusre that the interface is functioning, i.e. the request definitely was
@@ -142,7 +142,7 @@
// And ensure that we can start a new interceptor for the same interface since
// the previous one was stopped.
interceptor =
- new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
+ new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
interceptor. => {};
interceptor.start();
interceptor.stop();
diff --git a/third_party/blink/web_tests/mojo/detached-frame.html b/third_party/blink/web_tests/mojo/detached-frame.html
index 0bea05d..b8a7d644 100644
--- a/third_party/blink/web_tests/mojo/detached-frame.html
+++ b/third_party/blink/web_tests/mojo/detached-frame.html
@@ -2,7 +2,7 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
-<script src="file:///gen/content/test/data/mojo_layouttest_test.mojom.js"></script>
+<script src="file:///gen/content/test/data/mojo_web_test_helper_test.mojom.js"></script>
<body>
<script>
@@ -27,8 +27,8 @@
let frameMojo = frame.contentWindow.Mojo;
document.body.removeChild(frame);
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
- frameMojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ let helper = new content.mojom.MojoWebTestHelperPtr;
+ frameMojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle);
try {
@@ -52,7 +52,7 @@
document.body.removeChild(frame);
let interceptor = new frameMojoInterfaceInterceptor(
- content.mojom.MojoLayoutTestHelper.name);
+ content.mojom.MojoWebTestHelper.name);
try {
interceptor.start();
assert_unreached();
@@ -70,7 +70,7 @@
// Create the interceptor while the frame is attached so that it is associated
// with the frame's execution context.
let interceptor = new frame.contentWindow.MojoInterfaceInterceptor(
- content.mojom.MojoLayoutTestHelper.name);
+ content.mojom.MojoWebTestHelper.name);
document.body.removeChild(frame);
try {
@@ -89,7 +89,7 @@
// Create the interceptor and start it while the frame is attached.
let interceptor = new frame.contentWindow.MojoInterfaceInterceptor(
- content.mojom.MojoLayoutTestHelper.name);
+ content.mojom.MojoWebTestHelper.name);
interceptor.start();
document.body.removeChild(frame);
diff --git a/third_party/blink/web_tests/mojo/resources/bind-intercepted-interface-in-worker.js b/third_party/blink/web_tests/mojo/resources/bind-intercepted-interface-in-worker.js
index 3b1340a..7386652 100644
--- a/third_party/blink/web_tests/mojo/resources/bind-intercepted-interface-in-worker.js
+++ b/third_party/blink/web_tests/mojo/resources/bind-intercepted-interface-in-worker.js
@@ -1,19 +1,19 @@
importScripts('../../resources/testharness.js');
importScripts('file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js');
-importScripts('file:///gen/content/test/data/mojo_layouttest_test.mojom.js');
+importScripts('file:///gen/content/test/data/mojo_web_test_helper_test.mojom.js');
importScripts('helpers.js');
promise_test(async () => {
let helperImpl = new TestHelperImpl;
let interceptor =
- new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name);
+ new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name);
interceptor. => {
helperImpl.bindRequest(e.handle);
};
interceptor.start();
- let helper = new content.mojom.MojoLayoutTestHelperPtr;
- Mojo.bindInterface(content.mojom.MojoLayoutTestHelper.name,
+ let helper = new content.mojom.MojoWebTestHelperPtr;
+ Mojo.bindInterface(content.mojom.MojoWebTestHelper.name,
mojo.makeRequest(helper).handle);
let response = await helper.reverse('the string');
@@ -25,7 +25,7 @@
assert_throws(
'NotSupportedError',
() => {
- new MojoInterfaceInterceptor(content.mojom.MojoLayoutTestHelper.name,
+ new MojoInterfaceInterceptor(content.mojom.MojoWebTestHelper.name,
"process");
});
}, 'Cannot create a MojoInterfaceInterceptor with process scope');
diff --git a/third_party/blink/web_tests/mojo/resources/helpers.js b/third_party/blink/web_tests/mojo/resources/helpers.js
index 31178fe..ed50937a 100644
--- a/third_party/blink/web_tests/mojo/resources/helpers.js
+++ b/third_party/blink/web_tests/mojo/resources/helpers.js
@@ -5,7 +5,7 @@
class TestHelperImpl {
constructor() {
this.binding_ =
- new mojo.Binding(content.mojom.MojoLayoutTestHelper, this);
+ new mojo.Binding(content.mojom.MojoWebTestHelper, this);
}
bindRequest(request) { this.binding_.bind(request); }
getLastString() { return this.lastString_; }