зеркало из https://github.com/mozilla/gecko-dev.git
Fix result submission, mac platform detection (intel vs ppc), and add statistics display to litmus tab
This commit is contained in:
Родитель
d591549c76
Коммит
d9ab9e6064
|
@ -40,6 +40,7 @@
|
|||
|
||||
var litmus = {
|
||||
baseURL : qaPref.getPref(qaPref.prefBase+".litmus.url", "char"),
|
||||
userStats : '',
|
||||
|
||||
getTestcase : function(testcase_id, callback) {
|
||||
litmus.getLitmusJson(testcase_id, callback, "testcase_id=");
|
||||
|
@ -152,18 +153,18 @@
|
|||
alert("XXX: not implemented");
|
||||
},
|
||||
postResultXML : function(xml, callback, errback) {
|
||||
var req = doSimpleXMLHttpRequest(litmus.baseURL+'process_test.cgi',
|
||||
{ data: xml });
|
||||
req.addErrback(errback);
|
||||
req.addCallback(function(resp) {
|
||||
var qs = queryString({ data: xml});
|
||||
var fake_callback = function(resp) {
|
||||
// only call callback() if we really had a sucuess. XML
|
||||
// processing errors should result in a call to errback()
|
||||
if ((/ok/i).exec(resp.responseText)) {
|
||||
if ((/^ok/i).exec(resp.responseText)) {
|
||||
callback(resp);
|
||||
} else {
|
||||
errback(resp);
|
||||
}
|
||||
});
|
||||
};
|
||||
qaTools.httpPostRequest(litmus.baseURL+'process_test.cgi',
|
||||
qs, fake_callback, errback);
|
||||
},
|
||||
|
||||
currentSubgroupID: null,
|
||||
|
@ -183,6 +184,23 @@
|
|||
if (litmus.currentSubgroupID != 0)
|
||||
litmus.getSubgroup(litmus.currentSubgroupID, function(subgroup) {litmus.statePopulateFields(subgroup); litmus.undisableAll();});
|
||||
},
|
||||
loadStats : function() {
|
||||
// pull new user statistics from litmus
|
||||
var url = litmus.baseURL+'json.cgi?' + 'user_stats=' + qaPref.litmus.getUsername();
|
||||
var req = loadJSONDoc(url);
|
||||
req.addCallback(function(data) {
|
||||
litmus.userStats = data;
|
||||
litmus.displayStats();
|
||||
});
|
||||
},
|
||||
displayStats : function() {
|
||||
var statbox = $('qa-litmus-stats');
|
||||
if (litmus.userStats != '') {
|
||||
var statline = qaMain.bundle.getFormattedString('qa.extension.litmus.stats',
|
||||
[litmus.userStats.week, litmus.userStats.month, litmus.userStats.alltime]);
|
||||
statbox.value = statline;
|
||||
}
|
||||
},
|
||||
checkRadioButtons : function() {
|
||||
var menu = document.getElementById('testlist');
|
||||
if (menu.selectedIndex == -1) return;
|
||||
|
@ -315,7 +333,11 @@
|
|||
}));
|
||||
|
||||
var callback = function(resp) {
|
||||
|
||||
// increment the stat counters:
|
||||
for (var i in litmus.userStats) {
|
||||
litmus.userStats[i]++;
|
||||
}
|
||||
litmus.displayStats();
|
||||
};
|
||||
|
||||
var errback = function(resp) {
|
||||
|
@ -397,8 +419,10 @@ Sysconfig.prototype = {
|
|||
|
||||
// platform:
|
||||
if (! this.platform) {
|
||||
if ((/^Mac/).exec(navigator.platform)) {
|
||||
this.platform = 'Mac';
|
||||
if ((/^MacPPC/).exec(navigator.platform)) {
|
||||
this.platform = 'Mac (PPC)';
|
||||
} else if ((/^MacIntel/).exec(navigator.platform)) {
|
||||
this.platform = 'Mac (Intel)';
|
||||
} else if ((/^Win/).exec(navigator.platform)) {
|
||||
this.platform = 'Windows';
|
||||
} else if ((/^Linux/).exec(navigator.platform)) {
|
||||
|
@ -432,7 +456,7 @@ Sysconfig.prototype = {
|
|||
}
|
||||
} else if (this.platform == 'Linux') {
|
||||
this.opsys = 'Linux';
|
||||
} else if (this.platform == 'Mac') {
|
||||
} else if (this.platform == 'Mac (PPC)' || this.platform == 'Mac (Intel)') {
|
||||
// no way to detect the OS on mac, so just assume
|
||||
// it's 10.4. The user can provide the real OS in setup
|
||||
this.opsys = 'Mac OS 10.4';
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
]>
|
||||
|
||||
<overlay id="qa-litmus-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<tabpanel id="qa-tab-litmus" onload="litmus.readStateFromPref()">
|
||||
<tabpanel id="qa-tab-litmus" onload="litmus.readStateFromPref();">
|
||||
|
||||
<vbox align="start" pack="start">
|
||||
<hbox align="start" pack="start">
|
||||
|
@ -108,6 +108,10 @@
|
|||
<button id="qa-mainwindow-previousButton" label="Previous" oncommand="litmus.prevButton()"/>
|
||||
<button id="qa-mainwindow-nextButton" label="Next (Submit)" oncommand="litmus.nextButton()"/>
|
||||
</hbox>
|
||||
<label id="qa-litmus-stats" value="" />
|
||||
<script type="application/x-javascript">
|
||||
this.addEventListener('load', litmus.loadStats, false);
|
||||
</script>
|
||||
</vbox>
|
||||
</tabpanel>
|
||||
|
||||
|
|
|
@ -5,4 +5,5 @@ qa.extension.prefs.savedMsg = Your settings have been saved
|
|||
qa.extension.sysconfig.loadingMsg = Loading menu options...
|
||||
qa.extension.loading = Loading...
|
||||
|
||||
qa.extension.litmus.progress = Test %1$S of %2$S
|
||||
qa.extension.litmus.progress = Test %1$S of %2$S
|
||||
qa.extension.litmus.stats = My tests run - week: %1$S, month: %2$S, all time: %3$S
|
Загрузка…
Ссылка в новой задаче