OLD | NEW |
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 // Mock out the support module to avoid depending on the message loop. | 5 // Mock out the support module to avoid depending on the message loop. |
6 define("mojo/public/js/bindings/support", ["timer"], function(timer) { | 6 define("mojo/public/js/support", ["timer"], function(timer) { |
7 var waitingCallbacks = []; | 7 var waitingCallbacks = []; |
8 | 8 |
9 function WaitCookie(id) { | 9 function WaitCookie(id) { |
10 this.id = id; | 10 this.id = id; |
11 } | 11 } |
12 | 12 |
13 function asyncWait(handle, flags, callback) { | 13 function asyncWait(handle, flags, callback) { |
14 var id = waitingCallbacks.length; | 14 var id = waitingCallbacks.length; |
15 waitingCallbacks.push(callback); | 15 waitingCallbacks.push(callback); |
16 return new WaitCookie(id); | 16 return new WaitCookie(id); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 exports.asyncWait = asyncWait; | 48 exports.asyncWait = asyncWait; |
49 exports.cancelWait = cancelWait; | 49 exports.cancelWait = cancelWait; |
50 exports.numberOfWaitingCallbacks = numberOfWaitingCallbacks; | 50 exports.numberOfWaitingCallbacks = numberOfWaitingCallbacks; |
51 exports.pumpOnce = pumpOnce; | 51 exports.pumpOnce = pumpOnce; |
52 exports.queuePump = queuePump; | 52 exports.queuePump = queuePump; |
53 return exports; | 53 return exports; |
54 }); | 54 }); |
55 | 55 |
56 define([ | 56 define([ |
57 "gin/test/expect", | 57 "gin/test/expect", |
58 "mojo/public/js/bindings/support", | 58 "mojo/public/js/support", |
59 "mojo/public/js/bindings/core", | 59 "mojo/public/js/core", |
60 "mojo/public/js/bindings/connection", | 60 "mojo/public/js/connection", |
61 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom", | 61 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom", |
62 "mojo/public/interfaces/bindings/tests/sample_service.mojom", | 62 "mojo/public/interfaces/bindings/tests/sample_service.mojom", |
63 "mojo/apps/js/bindings/threading", | 63 "mojo/apps/js/bindings/threading", |
64 "gc", | 64 "gc", |
65 ], function(expect, | 65 ], function(expect, |
66 mockSupport, | 66 mockSupport, |
67 core, | 67 core, |
68 connection, | 68 connection, |
69 sample_interfaces, | 69 sample_interfaces, |
70 sample_service, | 70 sample_service, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 }).then(function() { | 252 }).then(function() { |
253 throw Error("Expected echoString to fail."); | 253 throw Error("Expected echoString to fail."); |
254 }, function(error) { | 254 }, function(error) { |
255 expect(error.message).toBe("Connection error: " + core.RESULT_UNKNOWN); | 255 expect(error.message).toBe("Connection error: " + core.RESULT_UNKNOWN); |
256 | 256 |
257 // Clean up. | 257 // Clean up. |
258 core.readMessage = origReadMessage; | 258 core.readMessage = origReadMessage; |
259 }); | 259 }); |
260 } | 260 } |
261 }); | 261 }); |
OLD | NEW |