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/bindings/js/support", function() { | 6 define("mojo/apps/js/bindings/support", function() { |
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 22 matching lines...) Expand all Loading... |
39 var exports = {}; | 39 var exports = {}; |
40 exports.asyncWait = asyncWait; | 40 exports.asyncWait = asyncWait; |
41 exports.cancelWait = cancelWait; | 41 exports.cancelWait = cancelWait; |
42 exports.numberOfWaitingCallbacks = numberOfWaitingCallbacks; | 42 exports.numberOfWaitingCallbacks = numberOfWaitingCallbacks; |
43 exports.pumpOnce = pumpOnce; | 43 exports.pumpOnce = pumpOnce; |
44 return exports; | 44 return exports; |
45 }); | 45 }); |
46 | 46 |
47 define([ | 47 define([ |
48 "gin/test/expect", | 48 "gin/test/expect", |
49 "mojo/public/bindings/js/support", | 49 "mojo/apps/js/bindings/support", |
50 "mojo/public/bindings/js/core", | 50 "mojo/apps/js/bindings/core", |
51 "mojo/public/bindings/js/connector", | 51 "mojo/apps/js/bindings/connector", |
52 "mojom/sample_service", | 52 "mojom/sample_service", |
53 ], function(expect, mockSupport, core, connector, sample) { | 53 ], function(expect, mockSupport, core, connector, sample) { |
54 | 54 |
55 var receivedFrobinate = false; | 55 var receivedFrobinate = false; |
56 var receivedDidFrobinate = false; | 56 var receivedDidFrobinate = false; |
57 | 57 |
58 // ServiceImpl -------------------------------------------------------------- | 58 // ServiceImpl -------------------------------------------------------------- |
59 | 59 |
60 function ServiceImpl(peer) { | 60 function ServiceImpl(peer) { |
61 this.peer = peer; | 61 this.peer = peer; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 expect(core.close(anotherPipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT); | 116 expect(core.close(anotherPipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT); |
117 // anotherPipe.handle1 hasn't been closed yet. | 117 // anotherPipe.handle1 hasn't been closed yet. |
118 expect(core.close(anotherPipe.handle1)).toBe(core.RESULT_OK); | 118 expect(core.close(anotherPipe.handle1)).toBe(core.RESULT_OK); |
119 | 119 |
120 // The Connection object is responsible for closing these handles. | 120 // The Connection object is responsible for closing these handles. |
121 expect(core.close(pipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT); | 121 expect(core.close(pipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT); |
122 expect(core.close(pipe.handle1)).toBe(core.RESULT_INVALID_ARGUMENT); | 122 expect(core.close(pipe.handle1)).toBe(core.RESULT_INVALID_ARGUMENT); |
123 | 123 |
124 this.result = "PASS"; | 124 this.result = "PASS"; |
125 }); | 125 }); |
OLD | NEW |