~ubuntu-branches/ubuntu/intrepid/xulrunner-1.9/intrepid

« back to all changes in this revision

Viewing changes to mozilla/toolkit/components/passwordmgr/test/unit/test_storage_legacy_3.js

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Alexander Sack, Fabien Tassin
  • Date: 2008-02-13 11:47:21 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080213114721-7om0mgzngvuk9czv
Tags: 1.9~b3+nobinonly-0ubuntu1
* release FIREFOX_3_0b3_RELEASE

[ Alexander Sack ]
* submit patch that ships xpcshell to bugzilla
  - rename debian/patches/ship_xpcshell.patch =>
           debian/patches/bz410617_att295212_ship_xpcshell.patch
  - update debian/patches/series
* fix tooltip in epiphany: previously displayed out of screen bounds
  (LP: #37507)
  - add debian/patches/bz233371_att297343_fix_outofscreen_embed_tooltip.patch
  - update debian/patches/series
* use default upstream gcc tweaks for improved performance - especially of the
  javascript engine
  - update debian/rules
* update global extension/plugin patch to apply cleanly against latest code
  - update debian/patches/bzXXX_gre_extension_plugin_support.patch
* fix pyxpcom build failure introduced by recent commit
  - add debian/patches/bzXXX_fix_pyxpcom_build_failure.patch
  - update debian/patches/series
* add distro independent global install locations for extensions,
  /usr/lib/mozilla/extensions and /usr/share/mozilla/extensions
  - update debian/xulrunner-1.9.dirs
* support embedded tarball layout when either there is a *.tar.bz2 in orig tarball
  or if DEBIAN_MOZCLIENT_EMBEDDED is not unset (you will need this to produce embedded
  tarballs during |get-orig-source|
  - update debian/rules
* bump minimum libnss3-dev build requirements to >= 3.12.0~1.9b3
  - update debian/control
* bump minimum libnspr4-dev build requirements to >= 4.7.0~1.9b3
  - update debian/control

[ Fabien Tassin ]
* Drop patches applied upstream
  - drop debian/patches/bz410617_att295212_ship_xpcshell.patch
  - drop debian/patches/bz404634_att294921.patch
  - drop debian/patches/bz386610_python2.5_ftbfs_amd64.patch
  - drop debian/patches/bz373918_att295042.patch
  - drop debian/patches/bz408062_unstable_pc.patch
  - drop debian/patches/bz384304_fix_recursive_symlinks.patch
  - update debian/patches/series
* Refresh diverged patches:
  - update debian/patches/bzXXX_pc_honour_system_nspr_nss.patch
  - update debian/patches/rename_venkman_addon.patch
  - update debian/patches/bz344818_cairo_xrender.patch
* Install links for all .so libs in the -dev package
  - update debian/patches/dont_install_so_in_dev.patch
* Bump gtk requirement to 2.12 as per Mozilla bug 412432
  - update debian/control
* Add #DEBHELPER# token to postinst/prerm scripts
  - update debian/xulrunner-1.9.{postinst,prerm}
* Install previously missed libdbusservice.so
  - update debian/xulrunner-1.9.install
* Update venkman patch to also rename locales
  - update debian/patches/rename_venkman_addon.patch
* Bump requirement for system cairo to >= 1.5.8 as we now need
  the newly added cairo_path_extents()
  - update debian/rules
* Include mozilla-devscripts file using -include so ifneq could be omitted
  - update debian/rules
* Fix missing .so symlinks regression
  - update debian/patches/dont_install_so_in_dev.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Test suite for storage-Legacy.js -- various bug fixes.
3
 
 *
4
 
 * This test interfaces directly with the legacy login storage module,
5
 
 * bypassing the normal login manager usage.
6
 
 *
7
 
 */
8
 
 
9
 
 
10
 
function run_test() {
11
 
 
12
 
try {
13
 
 
14
 
 
15
 
/* ========== 0 ========== */
16
 
var testnum = 0;
17
 
var testdesc = "Initial connection to storage module"
18
 
 
19
 
var storage = Cc["@mozilla.org/login-manager/storage/legacy;1"].
20
 
              createInstance(Ci.nsILoginManagerStorage);
21
 
if (!storage)
22
 
    throw "Couldn't create storage instance.";
23
 
 
24
 
 
25
 
/* ========== 1 ========== */
26
 
testnum++;
27
 
var testdesc = "Create nsILoginInfo instances for testing with"
28
 
 
29
 
var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
30
 
                 createInstance(Ci.nsILoginInfo);
31
 
var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
32
 
                 createInstance(Ci.nsILoginInfo);
33
 
var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
34
 
                 createInstance(Ci.nsILoginInfo);
35
 
 
36
 
dummyuser1.init("http://dummyhost.mozilla.org", "", null,
37
 
    "testuser1", "testpass1", "put_user_here", "put_pw_here");
38
 
 
39
 
dummyuser2.init("http://dummyhost2.mozilla.org", "", null,
40
 
    "testuser2", "testpass2", "put_user2_here", "put_pw2_here");
41
 
 
42
 
dummyuser3.init("http://dummyhost2.mozilla.org", "", null,
43
 
    "testuser3", "testpass3", "put_user3_here", "put_pw3_here");
44
 
 
45
 
 
46
 
 
47
 
/*
48
 
 * ---------------------- Bug 380961 ----------------------
49
 
 * Need to support decoding the mime64-obscured format still
50
 
 * used by SeaMonkey.
51
 
 */
52
 
 
53
 
 
54
 
/* ========== 2 ========== */
55
 
testnum++;
56
 
 
57
 
testdesc = "checking import of mime64-obscured entries"
58
 
LoginTest.initStorage(storage, INDIR, "signons-380961-1.txt",
59
 
                               OUTDIR, "output-380961-1.txt");
60
 
LoginTest.checkStorageData(storage, [], [dummyuser1]);
61
 
 
62
 
testdesc = "[flush and reload for verification]"
63
 
LoginTest.initStorage(storage, OUTDIR, "output-380961-1.txt");
64
 
LoginTest.checkStorageData(storage, [], [dummyuser1]);
65
 
 
66
 
/* ========== 3 ========== */
67
 
testnum++;
68
 
 
69
 
testdesc = "testing import of multiple mime-64 entries for a host"
70
 
LoginTest.initStorage(storage, INDIR, "signons-380961-2.txt",
71
 
                               OUTDIR, "output-380961-2.txt");
72
 
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser3]);
73
 
 
74
 
testdesc = "[flush and reload for verification]"
75
 
LoginTest.initStorage(storage, OUTDIR, "output-380961-2.txt");
76
 
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser3]);
77
 
 
78
 
/* ========== 4 ========== */
79
 
testnum++;
80
 
 
81
 
testdesc = "testing import of mixed encrypted and mime-64 entries."
82
 
LoginTest.initStorage(storage, INDIR, "signons-380961-3.txt",
83
 
                               OUTDIR, "output-380961-3.txt");
84
 
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
85
 
 
86
 
testdesc = "[flush and reload for verification]"
87
 
LoginTest.initStorage(storage, OUTDIR, "output-380961-3.txt");
88
 
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
89
 
 
90
 
 
91
 
/*
92
 
 * ---------------------- Bug 381262 ----------------------
93
 
 * The SecretDecoderRing can't handle UCS2, failure to
94
 
 * convert to UTF8 garbles the result.
95
 
 *
96
 
 * Note: dump()ing to the console on OS X (at least) outputs
97
 
 * garbage, whereas the "bad" UCS2 looks ok!
98
 
 */
99
 
 
100
 
/* ========== 5 ========== */
101
 
testnum++;
102
 
 
103
 
testdesc = "initializing login with non-ASCII data."
104
 
var dummyuser4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
105
 
                 createInstance(Ci.nsILoginInfo);
106
 
 
107
 
dummyuser4.hostname      = "https://site.org";
108
 
dummyuser4.username      = String.fromCharCode(
109
 
                            355, 277, 349, 357, 533, 537, 101, 345, 185);
110
 
                            // "testuser1" using similar-looking glyphs
111
 
dummyuser4.usernameField = "username";
112
 
dummyuser4.password      = "testpa" + String.fromCharCode(223) + "1";
113
 
                            // "ss" replaced with German eszett.
114
 
dummyuser4.passwordField = "password";
115
 
dummyuser4.formSubmitURL = "https://site.org";
116
 
dummyuser4.httpRealm     = null;
117
 
 
118
 
 
119
 
/* ========== 6 ========== */
120
 
testnum++;
121
 
 
122
 
testdesc = "testing import of non-ascii username and password."
123
 
LoginTest.initStorage(storage, INDIR, "signons-381262.txt",
124
 
                               OUTDIR, "output-381262-1.txt");
125
 
var logins = storage.getAllLogins({});
126
 
LoginTest.checkStorageData(storage, [], [dummyuser4]);
127
 
 
128
 
testdesc = "[flush and reload for verification]"
129
 
LoginTest.initStorage(storage, OUTDIR, "output-381262-1.txt");
130
 
LoginTest.checkStorageData(storage, [], [dummyuser4]);
131
 
 
132
 
 
133
 
/* ========== 7 ========== */
134
 
testnum++;
135
 
 
136
 
testdesc = "testing storage of non-ascii username and password."
137
 
LoginTest.initStorage(storage, INDIR, "signons-empty.txt",
138
 
                               OUTDIR, "output-381262-2.txt");
139
 
LoginTest.checkStorageData(storage, [], []);
140
 
storage.addLogin(dummyuser4);
141
 
LoginTest.checkStorageData(storage, [], [dummyuser4]);
142
 
 
143
 
testdesc = "[flush and reload for verification]"
144
 
LoginTest.initStorage(storage, OUTDIR, "output-381262-2.txt");
145
 
logins = storage.getAllLogins({});
146
 
LoginTest.checkStorageData(storage, [], [dummyuser4]);
147
 
 
148
 
 
149
 
/*
150
 
 * ---------------------- Bug 400751 ----------------------
151
 
 * Migrating from existing mime64 encoded format causes
152
 
 * errors in storage legacy's code
153
 
 */
154
 
 
155
 
 
156
 
/* ========== 8 ========== */
157
 
testnum++;
158
 
 
159
 
testdesc = "checking double reading of mime64-obscured entries";
160
 
LoginTest.initStorage(storage, INDIR, "signons-380961-1.txt");
161
 
LoginTest.checkStorageData(storage, [], [dummyuser1]);
162
 
 
163
 
testdesc = "checking double reading of mime64-obscured entries part 2";
164
 
LoginTest.checkStorageData(storage, [], [dummyuser1]);
165
 
 
166
 
/* ========== 9 ========== */
167
 
testnum++;
168
 
 
169
 
testdesc = "checking correct storage of mime64 converted entries";
170
 
LoginTest.initStorage(storage, INDIR, "signons-380961-1.txt",
171
 
                               OUTDIR, "output-400751-1.txt");
172
 
LoginTest.checkStorageData(storage, [], [dummyuser1]);
173
 
LoginTest.checkStorageData(storage, [], [dummyuser1]);
174
 
storage.addLogin(dummyuser2); // trigger a write
175
 
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2]);
176
 
 
177
 
testdesc = "[flush and reload for verification]";
178
 
LoginTest.initStorage(storage, OUTDIR, "output-400751-1.txt");
179
 
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2]);
180
 
 
181
 
} catch (e) {
182
 
    throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
183
 
}
184
 
 
185
 
};