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

Unified Diff: mojo/public/js/tests/interface_ptr_unittest.js

Issue 2744963002: Introduce InterfaceEndpointClient(IEC), InterfaceEndpointHandle and (Closed)
Patch Set: Resolve Merge with new changes from master. Created 3 years, 9 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/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;

Powered by Google App Engine
This is Rietveld 408576698