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
authorPhil Hoffman <mrphilh@gmail.com>
Tue, 07 Jan 2014 13:57:36 -0500
changeset 162550 b46d73d9f7150adaf415ca4fd2100f1655cbac66
parent 162549 c7136dd407a6f1a02c4bf99b47cd6bfbf94a1199
child 162551 63d31c0367e9268ef94b185d7eba5e99c46b6d1a
push id25959
push userryanvm@gmail.com
push dateWed, 08 Jan 2014 20:28:56 +0000
treeherdermozilla-central@9ca0f64ee634 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs948087
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
mobile/android/base/tests/UITest.java
mobile/android/base/tests/UITestContext.java
mobile/android/base/tests/components/AboutHomeComponent.java
mobile/android/base/tests/helpers/WaitHelper.java
--- a/mobile/android/base/tests/UITest.java
+++ b/mobile/android/base/tests/UITest.java
@@ -140,23 +140,23 @@ abstract class UITest extends ActivityIn
     }
 
     @Override
     public Actions getActions() {
         return mActions;
     }
 
     @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
     public BaseComponent getComponent(final ComponentType type) {
         switch (type) {
             case ABOUTHOME:
                 return mAboutHome;
 
--- a/mobile/android/base/tests/UITestContext.java
+++ b/mobile/android/base/tests/UITestContext.java
@@ -26,18 +26,18 @@ public interface UITestContext {
 
     public Activity getActivity();
     public Solo getSolo();
     public Assert getAsserter();
     public Driver getDriver();
     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.
      */
     public String getAbsoluteHostnameUrl(final String url);
 
     /**
      * Returns the absolute version of the given URL using the host's IP address.
--- a/mobile/android/base/tests/components/AboutHomeComponent.java
+++ b/mobile/android/base/tests/components/AboutHomeComponent.java
@@ -17,16 +17,18 @@ import com.jayway.android.robotium.solo.
 import android.support.v4.view.PagerAdapter;
 import android.support.v4.view.ViewPager;
 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,
         TOP_SITES,
         BOOKMARKS,
         READING_LIST
     }
 
@@ -77,23 +79,23 @@ public class AboutHomeComponent extends 
 
     public AboutHomeComponent assertVisible() {
         assertEquals("The HomePager is visible",
                      View.VISIBLE, getHomePagerView().getVisibility());
         return this;
     }
 
     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;
     }
 
     private void swipeToPage(final int pageDirection) {
         assertTrue("Swiping in a vaild direction",
                 pageDirection == Solo.LEFT || pageDirection == Solo.RIGHT);
         assertVisible();
--- a/mobile/android/base/tests/helpers/WaitHelper.java
+++ b/mobile/android/base/tests/helpers/WaitHelper.java
@@ -100,17 +100,17 @@ public final class WaitHelper {
             // on and let the assertions fail if applicable.
             final boolean hasTimedOut = !sSolo.waitForCondition(new Condition() {
                 @Override
                 public boolean isSatisfied() {
                     return verifier.hasStateChanged();
                 }
             }, CHANGE_WAIT_MS);
 
-            sContext.dumpLog(verifier.getLogTag() +
+            sContext.dumpLog(verifier.getLogTag(),
                     (hasTimedOut ? "timed out." : "was satisfied."));
         }
     }
 
     /**
      * Implementations of this interface verify that the state of the test has changed from
      * the invocation of storeState to the invocation of hasStateChanged. A boolean will be
      * returned from hasStateChanged, indicating this change of status.
@@ -124,33 +124,32 @@ public final class WaitHelper {
          * (with a timeout), this method could potentially store state inconsistent with
          * what is visible to the user.
          */
         public void storeState();
         public boolean hasStateChanged();
     }
 
     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}://");
 
         private CharSequence mOldTitleText;
 
         @Override
         public String getLogTag() {
             return LOGTAG;
         }
 
         @Override
         public void storeState() {
             mOldTitleText = sToolbar.getPotentiallyInconsistentTitle();
-            sContext.dumpLog(LOGTAG + "stored title, \"" + mOldTitleText + "\".");
+            sContext.dumpLog(LOGTAG, "stored title, \"" + mOldTitleText + "\".");
         }
 
         @Override
         public boolean hasStateChanged() {
             // TODO: Additionally, consider Solo.waitForText.
             // TODO: Robocop sleeps .5 sec between calls. Cache title view?
             final CharSequence title = sToolbar.getPotentiallyInconsistentTitle();
 
@@ -158,14 +157,14 @@ public final class WaitHelper {
             // HACK: We want to wait until the title changes to the state a tester may assert
             // (e.g. the page title). However, the title is set to the URL before the title is
             // loaded from the server and set as the final page title; we ignore the
             // intermediate URL loading state here.
             final boolean isLoading = LOADING_PREFIX.matcher(title).lookingAt();
             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;
         }
     }
 }