Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
57
gaia/apps/system/test/raptor/lockscreen-lock2unlock-test.esp.js
Executable file
57
gaia/apps/system/test/raptor/lockscreen-lock2unlock-test.esp.js
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
'use strict';
|
||||
|
||||
/* globals require, module, Performance */
|
||||
|
||||
module.exports = function(filepath, outpath, requiredir) {
|
||||
// Developer can write their super fancy filter here.
|
||||
if (!filepath.match(/lockscreen.js$/)) {
|
||||
return;
|
||||
}
|
||||
var Logger = function() {
|
||||
this._writelogs = {};
|
||||
};
|
||||
Logger.prototype.log = function(outpath, advice) {
|
||||
this._writelogs[filepath] = {
|
||||
'outpath': outpath,
|
||||
'file': advice.file,
|
||||
'query': advice.query
|
||||
};
|
||||
};
|
||||
var logger = new Logger();
|
||||
var opts = {};
|
||||
if (outpath) {
|
||||
var fs = require('fs');
|
||||
opts.writer = {
|
||||
write: function(advice) {
|
||||
if (advice.instance.applied) {
|
||||
logger.log(filepath, advice);
|
||||
}
|
||||
var code = advice.code;
|
||||
fs.writeFile(outpath, code);
|
||||
}
|
||||
};
|
||||
}
|
||||
var Espect = require(requiredir + 'espect.js');
|
||||
var espect = new Espect(opts);
|
||||
espect
|
||||
.select(filepath + ' LockScreen.prototype.lock')
|
||||
.before(function() {
|
||||
performance.mark('lockScreenLock');
|
||||
})
|
||||
.done()
|
||||
.select(filepath + ' lockScreen.prototype.unlock')
|
||||
.before(function() {
|
||||
performance.mark('lockScreenUnlock');
|
||||
})
|
||||
.done()
|
||||
.done();
|
||||
// If it matched nothing as it was supposed to do, we have a bug.
|
||||
if (!logger._writelogs[filepath]) {
|
||||
throw new Error('TransformingFailed::Matched nothing to transform code.');
|
||||
} else {
|
||||
Object.keys(logger._writelogs).forEach(function(filepath) {
|
||||
var info = logger._writelogs[filepath];
|
||||
console.log('|lock2unlock.esp| Successfully wove ', filepath);
|
||||
});
|
||||
}
|
||||
};
|
||||
73
gaia/apps/system/test/raptor/lockscreen-lock2unlock-test.js
Executable file
73
gaia/apps/system/test/raptor/lockscreen-lock2unlock-test.js
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
'use strict';
|
||||
|
||||
/* global setup, afterEach, marionetteScriptFinished */
|
||||
/* Test from lock to unlock, how long does it take. */
|
||||
setup(function(options) {
|
||||
options.phase = 'reboot';
|
||||
});
|
||||
|
||||
afterEach(function(phase) {
|
||||
return phase.device.marionette
|
||||
.startSession()
|
||||
.then(function(client) {
|
||||
var Deferred = function() {
|
||||
this.promise = new Promise((function(res, rej) {
|
||||
this.resolve = res;
|
||||
this.reject = rej;
|
||||
}).bind(this));
|
||||
return this;
|
||||
};
|
||||
var deferred = new Deferred();
|
||||
deferred.promise = deferred.promise.then(function() {
|
||||
client.deleteSession();
|
||||
}).catch(function(err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
client.switchToFrame();
|
||||
client.executeAsyncScript(function() {
|
||||
var settings = window.wrappedJSObject.navigator.mozSettings;
|
||||
var lock = settings.createLock();
|
||||
lock.set({
|
||||
'lockscreen.enabled': true
|
||||
}).then(function() {
|
||||
marionetteScriptFinished(null, 'success');
|
||||
}).catch(function(err) {
|
||||
marionetteScriptFinished(err, 'falied');
|
||||
});
|
||||
});
|
||||
client.executeScript(function() {
|
||||
window.wrappedJSObject.Service.request('lock');
|
||||
});
|
||||
client.waitFor(function() {
|
||||
return client.executeScript(function() {
|
||||
return window.wrappedJSObject.Service.query('locked');
|
||||
});
|
||||
});
|
||||
client.executeScript(function() {
|
||||
window.wrappedJSObject.Service.request('unlock');
|
||||
});
|
||||
client.waitFor(function() {
|
||||
return client.executeScript(function() {
|
||||
return !window.wrappedJSObject.Service.query('locked');
|
||||
});
|
||||
});
|
||||
client.executeAsyncScript(function() {
|
||||
var settings = window.wrappedJSObject.navigator.mozSettings;
|
||||
var lock = settings.createLock();
|
||||
lock.set({
|
||||
'lockscreen.enabled': false
|
||||
}).then(function() {
|
||||
marionetteScriptFinished(null, 'success');
|
||||
}).catch(function(err) {
|
||||
marionetteScriptFinished(err, 'falied');
|
||||
});
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
deferred.reject(err);
|
||||
}
|
||||
deferred.resolve();
|
||||
});
|
||||
return deferred.promise;
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue