Bug 596023 Update Tests for Mozmill in m-c r=whimboo a=NPOTB

This commit is contained in:
Clint Talbert 2010-09-17 17:18:06 -07:00
Родитель d1ddcdaa2f
Коммит a333e3ca6b
154 изменённых файлов: 1890 добавлений и 11518 удалений

Просмотреть файл

Просмотреть файл

@ -1,69 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Google toolbar mozmill test suite.
*
* The Initial Developer of the Original Code is Google.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ankush Kalkote <ankush@google.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* @fileoverview This is very basic test for toolbar which is meant for the
* integration with Mozilla test suite.
*/
/**
* Ids of Google toolbar elements.
* @type string
*/
const GTB_ID = 'gtbToolbar';
/**
* Time-out for Google toolbar tests
* @type integer
*/
const gtbTimeout = 5000;
/**
* Sets up the test module by acquiring a browser controller.
* @param {module} module object for the test used by Mozmill.
*/
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
}
/**
* This test just verified the element with ID 'gtbToolbar' can be found.
*/
var testGoogleToolbarInstalled = function()
{
controller.waitForElement(new elementslib.ID(controller.window.document, GTB_ID), gtbTimeout);
}

Просмотреть файл

@ -1,80 +0,0 @@
/* * ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* **** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI', 'ModalDialogAPI'];
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
}
/**
* Test that we do not crash when removing a cookie
*/
var testCrashRemoveCookieAfterPrivateBrowsingMode = function()
{
var pb = new PrivateBrowsingAPI.privateBrowsing(controller);
pb.enabled = false;
pb.showPrompt = false;
pb.start();
pb.stop();
pb.showPrompt = true;
pb.enabled = false;
// Call clear recent history dialog and clear all form history
var md = new ModalDialogAPI.modalDialog(clearHistoryHandler);
md.start();
controller.click(new elementslib.Elem(controller.menus["tools-menu"].sanitizeItem));
}
/**
* Accesses the clear recent history dialog and accepts the default options to clear
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var clearHistoryHandler = function(controller)
{
var clearButton = new elementslib.Lookup(controller.window.document, '/id("SanitizeDialog")/anon({"anonid":"dlg-buttons"})/{"dlgtype":"accept"}');
controller.waitThenClick(clearButton);
}

Просмотреть файл

@ -1,61 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
am = new AddonsAPI.addonsManager();
}
var teardownModule = function(module) {
am.close(true);
}
var testAddonsManager = function() {
am.open(controller);
am.paneId = "themes";
am.search("rss");
am.clearSearchField();
am.close();
}

Просмотреть файл

@ -1,79 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['DownloadsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.dm = new DownloadsAPI.downloadManager();
}
var teardownModule = function(module)
{
// Cancel all downloads and close the download manager
dm.cancelActiveDownloads();
dm.close();
}
var testOpenDownloadManager = function()
{
var url = "ftp://ftp.mozilla.org/pub/firefox/releases/3.6/mac/en-US/Firefox%203.6.dmg";
DownloadsAPI.downloadFileOfUnknownType(controller, url);
// Open the download manager
dm.open(controller, true);
// Get the Firefox download
var download = dm.getElement({type: "download", subtype: "state", value : "0"});
dm.controller.waitForElement(download, gTimeout);
var pauseButton = dm.getElement({type: "download_button", subtype: "pause", value: download});
var resumeButton = dm.getElement({type: "download_button", subtype: "resume", value: download});
// Pause the download
dm.controller.click(pauseButton);
dm.waitForDownloadState(download, DownloadsAPI.downloadState.paused);
// Resume the download
dm.controller.click(resumeButton);
dm.waitForDownloadState(download, DownloadsAPI.downloadState.downloading);
}

Просмотреть файл

@ -1,63 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Clint Talbert <ctalbert@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
}
var testPrefHelperClass = function () {
PrefsAPI.openPreferencesDialog(handlePrefDialog);
}
/**
* Test the preferences dialog methods
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
function handlePrefDialog(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
var pane = prefDialog.pane;
prefDialog.paneId = 'paneContent';
prefDialog.close(true);
}

Просмотреть файл

@ -1,117 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI', 'SearchAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
search = new SearchAPI.searchBar(controller);
search.clear();
}
var teardownModule = function(module)
{
search.clear();
search.restoreDefaultEngines();
}
/**
* Add a MozSearch Search plugin
*/
var testSearchAPI = function()
{
// Check if Google is installed and there is no Googl engine present
controller.assertJS("subject.isGoogleInstalled == true",
{isGoogleInstalled: search.isEngineInstalled("Google")});
controller.assertJS("subject.isGooglInstalled == false",
{isGooglInstalled: search.isEngineInstalled("Googl")});
// Do some stuff in the Search Engine Manager
search.openEngineManager(handlerManager);
// Select another engine and start search
search.selectedEngine = "Yahoo";
search.search({text: "Firefox", action: "returnKey"});
}
var handlerManager = function(controller)
{
var manager = new SearchAPI.engineManager(controller);
var engines = manager.engines;
// Remove the first search engine
manager.removeEngine(engines[3].name);
manager.controller.sleep(500);
// Move engines down / up
manager.moveDownEngine(engines[0].name);
manager.moveUpEngine(engines[2].name);
manager.controller.sleep(500);
// Add a keyword for the first engine
manager.editKeyword(engines[0].name, handlerKeyword);
manager.controller.sleep(500);
// Restore the defaults
manager.restoreDefaults();
manager.controller.sleep(500);
// Disable suggestions
manager.suggestionsEnabled = false;
manager.controller.sleep(500);
manager.getMoreSearchEngines();
// Dialog closes automatically
//manager.close(true);
}
var handlerKeyword = function(controller)
{
var textbox = new elementslib.ID(controller.window.document, "loginTextbox");
controller.type(textbox, "g");
var okButton = new elementslib.Lookup(controller.window.document,
'/id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.click(okButton);
}

Просмотреть файл

@ -1,86 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['SessionStoreAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.session = new SessionStoreAPI.aboutSessionRestore(controller);
}
var testAboutSessionRestoreErrorPage = function()
{
controller.open("about:sessionrestore");
controller.sleep(400);
// Test the list
var list = session.getElement({type: "tabList"});
var windows = session.getWindows();
for (var ii = 0; ii < windows.length; ii++) {
var window = windows[ii];
var tabs = session.getTabs(window);
for (var jj = 0; jj < tabs.length; jj++) {
var tab = tabs[jj];
if (jj == 0) {
session.toggleRestoreState(tab);
}
}
}
// Test the buttons
var button = session.getElement({type: "button_restoreSession"});
controller.assertJS("subject.getAttribute('oncommand') == 'restoreSession();'", button.getNode());
var button = session.getElement({type: "button_newSession"});
controller.assertJS("subject.getAttribute('oncommand') == 'startNewSession();'", button.getNode());
controller.keypress(null, "t", {accelKey: true});
controller.open("http://www.google.com");
controller.waitForPageLoad();
controller.keypress(null, "w", {accelKey: true});
SessionStoreAPI.undoClosedTab(controller, {type: "shortcut"});
}

Просмотреть файл

@ -1 +0,0 @@
This is a place holder file

Просмотреть файл

@ -1,144 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI', 'PlacesAPI', 'UtilsAPI'];
const gDelay = 0;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
module.bs = PlacesAPI.bookmarksService;
module.hs = PlacesAPI.historyService;
module.ls = PlacesAPI.livemarkService;
}
var testVerifyDefaultBookmarks = function() {
var elemString = "/*[name()='window']/*[name()='toolbox'][1]/*[name()='toolbar'][3]/*[name()='toolbaritem'][1]/*[name()='hbox'][1]/*[name()='toolbarbutton'][%1]";
// Get list of items on the bookmarks toolbar and open container
var toolbarNodes = getBookmarkToolbarItems();
toolbarNodes.containerOpen = true;
// For a default profile there should be exactly 3 items
controller.assertJS("subject.toolbarItemCount == 3",
{toolbarItemCount: toolbarNodes.childCount});
// Check if the Most Visited folder is visible and has the correct title
var mostVisited = new elementslib.XPath(controller.window.document,
elemString.replace("%1", "1"));
controller.assertProperty(mostVisited, "label", toolbarNodes.getChild(0).title);
// Check Getting Started bookmarks title and URI
var gettingStarted = new elementslib.XPath(controller.window.document,
elemString.replace("%1", "2"));
controller.assertProperty(gettingStarted, "label", toolbarNodes.getChild(1).title);
var locationBar = new elementslib.ID(controller.window.document, "urlbar");
controller.click(gettingStarted);
controller.waitForPageLoad();
// Check for the correct path in the URL which also includes the locale
var uriSource = UtilsAPI.createURI(toolbarNodes.getChild(1).uri, null, null);
var uriTarget = UtilsAPI.createURI(locationBar.getNode().value, null, null);
controller.assertJS("subject.source.path == subject.target.path",
{source: uriSource, target: uriTarget});
// Check the title of the default RSS feed toolbar button
var RSS = new elementslib.XPath(controller.window.document, elemString.replace("%1", "3"));
controller.assertProperty(RSS, "label", toolbarNodes.getChild(2).title);
// Close container again
toolbarNodes.containerOpen = false;
// Create modal dialog observer
var md = new ModalDialogAPI.modalDialog(feedHandler);
md.start();
// Open the properties dialog of the feed
controller.rightClick(RSS);
controller.sleep(100);
controller.click(new elementslib.ID(controller.window.document, "placesContext_show:info"));
}
/**
* Callback handler for modal bookmark properties dialog
*
* @param controller {MozMillController} Controller of the modal dialog
*/
function feedHandler(controller) {
try {
// Get list of items on the bookmarks toolbar and open container
var toolbarNodes = getBookmarkToolbarItems();
toolbarNodes.containerOpen = true;
var child = toolbarNodes.getChild(2);
// Check if the child is a Livemark
controller.assertJS("subject.isLivemark == true",
{isLivemark: ls.isLivemark(child.itemId)});
// Compare the site and feed URI's
var siteLocation = new elementslib.ID(controller.window.document, "editBMPanel_siteLocationField");
controller.assertValue(siteLocation, ls.getSiteURI(child.itemId).spec);
var feedLocation = new elementslib.ID(controller.window.document, "editBMPanel_feedLocationField");
controller.assertValue(feedLocation, ls.getFeedURI(child.itemId).spec);
// Close container again
toolbarNodes.containerOpen = false;
} catch(e) {
}
controller.keypress(null, "VK_ESCAPE", {});
}
/**
* Get the Bookmarks Toolbar items
*/
function getBookmarkToolbarItems() {
var options = hs.getNewQueryOptions();
var query = hs.getNewQuery();
query.setFolders([bs.toolbarFolder], 1);
return hs.executeQuery(query, options).root;
}
/**
* Map test functions to litmus tests
*/
// testVerifyDefaultBookmarks.meta = {litmusids : [8751]};

Просмотреть файл

@ -1,145 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'ModalDialogAPI', 'UtilsAPI'];
const gTimeout = 5000;
const gSearchTimeout = 30000;
const gInstallTimeout = 30000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
persisted.extensionName = "Nightly Tester Tools";
persisted.extensionId = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
AddonsAPI.useAmoPreviewUrls();
}
var teardownModule = function(module)
{
AddonsAPI.resetAmoPreviewUrls();
}
/*
* Tests the installation of an add-on through the add-ons manager
*/
var testInstallExtension = function()
{
// Open the addons manager
addonsManager.open(controller);
// Search for the addon mentioned in extensionName
addonsManager.search(persisted.extensionName);
// Wait for search results to populate and click on the install addon button for extensionName
var footer = addonsManager.getElement({type: "search_status", subtype: "footer"});
addonsManager.controller.waitForElement(footer, gSearchTimeout);
// Select the extension we have searched for
var extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.waitThenClick(extension, gSearchTimeout);
// Create a modal dialog instance to handle the Software Installation dialog
var md = new ModalDialogAPI.modalDialog(handleTriggerDialog);
md.start();
// Trigger the extension installation
var installButton = addonsManager.getElement({type: "listbox_button", subtype: "installSearchResult", value: extension});
addonsManager.controller.waitThenClick(installButton);
// The lazy software dialog opening makes it hard for us to work with modal dialogs here.
// Until bug 560821 hasn't been fixed we have to do that workaround by setting the install
// panel manually if it hasn't been done automatically.
addonsManager.controller.waitForEval("subject.manager.paneId == 'installs' || " +
"subject.extension.getAttribute('action') == 'installing'", gInstallTimeout, 100,
{manager: addonsManager, extension: extension.getNode()});
addonsManager.paneId = "installs";
// ... and that the installation has been finished
extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.waitForElement(extension, gInstallTimeout);
addonsManager.controller.waitForEval("subject.extension.getAttribute('state') == 'success'", gInstallTimeout, 100,
{extension: extension.getNode()});
// Check if restart button is present
var restartButton = addonsManager.getElement({type: "notificationBar_buttonRestart"});
addonsManager.controller.waitForElement(restartButton, gTimeout);
}
/**
* Handle the Software Installation dialog
*/
var handleTriggerDialog = function(controller)
{
// Get list of extensions which should be installed
var itemElem = controller.window.document.getElementById("itemList");
var itemList = new elementslib.Elem(controller.window.document, itemElem);
controller.waitForElement(itemList, gTimeout);
// There should be listed only one extension
controller.assertJS("subject.extensionsCount == 1",
{extensionsCount: itemElem.childNodes.length});
// Check if the extension name is shown
controller.assertJS("subject.extensions[0].name == subject.targetName",
{extensions: itemElem.childNodes, targetName: persisted.extensionName});
// Will the extension be installed from https://addons.mozilla.org/?
controller.assertJS("subject.isExtensionFromAMO == true",
{isExtensionFromAMO: itemElem.childNodes[0].url.indexOf('addons.mozilla.org/') != -1});
// Check if the Cancel button is present
var cancelButton = new elementslib.Lookup(controller.window.document,
'/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"cancel"}');
controller.assertNode(cancelButton);
// Wait for the install button is enabled before clicking on it
var installButton = new elementslib.Lookup(controller.window.document,
'/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.waitForEval("subject.disabled != true", 7000, 100, installButton.getNode());
controller.click(installButton);
}
/**
* Map test functions to litmus tests
*/
// testInstallExtension.meta = {litmusids : [8828]};

Просмотреть файл

@ -1,73 +0,0 @@
/* ****** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI'];
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
}
var testCheckExtensionInstalled = function()
{
addonsManager.waitForOpened(controller);
// Extensions pane should be selected
addonsManager.controller.waitForEval("subject.manager.paneId == 'extensions'", 10000, 100,
{manager: addonsManager});
// Notification bar should show one new installed extension
var notificationBar = addonsManager.getElement({type: "notificationBar"});
addonsManager.controller.waitForElement(notificationBar, gTimeout);
// The installed extension should be displayed with a different background in the list.
// We can find it by the attribute "newAddon"
var extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.waitForElement(extension, gTimeout);
addonsManager.controller.assertJS("subject.isExtensionInstalled == true",
{isExtensionInstalled: extension.getNode().getAttribute('newAddon') == 'true'});
}
/**
* Map test functions to litmus tests
*/
// testCheckExtensionInstalled.meta = {litmusids : [8828]};

Просмотреть файл

@ -1,133 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'ModalDialogAPI', 'TabbedBrowsingAPI'];
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
persisted.url = "https://preview.addons.mozilla.org/de/firefox/addon/6543/";
persisted.extensionName = "Nightly Tester Tools";
persisted.extensionId = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
TabbedBrowsingAPI.closeAllTabs(controller);
}
var testInstallExtension = function() {
addonsManager.open(controller);
addonsManager.paneId = "search";
// Wait for the Browse All Add-ons link and click on it
var browseAllAddons = addonsManager.getElement({type: "link_browseAddons"});
addonsManager.controller.waitThenClick(browseAllAddons, gTimeout);
// The target web page is loaded lazily so wait for the newly created tab first
controller.waitForEval("subject.tabs.length == 2", gTimeout, 100, controller);
controller.waitForPageLoad();
// To avoid a broken test lets install Adblock directly
controller.open(persisted.url);
controller.waitForPageLoad();
// Create a modal dialog instance to handle the Software Installation dialog
var md = new ModalDialogAPI.modalDialog(handleTriggerDialog);
md.start();
// Click the link to install the extension
var triggerLink = new elementslib.XPath(controller.tabs.activeTab,
"//div[@id='addon-summary']/div/div/div/p/a/span");
controller.waitForElement(triggerLink, gTimeout);
controller.click(triggerLink, triggerLink.getNode().width / 2, triggerLink.getNode().height / 2);
// Wait that the Installation pane is selected after the extension has been installed
addonsManager.controller.waitForEval("subject.manager.paneId == 'installs'", 10000, 100,
{manager: addonsManager});
// Check if the installed extension is visible in the Add-ons Manager
var extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.waitForElement(extension, gTimeout);
var extensionName = extension.getNode().getAttribute('name');
addonsManager.controller.assertJS("subject.isValidExtensionName == true",
{isValidExtensionName: extensionName == persisted.extensionName});
// Check if restart button is present
var restartButton = addonsManager.getElement({type: "notificationBar_buttonRestart"});
addonsManager.controller.waitForElement(restartButton, gTimeout);
}
/**
* Handle the Software Installation dialog
*/
var handleTriggerDialog = function(controller) {
// Get list of extensions which should be installed
var itemElem = controller.window.document.getElementById("itemList");
var itemList = new elementslib.Elem(controller.window.document, itemElem);
controller.waitForElement(itemList, gTimeout);
// There should be listed only one extension
controller.assertJS("subject.extensions.length == 1",
{extensions: itemElem.childNodes});
// Check if the extension name is shown
controller.assertJS("subject.extensions[0].name == subject.extensionName",
{extensions: itemElem.childNodes, extensionName: persisted.extensionName});
// Will the extension be installed from https://addons.mozilla.org/?
controller.assertJS("subject.isExtensionFromAMO == true",
{isExtensionFromAMO: itemElem.childNodes[0].url.indexOf('addons.mozilla.org') != -1});
// Check if the Cancel button is present
var cancelButton = new elementslib.Lookup(controller.window.document,
'/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"cancel"}');
controller.assertNode(cancelButton);
// Wait for the install button is enabled before clicking on it
var installButton = new elementslib.Lookup(controller.window.document,
'/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.waitForEval("subject.disabled != true", 7000, 100, installButton.getNode());
controller.click(installButton);
}
/**
* Map test functions to litmus tests
*/
// testInstallExtension.meta = {litmusids : [7972]};

Просмотреть файл

@ -1,114 +0,0 @@
/* ****** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
* Aakash Desai <adesai@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'ModalDialogAPI', 'UtilsAPI'];
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
}
var testCheckInstalledExtension = function()
{
// Check if Add-ons Manager is automatically opened after restart
addonsManager.waitForOpened(controller);
// Extensions pane should be selected
addonsManager.controller.waitForEval("subject.manager.paneId == 'extensions'", 10000, 100,
{manager: addonsManager});
// Notification bar should show one new installed extension
var notificationBar = addonsManager.getElement({type: "notificationBar"});
addonsManager.controller.waitForElement(notificationBar, gTimeout);
// The installed extension should be displayed with a different background in the list.
// We can find it by the attribute "newAddon"
var extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.waitForElement(extension, gTimeout);
addonsManager.controller.assertJS("subject.isExtensionInstalled == true",
{isExtensionInstalled: extension.getNode().getAttribute('newAddon') == 'true'});
}
/*
* Tests the uninstallation of the extension
*/
var testUninstallExtension = function()
{
// Check if Add-ons Manager is automatically opened after restart
addonsManager.waitForOpened(controller);
addonsManager.paneId = "extensions";
// Confirm the installed extension and click on it
var extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.waitThenClick(extension, gTimeout);
// Create a modal dialog instance to handle the software uninstallation dialog
var md = new ModalDialogAPI.modalDialog(handleTriggerDialog);
md.start();
var uninstallButton = addonsManager.getElement({type: "listbox_button", subtype: "uninstall", value: extension});
addonsManager.controller.waitThenClick(uninstallButton, gTimeout);
// Wait for the restart button
var restartButton = addonsManager.getElement({type: "notificationBar_buttonRestart"});
addonsManager.controller.waitForElement(restartButton, gTimeout);
}
/**
* Handle the Software Un-installation dialog
*/
var handleTriggerDialog = function(controller)
{
var cancelButton = new elementslib.Lookup(controller.window.document,
'/id("addonList")/anon({"anonid":"buttons"})/{"dlgtype":"cancel"}');
controller.waitForElement(cancelButton, gTimeout);
var uninstallButton = new elementslib.Lookup(controller.window.document,
'/id("addonList")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.waitForEval("subject.disabled != true", 7000, 100, uninstallButton.getNode());
controller.waitThenClick(uninstallButton, gTimeout);
}
/**
* Map test functions to litmus tests
*/
// testCheckInstalledExtension.meta = {litmusids : [7972]};
// testUninstallExtension.meta = {litmusids : [8164]};

Просмотреть файл

@ -1,64 +0,0 @@
/* ****** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI'];
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
module.addonsManager = new AddonsAPI.addonsManager();
}
var testCheckUninstalledExtension = function()
{
addonsManager.open(controller);
addonsManager.paneId = "extensions";
// Confirm the uninstalled extension is not shown and assert its not in the extensions box
var extension = addonsManager.getListboxItem("addonID", persisted.extensionId);
addonsManager.controller.sleep(100);
addonsManager.controller.assertNodeNotExist(extension);
}
/**
* Map test functions to litmus tests
*/
// testUninstallExtension.meta = {litmusids : [8164]};

Просмотреть файл

@ -1,286 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI','PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
}
var teardownModule = function(module)
{
// Remove all logins set by the testscript
var pm = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
pm.removeAllLogins();
}
/**
* Test saving login information and setting a master password
*/
var testSetMasterPassword = function()
{
var testSite = "http://www-archive.mozilla.org/quality/browser/front-end/testcases/wallet/login.html";
// Go to the sample login page and perform a test log-in with inputted fields
controller.open(testSite);
controller.waitForPageLoad();
var userField = new elementslib.ID(controller.tabs.activeTab, "uname");
var passField = new elementslib.ID(controller.tabs.activeTab, "Password");
controller.waitForElement(userField, gTimeout);
controller.type(userField, "bar");
controller.type(passField, "foo");
controller.waitThenClick(new elementslib.ID(controller.tabs.activeTab, "LogIn"), gTimeout);
controller.sleep(500);
// After logging in, remember the login information
var label = UtilsAPI.getProperty("chrome://passwordmgr/locale/passwordmgr.properties",
"notifyBarRememberButtonText");
var button = tabBrowser.getTabPanelElement(tabBrowser.selectedIndex,
'/{"value":"password-save"}/{"label":"' + label + '"}');
UtilsAPI.assertElementVisible(controller, button, true);
controller.waitThenClick(button, gTimeout);
controller.sleep(500);
controller.assertNodeNotExist(button);
// Call preferences dialog and invoke master password functionality
PrefsAPI.openPreferencesDialog(prefDialogSetMasterPasswordCallback);
}
/**
* Test invoking master password dialog when opening password manager
*/
var testInvokeMasterPassword = function()
{
// Call preferences dialog and invoke master password functionality
PrefsAPI.openPreferencesDialog(prefDialogInvokeMasterPasswordCallback);
}
/**
* Test removing the master password
*/
var testRemoveMasterPassword = function()
{
// Call preferences dialog and invoke master password functionality
PrefsAPI.openPreferencesDialog(prefDialogDeleteMasterPasswordCallback);
}
/**
* Handler for preferences dialog to set the Master Password
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogSetMasterPasswordCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneSecurity';
var masterPasswordCheck = new elementslib.ID(controller.window.document, "useMasterPassword");
controller.waitForElement(masterPasswordCheck, gTimeout);
controller.sleep(gDelay);
// Call setMasterPassword dialog and set a master password to your profile
var md = new ModalDialogAPI.modalDialog(masterPasswordHandler);
md.start(200);
controller.click(masterPasswordCheck);
// Close the Preferences dialog
prefDialog.close(true);
}
/**
* Set the master password via the master password dialog
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var masterPasswordHandler = function(controller)
{
var pw1 = new elementslib.ID(controller.window.document, "pw1");
var pw2 = new elementslib.ID(controller.window.document, "pw2");
// Fill in the master password into both input fields and click ok
controller.waitForElement(pw1, gTimeout);
controller.type(pw1, "test1");
controller.type(pw2, "test1");
// Call the confirmation dialog and click ok to go back to the preferences dialog
var md = new ModalDialogAPI.modalDialog(confirmHandler);
md.start(200);
var button = new elementslib.Lookup(controller.window.document,
'/id("changemp")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.waitThenClick(button, gTimeout);
}
/**
* Call the confirmation dialog and click ok to go back to the preferences dialog
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var confirmHandler = function(controller)
{
var button = new elementslib.Lookup(controller.window.document,
'/id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.waitThenClick(button, gTimeout);
}
/**
* Bring up the master password dialog via the preferences window
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogInvokeMasterPasswordCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneSecurity';
var showPasswordButton = new elementslib.ID(controller.window.document, "showPasswords");
controller.waitForElement(showPasswordButton, gTimeout);
// Call showPasswords dialog and view the passwords on your profile
var md = new ModalDialogAPI.modalDialog(checkMasterHandler);
md.start(200);
controller.click(showPasswordButton);
// Check if the password manager has been opened
controller.sleep(500);
var window = mozmill.wm.getMostRecentWindow('Toolkit:PasswordManager');
var pwdController = new mozmill.controller.MozMillController(window);
var togglePasswords = new elementslib.ID(pwdController.window.document, "togglePasswords");
var passwordCol = new elementslib.ID(pwdController.window.document, "passwordCol");
pwdController.waitForElement(togglePasswords, gTimeout);
UtilsAPI.assertElementVisible(pwdController, passwordCol, false);
// Call showPasswords dialog and view the passwords on your profile
var md = new ModalDialogAPI.modalDialog(checkMasterHandler);
md.start(200);
pwdController.click(togglePasswords);
UtilsAPI.assertElementVisible(pwdController, passwordCol, true);
// Close the password manager and the preferences dialog
pwdController.keypress(null, "w", {accelKey: true});
pwdController.sleep(200);
prefDialog.close(true);
}
/**
* Verify the master password dialog is invoked
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var checkMasterHandler = function(controller)
{
var passwordBox = new elementslib.ID(controller.window.document, "password1Textbox");
controller.waitForElement(passwordBox, gTimeout);
controller.type(passwordBox, "test1");
var button = new elementslib.Lookup(controller.window.document,
'/id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.click(button);
}
/**
* Delete the master password using the preferences window
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogDeleteMasterPasswordCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneSecurity';
var masterPasswordCheck = new elementslib.ID(controller.window.document, "useMasterPassword");
controller.waitForElement(masterPasswordCheck, gTimeout);
// Call setMasterPassword dialog and remove the master password to your profile
var md = new ModalDialogAPI.modalDialog(removeMasterHandler);
md.start(200);
controller.click(masterPasswordCheck);
// Close the Preferences dialog
prefDialog.close(true);
}
/**
* Remove the master password via the master password dialog
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var removeMasterHandler = function(controller)
{
var removePwdField = new elementslib.ID(controller.window.document, "password");
controller.waitForElement(removePwdField, gTimeout);
controller.type(removePwdField, "test1");
// Call the confirmation dialog and click ok to go back to the preferences dialog
var md = new ModalDialogAPI.modalDialog(confirmHandler);
md.start(200);
controller.click(new elementslib.Lookup(controller.window.document,
'/id("removemp")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}'));
}
/**
* Map test functions to litmus tests
*/
// testSetMasterPassword.meta = {litmusids : [8316]};
// testInvokeMasterPassword.meta = {litmusids : [8108]};
// testRemoveMasterPassword.meta = {litmusids : [8317]};

Просмотреть файл

@ -1,141 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'ModalDialogAPI', 'TabbedBrowsingAPI'];
const gTimeout = 5000;
const gDownloadTimeout = 60000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
persisted.themeName = "Walnut for Firefox";
persisted.themeId = "{5A170DD3-63CA-4c58-93B7-DE9FF536C2FF}";
persisted.defaultThemeId = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
TabbedBrowsingAPI.closeAllTabs(controller);
}
/*
* Tests theme installation
*/
var testInstallTheme = function()
{
addonsManager.open(controller);
addonsManager.paneId = "search";
// Wait for the Browse All Add-ons link and click on it
var browseAllAddons = addonsManager.getElement({type: "link_browseAddons"});
addonsManager.controller.waitThenClick(browseAllAddons, gTimeout);
// The target web page is loaded lazily so wait for the newly created tab first
controller.waitForEval("subject.tabs.length == 2", gTimeout, 100, controller);
controller.waitForPageLoad();
// Open the web page for the Walnut theme directly
controller.open("https://preview.addons.mozilla.org/en-US/firefox/addon/122");
controller.waitForPageLoad();
// Create a modal dialog instance to handle the Software Installation dialog
var md = new ModalDialogAPI.modalDialog(handleTriggerDialog);
md.start();
// Click link to install the theme which triggers a modal dialog
var triggerLink = new elementslib.XPath(controller.tabs.activeTab,
"//div[@id='addon-summary']/div/div/div/p/a/span");
controller.waitThenClick(triggerLink, gTimeout);
// Wait that the Installation pane is selected after the extension has been installed
addonsManager.controller.waitForEval("subject.manager.paneId == 'installs'", 10000, 100,
{manager: addonsManager});
// Wait until the Theme has been installed.
var theme = addonsManager.getListboxItem("addonID", persisted.themeId);
addonsManager.controller.waitForElement(theme, gDownloadTimeout);
var themeName = theme.getNode().getAttribute('name');
addonsManager.controller.assertJS("subject.isValidThemeName == true",
{isValidThemeName: themeName == persisted.themeName});
addonsManager.controller.assertJS("subject.isThemeInstalled == true",
{isThemeInstalled: theme.getNode().getAttribute('state') == 'success'});
// Check if restart button is present
var restartButton = addonsManager.getElement({type: "notificationBar_buttonRestart"});
addonsManager.controller.waitForElement(restartButton, gTimeout);
}
/**
* Handle the Software Installation dialog
*/
var handleTriggerDialog = function(controller)
{
// Get list of themes which should be installed
var itemElem = controller.window.document.getElementById("itemList");
var itemList = new elementslib.Elem(controller.window.document, itemElem);
controller.waitForElement(itemList, gTimeout);
// There should be one theme for installation
controller.assertJS("subject.themes.length == 1",
{themes: itemElem.childNodes});
// Check if the correct theme name is shown
controller.assertJS("subject.name == '" + persisted.themeName + "'",
itemElem.childNodes[0]);
// Will the theme be installed from https://addons.mozilla.org/?
controller.assertJS("subject.url.indexOf('addons.mozilla.org/') != -1",
itemElem.childNodes[0]);
// Check if the Cancel button is present
var cancelButton = new elementslib.Lookup(controller.window.document,
'/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"cancel"}');
controller.assertNode(cancelButton);
// Wait for the install button is enabled before clicking on it
var installButton = new elementslib.Lookup(controller.window.document,
'/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.waitForEval("subject.disabled != true", undefined, 100, installButton.getNode());
controller.click(installButton);
}
/**
* Map test functions to litmus tests
*/
// testInstallTheme.meta = {litmusids : [7973]};

Просмотреть файл

@ -1,98 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
* Aakash Desai <adesai@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'PrefsAPI', 'UtilsAPI'];
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
}
/*
* Verifies the theme has been installed
*/
var testCheckInstalledTheme = function()
{
addonsManager.open(controller);
addonsManager.paneId = "themes";
// The installed theme should be the current theme in the list
var theme = addonsManager.getListboxItem("addonID", persisted.themeId);
addonsManager.controller.waitThenClick(theme, gTimeout);
addonsManager.controller.assertJS("subject.isCurrentTheme == true",
{isCurrentTheme: theme.getNode().getAttribute('current') == 'true'});
addonsManager.close();
}
/*
* Tests changing the theme back to default
*/
var testThemeChange = function()
{
addonsManager.open(controller);
addonsManager.paneId = "themes";
// Select the default theme and click the use theme button
var theme = addonsManager.getListboxItem("addonID", persisted.defaultThemeId);
addonsManager.controller.waitThenClick(theme, gTimeout);
var useThemeButton = addonsManager.getElement({type: "listbox_button", subtype: "useTheme", value: theme});
addonsManager.controller.waitThenClick(useThemeButton, gTimeout);
// Wait for the restart button
var restartButton = addonsManager.getElement({type: "notificationBar_buttonRestart"});
addonsManager.controller.waitForElement(restartButton, gTimeout);
// Verify useThemeButton is not visible
addonsManager.controller.assertProperty(useThemeButton, "disabled", "true");
// ... and theme description has changed
var description = theme.getNode().getAttribute('description');
addonsManager.controller.assertJS("subject.hasDescriptionChanged == true",
{hasDescriptionChanged: description.indexOf('Restart') != -1});
}
/**
* Map test functions to litmus tests
*/
// testCheckInstalledTheme.meta = {litmusids : [7973]};
// testThemeChange.meta = {litmusids : [8168]};

Просмотреть файл

@ -1,68 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'PrefsAPI','UtilsAPI'];
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
}
/*
* Verifies theme change back to the default theme
*/
var testCheckThemeChange = function()
{
addonsManager.open(controller);
addonsManager.paneId = "themes";
// Check that the default theme is selected and highlighted
var theme = addonsManager.getListboxItem("addonID", persisted.defaultThemeId);
addonsManager.controller.waitForElement(theme, gTimeout);
addonsManager.controller.assertJS("subject.isCurrentTheme == true",
{isCurrentTheme: theme.getNode().getAttribute('current') == 'true'});
}
/**
* Map test functions to litmus tests
*/
// testCheckThemeChanged.meta = {litmusids : [8168]};

Просмотреть файл

@ -1,87 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['SoftwareUpdateAPI', 'UtilsAPI'];
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.update = new SoftwareUpdateAPI.softwareUpdate();
// Collect some data of the current build
module.persisted.preBuildId = UtilsAPI.appInfo.buildID;
module.persisted.preLocale = UtilsAPI.appInfo.locale;
module.persisted.preUserAgent = UtilsAPI.appInfo.userAgent;
module.persisted.preVersion = UtilsAPI.appInfo.version;
}
var teardownModule = function(module)
{
// Save the update properties for later usage
module.persisted.updateBuildId = update.activeUpdate.buildID;
module.persisted.updateType = update.isCompleteUpdate ? "complete" : "partial";
module.persisted.updateVersion = update.activeUpdate.version;
}
/**
* Download a minor update via the given update channel
*/
var testDirectUpdate_Download = function()
{
// Check if the user has permissions to run the update
controller.assertJS("subject.isUpdateAllowed == true",
{isUpdateAllowed: update.allowed});
// Open the software update dialog and wait until the check has been finished
update.openDialog(controller);
update.waitForCheckFinished();
// Check that an update is available
update.assertUpdateStep('updatesfound');
// Download the given type of update from the specified channel
update.download(persisted.type, persisted.channel);
// We should be ready for restart
update.assertUpdateStep('finished');
}
/**
* Map test functions to litmus tests
*/
// testDirectUpdate_Download.meta = {litmusids : [8696]};

Просмотреть файл

@ -1,95 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['SoftwareUpdateAPI', 'UtilsAPI'];
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.update = new SoftwareUpdateAPI.softwareUpdate();
// Collect some data of the current build
module.persisted.postBuildId = UtilsAPI.appInfo.buildID;
module.persisted.postLocale = UtilsAPI.appInfo.locale;
module.persisted.postUserAgent = UtilsAPI.appInfo.userAgent;
module.persisted.postVersion = UtilsAPI.appInfo.version;
}
/**
* Test that the update has been correctly applied and no further updates
* can be found.
*/
var testDirectUpdate_AppliedAndNoUpdatesFound = function()
{
// Open the software update dialog and wait until the check has been finished
update.openDialog(controller);
update.waitForCheckFinished();
// No updates should be offered now - filter out major updates
try {
update.assertUpdateStep('noupdatesfound');
} catch (ex) {
// If a major update is offered we shouldn't fail
controller.assertJS("subject.newUpdateType != subject.lastUpdateType",
{newUpdateType: update.updateType, lastUpdateType: persisted.type});
}
// The upgraded version should be identical with the version given by
// the update and we shouldn't have run a downgrade
var vc = Cc["@mozilla.org/xpcom/version-comparator;1"]
.getService(Ci.nsIVersionComparator);
var check = vc.compare(persisted.postVersion, persisted.preVersion);
controller.assertJS("subject.newVersionGreater == true",
{newVersionGreater: check >= 0});
controller.assertJS("subject.postBuildId > subject.preBuildId",
{postBuildId: persisted.postBuildId, preBuildId: persisted.preBuildId});
// An upgrade should not change the builds locale
controller.assertJS("subject.postLocale == subject.preLocale",
{postLocale: persisted.postLocale, preLocale: persisted.preLocale});
// Update was successful
persisted.success = true;
}
/**
* Map test functions to litmus tests
*/
// testDirectUpdate_AppliedAndNoUpdatesFound.meta = {litmusids : [8187]};

Просмотреть файл

@ -1,88 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['SoftwareUpdateAPI', 'UtilsAPI'];
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.update = new SoftwareUpdateAPI.softwareUpdate();
// Collect some data of the current build
module.persisted.preBuildId = UtilsAPI.appInfo.buildID;
module.persisted.preLocale = UtilsAPI.appInfo.locale;
module.persisted.preUserAgent = UtilsAPI.appInfo.userAgent;
module.persisted.preVersion = UtilsAPI.appInfo.version;
}
var teardownModule = function(module)
{
// Save the update properties for later usage
module.persisted.updateBuildId = update.activeUpdate.buildID;
module.persisted.updateType = update.isCompleteUpdate ? "complete" : "partial";
module.persisted.updateType += "+fallback";
module.persisted.updateVersion = update.activeUpdate.version;
}
var testFallbackUpdate_Download = function()
{
// Check if the user has permissions to run the update
controller.assertJS("subject.isUpdateAllowed == true",
{isUpdateAllowed: update.allowed});
// Open the software update dialog and wait until the check has been finished
update.openDialog(controller);
update.waitForCheckFinished();
// An update should have been found
update.assertUpdateStep('updatesfound');
// Download the given update from the specified channel
update.download(persisted.type, persisted.channel);
// We should be ready for restart
update.assertUpdateStep('finished');
// Put the downloaded update into failed state
update.forceFallback();
}
/**
* Map test functions to litmus tests
*/
// testFallbackUpdate_Download.meta = {litmusids : [8696]};

Просмотреть файл

@ -1,62 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['SoftwareUpdateAPI', 'UtilsAPI'];
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.update = new SoftwareUpdateAPI.softwareUpdate();
}
/**
* Test that the patch hasn't been applied and the complete patch gets downloaded
**/
var testFallbackUpdate_ErrorPatching = function()
{
// The dialog should be open in the background and shows a failure
update.waitForDialogOpen(controller);
update.assertUpdateStep('errorpatching');
controller.window.focus();
// Start downloading the fallback patch
update.download(persisted.type, persisted.channel);
// We should be ready for restart
update.assertUpdateStep('finished');
}

Просмотреть файл

@ -1,95 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['SoftwareUpdateAPI', 'UtilsAPI'];
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.update = new SoftwareUpdateAPI.softwareUpdate();
// Collect some data of the current build
module.persisted.postBuildId = UtilsAPI.appInfo.buildID;
module.persisted.postLocale = UtilsAPI.appInfo.locale;
module.persisted.postUserAgent = UtilsAPI.appInfo.userAgent;
module.persisted.postVersion = UtilsAPI.appInfo.version;
}
/**
* Test that the update has been correctly applied and no further updates
* can be found.
*/
var testFallbackUpdate_AppliedAndNoUpdatesFound = function()
{
// Open the software update dialog and wait until the check has been finished
update.openDialog(controller);
update.waitForCheckFinished();
// No updates should be offered now - filter out major updates
try {
update.assertUpdateStep('noupdatesfound');
} catch (ex) {
// If a major update is offered we shouldn't fail
controller.assertJS("subject.newUpdateType != subject.lastUpdateType",
{newUpdateType: update.updateType, lastUpdateType: persisted.type});
}
// The upgraded version should be identical with the version given by
// the update and we shouldn't have run a downgrade
var vc = Cc["@mozilla.org/xpcom/version-comparator;1"]
.getService(Ci.nsIVersionComparator);
var check = vc.compare(persisted.postVersion, persisted.preVersion);
controller.assertJS("subject.newVersionGreater == true",
{newVersionGreater: check >= 0});
controller.assertJS("subject.postBuildId > subject.preBuildId",
{postBuildId: persisted.postBuildId, preBuildId: persisted.preBuildId});
// An upgrade should not change the builds locale
controller.assertJS("subject.postLocale == subject.preLocale",
{postLocale: persisted.postLocale, preLocale: persisted.preLocale});
// Update was successful
persisted.success = true;
}
/**
* Map test functions to litmus tests
*/
// testFallbackUpdate_AppliedAndNoUpdatesFound.meta = {litmusids : [8187]};

Просмотреть файл

@ -0,0 +1,5 @@
<html>
<body">
<p>Lorem <span id="ipsum">ipsum</span> dolor sit amet, consectetur adipiscing elit.</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function setCookie()
{
var date = new Date();
date.setDate(new Date().getDate() + 36);
document.cookie = "litmus_1=true;expires=" + date.toGMTString();
}
</script>
</head>
<body onload="setCookie()">
</body>
</html>

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<body>
<form>
<table>
<tr>
<td>
First Name
</td>
<td>
<input type='text' id='ship_fname'>
</td>
</tr>
<tr>
<td>
Last Name
</td>
<td>
<input type='text' id='ship_lname'>
</td>
</tr>
<tr>
<td>
State
</td>
<td>
<select id='ship_state' size='1'>
<option value='Select Your State'>
Select your State
</option>
<option value='AL'>
Alabama
</option>
<option value='AK'>
Alaska
</option>
<option value='AZ'>
Arizona
</option>
<option value='AR'>
Arkansas
</option>
</select>
</td>
</tr>
<tr>
<td colspan='2'>
<input id='SubmitButton' type='submit' value='Submit'>
</td>
</tr>
</table>
</form>
</body>
</html>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
testing/mozmill/tests/firefox/test-files/images/mozilla_logo.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title>Mozilla.org - Home of the Mozilla Project</title>
<link rel="shortcut icon" type="image/ico" href="../images/mozilla_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#community">Community</a> |
<a href="#project">Project</a> |
<a href="#organization">Organization</a>
<div id="content">
<h1 id="page-title">
<strong>We believe</strong> that the internet should be public,
open and accessible.
</h1>
<h2><a name="community">Community</a></h2>
<p id="community">
We're a global community of thousands who believe in the power
of technology to enrich people's lives.
<a href="mozilla_community.html">More</a>
</p>
<h2><a name="project">Project</a></h2>
<p id="project">
We're an open source project whose code is used for some of the
Internet's most innovative applications.
<a href="mozilla_projects.html">More</a>
</p>
<h2><a name="organization">Organization</a></h2>
<p id="organization">
We're a public benefit organization dedicated to making the
Internet better for everyone.
<a href="mozilla_mission.html">More</a>
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title>Mozilla Community</title>
<link rel="shortcut icon" type="image/ico" href="../images/seamonkey_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#history">History</a> |
<a href="#communicate">Communicate</a> |
<a href="#more">More</a>
<div id="content">
<h1 id="page-title" name="page-title">Our Community</h1>
<h2><a name="history">History</a></h2>
<p id="history">
When www.mozilla.org was launched in 1998 all community activity
occurred right here on this site. Since then the community has
grown much bigger and there are now many different sites,
forums, blogs and newsgroups in different places that track
different parts of the project. These pages aim to be a
comprehensive list to all of the different community resources
available. If you know of something that's not on these lists
that should be, please contact us and we'll update these
pages.
</p>
<h2><a name="communicate">Communicate</a></h2>
<p id="communicate">
There are a number of different ways community members
communicate and coordinate (people use mailing lists and
newsgroups, blogs, forums, wikis and they even meet in real
life sometimes too) and all of these options might be
overwhelming at first. Hopefully this set of links will provide
some useful pointers to help you figure out where to go to find
what you're looking for. If you do get lost though and need
some help, feel free to ask for more information.
</p>
<h2><a name="more">More</a></h2>
<p id="more">
Please note that this is intended to be an entry point that
provides a high-level overview of the different community areas.
If you're looking for more detailed information about a specific
topic, please look at our Developer,
<a href="mozilla_contribute.html">Contribute</a> and Support
pages or take a look at the other information referenced
throughout this site.
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<title>Get Involved with Mozilla</title>
<link rel="shortcut icon" type="image/ico" href="../images/thunderbird_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#summary">Summary</a> |
<a href="#contribute">Contribute</a>
<div id="content">
<h1 id="page-title">Get Involved</h1>
<h2><a name="summary">Summary</a></h2>
<p id="summary">
You can <a href="mozilla_mission.html">build a better Internet</a>
by getting involved with Mozilla. You don't have to be a C++
guru (or even know what that means!) and you don't need to spend
lots of time. Take a look at the opportunities below and feel
free to ask if you have any questions.
</p>
<h2><a name="contribute">Contribute</a></h2>
<p id="contribute">
<h3>Area of Interest</h3>
<i>Browse contribution opportunities by area of interest.</i>
<ul id="areas_of_interest">
<li id="browser_choice">
<h4>Web Browser Choice</h4>
<p>
Mozilla has always believed that the freedom to
make informed choices should be central to making
the Web, and the world, a better place. Tell us
why having a choice of browser is important to you
and help us spread the word about how others can
take control of their online lives.
</p>
</li>
<li id="helping_users">
<h4>Helping Users</h4>
<p>
Interested in helping others get the most out of
using Firefox and other Mozilla projects? Our
support process relies on enthusiastic
contributors like you. Find out more about
supporting Firefox, Thunderbird and other Mozilla
projects.
</p>
</li>
<li id="localization">
<h4>Localization</h4>
<p>
Get involved with Mozilla by making Firefox,
Thunderbird and other projects available in your
language. Also help us tell the world about how
Mozilla is building a better Internet by
translating content on our web sites.
</p>
</li>
</ul>
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<title>Governance</title>
<link rel="shortcut icon" type="image/ico" href="../images/firefox_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#summary">Summary</a> |
<a href="#more">More</a>
<div id="content">
<h1 id="page-title">Governance</h1>
<h2><a name="summary">Summary</a></h2>
<p id="summary">
Mozilla is an open source project governed as a meritocracy. Our
community is structured as a virtual organization where
authority is distributed to both volunteer and employed
community members as they show their abilities through
contributions to the project.
</p>
<h2><a name="more">More</a></h2>
<p id="more">
<ul id="list">
<li id="roles">Roles and Responsibilities</li>
<li id="policies">Policies</li>
<li id="discussion">Discussion</li>
</ul>
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>Mozilla Grants</title>
<link rel="shortcut icon" type="image/ico" href="../images/mozilla_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#summary">Summary</a> |
<a href="#goals">Goals</a>
<div id="content">
<h1 id="page-title">Mozilla Grants</h1>
<h2><a name="summary">Summary</a></h2>
<p id="summary">
Since 2006, Mozilla has awarded over two million dollars to fund
projects that contribute to the health of the Open Web. The
Mozilla Grants program is jointly funded by the Mozilla
Corporation and the Mozilla Foundation, and awards financial
support to individuals and organizations whose work supports and
enhances the mission and values of the Mozilla Project.
</p>
<h2><a name="goals">Goals</a></h2>
<p id="goals">
Mozilla makes grants to individuals and organizations all over
the world. We mainly fund activity that supports the Mozilla
Grants program's four target areas:
<ul id="goal_list">
<li id="accessibility">
<strong>Accessibility:</strong> Mozilla believes that
the Internet truly is for everyone, and that those with
disabilities should be able to participate on the Web
along with their sighted and hearing peers. As part of
our accessibility strategy, we are funding the
development of free, open source options for those with
visual and auditory impairments.
</li>
<li id="community">
<strong>Community:</strong> Mozilla offers suppport to
the broader free culture and open source community, as
part of Mozilla's general effort to 'give back', aiding
in the creation of technologies and projects that
increase the health of the open Web ecosystem.
</li>
<li id="education">
<strong>Education:</strong> As part of Mozilla's broader
education initiative, we support educational
institutions that are producing the next generation of
innovative creators of software.
</li>
<li id="open_source">
<strong>Open Source:</strong> These grants support the
creation and adoption of Web standards, open source
principles, and the overall principles of transparency,
collaboration, and openness that free and open source
software projects adhere to.
</li>
</ul>
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>The Mozilla Mission</title>
<link rel="shortcut icon" type="image/ico" href="../images/seamonkey_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#mission">Mission</a> |
<a href="#organization">Organization</a> |
<a href="#goal">Goal</a>
<div id="content" name="content">
<h1 id="page-title" name="page-title">Mission</h1>
<h2><a name="mission">Mission</a></h2>
<p id="mission_statement">
Mozilla's mission is to <strong>promote openness, innovation,
and opportunity on the web</strong>. We do this by creating
great software, like the Firefox browser, and building
movements, like Drumbeat, that give people tools to take control
of their online lives.
</p>
<h2><a name="organization">Organization</a></h2>
<p id="organization">
As a non-profit organization, we define success in terms of
building communities and enriching people's lives instead of
benefiting our shareholders (guess what: we don't even have
shareholders). We believe in the power and potential of the
Internet and want to see it thrive for everyone, everywhere.
</p>
<h2><a name="goal">Goal</a></h2>
<p id="goal">
<strong>
Building a better Internet is an ambitious goal, but we
believe that it is possible
</strong>
when people who share our passion get involved. Coders, artists,
writers, testers, surfers, students, grandparents; anyone who
uses and cares about the web can help make it even better.
<a href="mozilla_contribute.html">Find out how you can help</a>.
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>Mozilla Organizations</title>
<link rel="shortcut icon" type="image/ico" href="../images/thunderbird_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#summary">Summary</a> |
<a href="#organization">Organization</a>
<div id="content">
<h1 id="page-title">Mozilla Organizations</h1>
<h2><a name="summary">Summary</a></h2>
<p id="summary">
Mozilla is a global community of people creating a better
Internet. We build public benefit into the Internet by creating
free, open source products and technologies that improve the
online experience for people everywhere.
</p>
<h2><a name="organization">Organization</a></h2>
<p id="organization">
There are several organizations that support the Mozilla
community and Mozilla's principles. They include the non-profit
Mozilla Foundation as well as two wholly owned taxable
subsidiaries, the Mozilla Corporation and Mozilla Messaging.
Mozilla considers itself a hybrid organization, combining non-
profit and market strategies to ensure the Internet remains a
shared public resource.
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>Mozilla Projects</title>
<link rel="shortcut icon" type="image/ico" href="../images/firefox_favicon.ico" />
</head>
<body>
<a href="mozilla.html">
<img id="mozilla_logo" src="../images/mozilla_logo.jpg" />
</a>
<a href="#summary">Summary</a> |
<a href="#applications">Applications</a>
<div id="content">
<h1 id="page-title">Our Projects</h1>
<h2><a name="summary">Summary</a></h2>
<p id="summary">
The Mozilla community produces a lot of great software and acts
as an incubator for innovative ideas as a way to advance our
<a href="mozilla_mission.html">mission</a> of building a better
Internet.
</p>
<h2><a name="applications">Applications</a></h2>
<p id="applications">
<p>
These applications are developed by the Mozilla community
and their code is hosted on mozilla.org.
</p>
<ul id="product_list">
<li id="bugzilla">
<h3><strong>Bugzilla</strong></h3>
Bugzilla is a bug tracking system designed to help teams
manage software development. Hundreds of organizations
across the globe are using this powerful tool to get
organized and communicate effectively.
</li>
<li id="camino">
<h3><strong>Camino</strong></h3>
Camino is a Web browser optimized for Mac OS X with a
Cocoa user interface, and powerful Gecko layout engine.
It's the simple, secure, and fast browser for Mac OS X.
</li>
<li id="firefox">
<h3><strong>Firefox for Desktop</strong></h3>
The award-winning Firefox Web browser has security,
speed and new features that will change the way you use
the Web. Dont settle for anything less.
</li>
</ul>
</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<body>
<form>
<table>
<tr>
<td>Username:</td>
<td><input id='uname'></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' id='Password'></td>
</tr>
<tr>
<td colspan='2'>
<input type='submit' value='Login' id='LogIn'>
</td>
</tr>
</table>
</form>
</body>
</html>

Просмотреть файл

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>This is a Pop-up!</title>
</head>
<body>
<p id='popupText'>This is a Pop-up!</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test Popups</title>
<script type="text/javascript">
<!-- Attempt to open 2 popups -->
var testPopups = function() {
for (var i=0; i<2; i++) {
window.open('popup.html', 'Test Popups ' + i, 'height=300,width=300');
}
}
</script>
</head>
<body onload="testPopups()">&nbsp;
</body>
</html>

Просмотреть файл

@ -0,0 +1,18 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Add MozSearch Plugin</title>
<script>
function add() {
var engine_url = window.document.location.href.replace(".html", ".xml")
window.external.AddSearchProvider(engine_url);
}
</script>
</head>
<body>
Click <a href="#" name="add" onclick="add();">here</a> to add the Mozilla
Test MozSearch plugin.
</body>
</html>

Просмотреть файл

@ -0,0 +1,8 @@
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>MDC</ShortName>
<Description>Mozilla Developer Center search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz%2F%2Fz8DJQAggJiQOe%2Ffv2fv7Oz8rays%2FN%2BVkfG%2FiYnJfyD%2F1%2BrVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw%2F8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi%2FG%2BQKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo%2BMXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia%2BCuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq%2FvLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg%2FkdypqCg4H8lUIACnQ%2FSOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD%2BaDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg%3D%3D</Image>
<Url type="text/html" method="GET" template="http://developer.mozilla.org/en/docs/Special:Search?search={searchTerms}"/>
<SearchForm>http://developer.mozilla.org/en/docs/Special:Search</SearchForm>
</SearchPlugin>

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<title>Search Results</title>
<script type="text/javascript">
function show() {
var results = /\?q=(.+)$/.exec(window.document.location);
searchterm = decodeURIComponent(results[1].replace(/\+/g, " "))
document.getElementById("term").innerHTML = searchterm;
}
</script>
</head>
<body onload="show();">
<p>Search term was '<span id="term"></span>'.</p>
</body>
</html>

Просмотреть файл

@ -6,13 +6,19 @@
var re = new RegExp("[0-9]+$");
var id = re.exec(window.document.location);
document.getElementById("id").innerHTML = id;
document.title = id;
var node = document.createElement("span");
node.id = "id";
node.innerHTML = id;
var result = document.getElementById("result");
result.appendChild(node);
}
</script>
</head>
<body onload="show();">
<p>Loaded link with id=<span id="id"></span>.</p>
<p id="result">Loaded link with id=</p>
</body>
</html>

Просмотреть файл

@ -1,95 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Raymond Etornam Agbeame <retornam@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const localTestFolder = collector.addHttpResource('./files');
var plugins = {"darwin": "DefaultPlugin.plugin",
"winnt": "npnul32.dll",
"linux": "libnullplugin.so"};
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
}
var teardownModule = function(module)
{
addonsManager.close();
}
/**
* Test disabling the default plugin
*/
var testDisableEnablePlugin = function()
{
var pluginId = plugins[mozmill.platform];
// Open Add-ons Manager and go to the themes pane
addonsManager.open(controller);
// Select the default plugin and disable it
addonsManager.setPluginState("addonID", pluginId, false);
// Check that the plugin is shown as disabled on web pages
var status = new elementslib.ID(controller.tabs.activeTab, "status");
controller.open(localTestFolder + "plugin.html");
controller.waitForPageLoad();
controller.assertText(status, "disabled");
// Enable the default plugin
addonsManager.setPluginState("addonID", pluginId, true);
// Check that the plugin is shown as disabled on web pages
controller.open(localTestFolder + "plugin.html");
controller.waitForPageLoad();
controller.assertText(status, "enabled");
}
/**
* Map test functions to litmus tests
*/
// testDisableEnablePlugin.meta = {litmusids : [8511]};

Просмотреть файл

@ -1,136 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const gSearchTimeout = 30000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
TabbedBrowsingAPI.closeAllTabs(controller);
}
var teardownModule = function(module)
{
addonsManager.close(true);
}
/**
* Test launching the addons manager
*/
var testLaunchAddonsManager = function()
{
// Open the addons manager via the menu entry
addonsManager.open(controller);
// Verify that panes are visible and can be selected
for each (pane in ["search", "extensions", "themes", "plugins"]) {
addonsManager.paneId = pane;
// Verify the update button is visible for extensions and themes
if (pane == "extensions" || pane == "themes") {
var updatesButton = addonsManager.getElement({type: "button_findUpdates"});
UtilsAPI.assertElementVisible(addonsManager.controller, updatesButton, true);
}
}
addonsManager.close();
}
/**
* Test the functionality of the get addons tab
*/
var testGetAddonsTab = function()
{
addonsManager.open(controller);
// Verify elements of the get addons pane are visible
addonsManager.paneId = "search";
var searchField = addonsManager.getElement({type: "search_field"});
addonsManager.controller.assertProperty(searchField, "hidden", "false");
var browseAllAddons = addonsManager.getElement({type: "link_browseAddons"});
addonsManager.controller.assertProperty(browseAllAddons, "hidden", "false");
var footer = addonsManager.getElement({type: "search_status", subtype: "footer"});
addonsManager.controller.waitForElement(footer, gSearchTimeout);
addonsManager.controller.assertProperty(footer, "hidden", false);
// Verify the number of addons is in-between 0 and the maxResults pref
var maxResults = PrefsAPI.preferences.getPref("extensions.getAddons.maxResults", -1);
var listBox = addonsManager.getElement({type: "listbox"});
addonsManager.controller.assertJS("subject.numSearchResults > 0",
{numSearchResults: listBox.getNode().itemCount});
addonsManager.controller.assertJS("subject.numSearchResults <= subject.maxResults",
{numSearchResults: listBox.getNode().itemCount,
maxResults: maxResults}
);
// Check if the see all recommended addons link is the same as the one in prefs
// XXX: Bug 529412 - Mozmill cannot operate on XUL elements which are outside of the view
// So we can only compare the URLs for now.
var footerLabel = addonsManager.getElement({type: "search_statusLabel", value: footer});
var recommendedUrl = UtilsAPI.formatUrlPref("extensions.getAddons.recommended.browseURL");
addonsManager.controller.assertJS("subject.correctRecommendedURL",
{correctRecommendedURL:
footerLabel.getNode().getAttribute('recommendedURL') == recommendedUrl}
);
// Check if the browse all addons link goes to the correct page on AMO
var browseAddonUrl = UtilsAPI.formatUrlPref("extensions.getAddons.browseAddons");
addonsManager.controller.waitThenClick(browseAllAddons, gTimeout);
// The target web page is loaded lazily so wait for the newly created tab first
controller.waitForEval("subject.tabs.length == 2", gTimeout, 100, controller);
controller.waitForPageLoad();
UtilsAPI.assertLoadedUrlEqual(controller, browseAddonUrl);
}
/**
* Map test functions to litmus tests
*/
// testLaunchAddonsManager.meta = {litmusids : [8154]};
// testGetAddonsTab.meta = {litmusids : [8155]};

Просмотреть файл

@ -1,114 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['AddonsAPI', 'PrefsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const gSearchTimeout = 30000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
addonsManager = new AddonsAPI.addonsManager();
}
var teardownModule = function(module)
{
addonsManager.close();
}
/**
* Test the search for Add-ons
*/
var testSearchForAddons = function()
{
addonsManager.open(controller);
controller = addonsManager.controller;
addonsManager.search("rss");
// Wait for search results to populate and verify elements of search functionality
var footer = addonsManager.getElement({type: "search_status", subtype: "footer"});
controller.waitForElement(footer, gSearchTimeout);
controller.assertProperty(footer, "hidden", false);
// Check if we show the x button in the search field
var searchButton = addonsManager.getElement({type: "search_fieldButton"});
var buttonPanel = searchButton.getNode().selectedPanel;
controller.assertJS("subject.isClearButtonShown == true",
{isClearButtonShown: buttonPanel.getAttribute('class') == 'textbox-search-clear'});
// Verify the number of addons is in-between 0 and the maxResults pref
var maxResults = PrefsAPI.preferences.getPref("extensions.getAddons.maxResults", -1);
var listBox = addonsManager.getElement({type: "listbox"});
addonsManager.controller.assertJS("subject.numSearchResults > 0",
{numSearchResults: listBox.getNode().itemCount});
addonsManager.controller.assertJS("subject.numSearchResults <= subject.maxResults",
{numSearchResults: listBox.getNode().itemCount,
maxResults: maxResults}
);
// Clear the search field and verify elements of that functionality
var searchField = addonsManager.getElement({type: "search_field"});
controller.keypress(searchField, "VK_ESCAPE", {});
buttonPanel = searchButton.getNode().selectedPanel;
controller.assertJS("subject.isClearButtonShown == true",
{isClearButtonShown: buttonPanel.getAttribute('class') != 'textbox-search-clear'});
controller.assertValue(searchField, "");
// We still have to show the footer with recommended addons
controller.waitForElement(footer, gSearchTimeout);
controller.assertProperty(footer, "hidden", false);
// Verify the number of recommended addons is in-between 0 and the maxResults pref
addonsManager.controller.assertJS("subject.numSearchResults > 0",
{numSearchResults: listBox.getNode().itemCount});
addonsManager.controller.assertJS("subject.numSearchResults <= subject.maxResults",
{numSearchResults: listBox.getNode().itemCount,
maxResults: maxResults}
);
}
/**
* Map test functions to litmus tests
*/
// testSearchForAddons.meta = {litmusids : [8825]};

Просмотреть файл

@ -1,104 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* **** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'ToolbarAPI'];
const gTimeout = 5000;
const gDelay = 100;
const websites = ['http://www.google.com/',
'http://www.mozilla.org/',
'http://www.getpersonas.com/',
'about:blank'];
var setupModule = function(module) {
controller = mozmill.getBrowserController();
locationBar = new ToolbarAPI.locationBar(controller);
// Clear complete history so we don't get interference from previous entries
try {
PlacesAPI.historyService.removeAllPages();
} catch (ex) {}
}
/**
* Check acces to the location bar drop down list via autocomplete
*/
var testAccessLocationBarHistory = function()
{
// Open a few different sites to create a small history (about:blank doesn't
// appear in history and clears the page for clean test arena
for each (website in websites) {
locationBar.loadURL(website);
controller.waitForPageLoad();
}
// Wait about 4s so the history gets populated
controller.sleep(4000);
// First - Focus the locationbar then delete any contents there
locationBar.clear();
// Second - Arrow down to open the autocomplete list (displays most recent visit first),
// then arrow down again to the first entry, in this case www.getpersonas.com;
controller.keypress(locationBar.urlbar, "VK_DOWN", {});
controller.sleep(gDelay);
controller.keypress(locationBar.urlbar, "VK_DOWN", {});
controller.sleep(gDelay);
// checks that the first item in the drop down list is selected.
controller.waitForEval("subject.selectedIndex == 0",
gTimeout, 100, locationBar.autoCompleteResults);
locationBar.contains("getpersonas");
controller.keypress(null, "VK_RETURN", {});
controller.waitForPageLoad();
// Finally - Check that the personas page was loaded
// Check for presense of Personsas image
var personasImage = new elementslib.XPath(controller.tabs.activeTab, "/html/body/div[@id='outer-wrapper']/div[@id='inner-wrapper']/div[@id='nav']/h1/a/img");
controller.waitForElement(personasImage, gTimeout, 100);
// Check that getpersonas is in the url bar
locationBar.contains("getpersonas");
}
/**
* Map test functions to litmus tests
*/
// testAccessLocationBarHistory.meta = {litmusids : [5981]};

Просмотреть файл

@ -1,134 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'PrefsAPI','ToolbarAPI'];
const gTimeout = 5000;
const gDelay = 200;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
// Clear complete history so we don't get interference from previous entries
try {
var historyService = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
historyService.removeAllPages();
}
catch (ex) {}
}
/**
* Check matched awesomebar items are highlighted.
*/
var testCheckItemHighlight = function()
{
// Use preferences dialog to select "When Using the location bar suggest:" History and Bookmarks
PrefsAPI.openPreferencesDialog(prefDialogSuggestsCallback);
var websites = ['http://www.google.com/', 'about:blank'];
// Open the test page then about:blank to set up the test test environment
for (var k = 0; k < websites.length; k++) {
locationBar.loadURL(websites[k]);
controller.waitForPageLoad();
}
// wait for 4 seconds to work around Firefox LAZY ADD of items to the db
controller.sleep(4000);
var testString = "google";
// Focus the locationbar, delete any contents there, then type in a match string
locationBar.clear();
// Use type and sleep on each letter to allow the autocomplete to populate with results.
for (var i = 0; i < testString.length; i++) {
locationBar.type(testString[i]);
controller.sleep(gDelay);
}
// Result to check for underlined text
var richlistItem = locationBar.autoCompleteResults.getResult(0);
// For the page title check matched text is underlined
controller.waitForEval('subject.isOpened == true', 3000, 100, locationBar.autoCompleteResults);
var entries = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "title");
controller.assertJS("subject.underlinedTextCount == 1",
{underlinedTextCount: entries.length})
for each (entry in entries) {
controller.assertJS("subject.enteredTitle == subject.underlinedTitle",
{enteredTitle: testString, underlinedTitle: entry.toLowerCase()});
}
// For the url check matched text is underlined
entries = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "url");
controller.assertJS("subject.underlinedUrlCount == 1",
{underlinedUrlCount: entries.length})
for each (entry in entries) {
controller.assertJS("subject.enteredUrl == subject.underlinedUrl",
{enteredUrl: testString, underlinedUrl: entry.toLowerCase()});
}
}
/**
* Set matching of the location bar to "History and Bookmarks"
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogSuggestsCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
var suggests = new elementslib.ID(controller.window.document, "locationBarSuggestion");
controller.waitForElement(suggests);
controller.select(suggests, null, null, 0);
controller.sleep(gDelay);
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testCheckItemHighlight.meta = {litmusids : [8774]};

Просмотреть файл

@ -1,99 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'ToolbarAPI'];
const gTimeout = 1000;
const gDelay = 100;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
// Clear complete history so we don't get interference from previous entries
try {
PlacesAPI.historyService.removeAllPages();
} catch (ex) {}
}
/**
* Check Escape key functionality during auto-complete process
*/
var testEscape = function()
{
var websites = ['http://www.google.com/', 'http://www.mozilla.org'];
// Open some pages to set up the test environment
for each (website in websites) {
locationBar.loadURL(website);
controller.waitForPageLoad();
}
// wait for 4 seconds to work around Firefox LAZY ADD of items to the db
controller.sleep(4000);
var testString = "google";
// Focus the locationbar and delete any contents there
locationBar.clear();
// Use type and sleep on each letter to allow the autocomplete to populate with results.
for (var i = 0; i < testString.length; i++) {
locationBar.type(testString[i]);
controller.sleep(gDelay);
}
// confirm that google is in the locationbar and the awesomecomplete list is open
controller.assertJS("subject.contains('" + testString + "') == true", locationBar);
controller.assertJS("subject.autoCompleteResults.isOpened == true", locationBar);
// After first Escape, confirm that google is in the locationbar and awesomecomplete list is closed
controller.keypress(locationBar.urlbar, 'VK_ESCAPE', {});
controller.assertJS("subject.contains('" + testString + "') == true", locationBar);
controller.assertJS("subject.autoCompleteResults.isOpened == false", locationBar);
// After second Escape, confirm the locationbar returns to the current page url
controller.keypress(locationBar.urlbar, 'VK_ESCAPE', {});
controller.assertJS("subject.contains('" + websites[1] + "') == true", locationBar);
}
/**
* Map test function to litmus test
*/
// testEscape.meta = {litmusids : [8693]};

Просмотреть файл

@ -20,6 +20,8 @@
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
* Geo Mealer <gmealer@mozilla.com>
* Aaron Train <atrain@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -36,63 +38,60 @@
* ***** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'PrefsAPI', 'ToolbarAPI'];
const RELATIVE_ROOT = '../../shared-modules';
const MODULE_REQUIRES = ['PlacesAPI', 'PrefsAPI', 'ToolbarAPI'];
const gTimeout = 5000;
const gDelay = 200;
const LOCAL_TEST_FOLDER = collector.addHttpResource('../test-files/');
const LOCAL_TEST_PAGE = {
url: LOCAL_TEST_FOLDER + 'layout/mozilla.html',
string: "mozilla"
};
const testSite = {url : 'http://www.google.com/', string: 'google'};
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
var setupModule = function() {
controller = mozmill.getBrowserController();
locationBar = new ToolbarAPI.locationBar(controller);
// Clear complete history so we don't get interference from previous entries
try {
PlacesAPI.historyService.removeAllPages();
} catch (ex) {}
PlacesAPI.removeAllHistory();
}
/**
* Check Favicon in autocomplete list
*
*/
var testFaviconInAutoComplete = function()
{
var testFaviconInAutoComplete = function() {
// Use preferences dialog to select "When Using the location bar suggest:" "History"
PrefsAPI.openPreferencesDialog(prefDialogSuggestsCallback);
// Open the test page
locationBar.loadURL(testSite.url);
// Open the local test page
locationBar.loadURL(LOCAL_TEST_PAGE.url);
controller.waitForPageLoad();
// Get the location bar favicon element URL.
// Get the location bar Favicon element URL
var locationBarFaviconUrl = locationBar.getElement({type:"favicon"}).getNode().getAttribute('src');
// wait for 4 seconds to work around Firefox LAZY ADD of items to the db
// Wait for 4 seconds to work around Firefox LAZY ADD of items to the DB
controller.sleep(4000);
// Focus the locationbar, delete any contents there
locationBar.clear();
// Type in each letter of the test string to allow the autocomplete to populate with results.
for each (letter in testSite.string) {
// Type in each letter of the test string to allow the autocomplete to populate with results
for each (var letter in LOCAL_TEST_PAGE.string) {
locationBar.type(letter);
controller.sleep(gDelay);
controller.sleep(200);
}
// defines the path to the first auto-complete result
// Define the path to the first auto-complete result
var richlistItem = locationBar.autoCompleteResults.getResult(0);
// Ensure the autocomplete list is open
controller.waitForEval('subject.isOpened == true', 3000, 100, locationBar.autoCompleteResults);
// Get url for the autocomplete favicon for the matched entry
// Get the URL for the autocomplete Favicon for the matched entry
var listFaviconUrl = richlistItem.getNode().boxObject.firstChild.childNodes[0].getAttribute('src');
// Check that both favicons have the same URL
// Check that both Favicons have the same URL
controller.assertJS("subject.isSameFavicon == true",
{isSameFavicon: richlistItem.getNode().image.indexOf(locationBarFaviconUrl) != -1});
}
@ -103,15 +102,14 @@ var testFaviconInAutoComplete = function()
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogSuggestsCallback = function(controller)
{
var prefDialogSuggestsCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
var suggests = new elementslib.ID(controller.window.document, "locationBarSuggestion");
controller.waitForElement(suggests);
controller.select(suggests, null, null, 1);
controller.sleep(gDelay);
controller.sleep(200);
prefDialog.close(true);
}

Просмотреть файл

@ -20,6 +20,7 @@
* Contributor(s):
* Anthony Hughes <ahughes@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
* Aaron Train <atrain@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -36,24 +37,28 @@
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ToolbarAPI', 'UtilsAPI'];
const RELATIVE_ROOT = '../../shared-modules';
const MODULE_REQUIRES = ['ToolbarAPI', 'UtilsAPI'];
const gDelay = 0;
const LOCAL_TEST_FOLDER = collector.addHttpResource('../test-files/');
const LOCAL_TEST_PAGES = [
LOCAL_TEST_FOLDER + 'layout/mozilla.html',
LOCAL_TEST_FOLDER + 'layout/mozilla_mission.html'
];
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
var setupModule = function() {
controller = mozmill.getBrowserController();
locationBar = new ToolbarAPI.locationBar(controller);
module.goButton = locationBar.getElement({type: "goButton"});
goButton = locationBar.getElement({type: "goButton"});
}
/**
* Test to make sure the GO button only appears while typing.
*/
var testGoButtonOnTypeOnly = function() {
// Start from a web page
controller.open("http://www.mozilla.org");
// Start from a local page
controller.open(LOCAL_TEST_PAGES[0]);
controller.waitForPageLoad();
// Verify GO button is hidden
@ -75,26 +80,26 @@ var testGoButtonOnTypeOnly = function() {
*/
var testClickLocationBarAndGo = function()
{
var url = "http://www.google.com/webhp?complete=1&hl=en";
// Start from a web page
controller.open("http://www.mozilla.org");
// Start from a local page
controller.open(LOCAL_TEST_PAGES[0]);
controller.waitForPageLoad();
// Focus and type a URL into the location bar
// Focus and type a URL; a second local page into the location bar
locationBar.focus({type: "shortcut"});
locationBar.type(url);
locationBar.type(LOCAL_TEST_PAGES[1]);
// Click the GO button
controller.click(goButton);
controller.waitForPageLoad();
// Check if the Google logo exists and the Go button is hidden
controller.assertNode(new elementslib.Name(controller.tabs.activeTab, "q"));
// Check if an element with an id of 'organization' exists and the Go button is hidden
var pageElement = new elementslib.ID(controller.tabs.activeTab, "organization");
controller.assertNode(pageElement);
UtilsAPI.assertElementVisible(controller, goButton, false);
// Check if the URL bar matches the expected domain name
controller.assertValue(locationBar.urlbar, url);
controller.assertValue(locationBar.urlbar, LOCAL_TEST_PAGES[1]);
}
/**

Просмотреть файл

@ -1,113 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* **** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ToolbarAPI'];
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
}
/**
* Test three different ways to search in the location bar
*/
var testLocationBarSearches = function ()
{
controller.open("about:blank");
controller.waitForPageLoad();
/**
* Part 1 - Check unmatched string search
*/
var randomTestString = "oau45rtdgsh34nft";
// Check if random test string is listed in the URL
locationBar.loadURL(randomTestString);
controller.waitForPageLoad();
controller.assertJS("subject.contains('" + randomTestString + "') == true", locationBar);
// Check for presense of Your search message containing search string
var yourSearchString = new elementslib.XPath(controller.tabs.activeTab,
"/html/body[@id='gsr']/div[@id='cnt']/div[@id='res']/div/p[1]/b");
controller.assertText(yourSearchString, randomTestString);
controller.open("about:blank");
controller.waitForPageLoad();
/**
* Part 2 - Check lucky match
*/
// Check if lucky match to getpersonas.com is produced
locationBar.loadURL("personas");
controller.waitForPageLoad();
controller.assertJS("subject.contains('getpersonas') == true", locationBar);
// Check for presense of Personsas image
var personasImage = new elementslib.XPath(controller.tabs.activeTab,
"/html/body/div[@id='outer-wrapper']/div[@id='inner-wrapper']/div[@id='nav']/h1/a/img");
controller.waitForElement(personasImage, gTimeout);
controller.open("about:blank");
controller.waitForPageLoad();
/**
* Part 3 - Check results list match
*/
var resultsTestString = "lotr";
// Check if search term is listed in URL
locationBar.loadURL(resultsTestString);
controller.waitForPageLoad();
controller.assertJS("subject.contains('" + resultsTestString + "') == true",
locationBar);
// Check for presense of search term in return results count
// That section of the Google results page is unique from the unmtached results page
var resultsStringCheck = new elementslib.XPath(controller.tabs.activeTab,
"/html/body[@id='gsr']/div[@id='cnt']/div[@id='ssb']/p/b[4]");
controller.assertText(resultsStringCheck, resultsTestString);
}
/**
* Map test functions to litmus tests
*/
// testLocationBarSearches.meta = {litmusids : [8082]};

Просмотреть файл

@ -1,165 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'PrefsAPI', 'ToolbarAPI'];
var testSite = {url : 'https://litmus.mozilla.org/', string: 'litmus'};
const gTimeout = 5000;
const gDelay = 200;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
// Clear complete history so we don't get interference from previous entries
try {
PlacesAPI.historyService.removeAllPages();
} catch (ex) {}
}
var teardownModule = function(module)
{
PlacesAPI.restoreDefaultBookmarks();
}
/**
* Check history and bookmarked (done in testStarInAutocomplete()) items appear in autocomplete list.
*/
var testSuggestHistoryAndBookmarks = function()
{
// Use preferences dialog to select "When Using the location bar suggest:" History and Bookmarks
PrefsAPI.openPreferencesDialog(prefDialogSuggestsCallback);
// Open the test page
locationBar.loadURL(testSite.url);
controller.waitForPageLoad();
// wait for 4 seconds to work around Firefox LAZY ADD of items to the db
controller.sleep(4000);
// Focus the locationbar, delete any contents there
locationBar.clear();
// Type in each letter of the test string to allow the autocomplete to populate with results.
for each (letter in testSite.string) {
locationBar.type(letter);
controller.sleep(gDelay);
}
// defines the path to the first auto-complete result
var richlistItem = locationBar.autoCompleteResults.getResult(0);
// Get the visible results from the autocomplete list. Verify it is 1
controller.waitForEval('subject.isOpened == true', 3000, 100, locationBar.autoCompleteResults);
var autoCompleteResultsList = locationBar.autoCompleteResults.getElement({type:"results"});
controller.assertJS("subject.getNumberOfVisibleRows() == 1", autoCompleteResultsList.getNode());
// For the page title check matched text is underlined
var entries = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "title");
for each (entry in entries) {
controller.assertJS("subject.enteredTitle == subject.underlinedTitle",
{enteredTitle: testSite.string, underlinedTitle: entry.toLowerCase()});
}
}
/**
* Check a star appears in autocomplete list for a bookmarked page.
*/
var testStarInAutocomplete = function()
{
// Bookmark the test page via bookmarks menu
controller.click(new elementslib.Elem(controller.menus.bookmarksMenu.menu_bookmarkThisPage));
// editBookmarksPanel is loaded lazily. Wait until overlay for StarUI has been loaded, then close the dialog
controller.waitForEval("subject._overlayLoaded == true", gTimeout, gDelay, controller.window.top.StarUI);
var doneButton = new elementslib.ID(controller.window.document, "editBookmarkPanelDoneButton");
controller.click(doneButton);
// defines the path to the first auto-complete result
var richlistItem = locationBar.autoCompleteResults.getResult(0);
// Clear history
try {
PlacesAPI.historyService.removeAllPages();
} catch (ex) {}
// Focus the locationbar, delete any contents there
locationBar.clear();
// Type in each letter of the test string to allow the autocomplete to populate with results.
for each (letter in testSite.string) {
locationBar.type(letter);
controller.sleep(gDelay);
}
// For the page title check matched text is underlined
controller.waitForEval('subject.isOpened == true', 3000, 100, locationBar.autoCompleteResults);
var entries = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "title");
for each (entry in entries) {
controller.assertJS("subject.enteredTitle == subject.underlinedTitle",
{enteredTitle: testSite.string, underlinedTitle: entry.toLowerCase()});
}
// For icons, check that the bookmark star is present
controller.assertJS("subject.isItemBookmarked == true",
{isItemBookmarked: richlistItem.getNode().getAttribute('type') == 'bookmark'});
}
/**
* Set suggests in the location bar to "History and Bookmarks"
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogSuggestsCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
var suggests = new elementslib.ID(controller.window.document, "locationBarSuggestion");
controller.waitForElement(suggests);
controller.select(suggests, null, null, 0);
controller.sleep(gDelay);
prefDialog.close(true);
}

Просмотреть файл

@ -1,117 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'PrefsAPI','ToolbarAPI'];
const gTimeout = 5000;
const gDelay = 100;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.locationBar = new ToolbarAPI.locationBar(controller);
// Clear complete history so we don't get interference from previous entries
try {
PlacesAPI.historyService.removeAllPages();
} catch (ex) {}
}
/**
* Check Six is the maximum visible items in a match list.
*/
var testVisibleItemsMax = function()
{
// Use preferences dialog to ensure "When Using the location bar suggest:" History and Bookmarks is selected
PrefsAPI.openPreferencesDialog(prefDialogSuggestsCallback);
// Load some pages to populate history.
var websites = [
'http://www.google.com/',
'http://www.mozilla.org',
'http://www.mozilla.org/projects/',
'http://www.mozilla.org/about/history.html',
'http://www.mozilla.org/contribute/',
'http://www.mozilla.org/causes/',
'http://www.mozilla.org/community/',
'http://www.mozilla.org/about/'
];
// Open some pages to set up the test environment
for each (website in websites) {
locationBar.loadURL(website);
controller.waitForPageLoad();
}
// wait for 4 seconds to work around Firefox LAZY ADD of items to the db
controller.sleep(4000);
var testString = 'll';
// Focus the locationbar, delete any contents there
locationBar.clear();
// Use type and sleep on each letter to allow the autocomplete to populate with results.
for each (letter in testString) {
locationBar.type(letter);
controller.sleep(gDelay);
}
// Get the visible results from the autocomplete list. Verify it is six
var autoCompleteResultsList = locationBar.autoCompleteResults.getElement({type:"results"});
controller.assertJS("subject.getNumberOfVisibleRows() == 6", autoCompleteResultsList.getNode());
}
/**
* Set matching of the location bar to "History and Bookmarks"
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogSuggestsCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
var suggests = new elementslib.ID(controller.window.document, "locationBarSuggestion");
controller.waitForElement(suggests);
controller.select(suggests, null, null, 0);
controller.sleep(gDelay);
prefDialog.close(true);
}

Просмотреть файл

@ -1,86 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI', 'UtilsAPI'];
const gDelay = 0;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
}
var teardownModule = function(module) {
PlacesAPI.restoreDefaultBookmarks();
}
var testAddBookmarkToBookmarksMenu = function() {
var uri = UtilsAPI.createURI("http://www.mozilla.org");
// Fail if the URI is already bookmarked
controller.assertJS("subject.isBookmarked == false",
{isBookmarked: PlacesAPI.bookmarksService.isBookmarked(uri)});
// Open URI and wait until it has been finished loading
controller.open(uri.spec);
controller.waitForPageLoad();
// Open the bookmark panel via bookmarks menu
controller.click(new elementslib.Elem(controller.menus.bookmarksMenu.menu_bookmarkThisPage));
// editBookmarksPanel is loaded lazily. Wait until overlay for StarUI has been loaded
controller.waitForEval("subject._overlayLoaded == true", 2000, 100, controller.window.top.StarUI);
// Bookmark should automatically be stored under the Bookmark Menu
// XXX: We should give a unique name too when controller.type will send oninput events (bug 474667)
var nameField = new elementslib.ID(controller.window.document, "editBMPanel_namePicker");
var doneButton = new elementslib.ID(controller.window.document, "editBookmarkPanelDoneButton");
controller.type(nameField, "Mozilla");
controller.sleep(gDelay);
controller.click(doneButton);
// Check if bookmark was created in the Bookmarks Menu
// XXX: Until we can't check via a menu click, call the Places API function for now (bug 474486)
controller.assertJS("subject.isBookmarkInBookmarksMenu == true",
{isBookmarkInBookmarksMenu: PlacesAPI.isBookmarkInFolder(uri, PlacesAPI.bookmarksService.bookmarksMenuFolder)});
}
/**
* Map test functions to litmus tests
*/
// testAddBookmarkToBookmarksMenu.meta = {litmusids : [8154]};

Просмотреть файл

@ -1,146 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
module.cm = Cc["@mozilla.org/cookiemanager;1"]
.getService(Ci.nsICookieManager2);
cm.removeAll();
}
var teardownModule = function(module)
{
PrefsAPI.preferences.clearUserPref("network.cookie.cookieBehavior");
cm.removeAll();
}
/**
* Tests disabling cookies from the preferences dialog
*/
var testDisableCookies = function()
{
// Call preferences dialog and disable cookies
PrefsAPI.openPreferencesDialog(prefDisableCookieDialogCallback);
// Go to mozilla.org to build a list of cookies
controller.open("http://www.mozilla.org/");
controller.waitForPageLoad();
// Call preferences dialog and check cookies
PrefsAPI.openPreferencesDialog(prefCheckDisableDialogCallback);
}
/**
* Go to the privacy pane and disable saving cookies
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDisableCookieDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
// Go to custom history settings and click on the show cookies button
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode, gTimeout);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
// Disable cookies
var acceptCookiesPref = new elementslib.ID(controller.window.document, "acceptCookies");
controller.check(acceptCookiesPref, false);
// Close the preferences dialog
prefDialog.close(true);
}
/**
* Go to the privacy pane and check that cookies are not saved
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefCheckDisableDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
// Go to custom history settings and click on the show cookies button
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode, gTimeout);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
var showCookies = new elementslib.ID(controller.window.document, "showCookiesButton");
controller.waitThenClick(showCookies, gTimeout);
controller.sleep(500);
try {
// Grab the cookies manager window
var window = mozmill.wm.getMostRecentWindow('Browser:Cookies');
var cmController = new mozmill.controller.MozMillController(window);
// Search for a cookie from mozilla.org and verify cookies are not saved
var removeCookieButton = new elementslib.ID(cmController.window.document, "removeCookie");
cmController.waitThenClick(removeCookieButton, gTimeout);
// XXX: Bug 513820 - Remove Cookies button is not cleared when cookie list is cleared
//cmController.assertProperty(removeCookieButton, "disabled", true);
cmController.assertJS("subject.cookieCount == 0",
{cookieCount : cm.countCookiesFromHost(".mozilla.org")});
} catch (ex) {
throw ex;
} finally {
// Close the cookies manager
cmController.keypress(null, "w", {accelKey: true});
controller.sleep(200);
}
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testDisableCookies.meta = {litmusids : [8053]};

Просмотреть файл

@ -1,145 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
module.cm = Cc["@mozilla.org/cookiemanager;1"]
.getService(Ci.nsICookieManager2);
cm.removeAll();
}
var teardownModule = function(module)
{
cm.removeAll();
}
/**
* Tests enabling cookies from the preferences dialog
*/
var testEnableCookies = function()
{
// Call preferences dialog and disable cookies
PrefsAPI.openPreferencesDialog(prefEnableCookieDialogCallback);
// Go to mozilla.org to build a list of cookies
controller.open("http://www.mozilla.org/");
controller.waitForPageLoad();
// Call preferences dialog and check cookies
PrefsAPI.openPreferencesDialog(prefCheckEnableDialogCallback);
}
/**
* Go to the privacy pane and enables cookie saving
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefEnableCookieDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
// Go to custom history settings and click on the show cookies button
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
// Enable cookies
var acceptCookiesPref = new elementslib.ID(controller.window.document, "acceptCookies");
controller.check(acceptCookiesPref, true);
// Close the preferences dialog
prefDialog.close(true);
}
/**
* Go to the privacy pane and check cookies have been saved
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefCheckEnableDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
// Go to custom history settings and click on the show cookies button
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
controller.waitThenClick(new elementslib.ID(controller.window.document, "showCookiesButton"), gTimeout);
controller.sleep(500);
try {
// Grab the cookies manager window
var window = mozmill.wm.getMostRecentWindow('Browser:Cookies');
var cmController = new mozmill.controller.MozMillController(window);
// Search for cookies from mozilla.org and verify cookies are saved
var removeCookieButton = new elementslib.ID(cmController.window.document, "removeCookie");
cmController.waitForElement(removeCookieButton, gTimeout);
cmController.assertProperty(removeCookieButton, "disabled", false);
cmController.assertJS("subject.cookieExists == true",
{cookieExists: cm.cookieExists({host: ".mozilla.org", name: "__utmz", path: "/"})});
cmController.assertJS("subject.cookieCount > 0",
{cookieCount : cm.countCookiesFromHost(".mozilla.org")});
} catch (ex) {
throw ex;
} finally {
// Close the cookies manager
cmController.keypress(null, "w", {accelKey: true});
controller.sleep(200);
}
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testEnableCookies.meta = {litmusids : [8058]};

Просмотреть файл

@ -1,117 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
module.cm = Cc["@mozilla.org/cookiemanager;1"]
.getService(Ci.nsICookieManager2);
cm.removeAll();
}
/**
* Test removing all cookies via the cookie manager
*/
var testRemoveAllCookies = function()
{
// Go to mozilla.org to build a list of cookies
controller.open("http://www.mozilla.org/");
controller.waitForPageLoad();
controller.open("http://www.amazon.com/");
controller.waitForPageLoad();
// Call preferences dialog and delete the created cookies
PrefsAPI.openPreferencesDialog(prefDialogCallback);
}
/**
* Go to the privacy pane and delete all cookies from the cookie manager
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
// Go to custom history settings and click on the show cookies button
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode, gTimeout);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
controller.waitThenClick(new elementslib.ID(controller.window.document, "showCookiesButton"), gTimeout);
controller.sleep(500);
try {
// Grab the cookies manager window
var window = mozmill.wm.getMostRecentWindow('Browser:Cookies');
var cmController = new mozmill.controller.MozMillController(window);
// Get the amount of current cookies
var cookiesList = cmController.window.document.getElementById("cookiesList");
cmController.assertJS("subject.cookieCount > 0",
{cookieCount : cookiesList.view.rowCount});
// Verify all cookies have been removed
cmController.waitThenClick(new elementslib.ID(cmController.window.document, "removeAllCookies"), gTimeout);
cmController.assertJS("subject.cookieCount == 0",
{cookieCount : cookiesList.view.rowCount});
} catch (ex) {
throw ex;
} finally {
// Close the cookies manager
cmController.keypress(null, "w", {accelKey: true});
controller.sleep(200);
}
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testRemoveAllCookies.meta = {litmusids : [8054]};

Просмотреть файл

@ -1,124 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
module.cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
cm.removeAll();
}
var teardownModule = function(module)
{
cm.removeAll();
}
/**
* Tests removing a single cookie via the cookie manager
*/
var testRemoveCookie = function()
{
// Go to mozilla.org to build a list of cookies
controller.open("http://www.mozilla.org/");
controller.waitForPageLoad();
// Call preferences dialog and delete the created cookie
PrefsAPI.openPreferencesDialog(prefDialogCallback);
}
/**
* Go to the privacy pane and delete a cookie from the cookie manager
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
// Go to custom history settings and click on the show cookies button
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
controller.waitThenClick(new elementslib.ID(controller.window.document, "showCookiesButton"), gTimeout);
controller.sleep(500);
try {
// Grab the cookies manager window
var window = mozmill.wm.getMostRecentWindow('Browser:Cookies');
var cmController = new mozmill.controller.MozMillController(window);
// Search for a cookie from mozilla.org and delete it
var filterField = new elementslib.ID(cmController.window.document, "filter");
cmController.waitForElement(filterField, gTimeout);
cmController.type(filterField, "__utmz");
cmController.sleep(500);
// Get the number of cookies in the file manager before removing a single cookie
var cookiesList = cmController.window.document.getElementById("cookiesList");
var origNumCookies = cookiesList.view.rowCount;
cmController.click(new elementslib.ID(cmController.window.document, "removeCookie"));
cmController.assertJS("subject.isCookieRemoved == true",
{isCookieRemoved: !cm.cookieExists({host: ".mozilla.org", name: "__utmz", path: "/"})});
cmController.assertJS("subject.list.view.rowCount == subject.numberCookies",
{list: cookiesList, numberCookies: origNumCookies - 1});
} catch (ex) {
throw ex;
} finally {
// Close the cookies manager
cmController.keypress(null, "w", {accelKey: true});
controller.sleep(200);
}
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testRemoveCookie.meta = {litmusids : [8055]};

Просмотреть файл

@ -1,109 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Anthony Hughes <anthony.s.hughes@gmail.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['DownloadsAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
// Get an instance of the Download Manager class
module.dm = new DownloadsAPI.downloadManager();
}
var teardownModule = function(module)
{
// If we failed in closing the Download Manager window do it now
if (dm.controller.window)
dm.controller.window.close();
}
/**
* Test closing the Download Manager
*/
var testCloseDownloadManager = function()
{
// Get the initial window count
var windowCount = mozmill.utils.getWindows().length;
// Test ESC
dm.open(controller, false);
dm._controller.keypress(null, "VK_ESCAPE", {});
controller.waitForEval("subject.getWindows().length == " + windowCount,
gTimeout, 100, mozmill.utils);
// Test ACCEL+W
// This is tested by dm.close()
// L10N: Entity cmd.close.commandKey in downloads.dtd#35
// All locales use 'w' so harcoded is locale-safe
// Use DTD Helper once it becomes available (Bug 504635)
dm.open(controller, false);
dm.close();
// Test ACCEL+SHIFT+Y
// NOTE: This test is only performed on Linux
// L10N: Entity cmd.close2Unix.commandKey in downloads.dtd#35
// All locales use 'y' so harcoded is locale-safe
// Use DTD Helper once it becomes available (Bug 504635)
if (mozmill.isLinux) {
dm.open(controller, false);
dm._controller.keypress(null, 'y', {shiftKey:true, accelKey:true});
controller.waitForEval("subject.getWindows().length == " + windowCount,
gTimeout, 100, mozmill.utils);
}
// Test ACCEL+J
// NOTE: This test is only performed on Windows and Mac
// L10N: Entity cmd.close2.commandKey in downloads.dtd#35
// All locales use 'j' so harcoded is locale-safe
// Use DTD Helper once it becomes available (Bug 504635)
if (!mozmill.isLinux) {
dm.open(controller, false);
dm._controller.keypress(null, 'j', {accelKey:true});
controller.waitForEval("subject.getWindows().length == " + windowCount,
gTimeout, 100, mozmill.utils);
}
}
/**
* Map test functions to litmus tests
*/
// testCloseDownloadManager.meta = {litmusids : [7980]};

Просмотреть файл

@ -1,93 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Anthony Hughes <anthony.s.hughes@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['DownloadsAPI'];
var URL = "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6/source/firefox-3.6.source.tar.bz2";
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
module.dm = new DownloadsAPI.downloadManager();
// Make sure Download Manager is clean before starting
dm.cleanAll();
}
var teardownModule = function(module)
{
dm.cleanAll();
dm.close();
}
/*
* This tests all four download states:
* Pause, Resume, Cancel, and Retry
*/
var testDownloadStates = function()
{
// Download a file
DownloadsAPI.downloadFileOfUnknownType(controller, URL);
// Wait for the Download Manager to open
dm.waitForOpened(controller);
// Get the download object
var download = dm.getElement({type: "download", subtype: "id", value: "dl1"});
controller.waitForElement(download);
// Click the pause button and verify the download is paused
var pauseButton = dm.getElement({type: "download_button", subtype: "pause", value: download});
controller.click(pauseButton);
dm.waitForDownloadState(download, DownloadsAPI.downloadState.paused);
// Click the resume button and verify the download is active
var resumeButton = dm.getElement({type: "download_button", subtype: "resume", value: download});
controller.click(resumeButton);
dm.waitForDownloadState(download, DownloadsAPI.downloadState.downloading);
// Click the cancel button and verify the download is canceled
var cancelButton = dm.getElement({type: "download_button", subtype: "cancel", value: download});
controller.click(cancelButton);
dm.waitForDownloadState(download, DownloadsAPI.downloadState.canceled);
// Click the retry button and verify the download is active
var retryButton = dm.getElement({type: "download_button", subtype: "retry", value: download});
controller.click(retryButton);
dm.waitForDownloadState(download, DownloadsAPI.downloadState.downloading);
}

Просмотреть файл

@ -1,74 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['DownloadsAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
// Get an instance of the Download Manager class
module.dm = new DownloadsAPI.downloadManager();
}
var teardownModule = function(module)
{
// If we failed in closing the Download Manager window force it now
dm.close(true);
}
/**
* Test opening the Download Manager
*/
var testOpenDownloadManager = function()
{
// Use the main menu
dm.open(controller, false);
dm.close();
// Use the keyboard shortcuts
dm.open(controller, true);
dm.close();
}
/**
* Map test functions to litmus tests
*/
// testOpenDownloadManager.meta = {litmusids : [7979]};

Просмотреть файл

@ -1,134 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Anthony Hughes <ahughes@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
* Tobias Markus <tobbi.bugs@googlemail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
containerString = '/id("main-window")/id("browser-bottombox")/id("FindToolbar")' +
'/anon({"anonid":"findbar-container"})';
findBar = new elementslib.Lookup(controller.window.document, containerString);
findBarTextField = new elementslib.Lookup(controller.window.document,
containerString + '/anon({"anonid":"findbar-textbox"})');
findBarNextButton = new elementslib.Lookup(controller.window.document,
containerString + '/anon({"anonid":"find-next"})');
findBarPrevButton = new elementslib.Lookup(controller.window.document,
containerString + '/anon({"anonid":"find-previous"})');
findBarCloseButton = new elementslib.Lookup(controller.window.document,
containerString + '/anon({"anonid":"find-closebutton"})');
}
var teardownModule = function(module) {
try {
// Just press Ctrl/Cmd + F to select the whole search string
controller.keypress(null, "f", {accelKey:true});
// Clear search text from the text field
controller.keypress(findBarTextField, 'VK_DELETE', {});
// Make sure the find bar is closed by click the X button
controller.click(findBarCloseButton);
} catch(e) {
}
}
/**
* Test find in page functionality
*
*/
var testFindInPage = function() {
var searchTerm = "mozilla";
var comparator = Ci.nsIDOMRange.START_TO_START;
var tabContent = controller.tabs.activeTabWindow;
// Open a website
controller.open("http://www.mozilla.org");
controller.waitForPageLoad();
// Press Ctrl/Cmd + F to open the find bar
controller.keypress(null, "f", {accelKey:true});
controller.sleep(gDelay);
// Check that the find bar is visible
controller.waitForElement(findBar, gTimeout);
// Type "mozilla" into the find bar text field and press return to start the search
controller.type(findBarTextField, searchTerm);
controller.keypress(null, "VK_RETURN", {});
controller.sleep(gDelay);
// Check that some text on the page has been highlighted
// (Lower case because we aren't checking for Match Case option)
var selectedText = tabContent.getSelection();
controller.assertJS("subject.selectedText == subject.searchTerm",
{selectedText: selectedText.toString().toLowerCase(), searchTerm: searchTerm});
// Remember DOM range of first search result
var range = selectedText.getRangeAt(0);
// Click the next button and check the strings again
controller.click(findBarNextButton);
controller.sleep(gDelay);
selectedText = tabContent.getSelection();
controller.assertJS("subject.selectedText == subject.searchTerm",
{selectedText: selectedText.toString().toLowerCase(), searchTerm: searchTerm});
// Check that the next result has been selected
controller.assertJS("subject.isNextResult == true",
{isNextResult: selectedText.getRangeAt(0).compareBoundaryPoints(comparator, range) != 0});
// Click the prev button and check the strings again
controller.click(findBarPrevButton);
controller.sleep(gDelay);
selectedText = tabContent.getSelection();
controller.assertJS("subject.selectedText == subject.searchTerm",
{selectedText: selectedText.toString().toLowerCase(), searchTerm: searchTerm});
// Check that the first result has been selected again
controller.assertJS("subject.isFirstResult == true",
{isFirstResult: selectedText.getRangeAt(0).compareBoundaryPoints(comparator, range) == 0});
}
/**
* Map test functions to litmus tests
*/
// testFindInPage.meta = {litmusids : [7970]};

Просмотреть файл

@ -1,78 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
}
var testAutoCompleteOff = function() {
var url = "http://www.google.com/webhp?complete=1&hl=en";
var searchTerm = "mozillazine";
// Open the google homepage
controller.open(url);
controller.waitForPageLoad();
// Search for mozillazine on google
var searchField = new elementslib.Name(controller.tabs.activeTab, "q");
var submitButton = new elementslib.Name(controller.tabs.activeTab, "btnG");
controller.waitForElement(searchField);
controller.type(searchField, searchTerm);
controller.click(submitButton);
// Go back to the search page
controller.open(url);
controller.waitForPageLoad();
// Enter a part of the search term only
controller.waitForElement(searchField, gTimeout);
controller.type(searchField, searchTerm.substring(0, 3));
controller.sleep(500);
// Verify source autocomplete=off
var popupAutoCompList = new elementslib.ID(controller.window.document, "PopupAutoComplete");
controller.assertProperty(popupAutoCompList, "popupOpen", false);
}
/**
* Map test functions to litmus tests
*/
// testAutoCompleteOff.meta = {litmusids : [9067]};

Просмотреть файл

@ -1,95 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const gDelay = 0;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
try {
// Clear complete form history so we don't interfer with already added entries
var formHistory = Cc["@mozilla.org/satchel/form-history;1"].
getService(Ci.nsIFormHistory2);
formHistory.removeAllEntries();
} catch (ex) {
}
}
var testFormCompletion = function() {
var url = 'http://www.mozilla.org/';
var searchText = 'mozillazine';
// Open the URL and verify it's the correct page
controller.open(url);
controller.waitForPageLoad();
var searchField = new elementslib.ID(controller.tabs.activeTab, "q");
controller.assertNode(searchField);
// Perform a search
controller.type(searchField, searchText);
controller.sleep(gDelay);
controller.click(new elementslib.ID(controller.tabs.activeTab, "quick-search-btn"));
controller.waitForPageLoad();
// Go to a filler site
controller.open('http://www.yahoo.com/');
controller.waitForPageLoad();
// Go back to the starting page
controller.open(url);
controller.waitForPageLoad();
// Verify search field element and type in a portion of the field
controller.type(searchField, "mozilla");
// Select the first element of the drop down
var popDownAutoCompList = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("mainPopupSet")/id("PopupAutoComplete")/anon({"anonid":"tree"})/{"class":"autocomplete-treebody"}');
controller.keypress(searchField, "VK_DOWN", {});
controller.sleep(1000);
controller.click(popDownAutoCompList);
// Verify the field element and the text in it
controller.assertValue(searchField, searchText);
}
/**
* Map test functions to litmus tests
*/
// testFormCompletion.meta = {litmusids : [7965]};

Просмотреть файл

@ -1,146 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI','UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var sampleFormSite = "http://www-archive.mozilla.org/wallet/samples/sample9.html";
var fname = "John";
var lname = "Smith";
var setupModule = function(module)
{
module.controller = mozmill.getBrowserController();
// Clear complete form history so we don't interfere with already added entries
try {
var formHistory = Cc["@mozilla.org/satchel/form-history;1"].
getService(Ci.nsIFormHistory2);
formHistory.removeAllEntries();
} catch (ex) {}
}
/**
* Verify saving and filling in form information
*/
var testSaveFormInformation = function()
{
// Go to the sample form website and submit form data
controller.open(sampleFormSite);
controller.waitForPageLoad();
var firstName = new elementslib.Name(controller.tabs.activeTab, "ship_fname");
var lastName = new elementslib.Name(controller.tabs.activeTab, "ship_lname");
controller.type(firstName, fname);
controller.type(lastName, lname);
controller.click(new elementslib.Name(controller.tabs.activeTab, "SubmitButton"));
controller.waitForPageLoad();
controller.waitForElement(firstName, gTimeout);
// Verify form completion in each inputted field
var popDownAutoCompList = new elementslib.ID(controller.window.document, "PopupAutoComplete");
controller.type(firstName, fname.substring(0,2));
controller.sleep(500);
controller.assertProperty(popDownAutoCompList, "popupOpen", true);
controller.keypress(firstName, "VK_DOWN", {});
controller.click(popDownAutoCompList);
controller.assertValue(firstName, fname);
controller.type(lastName, lname.substring(0,2));
controller.sleep(500);
controller.assertProperty(popDownAutoCompList, "popupOpen", true);
controller.keypress(lastName, "VK_DOWN", {});
controller.click(popDownAutoCompList);
controller.assertValue(lastName, lname);
}
/**
* Verify clearing form and search history
*/
var testClearFormHistory = function()
{
var firstName = new elementslib.Name(controller.tabs.activeTab, "ship_fname");
var lastName = new elementslib.Name(controller.tabs.activeTab, "ship_lname");
// Call clear recent history dialog and clear all form history
var md = new ModalDialogAPI.modalDialog(clearHistoryHandler);
md.start();
controller.click(new elementslib.Elem(controller.menus["tools-menu"].sanitizeItem));
// Verify forms are cleared
var popDownAutoCompList = new elementslib.ID(controller.window.document, "PopupAutoComplete");
controller.open(sampleFormSite);
controller.waitForPageLoad();
controller.waitForElement(firstName, gTimeout);
controller.type(firstName,fname.substring(0,2));
controller.sleep(500);
controller.assertProperty(popDownAutoCompList, "popupOpen", false);
controller.type(lastName, lname.substring(0,2));
controller.sleep(500);
controller.assertProperty(popDownAutoCompList, "popupOpen", false);
}
/**
* Accesses the clear recent history dialog and accepts the default options to clear
*/
var clearHistoryHandler = function(controller)
{
// Verify the checkbox to clear form data is checked
var checkBox = new elementslib.XPath(controller.window.document, "/*[name()='prefwindow']/*[name()='prefpane'][1]/*[name()='listbox'][1]/*[name()='listitem'][2]");
controller.waitForElement(checkBox, gTimeout);
controller.assertChecked(checkBox);
var clearButton = new elementslib.Lookup(controller.window.document, '/id("SanitizeDialog")/anon({"anonid":"dlg-buttons"})/{"dlgtype":"accept"}');
controller.waitThenClick(clearButton);
}
/**
* Map test functions to litmus tests
*/
// testSaveFormInformation.meta = {litmusids : [8052]};
// testClearFormHistory.meta = {litmusids : [8051]};

Просмотреть файл

@ -1,119 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];
const gDelay = 0;
const gTimeout = 200;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
// Clear complete form history so we don't interfer with already added entries
var formHistory = Cc["@mozilla.org/satchel/form-history;1"]
.getService(Ci.nsIFormHistory2);
formHistory.removeAllEntries();
}
var teardownModule = function(module) {
PrefsAPI.preferences.clearUserPref("browser.formfill.enable");
}
var testToggleFormManager = function() {
// Open Preferences dialog and uncheck save form and search history in the privacy pane
PrefsAPI.openPreferencesDialog(prefDialogFormCallback);
var url = "http://www-archive.mozilla.org/wallet/samples/sample9.html";
// Go to the sample form website and submit form data
controller.open(url);
controller.waitForPageLoad();
var firstName = new elementslib.Name(controller.tabs.activeTab, "ship_fname");
var fname = "John";
var lastName = new elementslib.Name(controller.tabs.activeTab, "ship_lname");
var lname = "Smith";
controller.type(firstName, fname);
controller.type(lastName, lname);
controller.click(new elementslib.Name(controller.tabs.activeTab, "SubmitButton"));
controller.waitForPageLoad();
controller.waitForElement(firstName, gTimeout);
// Verify no form completion in each submitted form field
var popDownAutoCompList = new elementslib.Lookup(controller.window.content.document, '/id("main-window")/id("mainPopupSet")/id("PopupAutoComplete")/anon({"anonid":"tree"})/{"class":"autocomplete-treebody"}');
controller.type(firstName, fname.substring(0,2));
controller.sleep(gTimeout);
controller.assertNodeNotExist(popDownAutoCompList);
controller.assertValue(firstName, fname.substring(0,2));
controller.type(lastName, lname.substring(0,2));
controller.sleep(gTimeout);
controller.assertNodeNotExist(popDownAutoCompList);
controller.assertValue(lastName, lname.substring(0,2));
}
/**
* Use preferences dialog to disable the form manager
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogFormCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
// Select custom settings for history and uncheck remember search and form history
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode);
controller.select(historyMode, null, null, "custom");
var rememberForms = new elementslib.ID(controller.window.document, "rememberForms");
controller.waitThenClick(rememberForms);
controller.sleep(gDelay);
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testToggleFormManager.meta = {litmusids : [8050]};

Просмотреть файл

@ -1,82 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['UtilsAPI'];
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
}
var testGoogleSuggestedTerms = function() {
// Open the Google web page
controller.open("http://www.google.com/webhp?complete=1&hl=en");
controller.waitForPageLoad();
// Enter a search term into the Google search field
var searchField = new elementslib.Name(controller.tabs.activeTab, "q");
controller.type(searchField, "area");
// The auto-complete box has a different markup for nightly builds
// Official releases will not have the 'pre' suffix in the version number
if (UtilsAPI.appInfo.platformVersion.indexOf("pre") == -1) {
var autoComplete = new elementslib.XPath(controller.tabs.activeTab, "/html/body/span[@id='main']/center/span[@id='body']/center/form/table[2]/tbody/tr[2]/td");
} else {
var autoComplete = new elementslib.XPath(controller.tabs.activeTab, "/html/body/center/form/table[1]/tbody/tr/td[2]");
}
// Click the first element in the pop-down autocomplete
controller.waitThenClick(autoComplete, gTimeout);
// Start the search
controller.click(new elementslib.Name(controller.tabs.activeTab, "btnG"));
controller.waitForPageLoad();
// Check if Search page has come up
var nextField = new elementslib.Link(controller.tabs.activeTab, "Next");
controller.waitForElement(searchField, gTimeout);
controller.waitForElement(nextField, gTimeout);
}
/**
* Map test functions to litmus tests
*/
// testGoogleSuggestedTerms.meta = {litmusids : [8083]};

Просмотреть файл

@ -1,81 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
}
/**
* Test the stop and reload buttons
*/
var testStopAndReload = function()
{
var url = "http://www.mozilla.com/en-US/";
// Make sure we have a blank page
controller.open("about:blank");
controller.waitForPageLoad();
// Go to the URL and start loading for some milliseconds
controller.open(url);
controller.sleep(100);
controller.click(new elementslib.ID(controller.window.document, "stop-button"));
// Even an element at the top of a page shouldn't exist when we hit the stop
// button extremely fast
var elem = new elementslib.ID(controller.tabs.activeTab, "query");
controller.assertNodeNotExist(elem);
controller.sleep(gDelay);
// Reload, wait for it to completely loading and test again
controller.open(url);
controller.waitForPageLoad();
controller.waitForElement(elem, gTimeout);
}
/**
* Map test functions to litmus tests
*/
// testStopAndReload.meta = {litmusids : [8030]};

Просмотреть файл

@ -1,89 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// File names for crash reporter application on all platforms
const fileNames = {
"darwin" : "crashreporter.app",
"win32" : "crashreporter.exe",
"linux" : "crashreporter"
};
// Expected states of the crash reporter
const states = {
"Enabled" : true,
"ServerURL" : "https://crash-reports.mozilla.com/submit"
};
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
// Get the application folder
var dirService = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
module.appDir = dirService.get("XCurProcD", Ci.nsILocalFile);
// Get the crash reporter service
module.crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Ci.nsICrashReporter);
}
/**
* Test that Breakpad is installed
*/
var testBreakpadInstalled = function()
{
// Check that the crash reporter executable is present
var execFile = Cc["@mozilla.org/file/local;1"]
.createInstance(Ci.nsILocalFile);
execFile.initWithPath(appDir.path);
execFile.append(fileNames[mozmill.platform]);
controller.assertJS("subject.exists() == true", execFile);
// Is the crash reporter enabled?
controller.assertJS("subject.reporter.enabled == subject.stateEnabled",
{reporter: crashReporter, stateEnabled: states['Enabled']});
// Do we have the correct server URL?
controller.assertJS("subject.reporter.serverURL.spec == subject.stateServerURL",
{reporter: crashReporter, stateServerURL: states['ServerURL']});
}
/**
* Map test functions to litmus tests
*/
// testBreakpadInstalled.meta = {litmusids : [7953]};

Просмотреть файл

@ -1,67 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tracy Walker <twalker@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['UtilsAPI'];
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
}
var testNavigateFTP = function () {
// opens the mozilla.org ftp page then navigates through a couple levels.
controller.open('ftp://ftp.mozilla.org/pub/');
controller.waitForPageLoad();
var firefox = new elementslib.Link(controller.tabs.activeTab, 'firefox');
controller.waitThenClick(firefox, gTimeout);
controller.waitForPageLoad();
var nightly = new elementslib.Link(controller.tabs.activeTab, 'nightly');
controller.waitThenClick(nightly, gTimeout);
controller.waitForPageLoad();
var latestLink = new elementslib.Link(controller.tabs.activeTab, 'latest-trunk');
controller.waitForElement(latestLink, gTimeout);
}
/**
* Map test functions to litmus tests
*/
// testNavigateFTP.meta = {litmusids : [7962]};

Просмотреть файл

@ -1,146 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var testSite = "http://www-archive.mozilla.org/quality/browser/front-end/testcases/wallet/login.html";
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
module.pm = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
pm.removeAllLogins();
}
var teardownModule = function(module) {
// Just in case the test fails remove all passwords
pm.removeAllLogins();
}
/**
* Test the password post-submit bar
*/
var testPasswordNotificationBar = function() {
// Go to the sample login page and perform a test log-in with input fields
controller.open(testSite);
controller.waitForPageLoad();
var userField = new elementslib.ID(controller.tabs.activeTab, "uname");
var passField = new elementslib.ID(controller.tabs.activeTab, "Password");
controller.waitForElement(userField, gTimeout);
controller.type(userField, "bar");
controller.type(passField, "foo");
// After logging in, close the notification bar
var button = tabBrowser.getTabPanelElement(tabBrowser.selectedIndex,
'/{"value":"password-save"}/anon({"type":"info"})' +
'/{"class":"messageCloseButton tabbable"}');
// The notification bar should not be visible before submitting the credentials
controller.assertNodeNotExist(button);
controller.click(new elementslib.ID(controller.tabs.activeTab, "LogIn"));
controller.waitForPageLoad();
controller.waitThenClick(button, gTimeout);
controller.sleep(500);
controller.assertNodeNotExist(button);
}
/**
* Verify passwords are not saved when we select not to save them
*/
var testPasswordNotSaved = function()
{
// Go back verify the login information has not been saved
controller.open(testSite);
controller.waitForPageLoad();
var userField = new elementslib.ID(controller.tabs.activeTab, "uname");
var passField = new elementslib.ID(controller.tabs.activeTab, "Password");
controller.waitForElement(userField, gTimeout);
controller.assertValue(userField, "");
controller.assertValue(passField, "");
// Call preferences dialog and check that no password has been saved
PrefsAPI.openPreferencesDialog(prefDialogCallback);
}
/**
* Checks that no password has been saved
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneSecurity';
controller.waitThenClick(new elementslib.ID(controller.window.document, "showPasswords"), gTimeout);
controller.sleep(500);
// Grab the password manager window
var window = mozmill.wm.getMostRecentWindow('Toolkit:PasswordManager');
var pwdController = new mozmill.controller.MozMillController(window);
var filterField = new elementslib.ID(pwdController.window.document, "filter");
pwdController.waitForElement(filterField, gTimeout);
var removeLogin = new elementslib.ID(pwdController.window.document, "removeSignon");
pwdController.assertProperty(removeLogin, 'disabled', 'true');
// Close the password manager and preferences dialog
pwdController.keypress(null, "W", {accelKey: true});
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testPasswordNotificationBar.meta = {litmusids : [8522]};
// testPasswordNotSaved.meta = {litmusids : [8174]};

Просмотреть файл

@ -1,161 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI', 'PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
module.pm = Cc["@mozilla.org/login-manager;1"]
.getService(Ci.nsILoginManager);
pm.removeAllLogins();
}
var teardownModule = function(module)
{
// Just in case the test fails remove all cookies
pm.removeAllLogins();
}
/**
* Test saving a password using the notification bar
*/
var testSavePassword = function()
{
var testSite = "http://www-archive.mozilla.org/quality/browser/front-end/testcases/wallet/login.html";
// Go to the sample login page and log-in with inputted fields
controller.open(testSite);
controller.waitForPageLoad();
var userField = new elementslib.ID(controller.tabs.activeTab, "uname");
var passField = new elementslib.ID(controller.tabs.activeTab, "Password");
controller.waitForElement(userField, gTimeout);
controller.type(userField, "bar");
controller.type(passField, "foo");
controller.click(new elementslib.ID(controller.tabs.activeTab, "LogIn"));
controller.sleep(500);
// After logging in, remember the login information
var label = UtilsAPI.getProperty("chrome://passwordmgr/locale/passwordmgr.properties", "notifyBarRememberButtonText");
var button = tabBrowser.getTabPanelElement(tabBrowser.selectedIndex,
'/{"value":"password-save"}/{"label":"' + label + '"}');
controller.waitThenClick(button, gTimeout);
controller.sleep(500);
controller.assertNodeNotExist(button);
// Go back to the login page and verify the password has been saved
controller.open(testSite);
controller.waitForPageLoad();
controller.waitForElement(userField, gTimeout);
controller.assertValue(userField, "bar");
controller.assertValue(passField, "foo");
}
/**
* Test the deletion of a password from the password manager dialog
*/
var testDeletePassword = function()
{
// Call preferences dialog and delete the saved password
PrefsAPI.openPreferencesDialog(prefDialogCallback);
}
/**
* Go to the security pane and open the password manager
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneSecurity';
controller.waitThenClick(new elementslib.ID(controller.window.document, "showPasswords"), gTimeout);
controller.sleep(500);
// Grab the password manager window
var window = mozmill.wm.getMostRecentWindow('Toolkit:PasswordManager');
var pwdController = new mozmill.controller.MozMillController(window);
var signOnsTree = pwdController.window.document.getElementById("signonsTree");
// Verify there is at least one saved password
pwdController.assertJS("subject.view.rowCount == 1", signOnsTree);
// Delete all passwords and accept the deletion of the saved passwords
var md = new ModalDialogAPI.modalDialog(confirmHandler);
md.start(200);
pwdController.click(new elementslib.ID(pwdController.window.document, "removeAllSignons"));
pwdController.assertJS("subject.view.rowCount == 0", signOnsTree);
// Close the password manager
pwdController.keypress(null, "w", {accelKey:true});
controller.sleep(200);
// Close the preferences dialog
prefDialog.close(true);
}
/**
* Call the confirmation dialog and click ok to go back to the password manager
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var confirmHandler = function(controller)
{
controller.waitThenClick(new elementslib.Lookup(controller.window.document,
'/id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}'), gTimeout);
}
/**
* Map test functions to litmus tests
*/
// testSavePassword.meta = {litmusids : [8172]};
// testDeletePassword.meta = {litmusids : [8173]};

Просмотреть файл

@ -1,116 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Anthony Hughes <ahughes@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
tabBrowser.closeAllTabs();
}
var teardownModule = function(module)
{
// Reset the pop-up blocking pref
PrefsAPI.preferences.clearUserPref("dom.disable_open_during_load");
for each (window in mozmill.utils.getWindows("navigator:browser")) {
if (!window.toolbar.visible)
window.close();
}
}
/**
* Test to make sure pop-ups are not blocked
*
*/
var testPopUpAllowed = function()
{
var url = "https://litmus.mozilla.org/testcase_files/firefox/5918/index.html";
PrefsAPI.openPreferencesDialog(prefDialogCallback);
// Get the window count
var windowCount = mozmill.utils.getWindows().length;
// Open the Pop-up test site
controller.open(url);
controller.waitForPageLoad();
// A notification bar always exists in the DOM so check the visibility of the X button
var button = tabBrowser.getTabPanelElement(tabBrowser.selectedIndex,
'/{"value":"popup-blocked"}/anon({"type":"warning"})' +
'/{"class":"messageCloseButton tabbable"}');
controller.assertNodeNotExist(button);
// Check for the status bar icon
var cssInfo = controller.window.getComputedStyle(controller.window.document.getElementById("page-report-button"), "");
controller.assertJS("subject.isReportButtonVisible == false",
{isReportButtonVisible: cssInfo.getPropertyValue('display') != 'none'});
// Check that the window count has changed
controller.assertJS("subject.preWindowCount != subject.postWindowCount",
{preWindowCount: windowCount, postWindowCount: mozmill.utils.getWindows().length});
}
/**
* Call-back handler for preferences dialog
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneContent';
// Make sure the pref is unchecked
var pref = new elementslib.ID(controller.window.document, "popupPolicy");
controller.waitForElement(pref, gTimeout);
controller.check(pref, false);
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testPopUpAllowed.meta = {litmusids : [8367]};

Просмотреть файл

@ -1,118 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Anthony Hughes <ahughes@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* **** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
}
var teardownModule = function(module)
{
// Reset the pop-up blocking pref and close all open tabs
PrefsAPI.preferences.clearUserPref("dom.disable_open_during_load");
tabBrowser.closeAllTabs();
for each (window in mozmill.utils.getWindows("navigator:browser")) {
if (!window.toolbar.visible)
window.close();
}
}
/**
* Test to make sure pop-ups are blocked
*
*/
var testPopUpBlocked = function()
{
var url = "https://litmus.mozilla.org/testcase_files/firefox/5918/index.html";
PrefsAPI.openPreferencesDialog(prefDialogCallback);
// Get the Window count
var windowCount = mozmill.utils.getWindows().length;
// Open the Pop-up test site
controller.open(url);
controller.waitForPageLoad();
// Check for the close button in the notification bar
// A notification bar always exists in the DOM so check the visibility of the X button
var button = tabBrowser.getTabPanelElement(tabBrowser.selectedIndex,
'/{"value":"popup-blocked"}/anon({"type":"warning"})' +
'/{"class":"messageCloseButton tabbable"}');
controller.waitForElement(button, gTimeout);
// Check for the status bar icon
var cssInfo = controller.window.getComputedStyle(controller.window.document.getElementById("page-report-button"), "");
controller.assertJS("subject.isReportButtonVisible == true",
{isReportButtonVisible: cssInfo.getPropertyValue('display') == '-moz-box'});
// Check that the window count has not changed
controller.assertJS("subject.preWindowCount == subject.postWindowCount",
{preWindowCount: windowCount, postWindowCount: mozmill.utils.getWindows().length});
}
/**
* Call-back handler for preferences dialog
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneContent';
// Make sure the pref is checked
var pref = new elementslib.ID(controller.window.document, "popupPolicy");
controller.waitForElement(pref, gTimeout);
controller.check(pref, true);
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testPopUpBlocked.meta = {litmusids : [7961]};

Просмотреть файл

@ -1,118 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
}
/**
* Open and dismiss the preferences dialog
*/
var testOpenCloseOptionsDialog = function()
{
// Reset pane to the main pane before starting the test
PrefsAPI.openPreferencesDialog(prefPaneResetCallback);
}
/**
* Panes of preferences dialog should retain state when opened next time
*/
var testOptionsDialogRetention = function()
{
// Choose the Privacy pane
PrefsAPI.openPreferencesDialog(prefPaneSetCallback);
// And check if the Privacy pane is still selected
PrefsAPI.openPreferencesDialog(prefPaneCheckCallback);
}
/**
* Reset the current pane to the main options
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefPaneResetCallback = function(controller)
{
let prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneMain';
prefDialog.close();
}
/**
* Select the Advanced and the Privacy pane
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefPaneSetCallback = function(controller)
{
let prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneAdvanced';
prefDialog.paneId = 'panePrivacy';
prefDialog.close();
}
/**
* The Privacy pane should still be selected
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefPaneCheckCallback = function(controller)
{
let prefDialog = new PrefsAPI.preferencesDialog(controller);
controller.assertJS("subject.paneId == 'panePrivacy'",
{paneId: prefDialog.paneId});
prefDialog.close();
}
/**
* Map test functions to litmus tests
*/
// testOptionsDialogRetention.meta = {litmusids : [8014]};
// testOpenCloseOptionsDialog.meta = {litmusids : [8015]};

Просмотреть файл

@ -1,131 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI', 'PrefsAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
}
var teardownModule = function(module) {
PrefsAPI.preferences.clearUserPref("intl.accept_languages");
}
/**
* Choose your preferred language for display
*/
var testSetLanguages = function () {
controller.open("about:blank");
// Call preferences dialog and set primary language to Italian
PrefsAPI.openPreferencesDialog(prefDialogCallback);
// Open the Google Home page
controller.open('http://www.google.com/');
controller.waitForPageLoad();
// Verify the site is Italian oriented
controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Accedi"));
controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Gruppi"));
controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Ricerca avanzata"));
}
/**
* Open preferences dialog to switch the primary language
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneContent';
// Call language dialog and set Italian as primary language
var md = new ModalDialogAPI.modalDialog(langHandler);
md.start(200);
var language = new elementslib.ID(controller.window.document, "chooseLanguage");
controller.waitThenClick(language, gTimeout);
prefDialog.close(true);
}
/**
* Callback handler for languages dialog
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var langHandler = function(controller) {
// Add the Italian Language
var langDropDown = new elementslib.ID(controller.window.document, "availableLanguages");
controller.waitForElement(langDropDown, gTimeout);
controller.keypress(langDropDown, "i", {});
controller.sleep(100);
controller.keypress(langDropDown, "t", {});
controller.sleep(100);
controller.keypress(langDropDown, "a", {});
controller.sleep(100);
controller.keypress(langDropDown, "l", {});
controller.sleep(100);
// Wait until the add button has been enabled
var addButton = new elementslib.ID(controller.window.document, "addButton");
controller.waitForEval("subject.disabled == false", gTimeout, 100, addButton.getNode());
controller.click(addButton);
// Move the Language to the Top of the List and Accept the new settings
var upButton = new elementslib.ID(controller.window.document, "up");
controller.click(upButton);
controller.sleep(gDelay);
controller.click(upButton);
controller.sleep(gDelay);
// Save and close the languages dialog window
controller.click(new elementslib.Lookup(controller.window.document, '/id("LanguagesDialog")/anon({"anonid":"dlg-buttons"})/{"dlgtype":"accept"}'));
}
/**
* Map test functions to litmus tests
*/
// testSetLanguages.meta = {litmusids : [8322]};

Просмотреть файл

@ -1,115 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
TabbedBrowsingAPI.closeAllTabs(controller);
}
var teardownModule = function(module) {
PrefsAPI.preferences.clearUserPref("browser.startup.homepage");
}
/**
* Restore home page to default
*/
var testRestoreHomeToDefault = function() {
// Open a web page for the temporary home page
controller.open('http://www.mozilla.org/');
controller.waitForPageLoad();
var link = new elementslib.Link(controller.tabs.activeTab, "Mozilla");
controller.assertNode(link);
// Call Preferences dialog and set home page
PrefsAPI.openPreferencesDialog(prefDialogHomePageCallback);
// Go to the saved home page and verify it's the correct page
controller.click(new elementslib.ID(controller.window.document, "home-button"));
controller.waitForPageLoad();
controller.assertNode(link);
// Open Preferences dialog and reset home page to default
PrefsAPI.openPreferencesDialog(prefDialogDefHomePageCallback);
}
/**
* Set the current page as home page via the preferences dialog
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogHomePageCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneMain';
// Set home page to the current page
var useCurrent = new elementslib.ID(controller.window.document, "useCurrent");
controller.waitThenClick(useCurrent);
controller.sleep(gDelay);
prefDialog.close(true);
}
var prefDialogDefHomePageCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
// Reset home page to the default page
var useDefault = new elementslib.ID(controller.window.document, "restoreDefaultHomePage");
controller.waitForElement(useDefault, gTimeout);
controller.click(useDefault);
// Check the browserconfig file to get the get default homepage
var defaultHomePage = UtilsAPI.getProperty("resource:/browserconfig.properties", "browser.startup.homepage");
var browserHomePage = new elementslib.ID(controller.window.document, "browserHomePage");
controller.assertValue(browserHomePage, defaultHomePage);
prefDialog.close();
}
/**
* Map test functions to litmus tests
*/
// testRestoreHomeToDefault.meta = {litmusids : [8327]};

Просмотреть файл

@ -20,6 +20,7 @@
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
* Aaron Train <atrain@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -36,16 +37,18 @@
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'TabbedBrowsingAPI'];
const RELATIVE_ROOT = '../../shared-modules';
const MODULE_REQUIRES = ['PrefsAPI', 'TabbedBrowsingAPI', 'ToolbarAPI'];
const gDelay = 0;
const gTimeout = 5000;
const LOCAL_TEST_FOLDER = collector.addHttpResource('../test-files/');
const LOCAL_TEST_PAGES = [
{url: LOCAL_TEST_FOLDER + 'layout/mozilla.html'},
{url: LOCAL_TEST_FOLDER + 'layout/mozilla_mission.html'}
];
const homepage = 'http://www.mozilla.org/';
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
var setupModule = function() {
controller = mozmill.getBrowserController();
locationBar = new ToolbarAPI.locationBar(controller);
TabbedBrowsingAPI.closeAllTabs(controller);
}
@ -58,11 +61,11 @@ var teardownModule = function(module) {
* Set homepage to current page
*/
var testSetHomePage = function() {
// Go to the Mozilla.org website and verify the correct page has loaded
controller.open(homepage);
// Go to the first local page and verify the correct page has loaded
controller.open(LOCAL_TEST_PAGES[0].url);
controller.waitForPageLoad();
var link = new elementslib.Link(controller.tabs.activeTab, "Mozilla");
var link = new elementslib.Link(controller.tabs.activeTab, "Community");
controller.assertNode(link);
// Call Prefs Dialog and set Home Page
@ -74,8 +77,8 @@ var testSetHomePage = function() {
*/
var testHomeButton = function()
{
// Open another page before going to the home page
controller.open('http://www.yahoo.com/');
// Open another local page before going to the home page
controller.open(LOCAL_TEST_PAGES[1].url);
controller.waitForPageLoad();
// Go to the saved home page and verify it's the correct page
@ -83,8 +86,7 @@ var testHomeButton = function()
controller.waitForPageLoad();
// Verify location bar with the saved home page
var locationBar = new elementslib.ID(controller.window.document, "urlbar");
controller.assertValue(locationBar, homepage);
controller.assertValue(locationBar.urlbar, LOCAL_TEST_PAGES[0].url);
}
/**

Просмотреть файл

@ -1,88 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozmill Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aakash Desai <adesai@mozilla.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Litmus test #8013: Main Menu of Options (Preferences)
*/
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'UtilsAPI'];
const gDelay = 100;
const gTimeout = 5000;
var setupModule = function(module) {
controller = mozmill.getBrowserController();
}
/**
* Switching through all panes of the preferences dialog
*/
var testPreferencesPanes = function() {
PrefsAPI.openPreferencesDialog(prefDialogCallback);
}
/**
* Callback handler for preferences window
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefDialogCallback = function(controller) {
var prefDialog = new PrefsAPI.preferencesDialog(controller);
// List of all available panes inside the Preferences window
var panes = [
"paneMain", "paneTabs", "paneContent", "paneApplications",
"panePrivacy", "paneSecurity", "paneAdvanced"
];
// Step through each of the panes
for each (pane in panes) {
prefDialog.paneId = pane;
controller.sleep(gDelay);
}
// Close the Preferences window
prefDialog.close();
}
/**
* Map test functions to litmus tests
*/
// testPreferencesPanes.meta = {litmusids : [8013]};

Просмотреть файл

@ -1,106 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
// Create Private Browsing instance and set handler
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
}
var setupTest = function(module)
{
// Make sure we are not in PB mode and don't show a prompt
pb.enabled = false;
pb.showPrompt = false;
}
var teardownTest = function(test)
{
pb.reset();
}
/**
* Verify about:privatebrowsing in regular mode
*/
var testCheckRegularMode = function()
{
controller.open("about:privatebrowsing");
controller.waitForPageLoad();
// XXX Bug 504635 - Can't check DTD entities yet
var statusText = new elementslib.ID(controller.tabs.activeTab, "errorShortDescTextNormal");
// Check button to enter Private Browsing mode
var button = new elementslib.ID(controller.tabs.activeTab, "startPrivateBrowsing");
controller.click(button);
controller.waitForPageLoad();
controller.waitForEval("subject.privateBrowsing.enabled == true", gTimeout, 100,
{privateBrowsing: pb});
}
/**
* Verify about:privatebrowsing in private browsing mode
*/
var testCheckPrivateBrowsingMode = function()
{
// Start the Private Browsing mode
pb.start();
controller.waitForPageLoad();
var moreInfo = new elementslib.ID(controller.tabs.activeTab, "moreInfoLink");
controller.waitThenClick(moreInfo, gTimeout);
// Clicking on the more info link opens a new tab with a page on SUMO
var targetUrl = UtilsAPI.formatUrlPref("app.support.baseURL") + "private-browsing";
controller.waitForEval("subject.length == 2", gTimeout, 100, controller.tabs);
controller.waitForPageLoad();
UtilsAPI.assertLoadedUrlEqual(controller, targetUrl);
}
/**
* Map test functions to litmus tests
*/
// testCheckAboutPrivateBrowsing.meta = {litmusids : [9203]};

Просмотреть файл

@ -19,6 +19,7 @@
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
* Aaron Train <atrain@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -34,35 +35,34 @@
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI'];
// Include necessary modules
const RELATIVE_ROOT = '../../shared-modules';
const MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const TIMEOUT = 5000;
var websites = [
{url: 'https://addons.mozilla.org/', id: 'search-query'},
{url: 'https://bugzilla.mozilla.org', id: 'quicksearch_top'}
];
const LOCAL_TEST_FOLDER = collector.addHttpResource('../test-files/');
const LOCAL_TEST_PAGES = [
{url: LOCAL_TEST_FOLDER + 'layout/mozilla.html', name: 'community'},
{url: LOCAL_TEST_FOLDER + 'layout/mozilla_mission.html', name: 'mission'}
];
var setupModule = function(module)
{
var setupModule = function(module) {
controller = mozmill.getBrowserController();
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
TabbedBrowsingAPI.closeAllTabs(controller);
}
var teardownModule = function(module)
{
var teardownModule = function(module) {
pb.reset();
}
/**
* Verify when closing window in private browsing that regular session is restored
*/
var testCloseWindow = function()
{
var testCloseWindow = function() {
// Closing the only browser window while staying in Private Browsing mode
// will quit the application on Windows and Linux. So only on the test on OS X.
if (!mozmill.isMac)
@ -74,45 +74,53 @@ var testCloseWindow = function()
pb.enabled = false;
pb.showPrompt = false;
// Open websites in separate tabs
// Open local pages in separate tabs
var newTab = new elementslib.Elem(controller.menus['file-menu'].menu_newNavigatorTab);
for (var ii = 0; ii < websites.length; ii++) {
controller.open(websites[ii].url);
for each (var page in LOCAL_TEST_PAGES) {
controller.open(page.url);
controller.click(newTab);
}
// Wait until all tabs have been finished loading
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
// Wait until all tabs have finished loading
for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) {
var elem = new elementslib.Name(controller.tabs.getTab(i), LOCAL_TEST_PAGES[i].name);
controller.waitForElement(elem, TIMEOUT);
}
// Start Private Browsing
pb.start();
// Get the window count and wait until the window has been closed
controller.keypress(null, "w", {shiftKey: true, accelKey: true});
controller.waitForEval("subject.getWindows().length == " + (windowCount - 1),
gTimeout, 100, mozmill.utils);
// One single window will be opened in PB mode which has to be closed now
var cmdKey = UtilsAPI.getEntity(tabBrowser.getDtds(), "closeCmd.key");
controller.keypress(null, cmdKey, {accelKey: true});
controller.waitForEval("subject.utils.getWindows().length == subject.expectedCount",
TIMEOUT, 100,
{utils: mozmill.utils, expectedCount: (windowCount - 1)});
// Without a window any keypress and menu click will fail.
// Flipping the pref directly will also do it.
pb.enabled = false;
controller.waitForEval("subject.getWindows().length == " + windowCount,
gTimeout, 100, mozmill.utils);
controller.waitForEval("subject.utils.getWindows().length == subject.expectedCount",
TIMEOUT, 100,
{utils: mozmill.utils, expectedCount: windowCount});
controller.sleep(500);
var window = mozmill.wm.getMostRecentWindow("navigator:browser");
controller = new mozmill.controller.MozMillController(window);
UtilsAPI.handleWindow("type", "navigator:browser", checkWindowOpen, true);
}
function checkWindowOpen(controller) {
// All tabs should be restored
controller.assertJS("subject.tabs.length == " + (websites.length + 1),
controller);
controller.assertJS("subject.tabs.length == subject.expectedCount",
{tabs: controller.tabs, expectedCount: (websites.length + 1)});
// Check if all pages were re-loaded and show their content
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
// Check if all local pages were re-loaded and show their content
for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) {
var tab = controller.tabs.getTab(i);
var elem = new elementslib.Name(tab, LOCAL_TEST_PAGES[i].name);
controller.waitForPageLoad(tab);
controller.waitForElement(elem, TIMEOUT);
}
}

Просмотреть файл

@ -1,96 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI'];
const gDelay = 0;
const gTimeout = 5000;
var setupModule = function(module) {
module.controller = mozmill.getBrowserController();
// Create Private Browsing instance and set handler
module.pb = new PrivateBrowsingAPI.privateBrowsing(controller);
}
var teardownModule = function(module)
{
pb.reset();
}
/**
* Verify "Import" is disabled during Private Browsing mode
*/
var testCheckAboutPrivateBrowsing = function()
{
// Make sure we are not in PB mode and don't show a prompt
pb.enabled = false;
pb.showPrompt = false;
pb.start();
// File -> Import should be disabled
var importItem = new elementslib.ID(controller.window.document, "menu_import");
controller.assertProperty(importItem, "disabled", true);
// On Mac we also have to check the menu item when the Library is open
if (mozmill.isMac) {
var libraryItem = new elementslib.ID(controller.window.document, "bookmarksShowAll");
controller.click(libraryItem);
controller.sleep(500);
// Check if the Page Info window has been opened
var window = mozmill.wm.getMostRecentWindow('Places:Organizer');
var libController = new mozmill.controller.MozMillController(window);
// Check File -> Import entry again
var importItem = new elementslib.ID(libController.window.document, "menu_import");
libController.assertProperty(importItem, "disabled", true);
// Check that "Import HTML" is available
var importHTML = new elementslib.ID(libController.window.document, "fileImport");
libController.assertPropertyNotExist(importHTML, "disabled");
libController.keypress(null, "w", {accelKey: true});
libController.sleep(200);
}
}
/**
* Map test functions to litmus tests
*/
// testCheckAboutPrivateBrowsing.meta = {litmusids : [9242]};

Просмотреть файл

@ -1,144 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI', 'PrefsAPI', 'PrivateBrowsingAPI',
'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var websites = [
"https://litmus.mozilla.org/testcase_files/firefox/5918/index.html",
"https://litmus.mozilla.org/testcase_files/firefox/cookies/cookie_single.html"
];
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
// Create Private Browsing instance
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
}
var teardownModule = function(module)
{
pb.reset();
// Reset the user cookie pref
PrefsAPI.preferences.clearUserPref("network.cookie.lifetimePolicy");
}
/**
* Verify various permissions are disabled when in Private Browsing mode
*/
var testPermissionsDisabled = function()
{
// Make sure we are not in PB mode and don't show a prompt
pb.enabled = false;
pb.showPrompt = false;
TabbedBrowsingAPI.closeAllTabs(controller);
pb.start();
// Check that the "allow" button for pop-ups is disabled in the preferences
controller.open(websites[0]);
controller.waitForPageLoad();
// Open context menu and check "Allow Popups" is disabled
var property = mozmill.isWindows ? "popupWarningButton.accesskey" : "popupWarningButtonUnix.accesskey";
var accessKey = UtilsAPI.getProperty("chrome://browser/locale/browser.properties", property);
controller.keypress(null, accessKey, {ctrlKey: mozmill.isMac, altKey: !mozmill.isMac});
var allow = new elementslib.XPath(controller.window.document, "/*[name()='window']/*[name()='popupset'][1]/*[name()='popup'][2]/*[name()='menuitem'][1]");
controller.waitForElement(allow);
controller.assertProperty(allow, "disabled", true);
controller.keypress(null, "VK_ESCAPE", {});
// Enable the "Ask me every time" cookie behavior
PrefsAPI.openPreferencesDialog(prefCookieHandler);
// No cookie dialog should show up
controller.open(websites[1]);
controller.waitForPageLoad();
}
/**
* Select "Ask me every time" for Cookies
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var prefCookieHandler = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'panePrivacy';
// Go to custom history settings and select ask me every time for cookies
var historyMode = new elementslib.ID(controller.window.document, "historyMode");
controller.waitForElement(historyMode, gTimeout);
controller.select(historyMode, null, null, "custom");
controller.sleep(gDelay);
var acceptCookies = new elementslib.ID(controller.window.document, "acceptCookies");
controller.assertChecked(acceptCookies);
// Select "ask me every time"
var keepCookies = new elementslib.ID(controller.window.document, "keepCookiesUntil");
controller.waitForElement(keepCookies, gTimeout);
controller.select(keepCookies, null, null, 1);
controller.sleep(gDelay);
prefDialog.close(true);
}
/**
* Just in case we open a modal dialog we have to mark the test as failed
*/
var cookieHandler = function(controller)
{
var button = new elementslib.ID(controller.window.document, "ok");
controller.assertNodeNotExist(button);
}
/**
* Map test functions to litmus tests
*/
// testPermissionsDisabled.meta = {litmusids : [9157]};

Просмотреть файл

@ -1,163 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Anthony Hughes <anthony.s.hughes@gmail.com>
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['DownloadsAPI', 'PrefsAPI', 'PrivateBrowsingAPI', 'UtilsAPI'];
const gDelay = 100;
const gTimeout = 5000;
const downloads = [
"http://www.adobe.com/education/pdf/etd/etd_lesson2.pdf",
"http://switch.dl.sourceforge.net/project/rarexpander/RAR%20Expander/0.8.4/rar_expander_v084.dmg"
];
const downloadsPB = [
"http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz"
];
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
// Make sure there are no active downloads, downloaded files
// or data in the Download Manager database before beginning
dm = new DownloadsAPI.downloadManager();
dm.cleanAll();
// Array for downloaded files
curDownloads = [];
// Make sure we are not in PB mode and don't show a prompt
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
pb.enabled = false;
pb.showPrompt = false;
}
var teardownModule = function(module)
{
dm.cleanAll();
pb.reset();
PrefsAPI.preferences.clearUserPref("browser.download.manager.showWhenStarting");
}
/**
* Test that no downloads are shown when switching in/out of PB mode
*/
var testDownloadManagerClosed = function()
{
// Disable the opening of the Downloads Manager when starting a download
PrefsAPI.openPreferencesDialog(handlePrefDialog);
// Download a couple of files
for (var ii = 0; ii < downloads.length; ii++)
DownloadsAPI.downloadFileOfUnknownType(controller, downloads[ii]);
// Wait until all downloads have been finished
controller.sleep(100);
controller.waitForEval("subject.activeDownloadCount == 0", 30000, 100, dm);
// Save information of currently downloaded files
curDownloads = dm.getAllDownloads();
// Enable Private Browsing mode
pb.start();
// Check that no downloads are shown
dm.open(controller);
var downloadView = new elementslib.ID(dm.controller.window.document, "downloadView");
dm.controller.waitForElement(downloadView, gTimeout);
dm.controller.waitForEval("subject.itemCount == 0",
gTimeout, 100, downloadView.getNode());
// Close the Download Manager
dm.close();
// Download a file in Private Browsing mode
DownloadsAPI.downloadFileOfUnknownType(controller, downloadsPB[0]);
// Wait until all downloads have been finished
controller.sleep(100);
controller.waitForEval("subject.activeDownloadCount == 0", 30000, 100, dm);
// Track the download from Private Browsing mode too
curDownloads = curDownloads.concat(dm.getAllDownloads());
pb.stop();
// Check that the downloads from before the Private Browsing mode are shown
dm.open(controller);
downloadView = new elementslib.ID(dm.controller.window.document, "downloadView");
dm.controller.waitForElement(downloadView, gTimeout);
dm.controller.waitForEval("subject.itemCount == " + downloads.length,
gTimeout, 100, downloadView.getNode());
for (var ii = 0; ii < downloads.length; ii++) {
var item = new elementslib.ID(dm.controller.window.document, "dl" + (ii + 1));
dm.controller.assertJS("subject.getAttribute('uri') == '" + downloads[ii] + "'",
item.getNode());
}
dm.close();
}
/**
* Deactivate the auto-open feature of the downloads manager
*
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var handlePrefDialog = function(controller)
{
var prefDialog = new PrefsAPI.preferencesDialog(controller);
prefDialog.paneId = 'paneMain';
// Don't show the download manager when a download starts
var show = new elementslib.ID(controller.window.document, "showWhenDownloading");
controller.waitForElement(show, gTimeout);
controller.check(show, false);
prefDialog.close(true);
}
/**
* Map test functions to litmus tests
*/
// testDownloadManagerClosed.meta = {litmusids : [9178]};

Просмотреть файл

@ -1,106 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI', 'PrivateBrowsingAPI',
'TabbedBrowsingAPI', 'UtilsAPI'
];
const gDelay = 0;
const gTimeout = 7000;
const PREF_GEO_TOKEN = "geo.wifi.access_token";
const localTestFolder = collector.addHttpResource('./files');
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
tabBrowser = new TabbedBrowsingAPI.tabBrowser(controller);
}
var teardownModule = function(module)
{
pb.reset();
}
/**
* Test that the content of all tabs (https) is reloaded when leaving PB mode
*/
var testTabRestoration = function()
{
var available = false;
var tokens = { };
// Make sure we are not in PB mode and don't show a prompt
pb.enabled = false;
pb.showPrompt = false;
// Start Private Browsing
pb.start();
// Load a page which supports geolocation and accept sharing the location
controller.open(localTestFolder + "geolocation.html");
controller.waitForPageLoad();
var shortcut = UtilsAPI.getProperty("chrome://browser/locale/browser.properties",
"geolocation.shareLocation.accesskey");
controller.keypress(null, shortcut, {ctrlKey: mozmill.isMac, altKey: !mozmill.isMac});
try {
var result = new elementslib.ID(controller.tabs.activeTab, "result");
controller.waitForEval("subject.innerHTML != 'undefined'", gTimeout, 100,
result.getNode());
available = true;
} catch (ex) {}
// If a position has been returned check for geo access tokens
if (available) {
PrefsAPI.preferences.branch.getChildList(PREF_GEO_TOKEN, tokens);
controller.assertJS("subject.hasGeoTokens == true",
{hasGeoTokens: tokens.value > 0});
}
// Stop Private Browsing
pb.stop();
// No geo access tokens should be present
PrefsAPI.preferences.branch.getChildList(PREF_GEO_TOKEN, tokens);
controller.assertJS("subject.hasNoGeoTokens == true",
{hasNoGeoTokens: tokens.value == 0});
}

Просмотреть файл

@ -19,6 +19,8 @@
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
* Aaron Train <atrain@mozilla.com>
* Anthony Hughes <ahughes@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -34,21 +36,22 @@
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
// Include necessary modules
const RELATIVE_ROOT = '../../shared-modules';
const MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const TIMEOUT = 5000;
const websites = [
{url: 'http://www.mozilla.org', id: 'q'},
{url: 'about:', id: 'aboutPageList'}
];
const LOCAL_TEST_FOLDER = collector.addHttpResource('../test-files/');
const LOCAL_TEST_PAGES = [
{url: LOCAL_TEST_FOLDER + 'layout/mozilla.html', id: 'community'},
{url: 'about:', id: 'aboutPageList'}
];
var setupModule = function(module) {
var setupModule = function() {
controller = mozmill.getBrowserController();
modifier = controller.window.document.documentElement
.getAttribute("titlemodifier_privatebrowsing");
modifier = controller.window.document.documentElement.
getAttribute("titlemodifier_privatebrowsing");
// Create Private Browsing instance and set handler
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
@ -57,57 +60,58 @@ var setupModule = function(module) {
TabbedBrowsingAPI.closeAllTabs(controller);
}
var teardownModule = function(module)
{
var teardownModule = function() {
pb.reset();
}
/**
* Enable Private Browsing Mode
*/
var testEnablePrivateBrowsingMode = function()
{
var testEnablePrivateBrowsingMode = function() {
// Make sure we are not in PB mode and show a prompt
pb.enabled = false;
pb.showPrompt = true;
// Open websites in separate tabs
var newTab = new elementslib.Elem(controller.menus['file-menu'].menu_newNavigatorTab);
for (var ii = 0; ii < websites.length; ii++) {
controller.open(websites[ii].url);
controller.click(newTab);
for each (var page in LOCAL_TEST_PAGES) {
controller.open(page.url);
controller.click(newTab);
}
// Wait until all tabs have been finished loading
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) {
var elem = new elementslib.ID(controller.tabs.getTab(i), LOCAL_TEST_PAGES[i].id);
controller.waitForElement(elem, TIMEOUT);
}
// Start the Private Browsing mode
pb.start();
// Check that only one tab is open
controller.assertJS("subject.tabs.length == 1", controller);
controller.assertJS("subject.isOnlyOneTab == true",
{isOnlyOneTab: controller.tabs.length == 1});
// Title modifier should have been set
controller.assertJS("subject.title.indexOf('" + modifier + "') != -1",
controller.window.document);
controller.assertJS("subject.hasTitleModifier == true",
{hasTitleModifier: controller.window.document.
title.indexOf(modifier) != -1});
// Check descriptions on the about:privatebrowsing page
// XXX: Bug 504635 needs to be implemented so we can get the entities from the DTD
var longDescElem = new elementslib.ID(controller.tabs.activeTab, "errorLongDescText")
var description = UtilsAPI.getEntity(pb.getDtds(), "privatebrowsingpage.description");
var learnMore = UtilsAPI.getEntity(pb.getDtds(), "privatebrowsingpage.learnMore");
var longDescElem = new elementslib.ID(controller.tabs.activeTab, "errorLongDescText");
var moreInfoElem = new elementslib.ID(controller.tabs.activeTab, "moreInfoLink");
controller.waitForElement(longDescElem, gTimeout);
controller.waitForElement(moreInfoElem, gTimeout);
controller.waitForElement(longDescElem, TIMEOUT);
controller.assertText(longDescElem, description);
controller.assertText(moreInfoElem, learnMore);
}
/**
* Stop the Private Browsing mode
*/
var testStopPrivateBrowsingMode = function()
{
var testStopPrivateBrowsingMode = function() {
// Force enable Private Browsing mode
pb.enabled = true;
@ -115,24 +119,24 @@ var testStopPrivateBrowsingMode = function()
pb.stop();
// All tabs should be restored
controller.assertJS("subject.tabs.length == " + (websites.length + 1),
controller);
controller.assertJS("subject.allTabsRestored == true",
{allTabsRestored: controller.tabs.length == LOCAL_TEST_PAGES.length + 1});
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) {
var elem = new elementslib.ID(controller.tabs.getTab(i), LOCAL_TEST_PAGES[i].id);
controller.waitForElement(elem, TIMEOUT);
}
// No title modifier should have been set
controller.assertJS("subject.title.indexOf('" + modifier + "') == -1",
controller.window.document);
controller.assertJS("subject.noTitleModifier == true",
{noTitleModifier: controller.window.document.
title.indexOf(modifier) == -1});
}
/**
* Verify Ctrl/Cmd+Shift+P keyboard shortcut for Private Browsing mode
*/
var testKeyboardShortcut = function()
{
var testKeyboardShortcut = function() {
// Make sure we are not in PB mode and show a prompt
pb.enabled = false;
pb.showPrompt = true;
@ -150,13 +154,15 @@ var testKeyboardShortcut = function()
* @param {MozMillController} controller
* MozMillController of the window to operate on
*/
var pbStartHandler = function(controller)
{
var pbStartHandler = function(controller) {
// Check to not ask anymore for entering Private Browsing mode
var checkbox = new elementslib.ID(controller.window.document, 'checkbox');
controller.waitThenClick(checkbox, gTimeout);
controller.waitThenClick(checkbox, TIMEOUT);
var okButton = new elementslib.Lookup(controller.window.document, '/id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
var okButton = new elementslib.Lookup(controller.window.document,
'/id("commonDialog")' +
'/anon({"anonid":"buttons"})' +
'/{"dlgtype":"accept"}');
controller.click(okButton);
}

Просмотреть файл

@ -19,6 +19,7 @@
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
* Anthony Hughes <ahughes@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -34,35 +35,33 @@
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
// Include necessary modules
const RELATIVE_ROOT = '../../shared-modules';
const MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const TIMEOUT = 5000;
var websites = [
{url: 'https://addons.mozilla.org/', id: 'search-query'},
{url: 'https://bugzilla.mozilla.org', id: 'quicksearch_top'}
];
const LOCAL_TEST_FOLDER = collector.addHttpResource('../test-files/');
const LOCAL_TEST_PAGES = [
{url: LOCAL_TEST_FOLDER + 'layout/mozilla_contribute.html', id: 'localization'},
{url: LOCAL_TEST_FOLDER + 'layout/mozilla_community.html', id: 'history'}
];
var setupModule = function(module)
{
var setupModule = function(module) {
controller = mozmill.getBrowserController();
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
TabbedBrowsingAPI.closeAllTabs(controller);
}
var teardownModule = function(module)
{
var teardownModule = function(module) {
pb.reset();
}
/**
* Test that the content of all tabs (https) is reloaded when leaving PB mode
*/
var testTabRestoration = function()
{
var testTabRestoration = function() {
// Make sure we are not in PB mode and don't show a prompt
pb.enabled = false;
pb.showPrompt = false;
@ -70,15 +69,15 @@ var testTabRestoration = function()
// Open websites in separate tabs after closing existing tabs
var newTab = new elementslib.Elem(controller.menus['file-menu'].menu_newNavigatorTab);
for (var ii = 0; ii < websites.length; ii++) {
controller.open(websites[ii].url);
for each (var page in LOCAL_TEST_PAGES) {
controller.open(page.url);
controller.click(newTab);
}
// Wait until all tabs have been finished loading
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) {
var elem = new elementslib.ID(controller.tabs.getTab(i), LOCAL_TEST_PAGES[i].id);
controller.waitForElement(elem, TIMEOUT);
}
// Start Private Browsing
@ -86,16 +85,16 @@ var testTabRestoration = function()
// Stop Private Browsing
pb.stop();
controller.waitForPageLoad();
// All tabs should be restored
controller.assertJS("subject.tabs.length == " + (websites.length + 1),
controller);
controller.assertJS("subject.tabCountActual == subject.tabCountExpected",
{tabCountActual: controller.tabs.length,
tabCountExpected: LOCAL_TEST_PAGES.length + 1});
// Check if all pages were re-loaded and show their content
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) {
var elem = new elementslib.ID(controller.tabs.getTab(i), LOCAL_TEST_PAGES[i].id);
controller.waitForElement(elem, TIMEOUT);
}
}

Просмотреть файл

@ -1,96 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrivateBrowsingAPI', 'TabbedBrowsingAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
var websites = [
{url: 'http://www.mozilla.org', id: 'q'},
{url: 'about:', id: 'aboutPageList'}
];
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
pb = new PrivateBrowsingAPI.privateBrowsing(controller);
TabbedBrowsingAPI.closeAllTabs(controller);
}
var teardownModule = function(module)
{
pb.reset();
}
/**
* Test that the content of all tabs (http, https, about), which were loaded
* before the transistion into PB mode, is re-loaded when leaving PB mode
*/
var testAllTabsClosedOnStop = function()
{
// Make sure we are not in PB mode and don't show a prompt
pb.enabled = false;
pb.showPrompt = false;
// Start Private Browsing
pb.start();
// Open websites in separate tabs
var newTab = new elementslib.Elem(controller.menus['file-menu'].menu_newNavigatorTab);
for (var ii = 0; ii < websites.length; ii++) {
controller.open(websites[ii].url);
controller.click(newTab);
}
// Wait until all tabs have been finished loading
for (var ii = 0; ii < websites.length; ii++) {
var elem = new elementslib.ID(controller.tabs.getTab(ii), websites[ii].id);
controller.waitForElement(elem, gTimeout);
}
pb.stop();
// All tabs should have been removed
controller.assertJS("subject.tabs.length == 1", controller);
}
/**
* Map test functions to litmus tests
*/
// testAllTabsClosedOnStop.meta = {litmusids : [9317]};

Просмотреть файл

@ -1,122 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MozMill Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henrik Skupin <hskupin@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['ModalDialogAPI', 'SearchAPI', 'UtilsAPI'];
const gDelay = 0;
const gTimeout = 5000;
const searchEngine = {name: "MDC",
url : "https://litmus.mozilla.org/testcase_files/firefox/search/mozsearch.html"};
var setupModule = function(module)
{
controller = mozmill.getBrowserController();
search = new SearchAPI.searchBar(controller);
}
var teardownModule = function(module)
{
search.removeEngine(searchEngine.name);
search.restoreDefaultEngines();
}
/**
* Add a MozSearch Search plugin
*/
var testAddMozSearchPlugin = function()
{
// Open the web page with the test MozSearch plugin
controller.open(searchEngine.url);
controller.waitForPageLoad();
// Create a modal dialog instance to handle the installation dialog
var md = new ModalDialogAPI.modalDialog(handleSearchInstall);
md.start();
// Add the search engine
var addButton = new elementslib.Name(controller.tabs.activeTab, "add");
controller.click(addButton);
controller.waitForEval("subject.search.isEngineInstalled(subject.engine) == true", gTimeout, 100,
{search: search, engine: searchEngine.name});
// The engine should not be selected by default
controller.assertJS("subject.newEngineNotSelected == true",
{newEngineNotSelected: search.selectedEngine != searchEngine.name});
// Select search engine and start a search
search.selectedEngine = searchEngine.name;
search.search({text: "Firefox", action: "goButton"});
}
/**
* Handle the modal security dialog when installing a new search engine
*
* @param {MozMillController} controller
* MozMillController of the browser window to operate on
*/
var handleSearchInstall = function(controller)
{
// Installation successful?
var confirmTitle = UtilsAPI.getProperty("chrome://global/locale/search/search.properties",
"addEngineConfirmTitle");
if (mozmill.isMac)
var title = controller.window.document.getElementById("info.title").textContent;
else
var title = controller.window.document.title;
controller.assertJS("subject.windowTitle == subject.addEngineTitle",
{windowTitle: title, addEngineTitle: confirmTitle});
// Check that litmus.mozilla.org is shown as domain
var infoBody = controller.window.document.getElementById("info.body");
controller.waitForEval("subject.textContent.indexOf('litmus.mozilla.org') != -1",
gTimeout, 100, infoBody);
var addButton = new elementslib.Lookup(controller.window.document,
'/id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
controller.click(addButton);
}
/**
* Map test functions to litmus tests
*/
// testAddMozSearchPlugin.meta = {litmusids : [8235]};

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше