Bug 775071 - Fix testCheck3 to abort the test if the disableScreenshto function fails. r=gbrown

This commit is contained in:
Kartikaya Gupta 2012-07-19 14:18:42 -04:00
Родитель a531b1a327
Коммит 6311af7ab1
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -15,7 +15,13 @@ public class testCheck3 extends PixelTest {
// Disable Fennec's low-res screenshot for the duration of this test;
// this distinguishes this test from testCheck2, which is otherwise
// identical.
disableScreenshot();
if (!disableScreenshot()) {
// if disabling the screenshot fails, there is no point in running
// this test, so abort. the lack of __start_report output from the
// end of the test should get picked up as an error by the talos
// harness.
return;
}
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
loadAndPaint(url);
@ -55,12 +61,13 @@ public class testCheck3 extends PixelTest {
mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
}
private void disableScreenshot() {
private boolean disableScreenshot() {
try {
ClassLoader classLoader = getActivity().getClassLoader();
Class appshell = classLoader.loadClass("org.mozilla.gecko.GeckoAppShell");
Method disableScreenshotMethod = appshell.getMethod("disableScreenshot");
disableScreenshotMethod.invoke(null);
return true;
} catch (ClassNotFoundException ex) {
mAsserter.ok(false, "Error getting class", ex.toString());
} catch (IllegalAccessException ex) {
@ -70,5 +77,6 @@ public class testCheck3 extends PixelTest {
} catch (java.lang.reflect.InvocationTargetException ex) {
mAsserter.ok(false, "Error invoking method", ex.toString());
}
return false;
}
}