browser_gcli_remotexhr.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. /*
  2. * Copyright 2012, Mozilla Foundation and contributors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. "use strict";
  17. // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
  18. // PLEASE TALK TO SOMEONE IN DEVELOPER TOOLS BEFORE EDITING IT
  19. const exports = {};
  20. function test() {
  21. helpers.runTestModule(exports, "browser_gcli_remotexhr.js");
  22. }
  23. // var assert = require('../testharness/assert');
  24. // var helpers = require('./helpers');
  25. // testRemoteWs and testRemoteXhr are virtually identical.
  26. // Changes made here should be made there too.
  27. // They are kept separate to save adding complexity to the test system and so
  28. // to help us select the test that are available in different environments
  29. exports.testRemoteXhr = function (options) {
  30. return helpers.audit(options, [
  31. {
  32. skipRemainingIf: options.isRemote || options.isNode || options.isFirefox,
  33. setup: "remote ",
  34. check: {
  35. input: "remote ",
  36. hints: "",
  37. markup: "EEEEEEV",
  38. cursor: 7,
  39. current: "__command",
  40. status: "ERROR",
  41. options: [ ],
  42. message: "Can't use 'remote'.",
  43. predictions: [ ],
  44. unassigned: [ ],
  45. }
  46. },
  47. {
  48. setup: "connect remote",
  49. check: {
  50. args: {
  51. prefix: { value: "remote" },
  52. url: { value: undefined }
  53. }
  54. },
  55. exec: {
  56. error: false
  57. }
  58. },
  59. {
  60. setup: "disconnect remote",
  61. check: {
  62. args: {
  63. prefix: {
  64. value: function (front) {
  65. assert.is(front.prefix, "remote", "disconnecting remote");
  66. }
  67. }
  68. }
  69. },
  70. exec: {
  71. output: /^Removed [0-9]* commands.$/,
  72. type: "string",
  73. error: false
  74. }
  75. },
  76. {
  77. setup: "connect remote --method xhr",
  78. check: {
  79. args: {
  80. prefix: { value: "remote" },
  81. url: { value: undefined }
  82. }
  83. },
  84. exec: {
  85. error: false
  86. }
  87. },
  88. {
  89. setup: "disconnect remote",
  90. check: {
  91. args: {
  92. prefix: {
  93. value: function (front) {
  94. assert.is(front.prefix, "remote", "disconnecting remote");
  95. }
  96. }
  97. }
  98. },
  99. exec: {
  100. output: /^Removed [0-9]* commands.$/,
  101. type: "string",
  102. error: false
  103. }
  104. },
  105. {
  106. setup: "connect remote --method xhr",
  107. check: {
  108. args: {
  109. prefix: { value: "remote" },
  110. url: { value: undefined }
  111. }
  112. },
  113. exec: {
  114. output: /^Added [0-9]* commands.$/,
  115. type: "string",
  116. error: false
  117. }
  118. },
  119. {
  120. setup: "remote ",
  121. check: {
  122. input: "remote ",
  123. // PhantomJS fails on this. Unsure why
  124. // hints: ' {',
  125. markup: "IIIIIIV",
  126. status: "ERROR",
  127. optionsIncludes: [
  128. "remote", "remote cd", "remote context", "remote echo",
  129. "remote exec", "remote exit", "remote firefox", "remote help",
  130. "remote intro", "remote make"
  131. ],
  132. message: "",
  133. predictionsIncludes: [ "remote" ],
  134. unassigned: [ ],
  135. }
  136. },
  137. {
  138. setup: "remote echo hello world",
  139. check: {
  140. input: "remote echo hello world",
  141. hints: "",
  142. markup: "VVVVVVVVVVVVVVVVVVVVVVV",
  143. cursor: 23,
  144. current: "message",
  145. status: "VALID",
  146. options: [ ],
  147. message: "",
  148. predictions: [ ],
  149. unassigned: [ ],
  150. args: {
  151. command: { name: "remote echo" },
  152. message: {
  153. value: "hello world",
  154. arg: " hello world",
  155. status: "VALID",
  156. message: ""
  157. }
  158. }
  159. },
  160. exec: {
  161. output: "hello world",
  162. type: "string",
  163. error: false
  164. }
  165. },
  166. {
  167. setup: "remote exec ls",
  168. check: {
  169. input: "remote exec ls",
  170. hints: "",
  171. markup: "VVVVVVVVVVVVVV",
  172. cursor: 14,
  173. current: "command",
  174. status: "VALID",
  175. options: [ ],
  176. message: "",
  177. predictions: [ ],
  178. unassigned: [ ],
  179. args: {
  180. command: {
  181. value: "ls",
  182. arg: " ls",
  183. status: "VALID",
  184. message: ""
  185. }
  186. }
  187. },
  188. exec: {
  189. // output: '', We can't rely on the contents of the FS
  190. type: "output",
  191. error: false
  192. }
  193. },
  194. {
  195. setup: "remote sleep mistake",
  196. check: {
  197. input: "remote sleep mistake",
  198. hints: "",
  199. markup: "VVVVVVVVVVVVVEEEEEEE",
  200. cursor: 20,
  201. current: "length",
  202. status: "ERROR",
  203. options: [ ],
  204. message: 'Can\'t convert "mistake" to a number.',
  205. predictions: [ ],
  206. unassigned: [ ],
  207. args: {
  208. command: { name: "remote sleep" },
  209. length: {
  210. value: undefined,
  211. arg: " mistake",
  212. status: "ERROR",
  213. message: 'Can\'t convert "mistake" to a number.'
  214. }
  215. }
  216. }
  217. },
  218. {
  219. setup: "remote sleep 1",
  220. check: {
  221. input: "remote sleep 1",
  222. hints: "",
  223. markup: "VVVVVVVVVVVVVV",
  224. cursor: 14,
  225. current: "length",
  226. status: "VALID",
  227. options: [ ],
  228. message: "",
  229. predictions: [ ],
  230. unassigned: [ ],
  231. args: {
  232. command: { name: "remote sleep" },
  233. length: { value: 1, arg: " 1", status: "VALID", message: "" }
  234. }
  235. },
  236. exec: {
  237. output: "Done",
  238. type: "string",
  239. error: false
  240. }
  241. },
  242. {
  243. setup: "remote help ",
  244. skipIf: true, // The help command is not remotable
  245. check: {
  246. input: "remote help ",
  247. hints: "[search]",
  248. markup: "VVVVVVVVVVVV",
  249. cursor: 12,
  250. current: "search",
  251. status: "VALID",
  252. options: [ ],
  253. message: "",
  254. predictions: [ ],
  255. unassigned: [ ],
  256. args: {
  257. command: { name: "remote help" },
  258. search: {
  259. value: undefined,
  260. arg: "",
  261. status: "VALID",
  262. message: ""
  263. }
  264. }
  265. },
  266. exec: {
  267. output: "",
  268. type: "string",
  269. error: false
  270. }
  271. },
  272. {
  273. setup: "remote intro",
  274. check: {
  275. input: "remote intro",
  276. hints: "",
  277. markup: "VVVVVVVVVVVV",
  278. cursor: 12,
  279. current: "__command",
  280. status: "VALID",
  281. options: [ ],
  282. message: "",
  283. predictions: [ ],
  284. unassigned: [ ],
  285. args: {
  286. command: { name: "remote intro" }
  287. }
  288. },
  289. exec: {
  290. output: [
  291. /GCLI is an experiment/,
  292. /F1\/Escape/
  293. ],
  294. type: "intro",
  295. error: false
  296. }
  297. },
  298. {
  299. setup: "context remote",
  300. check: {
  301. input: "context remote",
  302. // hints: ' {',
  303. markup: "VVVVVVVVVVVVVV",
  304. cursor: 14,
  305. current: "prefix",
  306. status: "VALID",
  307. optionsContains: [
  308. "remote", "remote cd", "remote echo", "remote exec", "remote exit",
  309. "remote firefox", "remote help", "remote intro", "remote make"
  310. ],
  311. message: "",
  312. // predictionsContains: [
  313. // 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit',
  314. // 'remote firefox', 'remote help', 'remote intro', 'remote make',
  315. // 'remote pref'
  316. // ],
  317. unassigned: [ ],
  318. args: {
  319. command: { name: "context" },
  320. prefix: {
  321. arg: " remote",
  322. status: "VALID",
  323. message: ""
  324. }
  325. }
  326. },
  327. exec: {
  328. output: "Using remote as a command prefix",
  329. type: "string",
  330. error: false
  331. }
  332. },
  333. {
  334. setup: "exec ls",
  335. check: {
  336. input: "exec ls",
  337. hints: "",
  338. markup: "VVVVVVV",
  339. cursor: 7,
  340. current: "command",
  341. status: "VALID",
  342. options: [ ],
  343. message: "",
  344. predictions: [ ],
  345. unassigned: [ ],
  346. args: {
  347. command: { value: "ls", arg: " ls", status: "VALID", message: "" },
  348. }
  349. },
  350. exec: {
  351. // output: '', We can't rely on the contents of the filesystem
  352. type: "output",
  353. error: false
  354. }
  355. },
  356. {
  357. setup: "echo hello world",
  358. check: {
  359. input: "echo hello world",
  360. hints: "",
  361. markup: "VVVVVVVVVVVVVVVV",
  362. cursor: 16,
  363. current: "message",
  364. status: "VALID",
  365. options: [ ],
  366. message: "",
  367. predictions: [ ],
  368. unassigned: [ ],
  369. args: {
  370. command: { name: "remote echo" },
  371. message: {
  372. value: "hello world",
  373. arg: " hello world",
  374. status: "VALID",
  375. message: ""
  376. }
  377. }
  378. },
  379. exec: {
  380. output: /^hello world$/,
  381. type: "string",
  382. error: false
  383. }
  384. },
  385. {
  386. setup: "context",
  387. check: {
  388. input: "context",
  389. hints: " [prefix]",
  390. markup: "VVVVVVV",
  391. cursor: 7,
  392. current: "__command",
  393. status: "VALID",
  394. optionsContains: [
  395. "remote", "remote cd", "remote echo", "remote exec", "remote exit",
  396. "remote firefox", "remote help", "remote intro", "remote make"
  397. ],
  398. message: "",
  399. predictions: [ ],
  400. unassigned: [ ],
  401. args: {
  402. command: { name: "context" },
  403. prefix: { value: undefined, arg: "", status: "VALID", message: "" }
  404. }
  405. },
  406. exec: {
  407. output: "Command prefix is unset",
  408. type: "string",
  409. error: false
  410. }
  411. },
  412. {
  413. setup: "disconnect ",
  414. check: {
  415. input: "disconnect ",
  416. hints: "remote",
  417. markup: "VVVVVVVVVVV",
  418. cursor: 11,
  419. current: "prefix",
  420. status: "ERROR",
  421. options: [ "remote" ],
  422. message: "",
  423. predictions: [ "remote" ],
  424. unassigned: [ ],
  425. args: {
  426. command: { name: "disconnect" },
  427. prefix: {
  428. value: undefined,
  429. arg: "",
  430. status: "INCOMPLETE",
  431. message: "Value required for 'prefix'."
  432. }
  433. }
  434. }
  435. },
  436. {
  437. setup: "disconnect remote",
  438. check: {
  439. input: "disconnect remote",
  440. hints: "",
  441. markup: "VVVVVVVVVVVVVVVVV",
  442. status: "VALID",
  443. message: "",
  444. unassigned: [ ],
  445. args: {
  446. prefix: {
  447. value: function (front) {
  448. assert.is(front.prefix, "remote", "disconnecting remote");
  449. },
  450. arg: " remote",
  451. status: "VALID",
  452. message: ""
  453. }
  454. }
  455. },
  456. exec: {
  457. output: /^Removed [0-9]* commands.$/,
  458. type: "string",
  459. error: false
  460. }
  461. },
  462. {
  463. setup: "remote ",
  464. check: {
  465. input: "remote ",
  466. hints: "",
  467. markup: "EEEEEEV",
  468. cursor: 7,
  469. current: "__command",
  470. status: "ERROR",
  471. options: [ ],
  472. message: "Can't use 'remote'.",
  473. predictions: [ ],
  474. unassigned: [ ],
  475. }
  476. }
  477. ]);
  478. };