| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* globals TEST_F, ASSERT_EQ, chrometest, NaClProcessManager */ |
| 8 |
| 7 'use strict'; | 9 'use strict'; |
| 8 | 10 |
| 9 // TODO(sbc): Remove this once html5f becomes the default for nacl-spawn | 11 // TODO(sbc): Remove this once html5f becomes the default for nacl-spawn |
| 10 NaClProcessManager.fsroot = '/' | 12 NaClProcessManager.fsroot = '/'; |
| 11 | 13 |
| 12 function run(nmf, cmd) { | 14 function run(nmf, cmd) { |
| 13 var mgr = new NaClProcessManager(); | 15 var mgr = new NaClProcessManager(); |
| 14 // Assume a default terminal size for headless processes. | 16 // Assume a default terminal size for headless processes. |
| 15 mgr.onTerminalResize(80, 24); | 17 mgr.onTerminalResize(80, 24); |
| 16 return new Promise(function(resolve, reject) { | 18 return new Promise(function(resolve, reject) { |
| 17 mgr.spawn( | 19 mgr.spawn( |
| 18 nmf, cmd, [], '/tmp', 'pnacl', null, | 20 nmf, cmd, [], '/tmp', 'pnacl', null, |
| 19 function(pid) { | 21 function(pid) { |
| 20 mgr.waitpid(pid, 0, function(pid, code) { resolve(code); }); | 22 mgr.waitpid(pid, 0, function(pid, code) { resolve(code); }); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 49 return Promise.resolve().then(function() { | 51 return Promise.resolve().then(function() { |
| 50 return runOk('jseval.nmf', ['jseval', '-e', '"9 * 9"', 'foo.txt']); | 52 return runOk('jseval.nmf', ['jseval', '-e', '"9 * 9"', 'foo.txt']); |
| 51 }).then(function() { | 53 }).then(function() { |
| 52 return runOk('jseval.nmf', ['jseval', '-f', 'foo.txt', 'bar.txt']); | 54 return runOk('jseval.nmf', ['jseval', '-f', 'foo.txt', 'bar.txt']); |
| 53 }).then(function() { | 55 }).then(function() { |
| 54 return getFile('bar.txt'); | 56 return getFile('bar.txt'); |
| 55 }).then(function(data) { | 57 }).then(function(data) { |
| 56 ASSERT_EQ('81', data); | 58 ASSERT_EQ('81', data); |
| 57 }); | 59 }); |
| 58 }); | 60 }); |
| OLD | NEW |