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
17
gaia/apps/findmydevice/test/marionette/.jshintrc
Executable file
17
gaia/apps/findmydevice/test/marionette/.jshintrc
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../.jshintrc",
|
||||
"predef": [
|
||||
"suite",
|
||||
"test",
|
||||
"setup",
|
||||
"teardown",
|
||||
"suiteSetup",
|
||||
"suiteTeardown",
|
||||
"marionette",
|
||||
"marionetteScriptFinished",
|
||||
"require",
|
||||
"define",
|
||||
"requireApp",
|
||||
"sinon"
|
||||
]
|
||||
}
|
||||
106
gaia/apps/findmydevice/test/marionette/findmydevice_test.js
Executable file
106
gaia/apps/findmydevice/test/marionette/findmydevice_test.js
Executable file
|
|
@ -0,0 +1,106 @@
|
|||
'use strict';
|
||||
/* global __dirname */
|
||||
|
||||
marionette('Find My Device lock >', function() {
|
||||
var assert = require('assert');
|
||||
|
||||
var FINDMYDEVICE_TEST_APP = 'app://test-findmydevice.gaiamobile.org';
|
||||
var SETTINGS_DIGEST_VALUE = 'lockscreen.passcode-lock.digest.value';
|
||||
|
||||
var client = marionette.client({
|
||||
profile: {
|
||||
apps: {
|
||||
'test-findmydevice.gaiamobile.org':
|
||||
__dirname + '/fixtures/test-findmydevice',
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setup(function() {
|
||||
// launch the test app
|
||||
client.apps.launch(FINDMYDEVICE_TEST_APP);
|
||||
client.apps.switchToApp(FINDMYDEVICE_TEST_APP);
|
||||
client.helper.waitForElement('body');
|
||||
});
|
||||
|
||||
test('Lock the screen through the test app', function() {
|
||||
var messageText = 'This phone is lost.';
|
||||
var messageInput = client.findElement('input[name="message"]');
|
||||
messageInput.sendKeys(messageText);
|
||||
|
||||
client.switchToFrame();
|
||||
var oldDigest = client.settings.get(SETTINGS_DIGEST_VALUE);
|
||||
client.apps.switchToApp(FINDMYDEVICE_TEST_APP);
|
||||
var passcode = '4567';
|
||||
var passcodeInput = client.findElement('input[name="code"]');
|
||||
passcodeInput.sendKeys(passcode);
|
||||
|
||||
var lockButton = client.findElement('#lock');
|
||||
lockButton.click();
|
||||
|
||||
// XXX: After we make LockScreen as an iframe or app, this should be the
|
||||
// line to switch to LockScreen frame.
|
||||
client.switchToFrame();
|
||||
var lockscreen = client.findElement('#lockscreen');
|
||||
client.waitFor(function() {
|
||||
return lockscreen.displayed();
|
||||
});
|
||||
|
||||
var lockscreenMessage = client.findElement('#lockscreen-message');
|
||||
client.waitFor(function() {
|
||||
var text = lockscreenMessage.text();
|
||||
if (text !== '') {
|
||||
assert.equal(lockscreenMessage.text(), messageText);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// sanity-check the settings we should have set
|
||||
var settings = {
|
||||
'lockscreen.enabled': true,
|
||||
'lockscreen.passcode-lock.enabled': true,
|
||||
'lockscreen.notifications-preview.enabled': false,
|
||||
'lockscreen.lock-message': messageText,
|
||||
};
|
||||
for (var s in settings) {
|
||||
assert.equal(client.settings.get(s), settings[s]);
|
||||
}
|
||||
// checking if passcode was changed:
|
||||
var newDigest = client.settings.get(SETTINGS_DIGEST_VALUE);
|
||||
assert.notEqual(newDigest, oldDigest);
|
||||
|
||||
client.switchToFrame();
|
||||
|
||||
// now unlock the screen and re-lock it, the message should disappear
|
||||
client.executeScript(function() {
|
||||
window.wrappedJSObject.Service.request('unlock');
|
||||
});
|
||||
|
||||
client.waitFor(function() {
|
||||
return client.executeScript(function() {
|
||||
return !window.wrappedJSObject.Service.locked;
|
||||
});
|
||||
});
|
||||
|
||||
client.executeScript(function() {
|
||||
window.wrappedJSObject.Service.request('lock');
|
||||
});
|
||||
|
||||
// XXX: After we make LockScreen as an iframe or app, this should be the
|
||||
// line to switch to LockScreen frame.
|
||||
client.switchToFrame();
|
||||
lockscreen = client.findElement('#lockscreen');
|
||||
client.waitFor(function() {
|
||||
return lockscreen.displayed();
|
||||
});
|
||||
|
||||
lockscreenMessage = client.findElement('#lockscreen-message');
|
||||
client.waitFor(function() {
|
||||
return !lockscreenMessage.displayed();
|
||||
});
|
||||
|
||||
assert.equal(client.settings.get('lockscreen.lock-message'), '');
|
||||
});
|
||||
});
|
||||
38
gaia/apps/findmydevice/test/marionette/fixtures/test-findmydevice/index.html
Executable file
38
gaia/apps/findmydevice/test/marionette/fixtures/test-findmydevice/index.html
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<title>Find My Device Test App</title>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="js/findmydevice.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="buttons">
|
||||
<button id="track">Track</button>
|
||||
<button id="erase">Erase</button>
|
||||
<button id="lock">Lock</button>
|
||||
<button id="ring">Ring</button>
|
||||
</div>
|
||||
|
||||
<div id="options">
|
||||
<label>Duration <input name="duration" type="number" placeholder="60"/></label>
|
||||
<label>Message <input name="message" type="text" placeholder="Help! I'm lost!"/></label>
|
||||
<label>Passcode <input name="code" type="text" placeholder="0000"/></label>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
window.onload = function() {
|
||||
var systemPort = null;
|
||||
navigator.mozApps.getSelf().onsuccess = function() {
|
||||
var app = this.result;
|
||||
app.connect('findmydevice-test').then(function(ports) {
|
||||
if (ports.length !== 1) {
|
||||
console.error('got more than one connection?');
|
||||
return;
|
||||
}
|
||||
|
||||
systemPort = ports[0];
|
||||
}, function(err) {
|
||||
console.error('failed to connect: ' + err);
|
||||
});
|
||||
};
|
||||
|
||||
var buttons = document.getElementById('buttons');
|
||||
buttons.addEventListener('click', function(event) {
|
||||
var cmdobj = {};
|
||||
var command = event.target.id[0];
|
||||
cmdobj[command] = {};
|
||||
|
||||
var options = document.getElementsByTagName('input');
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
cmdobj[command][options[i].name[0]] = options[i].value;
|
||||
}
|
||||
|
||||
systemPort.postMessage(cmdobj);
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "Test Find My Device",
|
||||
"description": "Manually issue commands for Find My Device",
|
||||
"type": "certified",
|
||||
"launch_path": "/index.html",
|
||||
"developer": {
|
||||
"name": "The Gaia Team",
|
||||
"url": "https://github.com/mozilla-b2g/gaia"
|
||||
},
|
||||
"default_locale": "en-US",
|
||||
"icons": {
|
||||
"128": "/style/icons/Blank.png"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in a new issue