summaryrefslogtreecommitdiffstats
path: root/mojo/public/js/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/public/js/bindings')
-rw-r--r--mojo/public/js/bindings/connection.js1
-rw-r--r--mojo/public/js/bindings/struct_unittests.js22
-rw-r--r--mojo/public/js/bindings/validation_unittests.js8
3 files changed, 27 insertions, 4 deletions
diff --git a/mojo/public/js/bindings/connection.js b/mojo/public/js/bindings/connection.js
index 31cf2aa..01e33e9 100644
--- a/mojo/public/js/bindings/connection.js
+++ b/mojo/public/js/bindings/connection.js
@@ -16,6 +16,7 @@ define("mojo/public/js/bindings/connection", [
this.local = new localFactory(this.remote);
this.router_.setIncomingReceiver(this.local);
+ // Validate incoming messages: remote responses and local requests.
var validateRequest = localFactory.prototype.validator;
var validateResponse = remoteFactory.prototype.validator;
var payloadValidators = [];
diff --git a/mojo/public/js/bindings/struct_unittests.js b/mojo/public/js/bindings/struct_unittests.js
index b9948a9..2d7abe5 100644
--- a/mojo/public/js/bindings/struct_unittests.js
+++ b/mojo/public/js/bindings/struct_unittests.js
@@ -72,8 +72,30 @@ define([
expect(s.f16).toEqual(r);
}
+ function testScopedConstants() {
+ expect(testStructs.ScopedConstants.TEN).toEqual(10);
+ expect(testStructs.ScopedConstants.ALSO_TEN).toEqual(10);
+ expect(testStructs.ScopedConstants.TEN_TOO).toEqual(10);
+
+ expect(testStructs.ScopedConstants.EType.E0).toEqual(0);
+ expect(testStructs.ScopedConstants.EType.E1).toEqual(1);
+ expect(testStructs.ScopedConstants.EType.E2).toEqual(10);
+ expect(testStructs.ScopedConstants.EType.E3).toEqual(10);
+ expect(testStructs.ScopedConstants.EType.E4).toEqual(11);
+
+ var s = new testStructs.ScopedConstants();
+ expect(s.f0).toEqual(0);
+ expect(s.f1).toEqual(1);
+ expect(s.f2).toEqual(10);
+ expect(s.f3).toEqual(10);
+ expect(s.f4).toEqual(11);
+ expect(s.f5).toEqual(10);
+ expect(s.f6).toEqual(10);
+ }
+
testConstructors();
testNoDefaultFieldValues();
testDefaultFieldValues();
+ testScopedConstants();
this.result = "PASS";
}); \ No newline at end of file
diff --git a/mojo/public/js/bindings/validation_unittests.js b/mojo/public/js/bindings/validation_unittests.js
index 73fd9c7..59aeb59 100644
--- a/mojo/public/js/bindings/validation_unittests.js
+++ b/mojo/public/js/bindings/validation_unittests.js
@@ -246,12 +246,12 @@ define([
function testConformanceMessageValidation() {
testMessageValidation("conformance_", [
- testInterface.ConformanceTestInterfaceStub.prototype.validator]);
+ testInterface.ConformanceTestInterface.validateRequest]);
}
function testNotImplementedMessageValidation() {
testMessageValidation("not_implemented_", [
- testInterface.ConformanceTestInterfaceStub.prototype.validator]);
+ testInterface.ConformanceTestInterface.validateRequest]);
}
function testIntegratedMessageValidation() {
@@ -279,8 +279,8 @@ define([
var testConnection = new connection.TestConnection(
testMessagePipe.handle1,
- testInterface.IntegrationTestInterface1Stub,
- testInterface.IntegrationTestInterface2Proxy);
+ testInterface.IntegrationTestInterface1.stubClass,
+ testInterface.IntegrationTestInterface2.proxyClass);
var validationError = noError;
testConnection.router_.validationErrorHandler = function(err) {