| 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(["gtest", "core"], function(gtest, core) { | 5 define([ |
| 6 "gtest", |
| 7 "mojo/public/bindings/js/core", |
| 8 ], function(gtest, core) { |
| 6 runWithPipe(testNop); | 9 runWithPipe(testNop); |
| 7 runWithPipe(testReadAndWriteMessage); | 10 runWithPipe(testReadAndWriteMessage); |
| 8 this.result = "PASS"; | 11 this.result = "PASS"; |
| 9 | 12 |
| 10 function runWithPipe(test) { | 13 function runWithPipe(test) { |
| 11 var pipe = core.createMessagePipe(); | 14 var pipe = core.createMessagePipe(); |
| 12 | 15 |
| 13 test(pipe); | 16 test(pipe); |
| 14 | 17 |
| 15 var result0 = core.close(pipe.handle0); | 18 var result0 = core.close(pipe.handle0); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 "mesage.bytesRead is " + mesage.bytesRead); | 52 "mesage.bytesRead is " + mesage.bytesRead); |
| 50 gtest.expectEqual(mesage.handles.length, 0, | 53 gtest.expectEqual(mesage.handles.length, 0, |
| 51 "mesage.handles.length is " + mesage.handles.length); | 54 "mesage.handles.length is " + mesage.handles.length); |
| 52 | 55 |
| 53 for (var i = 0; i < mesage.bytesRead; ++i) { | 56 for (var i = 0; i < mesage.bytesRead; ++i) { |
| 54 gtest.expectEqual(receiverData[i], (i * i) & 0xFF, | 57 gtest.expectEqual(receiverData[i], (i * i) & 0xFF, |
| 55 "receiverData[" + i + "] is " + receiverData[i]); | 58 "receiverData[" + i + "] is " + receiverData[i]); |
| 56 } | 59 } |
| 57 } | 60 } |
| 58 }); | 61 }); |
| OLD | NEW |