dom/mobilemessage/tests/test_mms_pdu_helper.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 let MMS = {};
michael@0 5 subscriptLoader.loadSubScript("resource://gre/modules/MmsPduHelper.jsm", MMS);
michael@0 6 MMS.debug = do_print;
michael@0 7
michael@0 8 function run_test() {
michael@0 9 run_next_test();
michael@0 10 }
michael@0 11
michael@0 12 //
michael@0 13 // Test target: BooleanValue
michael@0 14 //
michael@0 15
michael@0 16 //// BooleanValue.decode ////
michael@0 17
michael@0 18 add_test(function test_BooleanValue_decode() {
michael@0 19 for (let i = 0; i < 256; i++) {
michael@0 20 if (i == 128) {
michael@0 21 wsp_decode_test(MMS.BooleanValue, [128], true);
michael@0 22 } else if (i == 129) {
michael@0 23 wsp_decode_test(MMS.BooleanValue, [129], false);
michael@0 24 } else {
michael@0 25 wsp_decode_test(MMS.BooleanValue, [i], null, "CodeError");
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 run_next_test();
michael@0 30 });
michael@0 31
michael@0 32 //// BooleanValue.encode ////
michael@0 33
michael@0 34 add_test(function test_BooleanValue_encode() {
michael@0 35 wsp_encode_test(MMS.BooleanValue, true, [128]);
michael@0 36 wsp_encode_test(MMS.BooleanValue, false, [129]);
michael@0 37
michael@0 38 run_next_test();
michael@0 39 });
michael@0 40
michael@0 41 //
michael@0 42 // Test target: Address
michael@0 43 //
michael@0 44
michael@0 45 //// Address.decode ////
michael@0 46
michael@0 47 add_test(function test_Address_decode() {
michael@0 48 // Test for PLMN address
michael@0 49 wsp_decode_test(MMS.Address, strToCharCodeArray("+123.456-789/TYPE=PLMN"),
michael@0 50 {address: "+123.456-789", type: "PLMN"});
michael@0 51 wsp_decode_test(MMS.Address, strToCharCodeArray("123456789/TYPE=PLMN"),
michael@0 52 {address: "123456789", type: "PLMN"});
michael@0 53 // Test for IPv4
michael@0 54 wsp_decode_test(MMS.Address, strToCharCodeArray("1.2.3.4/TYPE=IPv4"),
michael@0 55 {address: "1.2.3.4", type: "IPv4"});
michael@0 56 // Test for IPv6
michael@0 57 wsp_decode_test(MMS.Address,
michael@0 58 strToCharCodeArray("1111:AAAA:bbbb:CdEf:1ABC:2cde:3Def:0000/TYPE=IPv6"),
michael@0 59 {address: "1111:AAAA:bbbb:CdEf:1ABC:2cde:3Def:0000", type: "IPv6"}
michael@0 60 );
michael@0 61 // Test for other device-address
michael@0 62 wsp_decode_test(MMS.Address, strToCharCodeArray("+H-e.l%l_o/TYPE=W0r1d_"),
michael@0 63 {address: "+H-e.l%l_o", type: "W0r1d_"});
michael@0 64 // Test for num-shortcode
michael@0 65 wsp_decode_test(MMS.Address, strToCharCodeArray("+123"),
michael@0 66 {address: "+123", type: "num"});
michael@0 67 wsp_decode_test(MMS.Address, strToCharCodeArray("*123"),
michael@0 68 {address: "*123", type: "num"});
michael@0 69 wsp_decode_test(MMS.Address, strToCharCodeArray("#123"),
michael@0 70 {address: "#123", type: "num"});
michael@0 71 // Test for alphanum-shortcode
michael@0 72 wsp_decode_test(MMS.Address, strToCharCodeArray("H0wD0Y0uTurnTh1s0n"),
michael@0 73 {address: "H0wD0Y0uTurnTh1s0n", type: "alphanum"});
michael@0 74 // Test for email address
michael@0 75 wsp_decode_test(MMS.Address, strToCharCodeArray("Joe User <joe@user.org>"),
michael@0 76 {address: "Joe User <joe@user.org>", type: "email"});
michael@0 77 // Test for invalid address
michael@0 78 wsp_decode_test(MMS.Address, strToCharCodeArray("@@@@@"),
michael@0 79 null, "CodeError");
michael@0 80
michael@0 81 run_next_test();
michael@0 82 });
michael@0 83
michael@0 84 //// Address.encode ////
michael@0 85
michael@0 86 add_test(function test_Address_encode() {
michael@0 87 // Test for PLMN address
michael@0 88 wsp_encode_test(MMS.Address, {address: "+123.456-789", type: "PLMN"},
michael@0 89 strToCharCodeArray("+123.456-789/TYPE=PLMN"));
michael@0 90 wsp_encode_test(MMS.Address, {address: "123456789", type: "PLMN"},
michael@0 91 strToCharCodeArray("123456789/TYPE=PLMN"));
michael@0 92 // Test for IPv4
michael@0 93 wsp_encode_test(MMS.Address, {address: "1.2.3.4", type: "IPv4"},
michael@0 94 strToCharCodeArray("1.2.3.4/TYPE=IPv4"));
michael@0 95 // Test for IPv6
michael@0 96 wsp_encode_test(MMS.Address,
michael@0 97 {address: "1111:AAAA:bbbb:CdEf:1ABC:2cde:3Def:0000", type: "IPv6"},
michael@0 98 strToCharCodeArray("1111:AAAA:bbbb:CdEf:1ABC:2cde:3Def:0000/TYPE=IPv6")
michael@0 99 );
michael@0 100 // Test for other device-address
michael@0 101 wsp_encode_test(MMS.Address, {address: "+H-e.l%l_o", type: "W0r1d_"},
michael@0 102 strToCharCodeArray("+H-e.l%l_o/TYPE=W0r1d_"));
michael@0 103 // Test for num-shortcode
michael@0 104 wsp_encode_test(MMS.Address, {address: "+123", type: "num"},
michael@0 105 strToCharCodeArray("+123"));
michael@0 106 wsp_encode_test(MMS.Address, {address: "*123", type: "num"},
michael@0 107 strToCharCodeArray("*123"));
michael@0 108 wsp_encode_test(MMS.Address, {address: "#123", type: "num"},
michael@0 109 strToCharCodeArray("#123"));
michael@0 110 // Test for alphanum-shortcode
michael@0 111 wsp_encode_test(MMS.Address, {address: "H0wD0Y0uTurnTh1s0n", type: "alphanum"},
michael@0 112 strToCharCodeArray("H0wD0Y0uTurnTh1s0n"));
michael@0 113 // Test for email address
michael@0 114 wsp_encode_test(MMS.Address, {address: "Joe User <joe@user.org>", type: "email"},
michael@0 115 strToCharCodeArray("Joe User <joe@user.org>"));
michael@0 116
michael@0 117 run_next_test();
michael@0 118 });
michael@0 119
michael@0 120 //
michael@0 121 // Test target: HeaderField
michael@0 122 //
michael@0 123
michael@0 124 //// HeaderField.decode ////
michael@0 125
michael@0 126 add_test(function test_HeaderField_decode() {
michael@0 127 wsp_decode_test(MMS.HeaderField, [65, 0, 66, 0], {name: "a", value: "B"});
michael@0 128 wsp_decode_test(MMS.HeaderField, [0x80 | 0x27, 128],
michael@0 129 {name: "x-mms-stored", value: true});
michael@0 130
michael@0 131 run_next_test();
michael@0 132 });
michael@0 133
michael@0 134 //// HeaderField.encode ////
michael@0 135
michael@0 136 add_test(function test_HeaderField_encode() {
michael@0 137 // Test for MmsHeader
michael@0 138 wsp_encode_test(MMS.HeaderField, {name: "X-Mms-Message-Type",
michael@0 139 value: MMS_PDU_TYPE_SEND_REQ},
michael@0 140 [0x80 | 0x0C, MMS_PDU_TYPE_SEND_REQ]);
michael@0 141 // Test for ApplicationHeader
michael@0 142 wsp_encode_test(MMS.HeaderField, {name: "a", value: "B"}, [97, 0, 66, 0]);
michael@0 143
michael@0 144 run_next_test();
michael@0 145 });
michael@0 146
michael@0 147 //
michael@0 148 // Test target: MmsHeader
michael@0 149 //
michael@0 150
michael@0 151 //// MmsHeader.decode ////
michael@0 152
michael@0 153 add_test(function test_MmsHeader_decode() {
michael@0 154 wsp_decode_test(MMS.MmsHeader, [0x80 | 0x00], null, "NotWellKnownEncodingError");
michael@0 155 wsp_decode_test(MMS.MmsHeader, [0x80 | 0x27, 128],
michael@0 156 {name: "x-mms-stored", value: true});
michael@0 157 wsp_decode_test(MMS.MmsHeader, [0x80 | 0x27, 255], null);
michael@0 158
michael@0 159 run_next_test();
michael@0 160 });
michael@0 161
michael@0 162 //// MmsHeader.encode ////
michael@0 163
michael@0 164 add_test(function test_MmsHeader_encode() {
michael@0 165 // Test for empty header name:
michael@0 166 wsp_encode_test(MMS.MmsHeader, {name: undefined, value: null}, null, "CodeError");
michael@0 167 wsp_encode_test(MMS.MmsHeader, {name: null, value: null}, null, "CodeError");
michael@0 168 wsp_encode_test(MMS.MmsHeader, {name: "", value: null}, null, "CodeError");
michael@0 169 // Test for non-well-known header name:
michael@0 170 wsp_encode_test(MMS.MmsHeader, {name: "X-No-Such-Field", value: null},
michael@0 171 null, "NotWellKnownEncodingError");
michael@0 172 // Test for normal header
michael@0 173 wsp_encode_test(MMS.MmsHeader, {name: "X-Mms-Message-Type",
michael@0 174 value: MMS_PDU_TYPE_SEND_REQ},
michael@0 175 [0x80 | 0x0C, MMS_PDU_TYPE_SEND_REQ]);
michael@0 176
michael@0 177 run_next_test();
michael@0 178 });
michael@0 179
michael@0 180 //
michael@0 181 // Test target: CancelStatusValue
michael@0 182 //
michael@0 183
michael@0 184 //// CancelStatusValue.decode ////
michael@0 185
michael@0 186 add_test(function test_CancelStatusValue_decode() {
michael@0 187 for (let i = 0; i < 256; i++) {
michael@0 188 if ((i >= 128) && (i <= 129)) {
michael@0 189 wsp_decode_test(MMS.CancelStatusValue, [i], i);
michael@0 190 } else {
michael@0 191 wsp_decode_test(MMS.CancelStatusValue, [i], null, "CodeError");
michael@0 192 }
michael@0 193 }
michael@0 194
michael@0 195 run_next_test();
michael@0 196 });
michael@0 197
michael@0 198 //// CancelStatusValue.encode ////
michael@0 199
michael@0 200 add_test(function test_CancelStatusValue_encode() {
michael@0 201 for (let i = 0; i < 256; i++) {
michael@0 202 if ((i >= 128) && (i <= 129)) {
michael@0 203 wsp_encode_test(MMS.CancelStatusValue, i, [i]);
michael@0 204 } else {
michael@0 205 wsp_encode_test(MMS.CancelStatusValue, i, null, "CodeError");
michael@0 206 }
michael@0 207 }
michael@0 208
michael@0 209 run_next_test();
michael@0 210 });
michael@0 211
michael@0 212 //
michael@0 213 // Test target: ContentClassValue
michael@0 214 //
michael@0 215
michael@0 216 //// ContentClassValue.decode ////
michael@0 217
michael@0 218 add_test(function test_ContentClassValue_decode() {
michael@0 219 for (let i = 0; i < 256; i++) {
michael@0 220 if ((i >= 128) && (i <= 135)) {
michael@0 221 wsp_decode_test(MMS.ContentClassValue, [i], i);
michael@0 222 } else {
michael@0 223 wsp_decode_test(MMS.ContentClassValue, [i], null, "CodeError");
michael@0 224 }
michael@0 225 }
michael@0 226
michael@0 227 run_next_test();
michael@0 228 });
michael@0 229
michael@0 230 //// ContentClassValue.encode ////
michael@0 231
michael@0 232 add_test(function test_ContentClassValue_encode() {
michael@0 233 for (let i = 0; i < 256; i++) {
michael@0 234 if ((i >= 128) && (i <= 135)) {
michael@0 235 wsp_encode_test(MMS.ContentClassValue, i, [i]);
michael@0 236 } else {
michael@0 237 wsp_encode_test(MMS.ContentClassValue, i, null, "CodeError");
michael@0 238 }
michael@0 239 }
michael@0 240
michael@0 241 run_next_test();
michael@0 242 });
michael@0 243
michael@0 244 //
michael@0 245 // Test target: ContentLocationValue
michael@0 246 //
michael@0 247
michael@0 248 //// ContentLocationValue.decode ////
michael@0 249
michael@0 250 add_test(function test_ContentLocationValue_decode() {
michael@0 251 // Test for MMS_PDU_TYPE_MBOX_DELETE_CONF & MMS_PDU_TYPE_DELETE_CONF
michael@0 252 function test(type, statusCount, exception) {
michael@0 253 function decode(data) {
michael@0 254 let options = {};
michael@0 255 if (type) {
michael@0 256 options["x-mms-message-type"] = type;
michael@0 257 }
michael@0 258 return MMS.ContentLocationValue.decode(data, options);
michael@0 259 }
michael@0 260
michael@0 261 let uri = "http://no.such.com/path";
michael@0 262
michael@0 263 let data = strToCharCodeArray(uri);
michael@0 264 if (statusCount != null) {
michael@0 265 data = [data.length + 1, statusCount | 0x80].concat(data);
michael@0 266 }
michael@0 267
michael@0 268 let expected;
michael@0 269 if (!exception) {
michael@0 270 expected = {};
michael@0 271 if (statusCount != null) {
michael@0 272 expected.statusCount = statusCount;
michael@0 273 }
michael@0 274 expected.uri = uri;
michael@0 275 }
michael@0 276
michael@0 277 do_print("data = " + JSON.stringify(data));
michael@0 278 wsp_decode_test_ex(decode, data, expected, exception);
michael@0 279 }
michael@0 280
michael@0 281 test(null, null, "FatalCodeError");
michael@0 282 for (let type = MMS_PDU_TYPE_SEND_REQ; type <= MMS_PDU_TYPE_CANCEL_CONF; type++) {
michael@0 283 if ((type == MMS_PDU_TYPE_MBOX_DELETE_CONF)
michael@0 284 || (type == MMS_PDU_TYPE_DELETE_CONF)) {
michael@0 285 test(type, 1, null);
michael@0 286 } else {
michael@0 287 test(type, null, null);
michael@0 288 }
michael@0 289 }
michael@0 290
michael@0 291 run_next_test();
michael@0 292 });
michael@0 293
michael@0 294 //
michael@0 295 // Test target: ElementDescriptorValue
michael@0 296 //
michael@0 297
michael@0 298 //// ElementDescriptorValue.decode ////
michael@0 299
michael@0 300 add_test(function test_ElementDescriptorValue_decode() {
michael@0 301 wsp_decode_test(MMS.ElementDescriptorValue, [2, 97, 0], {contentReference: "a"});
michael@0 302 wsp_decode_test(MMS.ElementDescriptorValue, [4, 97, 0, 0x80 | 0x02, 0x80],
michael@0 303 {contentReference: "a", params: {type: 0}});
michael@0 304
michael@0 305 run_next_test();
michael@0 306 });
michael@0 307
michael@0 308 //
michael@0 309 // Test target: Parameter
michael@0 310 //
michael@0 311
michael@0 312 //// Parameter.decodeParameterName ////
michael@0 313
michael@0 314 add_test(function test_Parameter_decodeParameterName() {
michael@0 315 wsp_decode_test_ex(function(data) {
michael@0 316 return MMS.Parameter.decodeParameterName(data);
michael@0 317 }, [0x80 | 0x02], "type"
michael@0 318 );
michael@0 319 wsp_decode_test_ex(function(data) {
michael@0 320 return MMS.Parameter.decodeParameterName(data);
michael@0 321 }, strToCharCodeArray("type"), "type"
michael@0 322 );
michael@0 323
michael@0 324 run_next_test();
michael@0 325 });
michael@0 326
michael@0 327 //// Parameter.decode ////
michael@0 328
michael@0 329 add_test(function test_Parameter_decode() {
michael@0 330 wsp_decode_test(MMS.Parameter, [0x80 | 0x02, 0x80 | 0x00], {name: "type", value: 0});
michael@0 331
michael@0 332 run_next_test();
michael@0 333 });
michael@0 334
michael@0 335 //// Parameter.decodeMultiple ////
michael@0 336
michael@0 337 add_test(function test_Parameter_decodeMultiple() {
michael@0 338 // FIXME: The following test case falls because Parameter-value decoding of
michael@0 339 // "type" parameters utilies WSP.ConstrainedEncoding, which in turn
michael@0 340 // utilies WSP.TextString, and TextString is not matual exclusive to
michael@0 341 // each other.
michael@0 342 //wsp_decode_test_ex(function(data) {
michael@0 343 // return MMS.Parameter.decodeMultiple(data, data.array.length);
michael@0 344 // }, [0x80 | 0x02, 0x80 | 0x00].concat(strToCharCodeArray("good")).concat([0x80 | 0x01]),
michael@0 345 // {type: 0, good: 1}
michael@0 346 //);
michael@0 347
michael@0 348 run_next_test();
michael@0 349 });
michael@0 350
michael@0 351 //// Parameter.encode ////
michael@0 352
michael@0 353 add_test(function test_Parameter_encode() {
michael@0 354 // Test for invalid parameter value
michael@0 355 wsp_encode_test(MMS.Parameter, null, null, "CodeError");
michael@0 356 wsp_encode_test(MMS.Parameter, undefined, null, "CodeError");
michael@0 357 wsp_encode_test(MMS.Parameter, {}, null, "CodeError");
michael@0 358 // Test for case-insensitive parameter name
michael@0 359 wsp_encode_test(MMS.Parameter, {name: "TYPE", value: 0}, [130, 128]);
michael@0 360 wsp_encode_test(MMS.Parameter, {name: "type", value: 0}, [130, 128]);
michael@0 361 // Test for non-well-known parameter name
michael@0 362 wsp_encode_test(MMS.Parameter, {name: "name", value: 0}, [110, 97, 109, 101, 0, 128]);
michael@0 363 // Test for constrained encoding value
michael@0 364 wsp_encode_test(MMS.Parameter, {name: "type", value: "0"}, [130, 48, 0]);
michael@0 365
michael@0 366 run_next_test();
michael@0 367 });
michael@0 368
michael@0 369 //
michael@0 370 // Test target: EncodedStringValue
michael@0 371 //
michael@0 372
michael@0 373 //// EncodedStringValue.decode ////
michael@0 374
michael@0 375 add_test(function test_EncodedStringValue_decode() {
michael@0 376 // Test for normal TextString
michael@0 377 wsp_decode_test(MMS.EncodedStringValue, strToCharCodeArray("Hello"), "Hello");
michael@0 378 // Test for non-well-known charset
michael@0 379 wsp_decode_test(MMS.EncodedStringValue, [1, 0x80], null, "NotWellKnownEncodingError");
michael@0 380 // Test for utf-8
michael@0 381 let (entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
michael@0 382 // "Mozilla" in full width.
michael@0 383 let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
michael@0 384
michael@0 385 let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
michael@0 386 .createInstance(Ci.nsIScriptableUnicodeConverter);
michael@0 387 conv.charset = entry.converter;
michael@0 388
michael@0 389 let raw = conv.convertToByteArray(str).concat([0]);
michael@0 390 wsp_decode_test(MMS.EncodedStringValue,
michael@0 391 [raw.length + 2, 0x80 | entry.number, 127].concat(raw), str);
michael@0 392 }
michael@0 393
michael@0 394 let (entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-16"]) {
michael@0 395 // "Mozilla" in full width.
michael@0 396 let str = "\u004d\u006F\u007A\u0069\u006C\u006C\u0061";
michael@0 397
michael@0 398 let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
michael@0 399 .createInstance(Ci.nsIScriptableUnicodeConverter);
michael@0 400 conv.charset = entry.converter;
michael@0 401
michael@0 402 let raw = conv.convertToByteArray(str).concat([0]);
michael@0 403 wsp_decode_test(MMS.EncodedStringValue,
michael@0 404 [raw.length + 3, 2, 3, 247].concat(raw), str);
michael@0 405 }
michael@0 406
michael@0 407 run_next_test();
michael@0 408 });
michael@0 409
michael@0 410 //// EncodedStringValue.encode ////
michael@0 411
michael@0 412 add_test(function test_EncodedStringValue_encode() {
michael@0 413 // Test for normal TextString
michael@0 414 wsp_encode_test(MMS.EncodedStringValue, "Hello", strToCharCodeArray("Hello"));
michael@0 415
michael@0 416 // Test for utf-8
michael@0 417 let (entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
michael@0 418 // "Mozilla" in full width.
michael@0 419 let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
michael@0 420
michael@0 421 let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
michael@0 422 .createInstance(Ci.nsIScriptableUnicodeConverter);
michael@0 423 conv.charset = entry.converter;
michael@0 424
michael@0 425 let raw = conv.convertToByteArray(str).concat([0]);
michael@0 426 wsp_encode_test(MMS.EncodedStringValue, str,
michael@0 427 [raw.length + 2, 0x80 | entry.number, 127].concat(raw));
michael@0 428
michael@0 429 // MMS.EncodedStringValue encodes non us-ascii characters (128 ~ 255)
michael@0 430 // (e.g., 'Ñ' or 'ü') by the utf-8 encoding. Otherwise, for us-ascii
michael@0 431 // characters (0 ~ 127), still use the normal TextString encoding.
michael@0 432
michael@0 433 // "Ñü" in full width.
michael@0 434 str = "\u00d1\u00fc";
michael@0 435 raw = conv.convertToByteArray(str).concat([0]);
michael@0 436 wsp_encode_test(MMS.EncodedStringValue, str,
michael@0 437 [raw.length + 2, 0x80 | entry.number, 127].concat(raw));
michael@0 438 }
michael@0 439
michael@0 440 run_next_test();
michael@0 441 });
michael@0 442
michael@0 443 //
michael@0 444 // Test target: ExpiryValue
michael@0 445 //
michael@0 446
michael@0 447 //// ExpiryValue.decode ////
michael@0 448
michael@0 449 add_test(function test_ExpiryValue_decode() {
michael@0 450 // Test for Absolute-token Date-value
michael@0 451 wsp_decode_test(MMS.ExpiryValue, [3, 128, 1, 0x80], new Date(0x80 * 1000));
michael@0 452 // Test for Relative-token Delta-seconds-value
michael@0 453 wsp_decode_test(MMS.ExpiryValue, [2, 129, 0x80], 0);
michael@0 454
michael@0 455 run_next_test();
michael@0 456 });
michael@0 457
michael@0 458 //// ExpiryValue.encode ////
michael@0 459
michael@0 460 add_test(function test_ExpiryValue_encode() {
michael@0 461 // Test for Absolute-token Date-value
michael@0 462 wsp_encode_test(MMS.ExpiryValue, new Date(0x80 * 1000), [3, 128, 1, 0x80]);
michael@0 463 // Test for Relative-token Delta-seconds-value
michael@0 464 wsp_encode_test(MMS.ExpiryValue, 0, [2, 129, 0x80]);
michael@0 465
michael@0 466 run_next_test();
michael@0 467 });
michael@0 468
michael@0 469 //
michael@0 470 // Test target: PreviouslySentByValue
michael@0 471 //
michael@0 472
michael@0 473 //// PreviouslySentByValue.decode ////
michael@0 474
michael@0 475 add_test(function test_PreviouslySentByValue_decode() {
michael@0 476 wsp_decode_test(MMS.PreviouslySentByValue, [3, 0x80 | 0x03, 65, 0],
michael@0 477 {forwardedCount: 3, originator: {address: "A",
michael@0 478 type: "alphanum"}});
michael@0 479
michael@0 480 run_next_test();
michael@0 481 });
michael@0 482
michael@0 483 //
michael@0 484 // Test target: PreviouslySentDateValue
michael@0 485 //
michael@0 486
michael@0 487 //// PreviouslySentDateValue.decode ////
michael@0 488
michael@0 489 add_test(function test_PreviouslySentDateValue_decode() {
michael@0 490 wsp_decode_test(MMS.PreviouslySentDateValue, [3, 0x80 | 0x03, 1, 4],
michael@0 491 {forwardedCount: 3, timestamp: new Date(4 * 1000)});
michael@0 492
michael@0 493 run_next_test();
michael@0 494 });
michael@0 495
michael@0 496 //
michael@0 497 // Test target: FromValue
michael@0 498 //
michael@0 499
michael@0 500 //// FromValue.decode ////
michael@0 501
michael@0 502 add_test(function test_FromValue_decode() {
michael@0 503 // Test for Insert-address-token:
michael@0 504 wsp_decode_test(MMS.FromValue, [1, 129], null);
michael@0 505 // Test for Address-present-token:
michael@0 506 let (addr = strToCharCodeArray("+123/TYPE=PLMN")) {
michael@0 507 wsp_decode_test(MMS.FromValue, [addr.length + 1, 128].concat(addr),
michael@0 508 {address: "+123", type: "PLMN"});
michael@0 509 }
michael@0 510
michael@0 511 run_next_test();
michael@0 512 });
michael@0 513
michael@0 514 //// FromValue.encode ////
michael@0 515
michael@0 516 add_test(function test_FromValue_encode() {
michael@0 517 // Test for Insert-address-token:
michael@0 518 wsp_encode_test(MMS.FromValue, null, [1, 129]);
michael@0 519 // Test for Address-present-token:
michael@0 520 let (addr = strToCharCodeArray("+123/TYPE=PLMN")) {
michael@0 521 wsp_encode_test(MMS.FromValue, {address: "+123", type: "PLMN"},
michael@0 522 [addr.length + 1, 128].concat(addr));
michael@0 523 }
michael@0 524
michael@0 525 run_next_test();
michael@0 526 });
michael@0 527
michael@0 528 //
michael@0 529 // Test target: MessageClassValue
michael@0 530 //
michael@0 531
michael@0 532 //// MessageClassValue.decodeClassIdentifier ////
michael@0 533
michael@0 534 add_test(function test_MessageClassValue_decodeClassIdentifier() {
michael@0 535 let (IDs = ["personal", "advertisement", "informational", "auto"]) {
michael@0 536 for (let i = 0; i < 256; i++) {
michael@0 537 if ((i >= 128) && (i <= 131)) {
michael@0 538 wsp_decode_test_ex(function(data) {
michael@0 539 return MMS.MessageClassValue.decodeClassIdentifier(data);
michael@0 540 }, [i], IDs[i - 128]
michael@0 541 );
michael@0 542 } else {
michael@0 543 wsp_decode_test_ex(function(data) {
michael@0 544 return MMS.MessageClassValue.decodeClassIdentifier(data);
michael@0 545 }, [i], null, "CodeError"
michael@0 546 );
michael@0 547 }
michael@0 548 }
michael@0 549 }
michael@0 550
michael@0 551 run_next_test();
michael@0 552 });
michael@0 553
michael@0 554 //// MessageClassValue.decode ////
michael@0 555
michael@0 556 add_test(function test_MessageClassValue_decode() {
michael@0 557 wsp_decode_test(MMS.MessageClassValue, [65, 0], "A");
michael@0 558 wsp_decode_test(MMS.MessageClassValue, [128], "personal");
michael@0 559
michael@0 560 run_next_test();
michael@0 561 });
michael@0 562
michael@0 563 //// MessageClassValue.encode ////
michael@0 564
michael@0 565 add_test(function test_MessageClassValue_encode() {
michael@0 566 wsp_encode_test(MMS.MessageClassValue, "personal", [128]);
michael@0 567 wsp_encode_test(MMS.MessageClassValue, "advertisement", [129]);
michael@0 568 wsp_encode_test(MMS.MessageClassValue, "informational", [130]);
michael@0 569 wsp_encode_test(MMS.MessageClassValue, "auto", [131]);
michael@0 570 wsp_encode_test(MMS.MessageClassValue, "A", [65, 0]);
michael@0 571
michael@0 572 run_next_test();
michael@0 573 });
michael@0 574
michael@0 575 //
michael@0 576 // Test target: MessageTypeValue
michael@0 577 //
michael@0 578
michael@0 579 //// MessageTypeValue.decode ////
michael@0 580
michael@0 581 add_test(function test_MessageTypeValue_decode() {
michael@0 582 for (let i = 0; i < 256; i++) {
michael@0 583 if ((i >= 128) && (i <= 151)) {
michael@0 584 wsp_decode_test(MMS.MessageTypeValue, [i], i);
michael@0 585 } else {
michael@0 586 wsp_decode_test(MMS.MessageTypeValue, [i], null, "CodeError");
michael@0 587 }
michael@0 588 }
michael@0 589
michael@0 590 run_next_test();
michael@0 591 });
michael@0 592
michael@0 593 //// MessageTypeValue.encode ////
michael@0 594
michael@0 595 add_test(function test_MessageTypeValue_encode() {
michael@0 596 for (let i = 0; i < 256; i++) {
michael@0 597 if ((i >= 128) && (i <= 151)) {
michael@0 598 wsp_encode_test(MMS.MessageTypeValue, i, [i]);
michael@0 599 } else {
michael@0 600 wsp_encode_test(MMS.MessageTypeValue, i, null, "CodeError");
michael@0 601 }
michael@0 602 }
michael@0 603
michael@0 604 run_next_test();
michael@0 605 });
michael@0 606
michael@0 607 //
michael@0 608 // Test target: MmFlagsValue
michael@0 609 //
michael@0 610
michael@0 611 //// MmFlagsValue.decode ////
michael@0 612
michael@0 613 add_test(function test_MmFlagsValue_decode() {
michael@0 614 for (let i = 0; i < 256; i++) {
michael@0 615 if ((i >= 128) && (i <= 130)) {
michael@0 616 wsp_decode_test(MMS.MmFlagsValue, [3, i, 65, 0], {type: i, text: "A"});
michael@0 617 } else {
michael@0 618 wsp_decode_test(MMS.MmFlagsValue, [3, i, 65, 0], null, "CodeError");
michael@0 619 }
michael@0 620 }
michael@0 621
michael@0 622 run_next_test();
michael@0 623 });
michael@0 624
michael@0 625 //// MmFlagsValue.encode ////
michael@0 626
michael@0 627 add_test(function test_MmFlagsValue_encode() {
michael@0 628 for (let i = 0; i < 256; i++) {
michael@0 629 if ((i >= 128) && (i <= 130)) {
michael@0 630 wsp_encode_test(MMS.MmFlagsValue, {type: i, text: "A"}, [3, i, 65, 0]);
michael@0 631 } else {
michael@0 632 wsp_encode_test(MMS.MmFlagsValue, {type: i, text: "A"}, null, "CodeError");
michael@0 633 }
michael@0 634 }
michael@0 635
michael@0 636 run_next_test();
michael@0 637 });
michael@0 638
michael@0 639 //
michael@0 640 // Test target: MmStateValue
michael@0 641 //
michael@0 642
michael@0 643 //// MmStateValue.decode ////
michael@0 644
michael@0 645 add_test(function test_MmStateValue_decode() {
michael@0 646 for (let i = 0; i < 256; i++) {
michael@0 647 if ((i >= 128) && (i <= 132)) {
michael@0 648 wsp_decode_test(MMS.MmStateValue, [i], i);
michael@0 649 } else {
michael@0 650 wsp_decode_test(MMS.MmStateValue, [i], null, "CodeError");
michael@0 651 }
michael@0 652 }
michael@0 653
michael@0 654 run_next_test();
michael@0 655 });
michael@0 656
michael@0 657 //// MmStateValue.encode ////
michael@0 658
michael@0 659 add_test(function test_MmStateValue_encode() {
michael@0 660 for (let i = 0; i < 256; i++) {
michael@0 661 if ((i >= 128) && (i <= 132)) {
michael@0 662 wsp_encode_test(MMS.MmStateValue, i, [i]);
michael@0 663 } else {
michael@0 664 wsp_encode_test(MMS.MmStateValue, i, null, "CodeError");
michael@0 665 }
michael@0 666 }
michael@0 667
michael@0 668 run_next_test();
michael@0 669 });
michael@0 670
michael@0 671 //
michael@0 672 // Test target: PriorityValue
michael@0 673 //
michael@0 674
michael@0 675 //// PriorityValue.decode ////
michael@0 676
michael@0 677 add_test(function test_PriorityValue_decode() {
michael@0 678 for (let i = 0; i < 256; i++) {
michael@0 679 if ((i >= 128) && (i <= 130)) {
michael@0 680 wsp_decode_test(MMS.PriorityValue, [i], i);
michael@0 681 } else {
michael@0 682 wsp_decode_test(MMS.PriorityValue, [i], null, "CodeError");
michael@0 683 }
michael@0 684 }
michael@0 685
michael@0 686 run_next_test();
michael@0 687 });
michael@0 688
michael@0 689 //// PriorityValue.encode ////
michael@0 690
michael@0 691 add_test(function test_PriorityValue_encode() {
michael@0 692 for (let i = 0; i < 256; i++) {
michael@0 693 if ((i >= 128) && (i <= 130)) {
michael@0 694 wsp_encode_test(MMS.PriorityValue, i, [i]);
michael@0 695 } else {
michael@0 696 wsp_encode_test(MMS.PriorityValue, i, null, "CodeError");
michael@0 697 }
michael@0 698 }
michael@0 699
michael@0 700 run_next_test();
michael@0 701 });
michael@0 702
michael@0 703 //
michael@0 704 // Test target: ReadStatusValue
michael@0 705 //
michael@0 706
michael@0 707 //// ReadStatusValue.decode ////
michael@0 708
michael@0 709 add_test(function test_ReadStatusValue_decode() {
michael@0 710 for (let i = 0; i < 256; i++) {
michael@0 711 if ((i >= 128) && (i <= 129)) {
michael@0 712 wsp_decode_test(MMS.ReadStatusValue, [i], i);
michael@0 713 } else {
michael@0 714 wsp_decode_test(MMS.ReadStatusValue, [i], null, "CodeError");
michael@0 715 }
michael@0 716 }
michael@0 717
michael@0 718 run_next_test();
michael@0 719 });
michael@0 720
michael@0 721 //// ReadStatusValue.encode ////
michael@0 722
michael@0 723 add_test(function test_ReadStatusValue_encode() {
michael@0 724 for (let i = 0; i < 256; i++) {
michael@0 725 if ((i >= 128) && (i <= 129)) {
michael@0 726 wsp_encode_test(MMS.ReadStatusValue, i, [i]);
michael@0 727 } else {
michael@0 728 wsp_encode_test(MMS.ReadStatusValue, i, null, "CodeError");
michael@0 729 }
michael@0 730 }
michael@0 731
michael@0 732 run_next_test();
michael@0 733 });
michael@0 734
michael@0 735 //
michael@0 736 // Test target: RecommendedRetrievalModeValue
michael@0 737 //
michael@0 738
michael@0 739 //// RecommendedRetrievalModeValue.decode ////
michael@0 740
michael@0 741 add_test(function test_RecommendedRetrievalModeValue_decode() {
michael@0 742 for (let i = 0; i < 256; i++) {
michael@0 743 if (i == 128) {
michael@0 744 wsp_decode_test(MMS.RecommendedRetrievalModeValue, [i], i);
michael@0 745 } else {
michael@0 746 wsp_decode_test(MMS.RecommendedRetrievalModeValue, [i], null, "CodeError");
michael@0 747 }
michael@0 748 }
michael@0 749
michael@0 750 run_next_test();
michael@0 751 });
michael@0 752
michael@0 753 //
michael@0 754 // Test target: ReplyChargingValue
michael@0 755 //
michael@0 756
michael@0 757 //// ReplyChargingValue.decode ////
michael@0 758
michael@0 759 add_test(function test_ReplyChargingValue_decode() {
michael@0 760 for (let i = 0; i < 256; i++) {
michael@0 761 if ((i >= 128) && (i <= 131)) {
michael@0 762 wsp_decode_test(MMS.ReplyChargingValue, [i], i);
michael@0 763 } else {
michael@0 764 wsp_decode_test(MMS.ReplyChargingValue, [i], null, "CodeError");
michael@0 765 }
michael@0 766 }
michael@0 767
michael@0 768 run_next_test();
michael@0 769 });
michael@0 770
michael@0 771 //// ReplyChargingValue.encode ////
michael@0 772
michael@0 773 add_test(function test_ReplyChargingValue_encode() {
michael@0 774 for (let i = 0; i < 256; i++) {
michael@0 775 if ((i >= 128) && (i <= 131)) {
michael@0 776 wsp_encode_test(MMS.ReplyChargingValue, i, [i]);
michael@0 777 } else {
michael@0 778 wsp_encode_test(MMS.ReplyChargingValue, i, null, "CodeError");
michael@0 779 }
michael@0 780 }
michael@0 781
michael@0 782 run_next_test();
michael@0 783 });
michael@0 784
michael@0 785 //
michael@0 786 // Test target: ResponseText
michael@0 787 //
michael@0 788
michael@0 789 //// ResponseText.decode ////
michael@0 790
michael@0 791 add_test(function test_ResponseText_decode() {
michael@0 792 // Test for MMS_PDU_TYPE_MBOX_DELETE_CONF & MMS_PDU_TYPE_DELETE_CONF
michael@0 793 wsp_decode_test_ex(function(data) {
michael@0 794 data.array[0] = data.array.length - 1;
michael@0 795
michael@0 796 let options = {};
michael@0 797 options["x-mms-message-type"] = MMS_PDU_TYPE_MBOX_DELETE_CONF;
michael@0 798 return MMS.ResponseText.decode(data, options);
michael@0 799 }, [0, 0x80 | 0x00].concat(strToCharCodeArray("http://no.such.com/path")),
michael@0 800 {statusCount: 0, text: "http://no.such.com/path"}
michael@0 801 );
michael@0 802 wsp_decode_test_ex(function(data) {
michael@0 803 data.array[0] = data.array.length - 1;
michael@0 804
michael@0 805 let options = {};
michael@0 806 options["x-mms-message-type"] = MMS_PDU_TYPE_DELETE_CONF;
michael@0 807 return MMS.ResponseText.decode(data, options);
michael@0 808 }, [0, 0x80 | 0x00].concat(strToCharCodeArray("http://no.such.com/path")),
michael@0 809 {statusCount: 0, text: "http://no.such.com/path"}
michael@0 810 );
michael@0 811 // Test for other situations
michael@0 812 wsp_decode_test_ex(function(data) {
michael@0 813 let options = {};
michael@0 814 options["x-mms-message-type"] = MMS_PDU_TYPE_SEND_REQ;
michael@0 815 return MMS.ResponseText.decode(data, options);
michael@0 816 }, strToCharCodeArray("http://no.such.com/path"),
michael@0 817 {text: "http://no.such.com/path"}
michael@0 818 );
michael@0 819
michael@0 820 run_next_test();
michael@0 821 });
michael@0 822
michael@0 823 //
michael@0 824 // Test target: RetrieveStatusValue
michael@0 825 //
michael@0 826
michael@0 827 //// RetrieveStatusValue.decode ////
michael@0 828
michael@0 829 add_test(function test_RetrieveStatusValue_decode() {
michael@0 830 for (let i = 0; i < 256; i++) {
michael@0 831 if ((i == MMS_PDU_ERROR_OK)
michael@0 832 || (i >= MMS_PDU_ERROR_TRANSIENT_FAILURE)) {
michael@0 833 wsp_decode_test(MMS.RetrieveStatusValue, [i], i);
michael@0 834 } else {
michael@0 835 wsp_decode_test(MMS.RetrieveStatusValue, [i],
michael@0 836 MMS_PDU_ERROR_PERMANENT_FAILURE);
michael@0 837 }
michael@0 838 }
michael@0 839
michael@0 840 run_next_test();
michael@0 841 });
michael@0 842
michael@0 843 //
michael@0 844 // Test target: SenderVisibilityValue
michael@0 845 //
michael@0 846
michael@0 847 //// SenderVisibilityValue.decode ////
michael@0 848
michael@0 849 add_test(function test_SenderVisibilityValue_decode() {
michael@0 850 for (let i = 0; i < 256; i++) {
michael@0 851 if ((i >= 128) && (i <= 129)) {
michael@0 852 wsp_decode_test(MMS.SenderVisibilityValue, [i], i);
michael@0 853 } else {
michael@0 854 wsp_decode_test(MMS.SenderVisibilityValue, [i], null, "CodeError");
michael@0 855 }
michael@0 856 }
michael@0 857
michael@0 858 run_next_test();
michael@0 859 });
michael@0 860
michael@0 861 //// SenderVisibilityValue.encode ////
michael@0 862
michael@0 863 add_test(function test_SenderVisibilityValue_encode() {
michael@0 864 for (let i = 0; i < 256; i++) {
michael@0 865 if ((i >= 128) && (i <= 129)) {
michael@0 866 wsp_encode_test(MMS.SenderVisibilityValue, i, [i]);
michael@0 867 } else {
michael@0 868 wsp_encode_test(MMS.SenderVisibilityValue, i, null, "CodeError");
michael@0 869 }
michael@0 870 }
michael@0 871
michael@0 872 run_next_test();
michael@0 873 });
michael@0 874
michael@0 875 //
michael@0 876 // Test target: StatusValue
michael@0 877 //
michael@0 878
michael@0 879 //// StatusValue.decode ////
michael@0 880
michael@0 881 add_test(function test_StatusValue_decode() {
michael@0 882 for (let i = 0; i < 256; i++) {
michael@0 883 if ((i >= 128) && (i <= 135)) {
michael@0 884 wsp_decode_test(MMS.StatusValue, [i], i);
michael@0 885 } else {
michael@0 886 wsp_decode_test(MMS.StatusValue, [i], null, "CodeError");
michael@0 887 }
michael@0 888 }
michael@0 889
michael@0 890 run_next_test();
michael@0 891 });
michael@0 892
michael@0 893 //// StatusValue.encode ////
michael@0 894
michael@0 895 add_test(function test_StatusValue_encode() {
michael@0 896 for (let i = 0; i < 256; i++) {
michael@0 897 if ((i >= 128) && (i <= 135)) {
michael@0 898 wsp_encode_test(MMS.StatusValue, i, [i]);
michael@0 899 } else {
michael@0 900 wsp_encode_test(MMS.StatusValue, i, null, "CodeError");
michael@0 901 }
michael@0 902 }
michael@0 903
michael@0 904 run_next_test();
michael@0 905 });
michael@0 906
michael@0 907 //
michael@0 908 // Test target: PduHelper
michael@0 909 //
michael@0 910
michael@0 911 //// PduHelper.parseHeaders ////
michael@0 912
michael@0 913 add_test(function test_PduHelper_parseHeaders() {
michael@0 914 function parse(input, expect, exception) {
michael@0 915 let data = {array: input, offset: 0};
michael@0 916 do_check_throws(wsp_test_func.bind(null, MMS.PduHelper.parseHeaders, data, expect),
michael@0 917 exception);
michael@0 918 }
michael@0 919
michael@0 920 // Parse ends with Content-Type
michael@0 921 let expect = {};
michael@0 922 expect["x-mms-mms-version"] = MMS_VERSION_1_3;
michael@0 923 expect["content-type"] = {
michael@0 924 media: "application/vnd.wap.multipart.related",
michael@0 925 params: null,
michael@0 926 };
michael@0 927 parse([0x80 | 0x0D, 0x80 | MMS_VERSION_1_3, // X-Mms-Mms-Version: 1.3
michael@0 928 0x80 | 0x04, 0x80 | 0x33, // Content-Type: application/vnd.wap.multipart.related
michael@0 929 0x80 | 0x0C, MMS_PDU_TYPE_SEND_REQ // X-Mms-Message-Type: M-Send.req
michael@0 930 ], expect);
michael@0 931
michael@0 932 // Parse header fields with multiple entries
michael@0 933 expect = {
michael@0 934 to: [
michael@0 935 { address: "+123", type: "PLMN" },
michael@0 936 { address: "+456", type: "num" },
michael@0 937 ],
michael@0 938 };
michael@0 939 expect["content-type"] = {
michael@0 940 media: "application/vnd.wap.multipart.related",
michael@0 941 params: null,
michael@0 942 };
michael@0 943 parse(Array.concat([0x80 | 0x17]).concat(strToCharCodeArray("+123/TYPE=PLMN"))
michael@0 944 .concat([0x80 | 0x17]).concat(strToCharCodeArray("+456"))
michael@0 945 .concat([0x80 | 0x04, 0x80 | 0x33]),
michael@0 946 expect);
michael@0 947
michael@0 948 run_next_test();
michael@0 949 });
michael@0 950
michael@0 951 //// PduHelper.encodeHeader ////
michael@0 952
michael@0 953 add_test(function test_PduHelper_encodeHeader() {
michael@0 954 function func(name, data, headers) {
michael@0 955 MMS.PduHelper.encodeHeader(data, headers, name);
michael@0 956
michael@0 957 // Remove extra space consumed during encoding.
michael@0 958 while (data.array.length > data.offset) {
michael@0 959 data.array.pop();
michael@0 960 }
michael@0 961
michael@0 962 return data.array;
michael@0 963 }
michael@0 964
michael@0 965 // Encode header fields with multiple entries
michael@0 966 let headers = {
michael@0 967 to: [
michael@0 968 { address: "+123", type: "PLMN" },
michael@0 969 { address: "+456", type: "num" },
michael@0 970 ],
michael@0 971 };
michael@0 972 wsp_encode_test_ex(func.bind(null, "to"), headers,
michael@0 973 Array.concat([0x80 | 0x17]).concat(strToCharCodeArray("+123/TYPE=PLMN"))
michael@0 974 .concat([0x80 | 0x17]).concat(strToCharCodeArray("+456")));
michael@0 975
michael@0 976 run_next_test();
michael@0 977 });
michael@0 978
michael@0 979 //// PduHelper.encodeHeaderIfExists ////
michael@0 980
michael@0 981 add_test(function test_PduHelper_encodeHeaderIfExists() {
michael@0 982 function func(name, data, headers) {
michael@0 983 MMS.PduHelper.encodeHeaderIfExists(data, headers, name);
michael@0 984
michael@0 985 // Remove extra space consumed during encoding.
michael@0 986 while (data.array.length > data.offset) {
michael@0 987 data.array.pop();
michael@0 988 }
michael@0 989
michael@0 990 return data.array;
michael@0 991 }
michael@0 992
michael@0 993 wsp_encode_test_ex(func.bind(null, "to"), {}, []);
michael@0 994
michael@0 995 run_next_test();
michael@0 996 });
michael@0 997
michael@0 998 //// PduHelper.encodeHeaders ////
michael@0 999
michael@0 1000 add_test(function test_PduHelper_encodeHeaders() {
michael@0 1001 function func(data, headers) {
michael@0 1002 MMS.PduHelper.encodeHeaders(data, headers);
michael@0 1003
michael@0 1004 // Remove extra space consumed during encoding.
michael@0 1005 while (data.array.length > data.offset) {
michael@0 1006 data.array.pop();
michael@0 1007 }
michael@0 1008
michael@0 1009 return data.array;
michael@0 1010 }
michael@0 1011
michael@0 1012 let headers = {};
michael@0 1013 headers["x-mms-message-type"] = MMS_PDU_TYPE_SEND_REQ;
michael@0 1014 headers["x-mms-mms-version"] = MMS_VERSION_1_3;
michael@0 1015 headers["x-mms-transaction-id"] = "asdf";
michael@0 1016 headers["to"] = { address: "+123", type: "PLMN" };
michael@0 1017 headers["content-type"] = {
michael@0 1018 media: "application/vnd.wap.multipart.related",
michael@0 1019 };
michael@0 1020 wsp_encode_test_ex(func, headers,
michael@0 1021 Array.concat([0x80 | 0x0C, MMS_PDU_TYPE_SEND_REQ])
michael@0 1022 .concat([0x80 | 0x18]).concat(strToCharCodeArray(headers["x-mms-transaction-id"]))
michael@0 1023 .concat([0x80 | 0x0D, 0x80 | MMS_VERSION_1_3])
michael@0 1024 .concat([0x80 | 0x17]).concat(strToCharCodeArray("+123/TYPE=PLMN"))
michael@0 1025 .concat([0x80 | 0x04, 0x80 | 0x33]));
michael@0 1026
michael@0 1027 run_next_test();
michael@0 1028 });
michael@0 1029

mercurial