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
24
gaia/tests/jsmarionette/plugins/marionette-content-script/test/fixtures/load_everywhere.js
vendored
Executable file
24
gaia/tests/jsmarionette/plugins/marionette-content-script/test/fixtures/load_everywhere.js
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
/* global Components, Services, dump */
|
||||
'use strict';
|
||||
Components.utils.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
try {
|
||||
Services.obs.addObserver(function(document) {
|
||||
if (!document || !document.location)
|
||||
return;
|
||||
|
||||
var location = document.location.href;
|
||||
dump('\n\n' + location + '\n\n');
|
||||
|
||||
try {
|
||||
let window = document.defaultView.wrappedJSObject;
|
||||
window.navigator.__defineGetter__('I_AM_HACKED', function() {
|
||||
return 'UNIQUE';
|
||||
});
|
||||
} catch (e) {
|
||||
dump('ERR: ' + e.toString() + '\n');
|
||||
}
|
||||
}, 'document-element-inserted', false);
|
||||
} catch (e) {
|
||||
dump('ERR: ' + e.toString() + '\n');
|
||||
}
|
||||
69
gaia/tests/jsmarionette/plugins/marionette-content-script/test/index_test.js
Executable file
69
gaia/tests/jsmarionette/plugins/marionette-content-script/test/index_test.js
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('index', function() {
|
||||
var CLOCK_APP = 'app://clock.gaiamobile.org';
|
||||
var CALENDAR_APP = 'app://calendar.gaiamobile.org';
|
||||
|
||||
marionette.plugin('apps', require('marionette-apps'));
|
||||
marionette.plugin('contentScript', require('../'));
|
||||
|
||||
var client = marionette.client();
|
||||
|
||||
suite('#inject', function() {
|
||||
setup(function() {
|
||||
client.contentScript.inject(__dirname + '/fixtures/load_everywhere.js');
|
||||
client.apps.launch(CLOCK_APP);
|
||||
client.apps.switchToApp(CLOCK_APP);
|
||||
});
|
||||
|
||||
function getCustomProperty() {
|
||||
return client.executeScript(function() {
|
||||
return window.wrappedJSObject.navigator.I_AM_HACKED;
|
||||
});
|
||||
}
|
||||
|
||||
function updatesCustomProperty(message) {
|
||||
var expectedValue = 'UNIQUE';
|
||||
assert.equal(
|
||||
getCustomProperty(),
|
||||
expectedValue,
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
test('in a single app', function() {
|
||||
updatesCustomProperty('I_AM_HACKED is exposed');
|
||||
});
|
||||
|
||||
test('multiple apps', function() {
|
||||
// back to root frame
|
||||
client.switchToFrame();
|
||||
// so we can launch another app
|
||||
client.apps.launch(CALENDAR_APP);
|
||||
client.apps.switchToApp(CALENDAR_APP);
|
||||
|
||||
updatesCustomProperty('I_AM_HACKED is exposed');
|
||||
});
|
||||
|
||||
suite('system app', function() {
|
||||
setup(function() {
|
||||
// go to system app
|
||||
client.switchToFrame();
|
||||
});
|
||||
|
||||
test('system app is not modified ', function() {
|
||||
// sanity check
|
||||
assert.ok(!getCustomProperty(), 'system app is not modified');
|
||||
});
|
||||
|
||||
test('next reload of system app will be modified', function() {
|
||||
// reload!
|
||||
client.goUrl(client.getUrl());
|
||||
|
||||
updatesCustomProperty();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue