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

Commit

Permalink
Merge pull request #23256 from KevinGrandon/bug_1054672_rocketbar_tes…
Browse files Browse the repository at this point in the history
…t_browser_chrome_new_window

Bug 1054672 - Failing rocketbar test, browser_chrome_new_window.js
  • Loading branch information
KevinGrandon committed Aug 26, 2014
2 parents 6a29642 + ce42067 commit 38a34b7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
13 changes: 7 additions & 6 deletions apps/system/js/app_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
var _id = 0;
var _ = navigator.mozL10n.get;

var newTabApp = null;
var newTabManifestURL = null;
SettingsListener.observe('rocketbar.newTabAppURL', '',
function(url) {
var manifestURL = url ? url.match(/(^.*?:\/\/.*?\/)/)[1] +
// The application list in applications.js is not yet ready, so we store
// only the manifestURL for now and we look up the application whenever
// we trigger a new window.
newTabManifestURL = url ? url.match(/(^.*?:\/\/.*?\/)/)[1] +
'manifest.webapp' : '';
newTabApp = applications.getByManifestURL(manifestURL);
});

/**
Expand Down Expand Up @@ -621,9 +623,8 @@
};

AppChrome.prototype.onNewWindow = function ac_onNewWindow() {
if (newTabApp) {
newTabApp.launch();
}
var newTabApp = applications.getByManifestURL(newTabManifestURL);
newTabApp.launch();

this.hideOverflowMenu();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var Home = require(
'../../../../apps/verticalhome/test/marionette/lib/home2');
var Search = require(
'../../../../apps/search/test/marionette/lib/search');
var Server = require('../../../../shared/test/integration/server');
var System = require('./lib/system');
var Rocketbar = require('./lib/rocketbar');

Expand All @@ -21,7 +22,18 @@ marionette('Browser Chrome - Open New Window', function() {
}
});

var actions, home, rocketbar, search, system;
var actions, home, rocketbar, search, server, system;

suiteSetup(function(done) {
Server.create(__dirname + '/fixtures/', function(err, _server) {
server = _server;
done();
});
});

suiteTeardown(function() {
server.stop();
});

setup(function() {
actions = new Actions(client);
Expand All @@ -36,8 +48,9 @@ marionette('Browser Chrome - Open New Window', function() {

test('open new window', function() {
// Use the home-screen search box to open up the system browser
var url = server.url('sample.html');
rocketbar.homescreenFocus();
rocketbar.enterText('mozilla.org\uE006');
rocketbar.enterText(url + '\uE006');

// Count the number of currently open apps
var nApps = system.getAppWindows().length;
Expand All @@ -53,6 +66,8 @@ marionette('Browser Chrome - Open New Window', function() {

// Confirm that a new window was opened
client.switchToFrame();
assert(system.getAppWindows().length === nApps + 1);
client.waitFor(function(){
return system.getAppWindows().length === nApps + 1;
});
});
});

0 comments on commit 38a34b7

Please sign in to comment.