NativeDaemonConnectorTestpublic class NativeDaemonConnectorTest extends android.test.AndroidTestCase Tests for {@link NativeDaemonConnector}. |
Fields Summary |
---|
private static final String | TAG |
Methods Summary |
---|
public void | testArgumentNormal()
final StringBuilder builder = new StringBuilder();
builder.setLength(0);
appendEscaped(builder, "");
assertEquals("", builder.toString());
builder.setLength(0);
appendEscaped(builder, "foo");
assertEquals("foo", builder.toString());
builder.setLength(0);
appendEscaped(builder, "foo\"bar");
assertEquals("foo\\\"bar", builder.toString());
builder.setLength(0);
appendEscaped(builder, "foo\\bar\\\"baz");
assertEquals("foo\\\\bar\\\\\\\"baz", builder.toString());
| public void | testArgumentWithSpaces()
final StringBuilder builder = new StringBuilder();
builder.setLength(0);
appendEscaped(builder, "foo bar");
assertEquals("\"foo bar\"", builder.toString());
builder.setLength(0);
appendEscaped(builder, "foo\"bar\\baz foo");
assertEquals("\"foo\\\"bar\\\\baz foo\"", builder.toString());
| public void | testArgumentWithUtf()
final StringBuilder builder = new StringBuilder();
builder.setLength(0);
appendEscaped(builder, "caf\u00E9 c\u00F6ffee");
assertEquals("\"caf\u00E9 c\u00F6ffee\"", builder.toString());
| public void | testSensitiveArgs()
final StringBuilder rawBuilder = new StringBuilder();
final StringBuilder logBuilder = new StringBuilder();
rawBuilder.setLength(0);
logBuilder.setLength(0);
makeCommand(rawBuilder, logBuilder, 1, "foo", "bar", "baz");
assertEquals("1 foo bar baz\0", rawBuilder.toString());
assertEquals("1 foo bar baz", logBuilder.toString());
rawBuilder.setLength(0);
logBuilder.setLength(0);
makeCommand(rawBuilder, logBuilder, 1, "foo", new SensitiveArg("bar"), "baz");
assertEquals("1 foo bar baz\0", rawBuilder.toString());
assertEquals("1 foo [scrubbed] baz", logBuilder.toString());
rawBuilder.setLength(0);
logBuilder.setLength(0);
makeCommand(rawBuilder, logBuilder, 1, "foo", new SensitiveArg("foo bar"), "baz baz",
new SensitiveArg("wat"));
assertEquals("1 foo \"foo bar\" \"baz baz\" wat\0", rawBuilder.toString());
assertEquals("1 foo [scrubbed] \"baz baz\" [scrubbed]", logBuilder.toString());
|
|