mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1359541
- Enable eslint on mobile/android/tests; r=standard8,snorp
This commit is contained in:
parent
a9623d4d6e
commit
708a1b1c64
@ -261,7 +261,7 @@ js/src/jit-test/**
|
||||
js/src/tests/**
|
||||
|
||||
# mobile/android/ exclusions
|
||||
mobile/android/tests/
|
||||
mobile/android/tests/browser/chrome/tp5/**
|
||||
|
||||
# Uses `#filter substitution`
|
||||
mobile/android/b2gdroid/app/b2gdroid.js
|
||||
|
@ -1,18 +0,0 @@
|
||||
globals:
|
||||
# TODO: Verify that these are correct.
|
||||
Point: false
|
||||
SpecialPowers: false
|
||||
XPCNativeWrapper: false
|
||||
add_task: false
|
||||
add_test: false
|
||||
do_check_eq: false
|
||||
do_check_false: false
|
||||
do_check_neq: false
|
||||
do_check_true: false
|
||||
do_print: false
|
||||
do_register_cleanup: false
|
||||
do_report_result: false
|
||||
do_test_finished: false
|
||||
do_test_pending: false
|
||||
do_throw: false
|
||||
run_next_test: false
|
7
mobile/android/tests/browser/chrome/.eslintrc.js
Normal file
7
mobile/android/tests/browser/chrome/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/chrome-test"
|
||||
]
|
||||
};
|
@ -36,7 +36,7 @@ function promiseTabEvent(container, eventType) {
|
||||
});
|
||||
}
|
||||
|
||||
function promiseNotification(topic) {
|
||||
function promiseNotification(aTopic) {
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -45,15 +45,15 @@ function promiseNotification(topic) {
|
||||
Services.obs.removeObserver(observe, topic);
|
||||
resolve();
|
||||
}
|
||||
Services.obs.addObserver(observe, topic);
|
||||
info("Now waiting for " + topic + " notification from Gecko");
|
||||
Services.obs.addObserver(observe, aTopic);
|
||||
info("Now waiting for " + aTopic + " notification from Gecko");
|
||||
});
|
||||
}
|
||||
|
||||
function promiseLinkVisit(url) {
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var topic = "link-visited";
|
||||
var linkVisitedTopic = "link-visited";
|
||||
return new Promise((resolve, reject) => {
|
||||
function observe(subject, topic, data) {
|
||||
info("Received " + topic + " notification from Gecko");
|
||||
@ -66,8 +66,8 @@ function promiseLinkVisit(url) {
|
||||
Services.obs.removeObserver(observe, topic);
|
||||
resolve();
|
||||
};
|
||||
Services.obs.addObserver(observe, topic);
|
||||
info("Now waiting for " + topic + " notification from Gecko with URL " + url);
|
||||
Services.obs.addObserver(observe, linkVisitedTopic);
|
||||
info("Now waiting for " + linkVisitedTopic + " notification from Gecko with URL " + url);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,11 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
for (let row of invalidRows) {
|
||||
try {
|
||||
yield storage.save([row]);
|
||||
} catch (e if e instanceof HomeProvider.ValidationError) {
|
||||
} catch (e) {
|
||||
// Just catch and ignore validation errors
|
||||
if (!(e instanceof HomeProvider.ValidationError)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,8 +138,11 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
// Try to save all the rows at once
|
||||
try {
|
||||
yield storage.save(rows);
|
||||
} catch (e if e instanceof HomeProvider.ValidationError) {
|
||||
} catch (e) {
|
||||
// Just catch and ignore validation errors
|
||||
if (!(e instanceof HomeProvider.ValidationError)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Peek in the DB to make sure we have the right data.
|
||||
|
@ -57,7 +57,7 @@ function queryElement(contentWindow, data) {
|
||||
|
||||
function dispatchUIEvent(input, type) {
|
||||
let event = input.ownerDocument.createEvent("UIEvents");
|
||||
event.initUIEvent(type, true, true, input.ownerDocument.defaultView, 0);
|
||||
event.initUIEvent(type, true, true, input.ownerGlobal, 0);
|
||||
input.dispatchEvent(event);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
]; // gTests
|
||||
|
||||
add_task(function* test() {
|
||||
add_task(function* run_all() {
|
||||
for (let test of gTests) {
|
||||
info("Running: " + test.desc);
|
||||
yield test.run();
|
||||
|
@ -47,7 +47,7 @@
|
||||
let getEditor, setValue, setSelection;
|
||||
|
||||
let test = {
|
||||
focus_input: function(val) {
|
||||
focus_input: function(value) {
|
||||
getEditor = function() {
|
||||
return SpecialPowers.wrap(input).QueryInterface(
|
||||
SpecialPowers.Ci.nsIDOMNSEditableElement).editor;
|
||||
@ -58,11 +58,11 @@
|
||||
setSelection = function(pos) {
|
||||
input.setSelectionRange(pos, pos);
|
||||
};
|
||||
setValue(val);
|
||||
setValue(value);
|
||||
input.focus();
|
||||
},
|
||||
|
||||
focus_text_area: function(val) {
|
||||
focus_text_area: function(value) {
|
||||
getEditor = function() {
|
||||
return SpecialPowers.wrap(textArea).QueryInterface(
|
||||
SpecialPowers.Ci.nsIDOMNSEditableElement).editor;
|
||||
@ -73,11 +73,11 @@
|
||||
setSelection = function(pos) {
|
||||
textArea.setSelectionRange(pos, pos);
|
||||
};
|
||||
setValue(val);
|
||||
setValue(value);
|
||||
textArea.focus();
|
||||
},
|
||||
|
||||
focus_content_editable: function(val) {
|
||||
focus_content_editable: function(value) {
|
||||
getEditor = function() {
|
||||
return SpecialPowers.wrap(window).QueryInterface(
|
||||
SpecialPowers.Ci.nsIInterfaceRequestor).getInterface(
|
||||
@ -90,11 +90,11 @@
|
||||
setSelection = function(pos) {
|
||||
window.getSelection().collapse(contentEditable.firstChild, pos);
|
||||
};
|
||||
setValue(val);
|
||||
setValue(value);
|
||||
contentEditable.focus();
|
||||
},
|
||||
|
||||
focus_design_mode: function(val) {
|
||||
focus_design_mode: function(value) {
|
||||
getEditor = function() {
|
||||
return SpecialPowers.wrap(designMode.contentWindow).QueryInterface(
|
||||
SpecialPowers.Ci.nsIInterfaceRequestor).getInterface(
|
||||
@ -108,7 +108,7 @@
|
||||
designMode.contentWindow.getSelection().collapse(
|
||||
designMode.contentDocument.body.firstChild, pos);
|
||||
};
|
||||
setValue(val);
|
||||
setValue(value);
|
||||
designMode.contentWindow.focus();
|
||||
designMode.contentDocument.body.focus();
|
||||
},
|
||||
|
@ -37,9 +37,9 @@ add_test(function filepicker_open() {
|
||||
|
||||
let e = fp.domFileOrDirectoryEnumerator;
|
||||
while (e.hasMoreElements()) {
|
||||
let file = e.getNext();
|
||||
do_print("DOMFile: " + file.mozFullPath);
|
||||
is(file.mozFullPath, "/mnt/sdcard/my-favorite-martian.png", "Retrieve the right martian file from domFileOrDirectoryEnumerator array!");
|
||||
let domFile = e.getNext();
|
||||
do_print("DOMFile: " + domFile.mozFullPath);
|
||||
is(domFile.mozFullPath, "/mnt/sdcard/my-favorite-martian.png", "Retrieve the right martian file from domFileOrDirectoryEnumerator array!");
|
||||
}
|
||||
|
||||
do_test_finished();
|
||||
|
@ -79,8 +79,8 @@ add_task(function* test_migrate_cache() {
|
||||
|
||||
// This will always happen because there is no pre-existing data store.
|
||||
request.onupgradeneeded = event => {
|
||||
let cacheDB = event.target.result;
|
||||
cacheDB.createObjectStore("articles", { keyPath: "url" });
|
||||
let cacheDB2 = event.target.result;
|
||||
cacheDB2.createObjectStore("articles", { keyPath: "url" });
|
||||
};
|
||||
|
||||
request.onsuccess = event => resolve(event.target.result);
|
||||
|
Loading…
Reference in New Issue
Block a user