|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 Cu.import("resource://services-common/utils.js"); |
|
5 |
|
6 function run_test() { |
|
7 run_next_test(); |
|
8 } |
|
9 |
|
10 add_test(function test_simple() { |
|
11 let expected = { |
|
12 hello: "aGVsbG8=", |
|
13 "<>?": "PD4_", |
|
14 }; |
|
15 |
|
16 for (let [k, v] in Iterator(expected)) { |
|
17 do_check_eq(CommonUtils.encodeBase64URL(k), v); |
|
18 } |
|
19 |
|
20 run_next_test(); |
|
21 }); |
|
22 |
|
23 add_test(function test_no_padding() { |
|
24 do_check_eq(CommonUtils.encodeBase64URL("hello", false), "aGVsbG8"); |
|
25 |
|
26 run_next_test(); |
|
27 }); |