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

Side by Side Diff: mojo/public/js/tests/connection_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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 define([ 5 define([
6 "gin/test/expect", 6 "gin/test/expect",
7 "mojo/public/js/bindings", 7 "mojo/public/js/bindings",
8 "mojo/public/js/core", 8 "mojo/public/js/core",
9 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom", 9 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom",
10 "mojo/public/interfaces/bindings/tests/sample_service.mojom", 10 "mojo/public/interfaces/bindings/tests/sample_service.mojom",
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return Promise.resolve({a: a, b: b}); 108 return Promise.resolve({a: a, b: b});
109 }; 109 };
110 110
111 var provider = new sample_interfaces.ProviderPtr(); 111 var provider = new sample_interfaces.ProviderPtr();
112 var providerBinding = new bindings.Binding(sample_interfaces.Provider, 112 var providerBinding = new bindings.Binding(sample_interfaces.Provider,
113 new ProviderImpl(), 113 new ProviderImpl(),
114 bindings.makeRequest(provider)); 114 bindings.makeRequest(provider));
115 var promise = provider.echoString("hello").then(function(response) { 115 var promise = provider.echoString("hello").then(function(response) {
116 expect(response.a).toBe("hello"); 116 expect(response.a).toBe("hello");
117 return provider.echoStrings("hello", "world"); 117 return provider.echoStrings("hello", "world");
118 }).then(function(response) {
119 expect(response.a).toBe("hello");
120 expect(response.b).toBe("world");
121 // Mock a read failure, expect it to fail.
122 core.readMessage = function() {
123 return { result: core.RESULT_UNKNOWN };
124 };
125 return provider.echoString("goodbye");
126 }).then(function() {
127 throw Error("Expected echoString to fail.");
128 }, function(error) {
129 expect(error.message).toBe("Connection error: " + core.RESULT_UNKNOWN);
130
131 return Promise.resolve();
132 }); 118 });
133 119
134 return promise; 120 return promise;
135 } 121 }
136 }); 122 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698