browser_gcli_pref2.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_pref2.js");
  22. }
  23. // var assert = require('../testharness/assert');
  24. // var helpers = require('./helpers');
  25. var mockSettings = require("./mockSettings");
  26. exports.testPrefExec = function (options) {
  27. if (options.requisition.system.commands.get("pref") == null) {
  28. assert.log("Skipping test; missing pref command.");
  29. return;
  30. }
  31. if (options.isRemote) {
  32. assert.log("Skipping test which assumes local settings.");
  33. return;
  34. }
  35. assert.is(mockSettings.tempNumber.value, 42, "set to 42");
  36. return helpers.audit(options, [
  37. {
  38. // Delegated remote types can't transfer value types so we only test for
  39. // the value of 'value' when we're local
  40. skipIf: options.isRemote,
  41. setup: "pref set tempNumber 4",
  42. check: {
  43. setting: { value: mockSettings.tempNumber },
  44. args: { value: { value: 4 } }
  45. }
  46. },
  47. {
  48. setup: "pref set tempNumber 4",
  49. check: {
  50. input: "pref set tempNumber 4",
  51. hints: "",
  52. markup: "VVVVVVVVVVVVVVVVVVVVV",
  53. cursor: 21,
  54. current: "value",
  55. status: "VALID",
  56. predictions: [ ],
  57. unassigned: [ ],
  58. args: {
  59. command: { name: "pref set" },
  60. setting: {
  61. arg: " tempNumber",
  62. status: "VALID",
  63. message: ""
  64. },
  65. value: {
  66. arg: " 4",
  67. status: "VALID",
  68. message: ""
  69. }
  70. }
  71. },
  72. exec: {
  73. output: ""
  74. },
  75. post: function () {
  76. assert.is(mockSettings.tempNumber.value, 4, "set to 4");
  77. }
  78. },
  79. {
  80. setup: "pref reset tempNumber",
  81. check: {
  82. args: {
  83. command: { name: "pref reset" },
  84. setting: { value: mockSettings.tempNumber }
  85. }
  86. },
  87. exec: {
  88. output: ""
  89. },
  90. post: function () {
  91. assert.is(mockSettings.tempNumber.value, 42, "reset to 42");
  92. }
  93. },
  94. {
  95. skipRemainingIf: function commandPrefListMissing() {
  96. return options.requisition.system.commands.get("pref list") == null;
  97. },
  98. setup: "pref list tempNum",
  99. check: {
  100. args: {
  101. command: { name: "pref list" },
  102. search: { value: "tempNum" }
  103. }
  104. },
  105. exec: {
  106. output: /tempNum/
  107. }
  108. },
  109. ]);
  110. };