Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | package org.mozilla.gecko; |
michael@0 | 6 | |
michael@0 | 7 | |
michael@0 | 8 | public class FennecTalosAssert implements Assert { |
michael@0 | 9 | |
michael@0 | 10 | public FennecTalosAssert() { } |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * Write information to a logfile and logcat |
michael@0 | 14 | */ |
michael@0 | 15 | public void dumpLog(String message) { |
michael@0 | 16 | FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | /** Write information to a logfile and logcat */ |
michael@0 | 20 | public void dumpLog(String message, Throwable t) { |
michael@0 | 21 | FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | /** |
michael@0 | 25 | * Set the filename used for dumpLog. |
michael@0 | 26 | */ |
michael@0 | 27 | public void setLogFile(String filename) { |
michael@0 | 28 | FennecNativeDriver.setLogFile(filename); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | public void setTestName(String testName) { } |
michael@0 | 32 | |
michael@0 | 33 | public void endTest() { } |
michael@0 | 34 | |
michael@0 | 35 | public void ok(boolean condition, String name, String diag) { |
michael@0 | 36 | if (!condition) { |
michael@0 | 37 | dumpLog("__FAIL" + name + ": " + diag + "__FAIL"); |
michael@0 | 38 | } |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | public void is(Object actual, Object expected, String name) { |
michael@0 | 42 | boolean pass = (actual == null ? expected == null : actual.equals(expected)); |
michael@0 | 43 | ok(pass, name, "got " + actual + ", expected " + expected); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | public void isnot(Object actual, Object notExpected, String name) { |
michael@0 | 47 | boolean fail = (actual == null ? notExpected == null : actual.equals(notExpected)); |
michael@0 | 48 | ok(!fail, name, "got " + actual + ", expected not " + notExpected); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | public void ispixel(int actual, int r, int g, int b, String name) { |
michael@0 | 52 | throw new UnsupportedOperationException(); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | public void isnotpixel(int actual, int r, int g, int b, String name) { |
michael@0 | 56 | throw new UnsupportedOperationException(); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | public void todo(boolean condition, String name, String diag) { |
michael@0 | 60 | throw new UnsupportedOperationException(); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | public void todo_is(Object actual, Object expected, String name) { |
michael@0 | 64 | throw new UnsupportedOperationException(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | public void todo_isnot(Object actual, Object notExpected, String name) { |
michael@0 | 68 | throw new UnsupportedOperationException(); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | public void info(String name, String message) { |
michael@0 | 72 | dumpLog(name + ": " + message); |
michael@0 | 73 | } |
michael@0 | 74 | } |