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

Unified Diff: mojo/public/js/validation_unittests.js

Issue 2615633005: Mojo JS bindings: remove usage of the connection module. (Closed)
Patch Set: . Created 3 years, 11 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: mojo/public/js/validation_unittests.js
diff --git a/mojo/public/js/validation_unittests.js b/mojo/public/js/validation_unittests.js
index 0eb0e4dc5acce866c089e5672fa30323f1c5ceff..b4744b9d7fb6d6b4ca6513743091218fa53544ef 100644
--- a/mojo/public/js/validation_unittests.js
+++ b/mojo/public/js/validation_unittests.js
@@ -7,25 +7,21 @@ define([
"file",
"gin/test/expect",
"mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom",
+ "mojo/public/js/bindings",
"mojo/public/js/buffer",
"mojo/public/js/codec",
- "mojo/public/js/connection",
- "mojo/public/js/connector",
"mojo/public/js/core",
"mojo/public/js/test/validation_test_input_parser",
- "mojo/public/js/router",
"mojo/public/js/validator",
], function(console,
file,
expect,
testInterface,
+ bindings,
buffer,
codec,
- connection,
- connector,
core,
parser,
- router,
validator) {
var noError = validator.validationError.NONE;
@@ -274,18 +270,23 @@ define([
testInterface.BoundsCheckTestInterface.validateResponse]);
}
- function testIntegratedMessageValidation(testFilesPattern,
- localFactory,
- remoteFactory) {
+ function testIntegratedMessageValidation(testFilesPattern, endpoint) {
var testFiles = getMessageTestFiles(testFilesPattern);
expect(testFiles.length).toBeGreaterThan(0);
var testMessagePipe = core.createMessagePipe();
expect(testMessagePipe.result).toBe(core.RESULT_OK);
- var testConnection = new connection.TestConnection(
- testMessagePipe.handle1, localFactory, remoteFactory);
+
+ endpoint.bind(testMessagePipe.handle1);
+ var testingController = endpoint.enableTestingMode();
+
+ var validationError;
+ testingController.setInvalidIncomingMessageHandler(function(error) {
+ validationError = error;
+ });
for (var i = 0; i < testFiles.length; i++) {
+ validationError = noError;
var testMessage = readTestMessage(testFiles[i]);
var handles = new Array(testMessage.handleCount);
@@ -296,42 +297,32 @@ define([
core.WRITE_MESSAGE_FLAG_NONE);
expect(writeMessageValue).toBe(core.RESULT_OK);
- var validationError = noError;
- testConnection.router_.validationErrorHandler = function(err) {
- validationError = err;
- };
-
- testConnection.router_.connector_.waitForNextMessage();
+ testingController.waitForNextMessage();
checkValidationResult(testFiles[i], validationError);
}
- testConnection.close();
expect(core.close(testMessagePipe.handle0)).toBe(core.RESULT_OK);
}
function testIntegratedMessageHeaderValidation() {
testIntegratedMessageValidation(
"integration_msghdr",
- testInterface.IntegrationTestInterface.stubClass,
- undefined);
+ new bindings.Binding(testInterface.IntegrationTestInterface, {}));
testIntegratedMessageValidation(
"integration_msghdr",
- undefined,
- testInterface.IntegrationTestInterface.proxyClass);
+ new testInterface.IntegrationTestInterfacePtr().ptr);
}
function testIntegratedRequestMessageValidation() {
testIntegratedMessageValidation(
"integration_intf_rqst",
- testInterface.IntegrationTestInterface.stubClass,
- undefined);
+ new bindings.Binding(testInterface.IntegrationTestInterface, {}));
}
function testIntegratedResponseMessageValidation() {
testIntegratedMessageValidation(
"integration_intf_resp",
- undefined,
- testInterface.IntegrationTestInterface.proxyClass);
+ new testInterface.IntegrationTestInterfacePtr().ptr);
}
expect(checkTestMessageParser()).toBeNull();
« no previous file with comments | « mojo/public/js/router.js ('k') | mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698