Bug 948087 - Add the LOGTAG to the log message produced by UITestContext.dumpLog() and update calls to this method to use the updated method declaration. r=mcomella

This commit is contained in:
Phil Hoffman 2014-01-07 13:57:36 -05:00
parent 0e73a0c9f6
commit ea325132a1
4 changed files with 14 additions and 13 deletions

View File

@ -145,13 +145,13 @@ abstract class UITest extends ActivityInstrumentationTestCase2<Activity>
}
@Override
public void dumpLog(final String message) {
mAsserter.dumpLog(message);
public void dumpLog(final String logtag, final String message) {
mAsserter.dumpLog(logtag + ": " + message);
}
@Override
public void dumpLog(final String message, final Throwable t) {
mAsserter.dumpLog(message, t);
public void dumpLog(final String logtag, final String message, final Throwable t) {
mAsserter.dumpLog(logtag + ": " + message, t);
}
@Override

View File

@ -31,8 +31,8 @@ public interface UITestContext {
public Actions getActions();
public Instrumentation getInstrumentation();
public void dumpLog(final String message);
public void dumpLog(final String message, final Throwable t);
public void dumpLog(final String logtag, final String message);
public void dumpLog(final String logtag, final String message, final Throwable t);
/**
* Returns the absolute version of the given URL using the host's hostname.

View File

@ -22,6 +22,8 @@ import android.view.View;
* A class representing any interactions that take place on the Awesomescreen.
*/
public class AboutHomeComponent extends BaseComponent {
private static final String LOGTAG = AboutHomeComponent.class.getSimpleName();
// The different types of pages that can be present on about:home
public enum PageType {
HISTORY,
@ -82,13 +84,13 @@ public class AboutHomeComponent extends BaseComponent {
}
public AboutHomeComponent swipeToPageOnRight() {
mTestContext.dumpLog("Swiping to the page on the right.");
mTestContext.dumpLog(LOGTAG, "Swiping to the page on the right.");
swipeToPage(Solo.RIGHT);
return this;
}
public AboutHomeComponent swipeToPageOnLeft() {
mTestContext.dumpLog("Swiping to the page on the left.");
mTestContext.dumpLog(LOGTAG, "Swiping to the page on the left.");
swipeToPage(Solo.LEFT);
return this;
}

View File

@ -105,7 +105,7 @@ public final class WaitHelper {
}
}, CHANGE_WAIT_MS);
sContext.dumpLog(verifier.getLogTag() +
sContext.dumpLog(verifier.getLogTag(),
(hasTimedOut ? "timed out." : "was satisfied."));
}
}
@ -129,8 +129,7 @@ public final class WaitHelper {
}
private static class ToolbarTitleTextChangeVerifier implements ChangeVerifier {
private static final String LOGTAG =
ToolbarTitleTextChangeVerifier.class.getSimpleName() + ": ";
private static final String LOGTAG = ToolbarTitleTextChangeVerifier.class.getSimpleName();
// A regex that matches the page title that shows up while the page is loading.
private static final Pattern LOADING_PREFIX = Pattern.compile("[A-Za-z]{3,9}://");
@ -145,7 +144,7 @@ public final class WaitHelper {
@Override
public void storeState() {
mOldTitleText = sToolbar.getPotentiallyInconsistentTitle();
sContext.dumpLog(LOGTAG + "stored title, \"" + mOldTitleText + "\".");
sContext.dumpLog(LOGTAG, "stored title, \"" + mOldTitleText + "\".");
}
@Override
@ -163,7 +162,7 @@ public final class WaitHelper {
final boolean hasStateChanged = !isLoading && !mOldTitleText.equals(title);
if (hasStateChanged) {
sContext.dumpLog(LOGTAG + "state changed to title, \"" + title + "\".");
sContext.dumpLog(LOGTAG, "state changed to title, \"" + title + "\".");
}
return hasStateChanged;
}