| 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 define([ | 5 define([ |
| 6 "gin/test/expect", | 6 "gin/test/expect", |
| 7 "mojo/public/bindings/js/core", | 7 "mojo/apps/js/bindings/core", |
| 8 ], function(expect, core) { | 8 ], function(expect, core) { |
| 9 runWithPipe(testNop); | 9 runWithPipe(testNop); |
| 10 runWithPipe(testReadAndWriteMessage); | 10 runWithPipe(testReadAndWriteMessage); |
| 11 this.result = "PASS"; | 11 this.result = "PASS"; |
| 12 | 12 |
| 13 function runWithPipe(test) { | 13 function runWithPipe(test) { |
| 14 var pipe = core.createMessagePipe(); | 14 var pipe = core.createMessagePipe(); |
| 15 | 15 |
| 16 test(pipe); | 16 test(pipe); |
| 17 | 17 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 expect(read.result).toBe(core.RESULT_OK); | 42 expect(read.result).toBe(core.RESULT_OK); |
| 43 expect(read.buffer.byteLength).toBe(42); | 43 expect(read.buffer.byteLength).toBe(42); |
| 44 expect(read.handles.length).toBe(0); | 44 expect(read.handles.length).toBe(0); |
| 45 | 45 |
| 46 var memory = new Uint8Array(read.buffer); | 46 var memory = new Uint8Array(read.buffer); |
| 47 for (var i = 0; i < memory.length; ++i) | 47 for (var i = 0; i < memory.length; ++i) |
| 48 expect(memory[i]).toBe((i * i) & 0xFF); | 48 expect(memory[i]).toBe((i * i) & 0xFF); |
| 49 } | 49 } |
| 50 }); | 50 }); |
| OLD | NEW |