~ubuntu-branches/ubuntu/trusty/enigmail/trusty-updates

« back to all changes in this revision

Viewing changes to services/sync/tests/unit/test_utils_status.js

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2011-06-07 14:35:53 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: package-import@ubuntu.com-20110607143553-fbgqhhvh8g8h6j1y
Tags: 2:1.2~a2~cvs20110606t2200-0ubuntu1
* Update to latest trunk snapshot for Thunderbird beta compat

* Remove build/pgo/profileserver.py from debian/clean. The new build
  system has a target depending on this
  - update debian/clean
* Drop debian/patches/autoconf.diff, just generate this at build time
* Refresh debian/patches/build_system_dont_link_libxul.diff
* libipc seems to be renamed to libipc-pipe. Fix genxpi and chrome.manifest
  to fix this 
  - add debian/patches/ipc-pipe_rename.diff
  - update debian/patches/series
* The makefiles in extensions/enigmail/ipc have an incorrect DEPTH
  attribute. Fix this so that they can find the rest of the build system
  - add debian/patches/makefile_depth.diff
  - update debian/patches/series
* Drop debian/patches/makefile-in-empty-xpcom-fix.diff - fixed in the
  current version
* Don't register a class ID multiple times, as this breaks enigmail entirely
  - add debian/patches/dont_register_cids_multiple_times.diff
  - update debian/patches/series
* Look for the Thunderbird 5 SDK
  - update debian/rules
  - update debian/control
* Run autoconf2.13 at build time
  - update debian/rules
  - update debian/control
* Add useless mesa-common-dev build-dep, just to satisfy the build system.
  We should just patch this out entirely really, but that's for another upload
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Cu.import("resource://services-sync/util.js");
 
2
 
 
3
// both the checkStatus and ensureStatus functions are tested
 
4
// here.
 
5
 
 
6
function run_test() {
 
7
  _test_checkStatus();
 
8
  _test_ensureStatus();
 
9
}
 
10
 
 
11
function _test_checkStatus() {
 
12
  let msg = "msg";
 
13
 
 
14
  _("test with default range");
 
15
  do_check_true(Utils.checkStatus(200, msg));
 
16
  do_check_true(Utils.checkStatus(299, msg));
 
17
  do_check_false(Utils.checkStatus(199, msg));
 
18
  do_check_false(Utils.checkStatus(300, msg));
 
19
 
 
20
  _("test with a number");
 
21
  do_check_true(Utils.checkStatus(100, msg, [100]));
 
22
  do_check_false(Utils.checkStatus(200, msg, [100]));
 
23
 
 
24
  _("test with two numbers");
 
25
  do_check_true(Utils.checkStatus(100, msg, [100, 200]));
 
26
  do_check_true(Utils.checkStatus(200, msg, [100, 200]));
 
27
  do_check_false(Utils.checkStatus(50, msg, [100, 200]));
 
28
  do_check_false(Utils.checkStatus(150, msg, [100, 200]));
 
29
  do_check_false(Utils.checkStatus(250, msg, [100, 200]));
 
30
 
 
31
  _("test with a range and a number");
 
32
  do_check_true(Utils.checkStatus(50, msg, [[50, 100], 100]));
 
33
  do_check_true(Utils.checkStatus(75, msg, [[50, 100], 100]));
 
34
  do_check_true(Utils.checkStatus(100, msg, [[50, 100], 100]));
 
35
  do_check_false(Utils.checkStatus(200, msg, [[50, 100], 100]));
 
36
 
 
37
  _("test with a number and a range");
 
38
  do_check_true(Utils.checkStatus(50, msg, [100, [50, 100]]));
 
39
  do_check_true(Utils.checkStatus(75, msg, [100, [50, 100]]));
 
40
  do_check_true(Utils.checkStatus(100, msg, [100, [50, 100]]));
 
41
  do_check_false(Utils.checkStatus(200, msg, [100, [50, 100]]));
 
42
}
 
43
 
 
44
function _test_ensureStatus() {
 
45
  _("test that ensureStatus throws exception when it should");
 
46
  let except;
 
47
  try {
 
48
    Utils.ensureStatus(400, "msg", [200]);
 
49
  } catch(e) {
 
50
    except = e;
 
51
  }
 
52
  do_check_true(!!except);
 
53
}