Index: mojo/public/js/tests/interface_ptr_unittest.js |
diff --git a/mojo/public/js/tests/interface_ptr_unittest.js b/mojo/public/js/tests/interface_ptr_unittest.js |
index 6203154d204c96c2e24cc7bf348446a49a627f56..86003dea1affd607b6579a02e064b66a2316dd47 100644 |
--- a/mojo/public/js/tests/interface_ptr_unittest.js |
+++ b/mojo/public/js/tests/interface_ptr_unittest.js |
@@ -21,6 +21,8 @@ define([ |
.then(testEndToEnd) |
.then(testReusable) |
.then(testConnectionError) |
+ .then(testConnectionErrorWithReason) |
+ .then(testResetWithReason) |
.then(testPassInterface) |
.then(testBindRawHandle) |
.then(testQueryVersion) |
@@ -137,6 +139,44 @@ define([ |
return promise; |
} |
+ function testConnectionErrorWithReason() { |
+ var calc = new math.CalculatorPtr(); |
+ var calcBinding = new bindings.Binding(math.Calculator, |
+ new CalculatorImpl(), |
+ bindings.makeRequest(calc)); |
+ |
+ var promise = new Promise(function(resolve, reject) { |
+ calc.ptr.setConnectionErrorHandler(function({custom_reason, |
+ description}) { |
+ expect(custom_reason).toBe(42); |
+ expect(description).toBe('hey'); |
+ resolve(); |
+ }); |
+ calcBinding.closeWithReason({custom_reason: 42, description: 'hey'}); |
+ }); |
+ |
+ return promise; |
+ } |
+ |
+ function testResetWithReason() { |
+ var calc = new math.CalculatorPtr(); |
+ var calcBinding = new bindings.Binding(math.Calculator, |
+ new CalculatorImpl(), |
+ bindings.makeRequest(calc)); |
+ |
+ var promise = new Promise(function(resolve, reject) { |
+ calcBinding.setConnectionErrorHandler(function({custom_reason, |
+ description}) { |
+ expect(custom_reason).toBe(32); |
+ expect(description).toBe('goodbye'); |
+ resolve(); |
+ }); |
+ calc.ptr.resetWithReason({custom_reason: 32, description: 'goodbye'}); |
+ }); |
+ |
+ return promise; |
+ } |
+ |
function testPassInterface() { |
var calc = new math.CalculatorPtr(); |
var newCalc = null; |