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