Bug 711692 - Intermittent service callback log failure fix. r=rstrong.

This commit is contained in:
Brian R. Bondy 2012-01-04 23:19:18 -05:00
Родитель 935e72a826
Коммит b5dfde2fac
1 изменённых файлов: 16 добавлений и 6 удалений

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

@ -645,12 +645,12 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus,
updater.copyTo(applyToUpdater, UPDATER_BIN_FILE);
}
// We can't get sync behavior here since Firefox does not wait for the
// process launched through the service to finish. Since the service
// launches the updater in the background, providing an observer argument
// doesn't solve anything either, so we will rely on watching the
// update.status file instead.
process.runAsync(args, args.length);
// Firefox does not wait for the service command to finish, but
// we still launch the process sync to avoid intemittent failures with
// the log file not being written out yet.
// We will rely on watching the update.status file and waiting for the service
// to stop to know the service command is done.
process.run(true, args, args.length);
resetEnvironment();
@ -1165,6 +1165,16 @@ function checkCallbackServiceLog() {
let logFile = AUS_Cc["@mozilla.org/file/local;1"].createInstance(AUS_Ci.nsILocalFile);
logFile.initWithPath(gServiceLaunchedCallbackLog);
let logContents = readFile(logFile);
// It is possible for the log file contents check to occur before the log file
// contents are completely written so wait until the contents are the expected
// value. If the contents are never the expected value then the test will
// fail by timing out.
if (logContents != expectedLogContents) {
logTestInfo("callback service log not expected value, waiting longer");
do_timeout(TEST_HELPER_TIMEOUT, checkCallbackServiceLog);
return;
}
logTestInfo("testing that the callback application successfully launched " +
"and the expected command line arguments passed to it");