build/mobile/robocop/FennecTalosAssert.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/mobile/robocop/FennecTalosAssert.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +package org.mozilla.gecko;
     1.9 +
    1.10 +
    1.11 +public class FennecTalosAssert implements Assert {
    1.12 +
    1.13 +    public FennecTalosAssert() { }
    1.14 +
    1.15 +    /**
    1.16 +     *  Write information to a logfile and logcat
    1.17 +     */
    1.18 +    public void dumpLog(String message) {
    1.19 +        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message);
    1.20 +    }
    1.21 +
    1.22 +    /** Write information to a logfile and logcat */
    1.23 +    public void dumpLog(String message, Throwable t) {
    1.24 +        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t);
    1.25 +    }
    1.26 +
    1.27 +    /**
    1.28 +     *  Set the filename used for dumpLog.
    1.29 +     */
    1.30 +    public void setLogFile(String filename) {
    1.31 +        FennecNativeDriver.setLogFile(filename);
    1.32 +    }
    1.33 +
    1.34 +    public void setTestName(String testName) { }
    1.35 +
    1.36 +    public void endTest() { }
    1.37 +
    1.38 +    public void ok(boolean condition, String name, String diag) {
    1.39 +        if (!condition) {
    1.40 +            dumpLog("__FAIL" + name + ": " + diag + "__FAIL");
    1.41 +        }
    1.42 +    }
    1.43 +
    1.44 +    public void is(Object actual, Object expected, String name) {
    1.45 +        boolean pass = (actual == null ? expected == null : actual.equals(expected));
    1.46 +        ok(pass, name, "got " + actual + ", expected " + expected);
    1.47 +    }
    1.48 +
    1.49 +    public void isnot(Object actual, Object notExpected, String name) {
    1.50 +        boolean fail = (actual == null ? notExpected == null : actual.equals(notExpected));
    1.51 +        ok(!fail, name, "got " + actual + ", expected not " + notExpected);
    1.52 +    }
    1.53 +
    1.54 +    public void ispixel(int actual, int r, int g, int b, String name) {
    1.55 +        throw new UnsupportedOperationException();
    1.56 +    }
    1.57 +
    1.58 +    public void isnotpixel(int actual, int r, int g, int b, String name) {
    1.59 +        throw new UnsupportedOperationException();
    1.60 +    }
    1.61 +
    1.62 +    public void todo(boolean condition, String name, String diag) {
    1.63 +        throw new UnsupportedOperationException();
    1.64 +    }
    1.65 +
    1.66 +    public void todo_is(Object actual, Object expected, String name) {
    1.67 +        throw new UnsupportedOperationException();
    1.68 +    }
    1.69 +    
    1.70 +    public void todo_isnot(Object actual, Object notExpected, String name) {
    1.71 +        throw new UnsupportedOperationException();
    1.72 +    }
    1.73 +
    1.74 +    public void info(String name, String message) {
    1.75 +        dumpLog(name + ": " + message);
    1.76 +    }
    1.77 +}

mercurial