Merge m-c to b2ginbound, a=merge

--HG--
extra : commitid : 9BSOpO5MEsb
This commit is contained in:
Wes Kocher 2015-11-06 15:14:26 -08:00
Родитель 091abbaa98 35dd7b2e4a
Коммит e98e767258
138 изменённых файлов: 1154 добавлений и 1086 удалений

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

@ -1324,6 +1324,21 @@ BrowserGlue.prototype = {
}
}
if (this._mayNeedToWarnAboutTabGroups) {
let haveTabGroups = false;
let wins = Services.wm.getEnumerator("navigator:browser");
while (wins.hasMoreElements()) {
let win = wins.getNext();
if (win.TabView._tabBrowserHasHiddenTabs() && win.TabView.firstUseExperienced()) {
haveTabGroups = true;
break;
}
}
if (haveTabGroups) {
this._showTabGroupsDeprecationNotification();
}
}
#ifdef E10S_TESTING_ONLY
E10SUINotification.checkStatus();
#endif
@ -1362,6 +1377,27 @@ BrowserGlue.prototype = {
},
#endif
_showTabGroupsDeprecationNotification() {
let brandShortName = gBrandBundle.GetStringFromName("brandShortName");
let text = gBrowserBundle.formatStringFromName("tabgroups.deprecationwarning.description",
[brandShortName], 1);
let learnMore = gBrowserBundle.GetStringFromName("tabgroups.deprecationwarning.learnMore.label");
let learnMoreKey = gBrowserBundle.GetStringFromName("tabgroups.deprecationwarning.learnMore.accesskey");
let win = RecentWindow.getMostRecentBrowserWindow();
let notifyBox = win.document.getElementById("high-priority-global-notificationbox");
let button = {
label: learnMore,
accessKey: learnMoreKey,
callback: function(aNotificationBar, aButton) {
win.openUILinkIn("https://support.mozilla.org/kb/tab-groups-removal", "tab");
},
};
notifyBox.appendNotification(text, "tabgroups-removal-notification", null,
notifyBox.PRIORITY_WARNING_MEDIUM, [button]);
},
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
// If user has already dismissed quit request, then do nothing
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
@ -1869,7 +1905,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 32;
const UI_VERSION = 33;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion = 0;
try {
@ -2214,6 +2250,11 @@ BrowserGlue.prototype = {
this._notifyNotificationsUpgrade().catch(Cu.reportError);
}
if (currentUIVersion < 33) {
// We'll do something once windows are open:
this._mayNeedToWarnAboutTabGroups = true;
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},
@ -2240,7 +2281,10 @@ BrowserGlue.prototype = {
let win = RecentWindow.getMostRecentBrowserWindow();
win.openUILinkIn(data, "tab");
}
let imageURL = "chrome://browser/skin/web-notifications-icon.svg";
// Show the application icon for XUL notifications. We assume system-level
// notifications will include their own icon.
let imageURL = this._hasSystemAlertsService() ? "" :
"chrome://branding/content/about-logo.png";
let title = gBrowserBundle.GetStringFromName("webNotifications.upgradeTitle");
let text = gBrowserBundle.GetStringFromName("webNotifications.upgradeBody");
let url = Services.urlFormatter.formatURLPref("browser.push.warning.migrationURL");
@ -2249,6 +2293,14 @@ BrowserGlue.prototype = {
true, url, clickCallback);
}),
_hasSystemAlertsService: function() {
try {
return !!Cc["@mozilla.org/system-alerts-service;1"].getService(
Ci.nsIAlertsService);
} catch (e) {}
return false;
},
// ------------------------------
// public nsIBrowserGlue members
// ------------------------------

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

@ -104,6 +104,7 @@ skip-if = e10s # Bug 1086190
skip-if = buildapp == 'mulet'
[browser_tabview_bug627736.js]
[browser_tabview_bug628061.js]
skip-if = true
[browser_tabview_bug628165.js]
[browser_tabview_bug628270.js]
[browser_tabview_bug628887.js]

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

@ -158,6 +158,8 @@ function test() {
let onShow = function () {
cw = win.TabView.getContentWindow();
cw.document.querySelector('.banner').remove();
let groupItem = cw.GroupItems.groupItems[0];
groupItem.setSize(200, 200, true);
groupItem.setUserSize();

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

@ -32,12 +32,12 @@ function test() {
let assertNotificationBannerVisible = function (win) {
let cw = win.TabView.getContentWindow();
is(cw.iQ(".banner").length, 1, "notification banner is visible");
is(cw.iQ(".banner").length, 2, "notification banner is visible");
};
let assertNotificationBannerNotVisible = function (win) {
let cw = win.TabView.getContentWindow();
is(cw.iQ(".banner").length, 0, "notification banner is not visible");
is(cw.iQ(".banner").length, 1, "notification banner is not visible");
};
let next = function () {

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

@ -511,6 +511,8 @@ var UI = {
TabItems.resumePainting();
}
this.notifyDeprecation();
if (gTabView.firstUseExperienced)
gTabView.enableSessionRestore();
},
@ -522,6 +524,8 @@ var UI = {
if (!this.isTabViewVisible() || this._isChangingVisibility)
return;
iQ(".banner").remove();
// another tab might be select if user decides to stay on a page when
// a onclose confirmation prompts.
GroupItems.removeHiddenGroups();
@ -1541,7 +1545,37 @@ var UI = {
};
banner.animate({opacity: 0.7}, {duration: 1500, complete: onFadeIn});
}
},
// Function: notifyDeprecation
// Notify the user that tab groups will be deprecated soon.
notifyDeprecation() {
let brandBundle = gWindow.document.getElementById("bundle_brand");
let brandShortName = brandBundle.getString("brandShortName");
let browserBundle = gWindow.document.getElementById("bundle_browser");
let notificationText = browserBundle.getFormattedString(
"tabgroups.deprecationwarning.description", [brandShortName]);
let learnMoreText = browserBundle.getString("tabgroups.deprecationwarning.learnMore.label");
let onButtonClick = () => {
this.hideTabView();
gWindow.openUILinkIn("https://support.mozilla.org/kb/tab-groups-removal", "tab");
};
let button = iQ("<button>")
.text(learnMoreText)
.css('-moz-margin-start', '10px')
.one('click', onButtonClick);
let banner = iQ("<div>")
.text(notificationText)
.addClass("banner")
.append(button)
.appendTo("body");
banner.animate({opacity: 0.7}, {duration: 1500});
},
};
// ----------

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

@ -797,3 +797,9 @@ muteTab.label = Mute Tab
muteTab.accesskey = M
unmuteTab.label = Unmute Tab
unmuteTab.accesskey = M
# LOCALIZATION NOTE (tabgroups.deprecationwarning.description):
# %S is brandShortName
tabgroups.deprecationwarning.description = Heads up! Tab Groups will be removed from %S soon.
tabgroups.deprecationwarning.learnMore.label = Learn More
tabgroups.deprecationwarning.learnMore.accesskey = L

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

@ -564,7 +564,7 @@ html[dir=rtl] .iq-resizable-se {
#search{
width: 100%;
height: 100%;
height: calc(100% - 1.7em - 20px); /* leave room for banner */
}
#searchbox{

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

@ -552,7 +552,7 @@ html[dir=rtl] .iq-resizable-se {
#search{
width: 100%;
height: 100%;
height: calc(100% - 1.7em - 20px); /* leave room for banner */
}
#searchbox {

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

@ -569,7 +569,7 @@ html[dir=rtl] .iq-resizable-se {
#search{
width: 100%;
height: 100%;
height: calc(100% - 1.7em - 20px); /* leave room for banner */
}
#searchbox{

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

@ -1441,7 +1441,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
}
#ifdef MOZ_THUNDERBIRD
else if (selContent->IsElement()) {
nsRefPtr<nsStyleContext> styleContext =
RefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(
selContent->AsElement(), nullptr, nullptr);
if (styleContext) {

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

@ -25,7 +25,6 @@ function CaptureStreamTestHelper(width, height) {
CaptureStreamTestHelper.prototype = {
/* Predefined colors for use in the methods below. */
black: { data: [0, 0, 0, 255], name: "black" },
blackTransparent: { data: [0, 0, 0, 0], name: "blackTransparent" },
green: { data: [0, 255, 0, 255], name: "green" },
red: { data: [255, 0, 0, 255], name: "red" },
@ -53,90 +52,55 @@ CaptureStreamTestHelper.prototype = {
video.srcObject.requestFrame();
},
/*
* Returns the pixel at (|offsetX|, |offsetY|) (from top left corner) of
* |video| as an array of the pixel's color channels: [R,G,B,A].
*/
getPixel: function (video, offsetX, offsetY) {
offsetX = offsetX || 0; // Set to 0 if not passed in.
offsetY = offsetY || 0; // Set to 0 if not passed in.
/* Tests the top left pixel of |video| against |refData|. Format [R,G,B,A]. */
testPixel: function (video, refData, threshold) {
var ctxout = this.cout.getContext('2d');
ctxout.drawImage(video, 0, 0);
return ctxout.getImageData(offsetX, offsetY, 1, 1).data;
var pixel = ctxout.getImageData(0, 0, 1, 1).data;
return pixel.every((val, i) => Math.abs(val - refData[i]) <= threshold);
},
/*
* Returns true if px lies within the per-channel |threshold| of the
* referenced color for all channels. px is on the form of an array of color
* channels, [R,G,B,A]. Each channel is in the range [0, 255].
* Returns a promise that resolves when the pixel matches. Use |threshold|
* for fuzzy matching the color on each channel, in the range [0,255].
*/
isPixel: function (px, refColor, threshold) {
threshold = threshold || 0; // Default to 0 (exact match) if not passed in.
return px.every((ch, i) => Math.abs(ch - refColor.data[i]) <= threshold);
},
/*
* Returns true if px lies further away than |threshold| of the
* referenced color for any channel. px is on the form of an array of color
* channels, [R,G,B,A]. Each channel is in the range [0, 255].
*/
isPixelNot: function (px, refColor, threshold) {
if (threshold === undefined) {
// Default to 127 (should be sufficiently far away) if not passed in.
threshold = 127;
}
return px.some((ch, i) => Math.abs(ch - refColor.data[i]) > threshold);
},
/*
* Returns a promise that resolves when the provided function |test|
* returns true.
*/
waitForPixel: function (video, offsetX, offsetY, test, timeout) {
waitForPixel: function (video, refColor, threshold, infoString) {
return new Promise(resolve => {
const startTime = video.currentTime;
info("Testing " + video.id + " against [" + refColor.data.join(',') + "]");
CaptureStreamTestHelper2D.prototype.clear.call(this, this.cout);
var ontimeupdate = () => {
const pixelMatch = test(this.getPixel(video, offsetX, offsetY));
if (!pixelMatch &&
(!timeout || video.currentTime < startTime + (timeout / 1000.0))) {
// No match yet and,
// No timeout (waiting indefinitely) or |timeout| has not passed yet.
return;
video.ontimeupdate = () => {
if (this.testPixel(video, refColor.data, threshold)) {
ok(true, video.id + " " + infoString);
video.ontimeupdate = null;
resolve();
}
video.removeEventListener("timeupdate", ontimeupdate);
resolve(pixelMatch);
};
video.addEventListener("timeupdate", ontimeupdate);
});
},
/*
* Returns a promise that resolves when the top left pixel of |video| matches
* on all channels. Use |threshold| for fuzzy matching the color on each
* channel, in the range [0,255].
*/
waitForPixelColor: function (video, refColor, threshold, infoString) {
info("Waiting for video " + video.id + " to match [" +
refColor.data.join(',') + "] - " + refColor.name +
" (" + infoString + ")");
return this.waitForPixel(video, 0, 0,
px => this.isPixel(px, refColor, threshold))
.then(() => ok(true, video.id + " " + infoString));
},
/*
* Returns a promise that resolves after |timeout| ms of playback or when the
* top left pixel of |video| becomes |refColor|. The test is failed if the
* Returns a promise that resolves after |timeout| ms of playback or when a
* pixel of |video| becomes the color |refData|. The test is failed if the
* timeout is not reached.
*/
waitForPixelColorTimeout: function (video, refColor, threshold, timeout, infoString) {
info("Waiting for " + video.id + " to time out after " + timeout +
"ms against [" + refColor.data.join(',') + "] - " + refColor.name);
return this.waitForPixel(video, 0, 0,
px => this.isPixel(px, refColor, threshold),
timeout)
.then(result => ok(!result, video.id + " " + infoString));
waitForPixelToTimeout: function (video, refColor, threshold, timeout, infoString) {
return new Promise(resolve => {
info("Waiting for " + video.id + " to time out after " + timeout +
"ms against [" + refColor.data.join(',') + "] - " + refColor.name);
CaptureStreamTestHelper2D.prototype.clear.call(this, this.cout);
var startTime = video.currentTime;
video.ontimeupdate = () => {
if (this.testPixel(video, refColor.data, threshold)) {
ok(false, video.id + " " + infoString);
video.ontimeupdate = null;
resolve();
} else if (video.currentTime > startTime + (timeout / 1000.0)) {
ok(true, video.id + " " + infoString);
video.ontimeupdate = null;
resolve();
}
};
});
},
/* Create an element of type |type| with id |id| and append it to the body. */

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

@ -23,21 +23,15 @@ function checkDrawColorInitialRed() {
vmanual.srcObject = c.captureStream(0);
vrate.srcObject = c.captureStream(10);
ok(h.isPixel(h.getPixel(vauto), h.blackTransparent, 0),
"vauto should not be drawn to before stable state");
ok(h.isPixel(h.getPixel(vrate), h.blackTransparent, 0),
"vrate should not be drawn to before stable state");
ok(h.isPixel(h.getPixel(vmanual), h.blackTransparent, 0),
"vmanual should not be drawn to before stable state");
ok(h.testPixel(vauto, [0, 0, 0, 0], 0), "vauto hould not be drawn to before stable state");
ok(h.testPixel(vrate, [0, 0, 0, 0], 0), "vrate Should not be drawn to before stable state");
ok(h.testPixel(vmanual, [0, 0, 0, 0], 0), "vmanual Should not be drawn to before stable state");
return Promise.resolve()
.then(() => h.waitForPixelColor(vauto, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vrate, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red when we get" +
" to stable state (first frame)"));
.then(() => h.waitForPixel(vauto, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vrate, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red when we get" +
" to stable state (first frame)"));
}
function checkDrawColorGreen() {
@ -46,15 +40,11 @@ function checkDrawColorGreen() {
var drawing = h.startDrawing(() => h.drawColor(c, h.green));
return Promise.resolve()
.then(() => h.waitForPixelColor(vauto, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vrate, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should still be red"))
.then(() => h.waitForPixel(vauto, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vrate, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should still be red"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should become green after requstFrame()"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should become green after requstFrame()"))
.catch(err => ok(false, "checkDrawColorGreen failed: ", err))
.then(() => drawing.stop());
}
@ -64,12 +54,10 @@ function checkRequestFrameOrderGuarantee() {
"call results in the expected frame seen in the stream.");
return Promise.resolve()
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should still be green"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should still be green"))
.then(() => h.drawColor(c, h.red)) // 1. Draw canvas red
.then(() => h.requestFrame(vmanual)) // 2. Immediately request a frame
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red after call order test"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red after call order test"))
}
function checkDrawImageNotCleanRed() {
@ -86,14 +74,11 @@ function checkDrawImageNotCleanRed() {
})
.then(() => drawing = h.startDrawing(() => ctx.drawImage(notCleanRed, 0, 0, c.width, c.height)))
.then(() => h.testNotClean(c))
.then(() => h.waitForPixelColorTimeout(vauto, h.red, 0, 1000,
"should not become red"))
.then(() => h.isPixelNot(h.getPixel(vrate), h.red, 250,
"should not have become red"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0, "should still be green"))
.then(() => h.waitForPixelToTimeout(vauto, h.red, 0, 1000, "should not become red"))
.then(() => h.waitForPixelToTimeout(vrate, h.red, 0, 0, "should not become red"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should still be green"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixelColorTimeout(vmanual, h.red, 0, 1000,
"should not become red"))
.then(() => h.waitForPixelToTimeout(vmanual, h.red, 0, 1000, "should not become red"))
.catch(err => ok(false, "checkDrawImageNotCleanRed failed: ", err))
.then(() => drawing.stop());
}

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

@ -54,21 +54,14 @@ function checkClearColorInitialRed() {
vmanual.srcObject = c.captureStream(0);
vrate.srcObject = c.captureStream(10);
ok(h.isPixel(h.getPixel(vauto), h.blackTransparent, 0,
"vauto should not be drawn to before stable state"));
ok(h.isPixel(h.getPixel(vrate), h.blackTransparent, 0,
"vrate should not be drawn to before stable state"));
ok(h.isPixel(h.getPixel(vmanual), h.blackTransparent, 0,
"vmanual should not be drawn to before stable state"));
ok(h.testPixel(vauto, [0, 0, 0, 0], 0), "Should not be drawn to before stable state");
ok(h.testPixel(vrate, [0, 0, 0, 0], 0), "Should not be drawn to before stable state");
ok(h.testPixel(vmanual, [0, 0, 0, 0], 0), "Should not be drawn to before stable state");
return Promise.resolve()
.then(() => h.waitForPixelColor(vauto, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vrate, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red when we get to stable " +
"state (first frame)"))
.then(() => h.waitForPixel(vauto, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vrate, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red when we get to stable state (first frame)"))
}
function checkDrawColorGreen() {
@ -76,15 +69,11 @@ function checkDrawColorGreen() {
var drawing = h.startDrawing(h.drawColor.bind(h, c, h.green));
checkGLError('after DrawColor');
return Promise.resolve()
.then(() => h.waitForPixelColor(vauto, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vrate, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should still be red"))
.then(() => h.waitForPixel(vauto, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vrate, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should still be red"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should become green after requstFrame()"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should become green after requstFrame()"))
.then(() => drawing.stop());
}
@ -92,15 +81,11 @@ function checkClearColorRed() {
info("Checking that clearing to red works.");
var drawing = h.startDrawing(h.clearColor.bind(h, c, h.red));
return Promise.resolve()
.then(() => h.waitForPixelColor(vauto, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vrate, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should still be green"))
.then(() => h.waitForPixel(vauto, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vrate, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should still be green"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red after requestFrame()"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red after requestFrame()"))
.then(() => drawing.stop());
}
@ -108,11 +93,10 @@ function checkRequestFrameOrderGuarantee() {
info("Checking that requestFrame() immediately after a draw " +
"call results in the expected frame seen in the stream.");
return Promise.resolve()
.then(() => h.waitForPixelColor(vmanual, h.red, 0, "should still be red"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should still be red"))
.then(() => h.drawColor(c, h.green)) // 1. Draw canvas green
.then(() => h.requestFrame(vmanual)) // 2. Immediately request a frame
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should become green after call order test"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should become green after call order test"))
}
function finish() {

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

@ -1415,22 +1415,25 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
RefPtr<PledgeSourceSet> p = new PledgeSourceSet();
uint32_t id = mOutstandingPledges.Append(*p);
nsAdoptingCString audioLoopDev, videoLoopDev;
if (!aFake) {
// Fake stream not requested. The entire device stack is available.
// Loop in loopback devices if they are set, and their respective type is
// requested. This is currently used for automated media tests only.
if (aVideoType == MediaSourceEnum::Camera) {
videoLoopDev = Preferences::GetCString("media.video_loopback_dev");
}
if (aAudioType == MediaSourceEnum::Microphone) {
audioLoopDev = Preferences::GetCString("media.audio_loopback_dev");
}
}
// Check if the preference for using audio/video loopback devices is
// enabled. This is currently used for automated media tests only.
//
// If present (and we're doing non-exotic cameras and microphones) use them
// instead of our built-in fake devices, except if fake tracks are requested
// (a feature of the built-in ones only).
if (!aFake) {
// Fake tracks only make sense when we have a fake stream.
aFakeTracks = false;
nsAdoptingCString audioLoopDev, videoLoopDev;
if (!aFakeTracks) {
if (aVideoType == dom::MediaSourceEnum::Camera) {
audioLoopDev = Preferences::GetCString("media.audio_loopback_dev");
videoLoopDev = Preferences::GetCString("media.video_loopback_dev");
if (aFake && !audioLoopDev.IsEmpty() && !videoLoopDev.IsEmpty()) {
aFake = false;
}
} else {
aFake = false;
}
}
MediaManager::PostTask(FROM_HERE, NewTaskFrom([id, aWindowId, audioLoopDev,

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

@ -56,7 +56,7 @@ function startTest() {
SimpleTest.finish();
};
document.getElementById("content").appendChild(video);
helper.waitForPixelColor(video, helper.red, 128, "Should become red")
helper.waitForPixel(video, helper.red, 128, "Should become red")
.then(SimpleTest.finish);
};

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

@ -20,6 +20,7 @@ function identityPcTest(remoteOptions) {
}], [remoteOptions || {
audio: true,
video: true,
fake: true,
peerIdentity: id1
}]);
test.pcLocal.setIdentityProvider('test1.example.com', 'idp.js');

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

@ -20,7 +20,8 @@ function theTest() {
// side is isolated anyway.
identityPcTest({
audio: true,
video: true
video: true,
fake: true
});
}
runNetworkTest(theTest);

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

@ -150,8 +150,6 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' &
[test_peerConnection_throwInCallbacks.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_toJSON.html]
[test_peerConnection_trackDisabling.html]
[test_peerConnection_twoAudioStreams.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g (Bug 1059867), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_twoAudioTracksInOneStream.html]

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

@ -46,24 +46,27 @@ runTest(() =>
.then(() => mustSucceed("unknown plain deviceId on video",
() => navigator.mediaDevices.getUserMedia({
video: { deviceId: "unknown9qHr8B0JIbcHlbl9xR+jMbZZ8WyoPfpCXPfc=" },
fake: true,
})))
.then(() => mustSucceed("unknown plain deviceId on audio",
() => navigator.mediaDevices.getUserMedia({
audio: { deviceId: "unknown9qHr8B0JIbcHlbl9xR+jMbZZ8WyoPfpCXPfc=" },
fake: true,
})))
.then(() => mustFailWith("unknown exact deviceId on video",
"OverconstrainedError", "deviceId",
() => navigator.mediaDevices.getUserMedia({
video: { deviceId: { exact: "unknown9qHr8B0JIbcHlbl9xR+jMbZZ8WyoPfpCXPfc=" } },
fake: true,
})))
.then(() => mustFailWith("unknown exact deviceId on audio",
"OverconstrainedError", "deviceId",
() => navigator.mediaDevices.getUserMedia({
audio: { deviceId: { exact: "unknown9qHr8B0JIbcHlbl9xR+jMbZZ8WyoPfpCXPfc=" } },
fake: true,
})))
// Check the special case of no devices found.
.then(() => pushPrefs(["media.navigator.streams.fake", false],
["media.audio_loopback_dev", "none"],
// Check the special case of no devices found (these prefs override fake).
.then(() => pushPrefs(["media.audio_loopback_dev", "none"],
["media.video_loopback_dev", "none"]))
.then(() => navigator.mediaDevices.enumerateDevices())
.then(devices => ok(devices.length === 0, "No devices found")));

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

@ -25,11 +25,8 @@
var testVideo = createMediaElement('video', 'testVideo');
return Promise.resolve()
.then(() => getUserMedia({
video: { mediaSource: "browser",
scrollWithPage: true },
fake: false
}))
.then(() => getUserMedia({ video: { mediaSource: "browser",
scrollWithPage: true } }))
.then(stream => {
var playback = new LocalMediaStreamPlayback(testVideo, stream);
return playback.playMediaWithDeprecatedStreamStop(false);
@ -41,8 +38,7 @@
viewportOffsetY: 0,
viewportWidth: 100,
viewportHeight: 100
},
fake: false
}
}))
.then(stream => {
var playback = new LocalMediaStreamPlayback(testVideo, stream);

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

@ -16,13 +16,16 @@ createHTML({ title: "Test getUserMedia constraints", bug: "882145" });
var tests = [
// Each test here tests a different constraint or codepath.
{ message: "unknown required constraint on video ignored",
constraints: { video: { somethingUnknown: { exact: 0 } } },
constraints: { video: { somethingUnknown: { exact: 0 } },
fake: true },
error: null },
{ message: "unknown required constraint on audio ignored",
constraints: { audio: { somethingUnknown: { exact: 0 } } },
constraints: { audio: { somethingUnknown: { exact: 0 } },
fake: true },
error: null },
{ message: "audio overconstrained by facingMode ignored",
constraints: { audio: { facingMode: { exact: 'left' } } },
constraints: { audio: { facingMode: { exact: 'left' } },
fake: true },
error: null },
{ message: "full screensharing requires permission",
constraints: { video: { mediaSource: 'screen' } },
@ -48,7 +51,8 @@ var tests = [
constraints: { },
error: "NotSupportedError" },
{ message: "Success-path: optional video facingMode + audio ignoring facingMode",
constraints: { audio: { mediaSource: 'microphone',
constraints: { fake: true,
audio: { mediaSource: 'microphone',
facingMode: 'left',
foo: 0,
advanced: [{ facingMode: 'environment' },
@ -62,7 +66,7 @@ var tests = [
{ bar: 0 }] } },
error: null },
{ message: "legacy facingMode ignored",
constraints: { video: { mandatory: { facingMode: 'left' } } },
constraints: { video: { mandatory: { facingMode: 'left' } }, fake: true },
error: null },
];

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

@ -13,7 +13,7 @@ createHTML({
});
function theTest() {
function testPeerIdentityConstraint(withConstraint) {
var config = { audio: true, video: true };
var config = { audio: true, video: true, fake: true };
if (withConstraint) {
config.peerIdentity = 'user@example.com';
}

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

@ -65,7 +65,7 @@ runNetworkTest(function() {
is(v2.currentTime, 0, "v2.currentTime is zero at outset");
// not testing legacy gUM here
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
navigator.mediaDevices.getUserMedia({ fake: true, video: true, audio: true })
.then(stream => pc1.addStream(v1.mozSrcObject = stream))
.then(() => pcall(pc1, pc1.createOffer))
.then(offer => pcall(pc1, pc1.setLocalDescription, offer))

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

@ -39,8 +39,7 @@ runNetworkTest(() => {
ok(!!vremote, "Should have remote video element for pcRemote");
},
function WAIT_FOR_REMOTE_GREEN() {
return h.waitForPixelColor(vremote, h.green, 128,
"pcRemote's remote should become green");
return h.waitForPixel(vremote, h.green, 128, "pcRemote's remote should become green");
},
function DRAW_LOCAL_RED() {
// After requesting a frame it will be captured at the time of next render.
@ -50,8 +49,7 @@ runNetworkTest(() => {
h.drawColor(canvas, h.red);
},
function WAIT_FOR_REMOTE_RED() {
return h.waitForPixelColor(vremote, h.red, 128,
"pcRemote's remote should become red");
return h.waitForPixel(vremote, h.red, 128, "pcRemote's remote should become red");
}
]);
test.run();

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

@ -89,8 +89,7 @@ runNetworkTest(() => {
ok(!!vremote, "Should have remote video element for pcRemote");
},
function WAIT_FOR_REMOTE_GREEN() {
return h.waitForPixelColor(vremote, h.green, 128,
"pcRemote's remote should become green");
return h.waitForPixel(vremote, h.green, 128, "pcRemote's remote should become green");
},
function REQUEST_FRAME(test) {
// After requesting a frame it will be captured at the time of next render.
@ -102,8 +101,7 @@ runNetworkTest(() => {
h.drawColor(canvas, h.red);
},
function WAIT_FOR_REMOTE_RED() {
return h.waitForPixelColor(vremote, h.red, 128,
"pcRemote's remote should become red");
return h.waitForPixel(vremote, h.red, 128, "pcRemote's remote should become red");
}
]);
test.run();

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

@ -36,7 +36,7 @@
is(v2.currentTime, 0, "v2.currentTime is zero at outset");
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
navigator.mediaDevices.getUserMedia({ fake: true, video: true, audio: true })
.then(stream => pc1.addStream(v1.srcObject = stream))
.then(() => pc1.createOffer({})) // check that createOffer accepts arg.
.then(offer => pc1.setLocalDescription(offer))

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

@ -30,7 +30,7 @@
var newTrack;
var audiotrack;
return navigator.mediaDevices.getUserMedia({video:true, audio:true})
return navigator.mediaDevices.getUserMedia({video:true, audio:true, fake:true})
.then(newStream => {
window.grip = newStream;
newTrack = newStream.getVideoTracks()[0];
@ -112,8 +112,7 @@
var sourceNode = test.audioCtx.createOscillator();
sourceNode.type = 'sine';
// We need a frequency not too close to the fake audio track
// (440Hz for loopback devices, 1kHz for fake tracks).
// We need a frequency not too close to the fake audio track (1kHz).
sourceNode.frequency.value = 2000;
sourceNode.start();
@ -158,7 +157,7 @@
is(e.name, "InvalidParameterError",
"addTrack existing track should fail");
}
return navigator.mediaDevices.getUserMedia({video:true})
return navigator.mediaDevices.getUserMedia({video:true, fake: true})
.then(differentStream => {
var track = differentStream.getVideoTracks()[0];
try {

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

@ -21,7 +21,7 @@
var oldstream = test.pcLocal._pc.getLocalStreams()[0];
var oldtrack = oldstream.getVideoTracks()[0];
var sender = test.pcLocal._pc.getSenders()[0];
return navigator.mediaDevices.getUserMedia({video:true})
return navigator.mediaDevices.getUserMedia({video:true, fake:true})
.then(newstream => {
var newtrack = newstream.getVideoTracks()[0];
return test.pcLocal.senderReplaceTrack(0, newtrack, newstream.id);

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

@ -48,7 +48,7 @@ runNetworkTest(function () {
pc2 = new RTCPeerConnection();
// Test success callbacks (happy path)
navigator.mozGetUserMedia({video:true}, function(video1) {
navigator.mozGetUserMedia({video:true, fake: true}, function(video1) {
pc1.addStream(video1);
pc1.createOffer(function(offer) {
pc1.setLocalDescription(offer, function() {

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

@ -1,95 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1219711",
title: "Disabling locally should be reflected remotely",
visible: true
});
runNetworkTest(() => {
var test = new PeerConnectionTest();
// Always use fake tracks since we depend on video to be somewhat green and
// audio to have a large 1000Hz component.
test.setMediaConstraints([{audio: true, video: true, fake: true}], []);
test.chain.append([
function CHECK_ASSUMPTIONS() {
is(test.pcLocal.mediaElements.length, 1,
"pcLocal should only have one media element");
is(test.pcRemote.mediaElements.length, 1,
"pcRemote should only have one media element");
is(test.pcLocal.streams.length, 1,
"pcLocal should only have one stream (the local one)");
is(test.pcRemote.streams.length, 1,
"pcRemote should only have one stream (the remote one)");
},
function CHECK_VIDEO() {
var h = new CaptureStreamTestHelper2D();
var localVideo = test.pcLocal.mediaElements[0];
var remoteVideo = test.pcRemote.mediaElements[0];
// We check a pixel somewhere away from the top left corner since
// MediaEngineDefault puts semi-transparent time indicators there.
const offsetX = 50;
const offsetY = 50;
const threshold = 128;
return Promise.resolve()
.then(() => info("Checking local video enabled"))
.then(() => h.waitForPixel(localVideo, offsetX, offsetY,
px => h.isPixelNot(px, h.black, 128)))
.then(() => info("Checking remote video enabled"))
.then(() => h.waitForPixel(remoteVideo, offsetX, offsetY,
px => h.isPixelNot(px, h.black, 128)))
.then(() => test.pcLocal.streams[0].getVideoTracks()[0].enabled = false)
.then(() => info("Checking local video disabled"))
.then(() => h.waitForPixel(localVideo, offsetX, offsetY,
px => h.isPixel(px, h.blackTransparent, 128)))
.then(() => info("Checking remote video disabled"))
.then(() => h.waitForPixel(remoteVideo, offsetX, offsetY,
px => h.isPixel(px, h.black, 128)))
},
function CHECK_AUDIO() {
var ac = new AudioContext();
var localAnalyser = new AudioStreamAnalyser(ac, test.pcLocal.streams[0]);
var remoteAnalyser = new AudioStreamAnalyser(ac, test.pcRemote.streams[0]);
var checkAudio = (analyser, fun) => {
analyser.enableDebugCanvas();
return analyser.waitForAnalysisSuccess(fun)
.then(() => analyser.disableDebugCanvas());
};
var freq1k = localAnalyser.binIndexForFrequency(1000);
var checkAudioEnabled = analyser =>
checkAudio(analyser, array => array[freq1k] > 200);
var checkAudioDisabled = analyser =>
checkAudio(analyser, array => array[freq1k] < 50);
return Promise.resolve()
.then(() => info("Checking local audio enabled"))
.then(() => checkAudioEnabled(localAnalyser))
.then(() => info("Checking remote audio enabled"))
.then(() => checkAudioEnabled(remoteAnalyser))
.then(() => test.pcLocal.streams[0].getAudioTracks()[0].enabled = false)
.then(() => info("Checking local audio disabled"))
.then(() => checkAudioDisabled(localAnalyser))
.then(() => info("Checking remote audio disabled"))
.then(() => checkAudioDisabled(remoteAnalyser))
}
]);
test.run();
});
</script>
</pre>
</body>
</html>

4
gradle/wrapper/gradle-wrapper.properties поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
#Sun Oct 18 17:00:46 PDT 2015
#Mon Nov 02 13:44:39 GMT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip

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

@ -553,6 +553,12 @@ public class BrowserApp extends GeckoApp
@Override
public void onCreate(Bundle savedInstanceState) {
if (!isSupportedSDK()) {
// This build does not support the Android version of the device; Exit early.
super.onCreate(savedInstanceState);
return;
}
final Intent intent = getIntent();
// Note that we're calling GeckoProfile.get *before GeckoApp.onCreate*.
@ -1217,6 +1223,12 @@ public class BrowserApp extends GeckoApp
@Override
public void onDestroy() {
if (!isSupportedSDK()) {
// This build does not support the Android version of the device; Exit early.
super.onDestroy();
return;
}
mDynamicToolbar.destroy();
if (mBrowserToolbar != null)

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

@ -64,6 +64,7 @@ import android.hardware.SensorEventListener;
import android.location.Location;
import android.location.LocationListener;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
@ -1220,6 +1221,14 @@ public abstract class GeckoApp
enableStrictMode();
}
if (!isSupportedSDK()) {
// This build does not support the Android version of the device: Show an error and finish the app.
super.onCreate(savedInstanceState);
showSDKVersionError();
finish();
return;
}
// The clock starts...now. Better hurry!
mJavaUiStartupTimer = new Telemetry.UptimeTimer("FENNEC_STARTUP_TIME_JAVAUI");
mGeckoReadyStartupTimer = new Telemetry.UptimeTimer("FENNEC_STARTUP_TIME_GECKOREADY");
@ -2133,6 +2142,13 @@ public abstract class GeckoApp
@Override
public void onDestroy() {
if (!isSupportedSDK()) {
// This build does not support the Android version of the device:
// We did not initialize anything, so skip cleaning up.
super.onDestroy();
return;
}
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
"Gecko:Ready",
"Gecko:DelayedStartup",
@ -2235,6 +2251,16 @@ public abstract class GeckoApp
}
}
protected boolean isSupportedSDK() {
return Build.VERSION.SDK_INT >= Versions.MIN_SDK_VERSION &&
Build.VERSION.SDK_INT <= Versions.MAX_SDK_VERSION;
}
public void showSDKVersionError() {
final String message = getString(R.string.unsupported_sdk_version, Build.CPU_ABI, Build.VERSION.SDK_INT);
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
// Get a temporary directory, may return null
public static File getTempDirectory() {
File dir = GeckoApplication.get().getExternalFilesDir("temp");

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

@ -9,6 +9,8 @@ android {
defaultConfig {
targetSdkVersion 22
minSdkVersion 9
// Used by Robolectric based tests; see TestRunner.
buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
}
compileOptions {

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

@ -748,3 +748,8 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY bookmarks_restricted_support2 "Firefox Help and Support for restricted profiles on Android tablets">
<!-- LOCALIZATION NOTE (bookmarks_restricted_webmaker):link title for https://webmaker.org -->
<!ENTITY bookmarks_restricted_webmaker "Learn the Web: Mozilla Webmaker">
<!-- LOCALIZATION NOTE (unsupported_sdk_version): The user installed a build of this app that does not support
the Android version of this device. the formatS1 is replaced by the CPU ABI (e.g., ARMv7); the formatS2 is
replaced by the Android OS version (e.g., 14)-->
<!ENTITY unsupported_sdk_version "Sorry! This &brandShortName; won\'t work on this device (&formatS1;, &formatS2;). Please download the correct version.">

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

@ -595,4 +595,6 @@
<string name="intent_uri_private_browsing_multiple_match_title">&intent_uri_private_browsing_multiple_match_title;</string>
<string name="devtools_auth_scan_header">&devtools_auth_scan_header;</string>
<string name="unsupported_sdk_version">&unsupported_sdk_version;</string>
</resources>

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

@ -7,6 +7,8 @@ android {
defaultConfig {
targetSdkVersion 22
minSdkVersion 9
// Used by Robolectric based tests; see TestRunner.
buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
}
compileOptions {

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

@ -175,6 +175,8 @@ class ArtifactSubCommand(SubCommand):
help='Firefox tree.'),
CommandArgument('--job', metavar='JOB', choices=['android-api-11', 'android-x86'],
help='Build job.'),
CommandArgument('--verbose', '-v', action='store_true',
help='Print verbose output.'),
]
for arg in args:
after = arg(after)
@ -207,9 +209,10 @@ class PackageFrontend(MachCommandBase):
'''
pass
def _make_artifacts(self, tree=None, job=None):
self.log_manager.terminal_handler.setLevel(logging.INFO)
def _set_log_level(self, verbose):
self.log_manager.terminal_handler.setLevel(logging.INFO if not verbose else logging.DEBUG)
def _make_artifacts(self, tree=None, job=None):
self._activate_virtualenv()
self.virtualenv_manager.install_pip_package('pylru==1.0.9')
self.virtualenv_manager.install_pip_package('taskcluster==0.0.16')
@ -242,14 +245,16 @@ class PackageFrontend(MachCommandBase):
'which case the current hg repository is inspected; an hg revision; '
'a remote URL; or a local file.',
default=None)
def artifact_install(self, source=None, tree=None, job=None):
def artifact_install(self, source=None, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
tree, job = self._compute_defaults(tree, job)
artifacts = self._make_artifacts(tree=tree, job=job)
return artifacts.install_from(source, self.distdir)
@ArtifactSubCommand('artifact', 'last',
'Print the last pre-built artifact installed.')
def artifact_print_last(self, tree=None, job=None):
def artifact_print_last(self, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
tree, job = self._compute_defaults(tree, job)
artifacts = self._make_artifacts(tree=tree, job=job)
artifacts.print_last()
@ -257,7 +262,8 @@ class PackageFrontend(MachCommandBase):
@ArtifactSubCommand('artifact', 'print-cache',
'Print local artifact cache for debugging.')
def artifact_print_cache(self, tree=None, job=None):
def artifact_print_cache(self, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
tree, job = self._compute_defaults(tree, job)
artifacts = self._make_artifacts(tree=tree, job=job)
artifacts.print_cache()
@ -265,7 +271,8 @@ class PackageFrontend(MachCommandBase):
@ArtifactSubCommand('artifact', 'clear-cache',
'Delete local artifacts and reset local artifact cache.')
def artifact_clear_cache(self, tree=None, job=None):
def artifact_clear_cache(self, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
tree, job = self._compute_defaults(tree, job)
artifacts = self._make_artifacts(tree=tree, job=job)
artifacts.clear_cache()

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

@ -3,14 +3,7 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URISyntaxException;
import ch.boye.httpclientandroidlib.HttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -18,21 +11,27 @@ import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.setup.auth.AuthenticateAccountStage;
import org.mozilla.gecko.sync.setup.auth.AuthenticateAccountStage.AuthenticateAccountStageDelegate;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import ch.boye.httpclientandroidlib.HttpResponse;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URISyntaxException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* Tests the authentication request stage of manual Account setup.
* @author liuche
*
*/
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestAccountAuthenticatorStage {
private static final int TEST_PORT = HTTPServerTestHelper.getTestPort();
private static final String TEST_SERVER = "http://localhost:" + TEST_PORT;

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

@ -3,27 +3,25 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.ProtocolVersion;
import ch.boye.httpclientandroidlib.message.BasicHttpResponse;
import ch.boye.httpclientandroidlib.message.BasicStatusLine;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.MockGlobalSessionCallback;
import org.mozilla.gecko.background.testhelpers.MockGlobalSession;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.SyncConfiguration;
import org.mozilla.gecko.sync.crypto.KeyBundle;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.ProtocolVersion;
import ch.boye.httpclientandroidlib.message.BasicHttpResponse;
import ch.boye.httpclientandroidlib.message.BasicStatusLine;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.mozilla.android.sync.test.helpers.MockGlobalSessionCallback;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestBackoff {
private final String TEST_USERNAME = "johndoe";
private final String TEST_PASSWORD = "password";

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

@ -3,16 +3,15 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import ch.boye.httpclientandroidlib.Header;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.net.BrowserIDAuthHeaderProvider;
import ch.boye.httpclientandroidlib.Header;
import org.robolectric.RobolectricGradleTestRunner;
import static org.junit.Assert.assertEquals;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestBrowserIDAuthHeaderProvider {
@Test
public void testHeader() {

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

@ -3,19 +3,7 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import ch.boye.httpclientandroidlib.HttpStatus;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
@ -32,6 +20,7 @@ import org.mozilla.gecko.background.testhelpers.MockClientsDataDelegate;
import org.mozilla.gecko.background.testhelpers.MockClientsDatabaseAccessor;
import org.mozilla.gecko.background.testhelpers.MockGlobalSession;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.CollectionKeys;
import org.mozilla.gecko.sync.CommandProcessor.Command;
@ -52,13 +41,23 @@ import org.mozilla.gecko.sync.net.SyncStorageResponse;
import org.mozilla.gecko.sync.repositories.NullCursorException;
import org.mozilla.gecko.sync.repositories.android.ClientsDatabaseAccessor;
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import ch.boye.httpclientandroidlib.HttpStatus;
import java.io.IOException;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestClientsEngineStage extends MockSyncClientsEngineStage {
public final static String LOG_TAG = "TestClientsEngSta";

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

@ -3,27 +3,26 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import ch.boye.httpclientandroidlib.Header;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.NonObjectJSONException;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import ch.boye.httpclientandroidlib.Header;
import org.robolectric.RobolectricGradleTestRunner;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import static org.junit.Assert.assertEquals;
/**
* Test the transfer of a UTF-8 string from desktop, and ensure that it results in the
* correct hashed Basic Auth header.
*/
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestCredentialsEndToEnd {
public static final String REAL_PASSWORD = "pïgéons1";

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

@ -3,22 +3,11 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.ProtocolVersion;
import ch.boye.httpclientandroidlib.message.BasicHttpResponse;
import ch.boye.httpclientandroidlib.message.BasicStatusLine;
import junit.framework.AssertionFailedError;
import org.json.simple.parser.ParseException;
import org.junit.Before;
import org.junit.Test;
@ -32,6 +21,7 @@ import org.mozilla.gecko.background.testhelpers.MockGlobalSession;
import org.mozilla.gecko.background.testhelpers.MockPrefsGlobalSession;
import org.mozilla.gecko.background.testhelpers.MockServerSyncStage;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.EngineSettings;
import org.mozilla.gecko.sync.ExtendedJSONObject;
@ -51,16 +41,24 @@ import org.mozilla.gecko.sync.stage.AndroidBrowserBookmarksServerSyncStage;
import org.mozilla.gecko.sync.stage.GlobalSyncStage;
import org.mozilla.gecko.sync.stage.GlobalSyncStage.Stage;
import org.mozilla.gecko.sync.stage.NoSuchStageException;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.ProtocolVersion;
import ch.boye.httpclientandroidlib.message.BasicHttpResponse;
import ch.boye.httpclientandroidlib.message.BasicStatusLine;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestGlobalSession {
private int TEST_PORT = HTTPServerTestHelper.getTestPort();
private final String TEST_CLUSTER_URL = "http://localhost:" + TEST_PORT;

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

@ -3,14 +3,14 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.Utils;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
@RunWith(TestRunner.class)
public class TestHeaderParsing {
@SuppressWarnings("static-method")

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

@ -2,9 +2,20 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.net.AuthHeaderProvider;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.SyncStorageCollectionRequest;
import org.mozilla.gecko.sync.net.SyncStorageCollectionRequestDelegate;
import org.mozilla.gecko.sync.net.SyncStorageResponse;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import java.io.IOException;
import java.io.PrintStream;
@ -12,21 +23,11 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.net.AuthHeaderProvider;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.SyncStorageCollectionRequest;
import org.mozilla.gecko.sync.net.SyncStorageCollectionRequestDelegate;
import org.mozilla.gecko.sync.net.SyncStorageResponse;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestLineByLineHandling {
private static final int TEST_PORT = HTTPServerTestHelper.getTestPort();
private static final String TEST_SERVER = "http://localhost:" + TEST_PORT;

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

@ -3,22 +3,13 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.simple.parser.ParseException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.CryptoRecord;
import org.mozilla.gecko.sync.ExtendedJSONObject;
@ -27,11 +18,20 @@ import org.mozilla.gecko.sync.delegates.MetaGlobalDelegate;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import org.mozilla.gecko.sync.net.SyncStorageResponse;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
@RunWith(RobolectricGradleTestRunner.class)
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestMetaGlobal {
public static Object monitor = new Object();

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

@ -3,28 +3,27 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.net.URISyntaxException;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.methods.HttpUriRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockResourceDelegate;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.HttpResponseObserver;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.methods.HttpUriRequest;
import org.robolectric.RobolectricGradleTestRunner;
import java.net.URISyntaxException;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestResource {
private static final int TEST_PORT = HTTPServerTestHelper.getTestPort();
private static final String TEST_SERVER = "http://localhost:" + TEST_PORT;

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

@ -1,22 +1,21 @@
package org.mozilla.android.sync.net.test;
import java.util.Date;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.runner.RunWith;
import org.mozilla.gecko.sync.net.SyncResponse;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.ProtocolVersion;
import ch.boye.httpclientandroidlib.impl.cookie.DateUtils;
import ch.boye.httpclientandroidlib.message.BasicHttpResponse;
import ch.boye.httpclientandroidlib.message.BasicStatusLine;
import org.robolectric.RobolectricGradleTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.net.SyncResponse;
@RunWith(RobolectricGradleTestRunner.class)
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestRetryAfter {
private int TEST_SECONDS = 120;

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

@ -3,17 +3,17 @@
package org.mozilla.android.sync.net.test;
import java.net.URI;
import java.net.URISyntaxException;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.InfoCollections;
import org.mozilla.gecko.sync.repositories.Server11Repository;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.net.URI;
import java.net.URISyntaxException;
@RunWith(TestRunner.class)
public class TestServer11Repository {
private static final String COLLECTION = "bookmarks";

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

@ -3,30 +3,30 @@
package org.mozilla.android.sync.net.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.json.simple.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.BaseTestStorageRequestDelegate;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.net.AuthHeaderProvider;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import org.mozilla.gecko.sync.net.SyncStorageRecordRequest;
import org.mozilla.gecko.sync.net.SyncStorageResponse;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
@RunWith(RobolectricGradleTestRunner.class)
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestSyncStorageRequest {
private static final int TEST_PORT = HTTPServerTestHelper.getTestPort();
private static final String TEST_SERVER = "http://localhost:" + TEST_PORT;

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

@ -3,9 +3,7 @@
package org.mozilla.android.sync.test;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import android.content.Context;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.WBORepository;
import org.mozilla.gecko.sync.repositories.FetchFailedException;
@ -19,7 +17,8 @@ import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFetchRecor
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFinishDelegate;
import org.mozilla.gecko.sync.repositories.domain.Record;
import android.content.Context;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
public class SynchronizerHelpers {
public static final String FAIL_SENTINEL = "Fail";

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

@ -3,6 +3,23 @@
package org.mozilla.android.sync.test;
import org.json.simple.JSONArray;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.CollectionKeys;
import org.mozilla.gecko.sync.CryptoRecord;
import org.mozilla.gecko.sync.NoCollectionKeysSetException;
import org.mozilla.gecko.sync.NonObjectJSONException;
import org.mozilla.gecko.sync.crypto.CryptoException;
import org.mozilla.gecko.sync.crypto.KeyBundle;
import java.io.IOException;
import java.util.Arrays;
import java.util.Set;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -10,24 +27,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.Arrays;
import java.util.Set;
import org.json.simple.JSONArray;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.sync.CollectionKeys;
import org.mozilla.gecko.sync.CryptoRecord;
import org.mozilla.gecko.sync.NoCollectionKeysSetException;
import org.mozilla.gecko.sync.NonObjectJSONException;
import org.mozilla.gecko.sync.crypto.CryptoException;
import org.mozilla.gecko.sync.crypto.KeyBundle;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestCollectionKeys {
@Test

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

@ -3,27 +3,27 @@
package org.mozilla.android.sync.test;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.CommandProcessor;
import org.mozilla.gecko.sync.CommandRunner;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.NonObjectJSONException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.sync.CommandProcessor;
import org.mozilla.gecko.sync.CommandRunner;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.NonObjectJSONException;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestCommandProcessor extends CommandProcessor {
public static final String commandType = "displayURI";

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

@ -3,21 +3,13 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.CryptoRecord;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.NonObjectJSONException;
@ -27,9 +19,17 @@ import org.mozilla.gecko.sync.crypto.KeyBundle;
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
import org.mozilla.gecko.sync.repositories.domain.HistoryRecord;
import org.mozilla.gecko.sync.repositories.domain.Record;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestCryptoRecord {
String base64EncryptionKey = "9K/wLdXdw+nrTtXo4ZpECyHFNr4d7aYHqeg3KW9+m6Q=";
String base64HmacKey = "MMntEfutgLTc8FlTLQFms8/xMPmCldqPlq/QQXEjx70=";

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

@ -1,20 +1,10 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.NonObjectJSONException;
import org.mozilla.gecko.sync.crypto.CryptoException;
@ -29,9 +19,19 @@ import org.mozilla.gecko.sync.jpake.JPakeParty;
import org.mozilla.gecko.sync.jpake.stage.ComputeKeyVerificationStage;
import org.mozilla.gecko.sync.jpake.stage.VerifyPairingStage;
import org.mozilla.gecko.sync.setup.Constants;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestJPakeSetup {
// Note: will throw NullPointerException if aborts. Only use stateless public
// methods.

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

@ -3,20 +3,13 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.db.Tab;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.CryptoRecord;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.NonObjectJSONException;
@ -26,9 +19,16 @@ import org.mozilla.gecko.sync.repositories.domain.HistoryRecord;
import org.mozilla.gecko.sync.repositories.domain.Record;
import org.mozilla.gecko.sync.repositories.domain.RecordParseException;
import org.mozilla.gecko.sync.repositories.domain.TabsRecord;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.io.IOException;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestRecord {
@SuppressWarnings("static-method")

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

@ -3,18 +3,12 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.SynchronizerHelpers.FailFetchWBORepository;
import org.mozilla.android.sync.test.helpers.ExpectSuccessRepositorySessionCreationDelegate;
import org.mozilla.android.sync.test.helpers.ExpectSuccessRepositorySessionFinishDelegate;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WBORepository;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.InactiveSessionException;
@ -25,9 +19,15 @@ import org.mozilla.gecko.sync.repositories.RepositorySessionBundle;
import org.mozilla.gecko.sync.repositories.domain.BookmarkRecord;
import org.mozilla.gecko.sync.synchronizer.RecordsChannel;
import org.mozilla.gecko.sync.synchronizer.RecordsChannelDelegate;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestRecordsChannel {
protected WBORepository remote;

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

@ -3,12 +3,7 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.HashMap;
import android.content.SharedPreferences;
import org.json.simple.parser.ParseException;
import org.junit.Before;
import org.junit.Test;
@ -17,6 +12,7 @@ import org.mozilla.gecko.background.testhelpers.DefaultGlobalSessionCallback;
import org.mozilla.gecko.background.testhelpers.MockPrefsGlobalSession;
import org.mozilla.gecko.background.testhelpers.MockServerSyncStage;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.CommandProcessor;
import org.mozilla.gecko.sync.EngineSettings;
@ -33,13 +29,16 @@ import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import org.mozilla.gecko.sync.stage.GlobalSyncStage;
import org.mozilla.gecko.sync.stage.GlobalSyncStage.Stage;
import android.content.SharedPreferences;
import org.robolectric.RobolectricGradleTestRunner;
import java.io.IOException;
import java.util.HashMap;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Test that reset commands properly invoke the reset methods on the correct stage.
*/
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestResetCommands {
private static final String TEST_USERNAME = "johndoe";
private static final String TEST_PASSWORD = "password";

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

@ -3,15 +3,7 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.atomic.AtomicBoolean;
import ch.boye.httpclientandroidlib.HttpEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.SynchronizerHelpers.TrackingWBORepository;
@ -19,6 +11,7 @@ import org.mozilla.android.sync.test.helpers.BaseTestStorageRequestDelegate;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.testhelpers.MockRecord;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.InfoCollections;
import org.mozilla.gecko.sync.JSONRecordFetcher;
@ -43,14 +36,20 @@ import org.mozilla.gecko.sync.repositories.domain.Record;
import org.mozilla.gecko.sync.stage.SafeConstrainedServer11Repository;
import org.mozilla.gecko.sync.synchronizer.ServerLocalSynchronizer;
import org.mozilla.gecko.sync.synchronizer.Synchronizer;
import org.robolectric.RobolectricGradleTestRunner;
import org.simpleframework.http.ContentType;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import ch.boye.httpclientandroidlib.HttpEntity;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.atomic.AtomicBoolean;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestServer11RepositorySession {
public class POSTMockServer extends MockServer {

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

@ -3,12 +3,6 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.SynchronizerHelpers.BatchFailStoreWBORepository;
@ -20,6 +14,7 @@ import org.mozilla.android.sync.test.SynchronizerHelpers.FinishFailedException;
import org.mozilla.android.sync.test.SynchronizerHelpers.SerialFailStoreWBORepository;
import org.mozilla.android.sync.test.SynchronizerHelpers.TrackingWBORepository;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WBORepository;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.FetchFailedException;
@ -28,9 +23,14 @@ import org.mozilla.gecko.sync.repositories.domain.BookmarkRecord;
import org.mozilla.gecko.sync.synchronizer.ServerLocalSynchronizer;
import org.mozilla.gecko.sync.synchronizer.Synchronizer;
import org.mozilla.gecko.sync.synchronizer.SynchronizerDelegate;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@RunWith(TestRunner.class)
public class TestServerLocalSynchronizer {
public static final String LOG_TAG = "TestServLocSync";

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

@ -3,17 +3,17 @@
package org.mozilla.android.sync.test;
import java.net.URI;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.Sync11Configuration;
import org.mozilla.gecko.sync.SyncConfiguration;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.net.URI;
@RunWith(TestRunner.class)
public class TestSyncConfiguration {
@Test
public void testURLs() throws Exception {

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

@ -3,16 +3,16 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.setup.InvalidSyncKeyException;
import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestSyncKeyVerification {
private int[] mutateIndices;

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

@ -3,21 +3,14 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Date;
import android.content.Context;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.SynchronizerHelpers.TrackingWBORepository;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WBORepository;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.RepositorySessionBundle;
@ -27,10 +20,16 @@ import org.mozilla.gecko.sync.synchronizer.SynchronizerDelegate;
import org.mozilla.gecko.sync.synchronizer.SynchronizerSession;
import org.mozilla.gecko.sync.synchronizer.SynchronizerSessionDelegate;
import android.content.Context;
import org.robolectric.RobolectricGradleTestRunner;
import java.util.Date;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestSynchronizer {
public static final String LOG_TAG = "TestSynchronizer";

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

@ -3,23 +3,14 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import android.content.Context;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.SynchronizerHelpers.DataAvailableWBORepository;
import org.mozilla.android.sync.test.SynchronizerHelpers.ShouldSkipWBORepository;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.background.testhelpers.WBORepository;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.SynchronizerConfiguration;
@ -30,10 +21,18 @@ import org.mozilla.gecko.sync.synchronizer.Synchronizer;
import org.mozilla.gecko.sync.synchronizer.SynchronizerSession;
import org.mozilla.gecko.sync.synchronizer.SynchronizerSessionDelegate;
import android.content.Context;
import org.robolectric.RobolectricGradleTestRunner;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(TestRunner.class)
public class TestSynchronizerSession {
public static final String LOG_TAG = TestSynchronizerSession.class.getSimpleName();

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

@ -3,22 +3,22 @@
package org.mozilla.android.sync.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Utils;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Utils;
import org.robolectric.RobolectricGradleTestRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestUtils extends Utils {
@Test

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

@ -3,16 +3,16 @@
package org.mozilla.android.sync.test.helpers;
import static org.junit.Assert.fail;
import java.io.IOException;
import org.mozilla.gecko.sync.net.AuthHeaderProvider;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import org.mozilla.gecko.sync.net.SyncStorageRequestDelegate;
import org.mozilla.gecko.sync.net.SyncStorageResponse;
import java.io.IOException;
import static org.junit.Assert.fail;
public class BaseTestStorageRequestDelegate implements
SyncStorageRequestDelegate {

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

@ -3,14 +3,13 @@
package org.mozilla.android.sync.test.helpers;
import java.util.concurrent.ExecutorService;
import junit.framework.AssertionFailedError;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.RepositorySession;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionBeginDelegate;
import java.util.concurrent.ExecutorService;
public class ExpectSuccessRepositorySessionBeginDelegate
extends ExpectSuccessDelegate
implements RepositorySessionBeginDelegate {

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

@ -4,7 +4,6 @@
package org.mozilla.android.sync.test.helpers;
import junit.framework.AssertionFailedError;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.RepositorySession;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionCreationDelegate;

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

@ -3,15 +3,14 @@
package org.mozilla.android.sync.test.helpers;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import junit.framework.AssertionFailedError;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFetchRecordsDelegate;
import org.mozilla.gecko.sync.repositories.domain.Record;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
public class ExpectSuccessRepositorySessionFetchRecordsDelegate extends
ExpectSuccessDelegate implements RepositorySessionFetchRecordsDelegate {
public ArrayList<Record> fetchedRecords = new ArrayList<Record>();

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

@ -3,15 +3,14 @@
package org.mozilla.android.sync.test.helpers;
import java.util.concurrent.ExecutorService;
import junit.framework.AssertionFailedError;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.RepositorySession;
import org.mozilla.gecko.sync.repositories.RepositorySessionBundle;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFinishDelegate;
import java.util.concurrent.ExecutorService;
public class ExpectSuccessRepositorySessionFinishDelegate extends
ExpectSuccessDelegate implements RepositorySessionFinishDelegate {

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

@ -3,13 +3,12 @@
package org.mozilla.android.sync.test.helpers;
import java.util.concurrent.ExecutorService;
import junit.framework.AssertionFailedError;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionStoreDelegate;
import java.util.concurrent.ExecutorService;
public class ExpectSuccessRepositorySessionStoreDelegate extends
ExpectSuccessDelegate implements RepositorySessionStoreDelegate {

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

@ -3,13 +3,12 @@
package org.mozilla.android.sync.test.helpers;
import java.util.concurrent.ExecutorService;
import junit.framework.AssertionFailedError;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionWipeDelegate;
import java.util.concurrent.ExecutorService;
public class ExpectSuccessRepositoryWipeDelegate extends ExpectSuccessDelegate
implements RepositorySessionWipeDelegate {

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

@ -3,7 +3,11 @@
package org.mozilla.android.sync.test.helpers;
import static org.junit.Assert.fail;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BaseResourceDelegate;
import org.simpleframework.transport.connect.Connection;
import org.simpleframework.transport.connect.SocketConnection;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -11,11 +15,7 @@ import java.net.SocketAddress;
import java.util.IdentityHashMap;
import java.util.Map;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BaseResourceDelegate;
import org.simpleframework.transport.connect.Connection;
import org.simpleframework.transport.connect.SocketConnection;
import static org.junit.Assert.fail;
/**
* Test helper code to bind <code>MockServer</code> instances to ports.

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

@ -3,15 +3,15 @@
package org.mozilla.android.sync.test.helpers;
import static org.junit.Assert.assertEquals;
import java.net.URI;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.delegates.GlobalSessionCallback;
import org.mozilla.gecko.sync.stage.GlobalSyncStage.Stage;
import java.net.URI;
import static org.junit.Assert.assertEquals;
/**
* A callback for use with a GlobalSession that records what happens for later
* inspection.

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

@ -3,21 +3,20 @@
package org.mozilla.android.sync.test.helpers;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.security.GeneralSecurityException;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.ClientProtocolException;
import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase;
import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
import org.mozilla.gecko.background.testhelpers.WaitHelper;
import org.mozilla.gecko.sync.net.AuthHeaderProvider;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import org.mozilla.gecko.sync.net.ResourceDelegate;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.ClientProtocolException;
import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase;
import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
import java.io.IOException;
import java.security.GeneralSecurityException;
import static org.junit.Assert.assertEquals;
public class MockResourceDelegate implements ResourceDelegate {
public WaitHelper waitHelper = null;

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

@ -3,17 +3,17 @@
package org.mozilla.android.sync.test.helpers;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.PrintStream;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.Utils;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import org.simpleframework.http.core.Container;
import java.io.IOException;
import java.io.PrintStream;
import static org.junit.Assert.assertEquals;
public class MockServer implements Container {
public static final String LOG_TAG = "MockServer";

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

@ -3,12 +3,12 @@
package org.mozilla.android.sync.test.helpers;
import static org.junit.Assert.assertTrue;
import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.SyncStorageResponse;
import org.mozilla.gecko.sync.stage.SyncClientsEngineStage;
import static org.junit.Assert.assertTrue;
public class MockSyncClientsEngineStage extends SyncClientsEngineStage {
public class MockClientUploadDelegate extends ClientUploadDelegate {
HTTPServerTestHelper data;

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

@ -1,11 +1,11 @@
package org.mozilla.android.sync.test.helpers;
import java.util.HashMap;
import org.simpleframework.http.Path;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import java.util.HashMap;
/**
* A trivial server that collects and returns WBOs.
*

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

@ -3,23 +3,23 @@
package org.mozilla.android.sync.test.helpers.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper.HTTPServerAlreadyRunningError;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper;
import org.mozilla.android.sync.test.helpers.MockServer;
import org.mozilla.android.sync.test.helpers.HTTPServerTestHelper.HTTPServerAlreadyRunningError;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestHTTPServerTestHelper {
public static final int TEST_PORT = HTTPServerTestHelper.getTestPort();

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

@ -3,14 +3,7 @@
package org.mozilla.gecko.background.common.log.writers.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import android.util.Log;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -22,11 +15,17 @@ import org.mozilla.gecko.background.common.log.writers.PrintLogWriter;
import org.mozilla.gecko.background.common.log.writers.SimpleTagLogWriter;
import org.mozilla.gecko.background.common.log.writers.StringLogWriter;
import org.mozilla.gecko.background.common.log.writers.ThreadLocalTagLogWriter;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import android.util.Log;
import org.robolectric.RobolectricGradleTestRunner;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestLogWriters {
public static final String TEST_LOG_TAG_1 = "TestLogTag1";

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

@ -3,16 +3,16 @@
package org.mozilla.gecko.background.fxa.test;
import java.util.Calendar;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.fxa.FxAccountAgeLockoutHelper;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.fxa.FxAccountConstants;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
import java.util.Calendar;
@RunWith(TestRunner.class)
public class TestFxAccountAgeLockoutHelper {
@Test
public void testPassesAgeCheck() {

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

@ -3,20 +3,19 @@
package org.mozilla.gecko.background.fxa.test;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.fxa.FxAccountClient20;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.net.BaseResource;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.fxa.FxAccountClient20;
import org.mozilla.gecko.sync.net.BaseResource;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestFxAccountClient20 {
protected static class MockFxAccountClient20 extends FxAccountClient20 {
public MockFxAccountClient20(String serverURI, Executor executor) {

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

@ -3,17 +3,17 @@
package org.mozilla.gecko.background.fxa.test;
import java.math.BigInteger;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.background.fxa.FxAccountUtils;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.sync.crypto.KeyBundle;
import org.mozilla.gecko.sync.net.SRPConstants;
import org.robolectric.RobolectricGradleTestRunner;
import java.math.BigInteger;
/**
* Test vectors from
@ -21,7 +21,7 @@ import org.robolectric.RobolectricGradleTestRunner;
* and
* <a href="https://github.com/mozilla/fxa-auth-server/wiki/onepw-protocol/5a9bc81e499306d769ca19b40b50fa60123df15d">https://github.com/mozilla/fxa-auth-server/wiki/onepw-protocol/5a9bc81e499306d769ca19b40b50fa60123df15d</a>.
*/
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestFxAccountUtils {
protected static void assertEncoding(String base16String, String utf8String) throws Exception {
Assert.assertEquals(base16String, FxAccountUtils.bytes(utf8String));

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

@ -3,10 +3,7 @@
package org.mozilla.gecko.background.healthreport.prune.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import android.content.SharedPreferences;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -14,11 +11,13 @@ import org.mozilla.gecko.background.healthreport.HealthReportConstants;
import org.mozilla.gecko.background.healthreport.prune.PrunePolicy;
import org.mozilla.gecko.background.healthreport.prune.PrunePolicyStorage;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import android.content.SharedPreferences;
import org.robolectric.RobolectricGradleTestRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestPrunePolicy {
public static class MockPrunePolicy extends PrunePolicy {
public MockPrunePolicy(final PrunePolicyStorage storage, final SharedPreferences sharedPrefs) {

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

@ -3,11 +3,9 @@
package org.mozilla.gecko.background.healthreport.test;
import org.json.JSONObject;
import android.database.Cursor;
import android.util.SparseArray;
import org.json.JSONObject;
import org.mozilla.gecko.background.healthreport.Environment;
import org.mozilla.gecko.background.healthreport.HealthReportStorage;

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

@ -5,7 +5,6 @@ package org.mozilla.gecko.background.healthreport.upload.test;
import android.content.Context;
import android.content.SharedPreferences;
import org.mozilla.gecko.background.healthreport.Environment;
import org.mozilla.gecko.background.healthreport.Environment.UIType;
import org.mozilla.gecko.background.healthreport.EnvironmentBuilder.ConfigurationProvider;

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

@ -3,8 +3,15 @@
package org.mozilla.gecko.background.healthreport.upload.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import android.content.SharedPreferences;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.healthreport.HealthReportConstants;
import org.mozilla.gecko.background.healthreport.upload.ObsoleteDocumentTracker;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.ArrayList;
@ -15,18 +22,10 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.healthreport.HealthReportConstants;
import org.mozilla.gecko.background.healthreport.upload.ObsoleteDocumentTracker;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import android.content.SharedPreferences;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestObsoleteDocumentTracker {
public static class MockObsoleteDocumentTracker extends ObsoleteDocumentTracker {
public MockObsoleteDocumentTracker(SharedPreferences sharedPrefs) {

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

@ -3,15 +3,7 @@
package org.mozilla.gecko.background.healthreport.upload.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.net.UnknownHostException;
import java.util.Collection;
import java.util.HashSet;
import android.content.SharedPreferences;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -21,12 +13,19 @@ import org.mozilla.gecko.background.healthreport.upload.SubmissionPolicy;
import org.mozilla.gecko.background.healthreport.upload.test.TestObsoleteDocumentTracker.MockObsoleteDocumentTracker;
import org.mozilla.gecko.background.healthreport.upload.test.TestSubmissionPolicy.MockSubmissionClient.Response;
import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import android.content.SharedPreferences;
import org.robolectric.RobolectricGradleTestRunner;
import java.net.UnknownHostException;
import java.util.Collection;
import java.util.HashSet;
@RunWith(RobolectricGradleTestRunner.class)
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunner.class)
public class TestSubmissionPolicy {
public static class MockSubmissionClient implements SubmissionClient {
public String lastId = null;

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

@ -3,23 +3,21 @@
package org.mozilla.gecko.background.healthreport.upload.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.healthreport.upload.AndroidSubmissionClient.SubmissionsFieldName;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient.MockHealthReportStorage;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient.MockSubmissionsTracker;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import java.util.Arrays;
import java.util.HashSet;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.healthreport.upload.AndroidSubmissionClient.SubmissionsFieldName;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient.MockHealthReportStorage;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient.MockSubmissionsTracker;
import org.robolectric.RobolectricGradleTestRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestSubmissionsTracker {
protected static class MockHealthReportStorage2 extends MockHealthReportStorage {
public final int FIRST_ATTEMPT_ID = SubmissionsFieldName.FIRST_ATTEMPT.getID(this);

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

@ -3,25 +3,23 @@
package org.mozilla.gecko.background.healthreport.upload.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.healthreport.HealthReportStorage;
import org.mozilla.gecko.background.healthreport.upload.AndroidSubmissionClient.SubmissionsTracker.TrackingRequestDelegate;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient.MockHealthReportStorage;
import org.mozilla.gecko.background.testhelpers.StubDelegate;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.util.HashSet;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.healthreport.HealthReportStorage;
import org.mozilla.gecko.background.healthreport.upload.AndroidSubmissionClient.SubmissionsTracker.TrackingRequestDelegate;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient;
import org.mozilla.gecko.background.healthreport.upload.test.MockAndroidSubmissionClient.MockHealthReportStorage;
import org.mozilla.gecko.background.testhelpers.StubDelegate;
import org.robolectric.RobolectricGradleTestRunner;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestTrackingRequestDelegate {
public static class MockAndroidSubmissionClient2 extends MockAndroidSubmissionClient {
public MockAndroidSubmissionClient2() {

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

@ -3,13 +3,13 @@
package org.mozilla.gecko.background.test;
import ch.boye.httpclientandroidlib.HttpEntity;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import ch.boye.httpclientandroidlib.HttpEntity;
public class EntityTestHelper {
private static final int DEFAULT_SIZE = 1024;

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

@ -3,18 +3,17 @@
package org.mozilla.gecko.background.test;
import java.io.IOException;
import java.util.Arrays;
import ch.boye.httpclientandroidlib.HttpEntity;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.bagheera.BoundedByteArrayEntity;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import ch.boye.httpclientandroidlib.HttpEntity;
import org.robolectric.RobolectricGradleTestRunner;
import java.io.IOException;
import java.util.Arrays;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestBoundedByteArrayEntity {
private static void expectFail(byte[] input, int start, int end) {
try {

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

@ -3,21 +3,19 @@
package org.mozilla.gecko.background.test;
import java.util.Arrays;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
import ch.boye.httpclientandroidlib.HttpEntity;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.bagheera.DeflateHelper;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import ch.boye.httpclientandroidlib.HttpEntity;
import org.robolectric.RobolectricGradleTestRunner;
import java.util.Arrays;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(TestRunner.class)
public class TestDeflation {
public static final String TEST_BODY_A = "";
public static final String TEST_BODY_B = "éíôü}ABCDEFGHaaQRSTUVWXYZá{Zá{";

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

@ -3,9 +3,6 @@
package org.mozilla.gecko.background.testhelpers;
import java.io.IOException;
import java.net.URISyntaxException;
import org.json.simple.parser.ParseException;
import org.mozilla.gecko.sync.NoCollectionKeysSetException;
import org.mozilla.gecko.sync.NonObjectJSONException;
@ -14,6 +11,9 @@ import org.mozilla.gecko.sync.repositories.RecordFactory;
import org.mozilla.gecko.sync.repositories.Repository;
import org.mozilla.gecko.sync.stage.ServerSyncStage;
import java.io.IOException;
import java.net.URISyntaxException;
/**
* A stage that joins two Repositories with no wrapping.
*/

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

@ -3,12 +3,12 @@
package org.mozilla.gecko.background.testhelpers;
import java.net.URI;
import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.delegates.GlobalSessionCallback;
import org.mozilla.gecko.sync.stage.GlobalSyncStage.Stage;
import java.net.URI;
public class DefaultGlobalSessionCallback implements GlobalSessionCallback {
@Override

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

@ -3,10 +3,10 @@
package org.mozilla.gecko.background.testhelpers;
import java.math.BigInteger;
import org.mozilla.gecko.sync.jpake.JPakeNumGenerator;
import java.math.BigInteger;
public class JPakeNumGeneratorFixed implements JPakeNumGenerator {
private String[] values;
private int index = 0;

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

@ -3,15 +3,15 @@
package org.mozilla.gecko.background.testhelpers;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.mozilla.gecko.sync.CommandProcessor.Command;
import org.mozilla.gecko.sync.repositories.NullCursorException;
import org.mozilla.gecko.sync.repositories.android.ClientsDatabaseAccessor;
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public class MockClientsDatabaseAccessor extends ClientsDatabaseAccessor {
public boolean storedRecord = false;
public boolean dbWiped = false;

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

@ -3,9 +3,6 @@
package org.mozilla.gecko.background.testhelpers;
import java.io.IOException;
import java.util.HashMap;
import org.json.simple.parser.ParseException;
import org.mozilla.gecko.sync.EngineSettings;
import org.mozilla.gecko.sync.NonObjectJSONException;
@ -18,6 +15,9 @@ import org.mozilla.gecko.sync.stage.CompletedStage;
import org.mozilla.gecko.sync.stage.GlobalSyncStage;
import org.mozilla.gecko.sync.stage.GlobalSyncStage.Stage;
import java.io.IOException;
import java.util.HashMap;
public class MockGlobalSession extends MockPrefsGlobalSession {

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

@ -3,8 +3,8 @@
package org.mozilla.gecko.background.testhelpers;
import java.io.IOException;
import android.content.Context;
import android.content.SharedPreferences;
import org.json.simple.parser.ParseException;
import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.NonObjectJSONException;
@ -16,8 +16,7 @@ import org.mozilla.gecko.sync.delegates.GlobalSessionCallback;
import org.mozilla.gecko.sync.net.AuthHeaderProvider;
import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
import android.content.Context;
import android.content.SharedPreferences;
import java.io.IOException;
/**
* GlobalSession touches the Android prefs system. Stub that out.

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