michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko; michael@0: michael@0: michael@0: public class FennecTalosAssert implements Assert { michael@0: michael@0: public FennecTalosAssert() { } michael@0: michael@0: /** michael@0: * Write information to a logfile and logcat michael@0: */ michael@0: public void dumpLog(String message) { michael@0: FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message); michael@0: } michael@0: michael@0: /** Write information to a logfile and logcat */ michael@0: public void dumpLog(String message, Throwable t) { michael@0: FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t); michael@0: } michael@0: michael@0: /** michael@0: * Set the filename used for dumpLog. michael@0: */ michael@0: public void setLogFile(String filename) { michael@0: FennecNativeDriver.setLogFile(filename); michael@0: } michael@0: michael@0: public void setTestName(String testName) { } michael@0: michael@0: public void endTest() { } michael@0: michael@0: public void ok(boolean condition, String name, String diag) { michael@0: if (!condition) { michael@0: dumpLog("__FAIL" + name + ": " + diag + "__FAIL"); michael@0: } michael@0: } michael@0: michael@0: public void is(Object actual, Object expected, String name) { michael@0: boolean pass = (actual == null ? expected == null : actual.equals(expected)); michael@0: ok(pass, name, "got " + actual + ", expected " + expected); michael@0: } michael@0: michael@0: public void isnot(Object actual, Object notExpected, String name) { michael@0: boolean fail = (actual == null ? notExpected == null : actual.equals(notExpected)); michael@0: ok(!fail, name, "got " + actual + ", expected not " + notExpected); michael@0: } michael@0: michael@0: public void ispixel(int actual, int r, int g, int b, String name) { michael@0: throw new UnsupportedOperationException(); michael@0: } michael@0: michael@0: public void isnotpixel(int actual, int r, int g, int b, String name) { michael@0: throw new UnsupportedOperationException(); michael@0: } michael@0: michael@0: public void todo(boolean condition, String name, String diag) { michael@0: throw new UnsupportedOperationException(); michael@0: } michael@0: michael@0: public void todo_is(Object actual, Object expected, String name) { michael@0: throw new UnsupportedOperationException(); michael@0: } michael@0: michael@0: public void todo_isnot(Object actual, Object notExpected, String name) { michael@0: throw new UnsupportedOperationException(); michael@0: } michael@0: michael@0: public void info(String name, String message) { michael@0: dumpLog(name + ": " + message); michael@0: } michael@0: }