Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1095097 - Override e.me url to localhost during tests. r=kgrandon
Browse files Browse the repository at this point in the history
  • Loading branch information
daleharvey committed Nov 10, 2014
1 parent 1ae19a5 commit 837e085
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ marionette('Browser Chrome - Bookmark Web Result', function() {

test('bookmark web result', function() {
var bookmarkIdentifier = 'mozilla1.org/';
home.waitForLaunch();
home.focusRocketBar();
search.triggerFirstRun(rocketbar);

rocketbar.homescreenFocus();
rocketbar.enterText('mozilla');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ marionette('Browser Chrome - Share Web Result', function() {
test('share web result via e-mail', function() {
var linkIdentifier = 'mozilla1.org/';

home.waitForLaunch();
home.focusRocketBar();
search.triggerFirstRun(rocketbar);

// Use the home-screen search box to open up the system browser
rocketbar.homescreenFocus();
rocketbar.enterText('mozilla');
Expand Down
13 changes: 10 additions & 3 deletions apps/verticalhome/test/marionette/search_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,30 @@ var Rocketbar = require(
var Search = require('../../../../apps/search/test/marionette/lib/search.js');
var System = require('../../../../apps/system/test/marionette/lib/system');
var Server = require('../../../../shared/test/integration/server');
var EmeServer = require(
'../../../../shared/test/integration/eme_server/parent');

marionette('Vertical - Search', function() {

var client = marionette.client(Home2.clientOptions);
var home, rocketbar, search, system, server;
var home, rocketbar, search, system, server, emeServer;
var phoneIdentifier =
'app://communications.gaiamobile.org/manifest.webapp-dialer';

suiteSetup(function(done) {
Server.create(__dirname + '/fixtures/', function(err, _server) {
server = _server;
done();
EmeServer(client, function(err, _server) {
emeServer = _server;
done(err);
});
});
system = new System(client);
});

suiteTeardown(function() {
suiteTeardown(function(done) {
server.stop();
emeServer.close(done);
});

setup(function() {
Expand All @@ -37,6 +43,7 @@ marionette('Vertical - Search', function() {
system = new System(client);
system.waitForStartup();
search.removeGeolocationPermission();
EmeServer.setServerURL(client, emeServer);
});

test('Search notification', function() {
Expand Down
7 changes: 7 additions & 0 deletions shared/js/everythingme/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
* respectively
*/
function Request(service, method, options) {

if (!eme.config.apiUrl) {
return new Promise(function(resolve, reject) {
reject('eme.config.apiUrl not defined');
});
}

var resource = service + '/' + method;
var url = eme.config.apiUrl.replace('{resource}', resource);
var payload = '';
Expand Down
3 changes: 1 addition & 2 deletions shared/js/everythingme/eme.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
const mozSettings = navigator.mozSettings;

const DEBUG = true;
const API_URL = 'https://api.everything.me/partners/1.0/{resource}/';

var initPromise = null;
var slice = Function.call.bind(Array.prototype.slice);

exports.eme = {
config: {
apiUrl: API_URL
apiUrl: null
},

init: function init() {
Expand Down
6 changes: 6 additions & 0 deletions shared/test/integration/eme_server/child.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ var emeServer = new EmeServer(process.argv[2], {
writeJSON(res, json);
},

'/Search/suggestions': function(req, res) {
var file = fs.readFileSync(this.root + 'search_suggestions.json');
var json = JSON.parse(file);
writeJSON(res, json);
},

'/settings/failAll': function(req, res) {
this.fail = true;
writeJSON(res);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errorCode":1,
"processingTime":14.3,
"response": [
"[ab]out.com",
"ab",
"[ab]ercrombie & fitch",
"[ab]ner louima"
],
"errorString":"OK",
"requestId":"8WxZsKjO_VU"
}
4 changes: 3 additions & 1 deletion shared/test/integration/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* @fileoverview this is where all the global profile overrides live.
*/
module.exports = {
// settings: {},
settings: {
'everythingme.api.url': null
}
// prefs: {},
// apps: {}
};

0 comments on commit 837e085

Please sign in to comment.