michael@0: /* michael@0: * Copyright 2012, Mozilla Foundation and contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: 'use strict'; michael@0: // michael@0: michael@0: // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT michael@0: // DO NOT EDIT IT DIRECTLY michael@0: michael@0: var exports = {}; michael@0: michael@0: var TEST_URI = "data:text/html;charset=utf-8,

gcli-testRemoteWs.js

"; michael@0: michael@0: function test() { michael@0: return Task.spawn(function() { michael@0: let options = yield helpers.openTab(TEST_URI); michael@0: yield helpers.openToolbar(options); michael@0: gcli.addItems(mockCommands.items); michael@0: michael@0: yield helpers.runTests(options, exports); michael@0: michael@0: gcli.removeItems(mockCommands.items); michael@0: yield helpers.closeToolbar(options); michael@0: yield helpers.closeTab(options); michael@0: }).then(finish, helpers.handleError); michael@0: } michael@0: michael@0: // michael@0: michael@0: // var assert = require('../testharness/assert'); michael@0: // var helpers = require('./helpers'); michael@0: michael@0: // testRemoteWs and testRemoteXhr are virtually identical. michael@0: // Changes made here should be made there too. michael@0: // They are kept separate to save adding complexity to the test system and so michael@0: // to help us select the test that are available in different environments michael@0: michael@0: exports.testRemoteWebsocket = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: skipRemainingIf: options.isRemote || options.isNode || options.isFirefox, michael@0: setup: 'remote ', michael@0: check: { michael@0: input: 'remote ', michael@0: hints: '', michael@0: markup: 'EEEEEEV', michael@0: cursor: 7, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: options: [ ], michael@0: message: 'Can\'t use \'remote\'.', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: } michael@0: }, michael@0: { michael@0: setup: 'connect remote', michael@0: check: { michael@0: args: { michael@0: prefix: { value: 'remote' }, michael@0: url: { value: undefined } michael@0: } michael@0: }, michael@0: exec: { michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'disconnect remote', michael@0: check: { michael@0: args: { michael@0: prefix: { michael@0: value: function(connection) { michael@0: assert.is(connection.prefix, 'remote', 'disconnecting remote'); michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: /^Removed [0-9]* commands.$/, michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'connect remote --method websocket', michael@0: check: { michael@0: args: { michael@0: prefix: { value: 'remote' }, michael@0: url: { value: undefined } michael@0: } michael@0: }, michael@0: exec: { michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'disconnect remote', michael@0: check: { michael@0: args: { michael@0: prefix: { michael@0: value: function(connection) { michael@0: assert.is(connection.prefix, 'remote', 'disconnecting remote'); michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: /^Removed [0-9]* commands.$/, michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'connect remote --method websocket', michael@0: check: { michael@0: args: { michael@0: prefix: { value: 'remote' }, michael@0: url: { value: undefined } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: /^Added [0-9]* commands.$/, michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote ', michael@0: check: { michael@0: input: 'remote ', michael@0: // PhantomJS fails on this. Unsure why michael@0: // hints: ' {', michael@0: markup: 'IIIIIIV', michael@0: status: 'ERROR', michael@0: optionsIncludes: [ michael@0: 'remote', 'remote cd', 'remote context', 'remote echo', michael@0: 'remote exec', 'remote exit', 'remote firefox', 'remote help', michael@0: 'remote intro', 'remote make' michael@0: ], michael@0: message: '', michael@0: predictionsIncludes: [ 'remote' ], michael@0: unassigned: [ ], michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote echo hello world', michael@0: check: { michael@0: input: 'remote echo hello world', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVVV', michael@0: cursor: 23, michael@0: current: 'message', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'remote echo' }, michael@0: message: { michael@0: value: 'hello world', michael@0: arg: ' hello world', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'hello world', michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote exec ls', michael@0: check: { michael@0: input: 'remote exec ls', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVV', michael@0: cursor: 14, michael@0: current: 'command', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { michael@0: value: 'ls', michael@0: arg: ' ls', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: // output: '', We can't rely on the contents of the FS michael@0: type: 'output', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote sleep mistake', michael@0: check: { michael@0: input: 'remote sleep mistake', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVEEEEEEE', michael@0: cursor: 20, michael@0: current: 'length', michael@0: status: 'ERROR', michael@0: options: [ ], michael@0: message: 'Can\'t convert "mistake" to a number.', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'remote sleep' }, michael@0: length: { michael@0: value: undefined, michael@0: arg: ' mistake', michael@0: status: 'ERROR', michael@0: message: 'Can\'t convert "mistake" to a number.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote sleep 1', michael@0: check: { michael@0: input: 'remote sleep 1', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVV', michael@0: cursor: 14, michael@0: current: 'length', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'remote sleep' }, michael@0: length: { value: 1, arg: ' 1', status: 'VALID', message: '' } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Done', michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote help ', michael@0: skipIf: true, // The help command is not remotable michael@0: check: { michael@0: input: 'remote help ', michael@0: hints: '[search]', michael@0: markup: 'VVVVVVVVVVVV', michael@0: cursor: 12, michael@0: current: 'search', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'remote help' }, michael@0: search: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: '', michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote intro', michael@0: check: { michael@0: input: 'remote intro', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVV', michael@0: cursor: 12, michael@0: current: '__command', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'remote intro' } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: [ michael@0: /^GCLI is an experiment/, michael@0: /F1\/Escape/ michael@0: ], michael@0: type: 'intro', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'context remote', michael@0: check: { michael@0: input: 'context remote', michael@0: // hints: ' {', michael@0: markup: 'VVVVVVVVVVVVVV', michael@0: cursor: 14, michael@0: current: 'prefix', michael@0: status: 'VALID', michael@0: optionsContains: [ michael@0: 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', michael@0: 'remote firefox', 'remote help', 'remote intro', 'remote make' michael@0: ], michael@0: message: '', michael@0: // predictionsContains: [ michael@0: // 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', michael@0: // 'remote firefox', 'remote help', 'remote intro', 'remote make', michael@0: // 'remote pref' michael@0: // ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'context' }, michael@0: prefix: { michael@0: arg: ' remote', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Using remote as a command prefix', michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'exec ls', michael@0: check: { michael@0: input: 'exec ls', michael@0: hints: '', michael@0: markup: 'VVVVVVV', michael@0: cursor: 7, michael@0: current: 'command', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { value: 'ls', arg: ' ls', status: 'VALID', message: '' }, michael@0: } michael@0: }, michael@0: exec: { michael@0: // output: '', We can't rely on the contents of the filesystem michael@0: type: 'output', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'echo hello world', michael@0: check: { michael@0: input: 'echo hello world', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVV', michael@0: cursor: 16, michael@0: current: 'message', michael@0: status: 'VALID', michael@0: options: [ ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'remote echo' }, michael@0: message: { michael@0: value: 'hello world', michael@0: arg: ' hello world', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: /^hello world$/, michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'context', michael@0: check: { michael@0: input: 'context', michael@0: hints: ' [prefix]', michael@0: markup: 'VVVVVVV', michael@0: cursor: 7, michael@0: current: '__command', michael@0: status: 'VALID', michael@0: optionsContains: [ michael@0: 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', michael@0: 'remote firefox', 'remote help', 'remote intro', 'remote make' michael@0: ], michael@0: message: '', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'context' }, michael@0: prefix: { value: undefined, arg: '', status: 'VALID', message: '' } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Command prefix is unset', michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'disconnect ', michael@0: check: { michael@0: input: 'disconnect ', michael@0: hints: 'remote', michael@0: markup: 'VVVVVVVVVVV', michael@0: cursor: 11, michael@0: current: 'prefix', michael@0: status: 'ERROR', michael@0: options: [ 'remote' ], michael@0: message: '', michael@0: predictions: [ 'remote' ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'disconnect' }, michael@0: prefix: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'prefix\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'disconnect remote', michael@0: check: { michael@0: input: 'disconnect remote', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVV', michael@0: status: 'VALID', michael@0: message: '', michael@0: unassigned: [ ], michael@0: args: { michael@0: prefix: { michael@0: value: function(connection) { michael@0: assert.is(connection.prefix, 'remote', 'disconnecting remote'); michael@0: }, michael@0: arg: ' remote', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: /^Removed [0-9]* commands.$/, michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: }, michael@0: { michael@0: setup: 'remote ', michael@0: check: { michael@0: input: 'remote ', michael@0: hints: '', michael@0: markup: 'EEEEEEV', michael@0: cursor: 7, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: options: [ ], michael@0: message: 'Can\'t use \'remote\'.', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: } michael@0: } michael@0: ]); michael@0: };