mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Updated test_passphrase_checking
This commit is contained in:
parent
25744eb911
commit
1b82e736e0
@ -316,6 +316,8 @@ function SyncTestingInfrastructure(engineFactory) {
|
||||
|
||||
ID.set('WeaveID',
|
||||
new Identity('Mozilla Services Encryption Passphrase', 'foo'));
|
||||
ID.set('WeaveCryptoID',
|
||||
new Identity('Mozilla Services Encryption Passphrase', 'foo'));
|
||||
|
||||
this.fakePasswordService = new FakePasswordService(__fakePasswords);
|
||||
this.fakePrefService = new FakePrefService(__fakePrefs);
|
||||
|
@ -1,49 +1,22 @@
|
||||
Cu.import("resource://weave/log4moz.js");
|
||||
Cu.import("resource://weave/dav.js");
|
||||
Cu.import("resource://weave/async.js");
|
||||
Cu.import("resource://weave/crypto.js");
|
||||
|
||||
let __fakePrefs = {
|
||||
"log.logger.async" : "Debug",
|
||||
"username" : "foo",
|
||||
"serverURL" : "https://example.com/",
|
||||
"encryption" : "aes-256-cbc",
|
||||
"enabled" : true,
|
||||
"schedule" : 0
|
||||
};
|
||||
|
||||
let __fakeDAVContents = {
|
||||
"meta/version" : "3",
|
||||
// Note that this private key is encrypted with the passphrase
|
||||
// "passhrase", provided by our testing infrastructure.
|
||||
"private/privkey" : '{"version":1,"algorithm":"RSA","privkey":"3ytj94K6Wo0mBjAVsiIwjm5x2+ENvpKTDUqLCz19iXbESf8RT6O8PmY7Pqcndpn+adqaQdvmr0T1JQ5bfLEHev0WBfo8oWJb+OS4rKoCWxDNzGwrOlW5hCfxSekw0KrKjqZyDZ0hT1Qt9vn6thlV2v9YWfmyn0OIxNC9hUqGwU3Wb2F2ejM0Tw40+IIW4eLEvFxLGv0vnEXpZvesPt413proL6FGQJe6vyapBg+sdX1JMYGaKZY84PUGIiDPxTbQg7yIWTSe3WlDhJ001khFiyEoTZvPhiAGXfML9ycrCRZUWkHp/cfS7QiusJXs6co0tLjrIk/rTk8h4mHBnyPkFIxh4YrfC7Bwf9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c6OWHWgUcuiIBRjKeo5gBTbExWmri2VG+cn005vQNxK+0s7JVyFB8TzZ96pV3nFjkYy9OUkaiJxGd6OVGcvhbbrcNsKkaZff7OsLqczf6x0bhwh+y8+bLjLkuusGYUdBvdeiuv12IfeRupvwD8Z3aZOgcD7d+8VTyTyd/KX9fu8P7tD5SojJ5joRPjcv4Q8/mhRgtwx1McMIL3YnKHG+U=","privkeyIV":"fZ7CB/KQAUjEhkmrEkns4Q==","privkeySalt":"JFs5h2RKX9m0Op9DlQIcCOSfOH1MuDrrrHxCx+CpCUU="}',
|
||||
"public/pubkey" : '{"version":1,"algorithm":"RSA","pubkey":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxxwObnXIoYeQKMG9RbvLkgsu/idDo25qOX87jIEiXkgW1wLKp/1D/DBLUEW303tVszNGVt6bTyAXOIj6skpmYoDs9Z48kvU3+g7Vi4QXEw5moSS4fr+yFpKiYd2Kx1+jCFGvGZjBzAAvnjsWmWrSA+LHJSrFlKY6SM3kNg8KrE8dxUi3wztlZnhZgo1ZYe7/VeBOXUfThtoadIl1VdREw2e79eiMQpPa0XLv4grCaMd/wLRs0be1/nPt7li4NyT0fnYFWg75SU3ni/xSaq/zR4NmW/of5vB2EcKyUG+/mvNplQ0CX+v3hRBCdhpCyPmcbHKUluyKzj7Ms9pKyCkwxwIDAQAB"}'
|
||||
};
|
||||
|
||||
let Service = loadInSandbox("resource://weave/service.js");
|
||||
|
||||
function TestService() {
|
||||
this.__superclassConstructor = Service.WeaveSvc;
|
||||
this.__superclassConstructor([]);
|
||||
}
|
||||
|
||||
TestService.prototype = {
|
||||
_initLogs: function TS__initLogs() {
|
||||
this._log = Log4Moz.Service.getLogger("Service.Main");
|
||||
}
|
||||
};
|
||||
TestService.prototype.__proto__ = Service.WeaveSvc.prototype;
|
||||
|
||||
Cu.import("resource://weave/identity.js");
|
||||
Function.prototype.async = Async.sugar;
|
||||
|
||||
let __fakeCryptoID = {
|
||||
ke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hpCyPmcbHKUluyKzj7Ms9pKyCkwxwIDAQAB"
|
||||
};
|
||||
|
||||
function checkpassphrase_coroutine() {
|
||||
var self = yield;
|
||||
|
||||
var idRSA = ID.get("WeaveCryptoID");
|
||||
|
||||
//Uncomment this line to cause things to go amiss.
|
||||
//idRSA.setTempPassword("badpassphrase");
|
||||
|
||||
var idTemp = new Identity("temp", "temp", null);
|
||||
// Generate a random symmetric key.
|
||||
Crypto.randomKeyGen.async(Crypto, self.cb, idTemp);
|
||||
@ -65,19 +38,11 @@ function checkpassphrase_coroutine() {
|
||||
}
|
||||
|
||||
function test_passphrase_checking() {
|
||||
var syncTesting = new SyncTestingInfrastructure();
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
|
||||
syncTesting.fakeDAVService.fakeContents = __fakeDAVContents;
|
||||
for (name in __fakePrefs)
|
||||
syncTesting.fakePrefService.fakeContents[name] = __fakePrefs[name];
|
||||
|
||||
var testService = new TestService();
|
||||
|
||||
function login(cb) {
|
||||
testService.login(cb);
|
||||
}
|
||||
|
||||
syncTesting.runAsyncFunc("Logging in", login);
|
||||
let id = ID.get("WeaveCryptoID");
|
||||
for (name in __fakeCryptoID)
|
||||
id[name] = __fakeCryptoID[name];
|
||||
|
||||
function checkpassphrase(cb) {
|
||||
checkpassphrase_coroutine.async({}, cb);
|
||||
|
Loading…
Reference in New Issue
Block a user