OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
5 <script> | 5 <script> |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 setup({ explicit_done: true }); | 8 setup({ explicit_done: true }); |
9 | 9 |
10 define([ | 10 define([ |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 await new Promise((resolve, reject) => { | 222 await new Promise((resolve, reject) => { |
223 integerSender0.ptr.setConnectionErrorHandler(function({custom_reason, | 223 integerSender0.ptr.setConnectionErrorHandler(function({custom_reason, |
224 description}) { | 224 description}) { |
225 assert_equals(custom_reason, 42); | 225 assert_equals(custom_reason, 42); |
226 assert_equals(description, 'hey'); | 226 assert_equals(description, 'hey'); |
227 resolve(); | 227 resolve(); |
228 }); | 228 }); |
229 }); | 229 }); |
230 }, 'connection error with reason'); | 230 }, 'connection error with reason'); |
231 | 231 |
| 232 // Test that AssociatedInterfacePtr is notified with connection error when |
| 233 // the interface hasn't associated with a message pipe and the peer is |
| 234 // closed. |
| 235 promise_test(async () => { |
| 236 var integerSenderPtrInfo = new |
| 237 associatedBindings.AssociatedInterfacePtrInfo(); |
| 238 var integerSenderRequest = associatedBindings.makeRequest( |
| 239 integerSenderPtrInfo); |
| 240 |
| 241 var integerSender = new |
| 242 testAssociatedInterfaces.AssociatedIntegerSenderPtr( |
| 243 integerSenderPtrInfo); |
| 244 |
| 245 await new Promise((resolve, reject) => { |
| 246 integerSender.ptr.setConnectionErrorHandler(function({custom_reason, |
| 247 description}) { |
| 248 assert_equals(custom_reason, 42); |
| 249 assert_equals(description, 'hey'); |
| 250 resolve(); |
| 251 }); |
| 252 integerSenderRequest.resetWithReason({custom_reason: 42, |
| 253 description: 'hey'}) |
| 254 }); |
| 255 }, 'pending AssociatedInterfacePtr connection error with reason'); |
| 256 |
232 promise_test(async () => { | 257 promise_test(async () => { |
233 var integerSenderConnection = new | 258 var integerSenderConnection = new |
234 testAssociatedInterfaces.IntegerSenderConnectionPtr(); | 259 testAssociatedInterfaces.IntegerSenderConnectionPtr(); |
235 var integerSenderConnectionBinding = new bindings.Binding( | 260 var integerSenderConnectionBinding = new bindings.Binding( |
236 testAssociatedInterfaces.IntegerSenderConnection, | 261 testAssociatedInterfaces.IntegerSenderConnection, |
237 new IntegerSenderConnectionImpl(), | 262 new IntegerSenderConnectionImpl(), |
238 bindings.makeRequest(integerSenderConnection)); | 263 bindings.makeRequest(integerSenderConnection)); |
239 | 264 |
240 // Sending AssociatedInterfaceRequest. | 265 // Sending AssociatedInterfaceRequest. |
241 var integerSenderPtrInfo0 = new | 266 var integerSenderPtrInfo0 = new |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 }); | 392 }); |
368 }); | 393 }); |
369 | 394 |
370 assert_equals(value, 'goodbye'); | 395 assert_equals(value, 'goodbye'); |
371 }, 'discard cached message if target endpoint closed'); | 396 }, 'discard cached message if target endpoint closed'); |
372 | 397 |
373 done(); | 398 done(); |
374 }); | 399 }); |
375 | 400 |
376 </script> | 401 </script> |
OLD | NEW |