diff options
author | Kevin Jin <kjin@google.com> | 2013-09-05 11:09:59 -0700 |
---|---|---|
committer | Kevin Jin <kjin@google.com> | 2013-09-05 11:22:37 -0700 |
commit | a5bb27d69e8501b7c8321b838646d0b8f6fa0d05 (patch) | |
tree | 871ecc52ecf955b7313d1946c1294558737061b6 /src | |
parent | e4de29ac873c9e0ffaec34832dcc8b120850d8f7 (diff) | |
download | droiddriver-a5bb27d69e8501b7c8321b838646d0b8f6fa0d05.tar.gz |
cosmetic changes for JavaDoc and logging for scroll
Change-Id: I5bf1044c51b642d682d4a0b3b4dc18aabe3a12cd
Diffstat (limited to 'src')
3 files changed, 15 insertions, 4 deletions
diff --git a/src/com/google/android/droiddriver/UiDevice.java b/src/com/google/android/droiddriver/UiDevice.java index 682409e..d55689a 100644 --- a/src/com/google/android/droiddriver/UiDevice.java +++ b/src/com/google/android/droiddriver/UiDevice.java @@ -45,6 +45,11 @@ public interface UiDevice { /** * Takes a screenshot of current window and stores it in {@code path} as PNG. + * <p> + * If this is used in a test which extends + * {@link android.test.ActivityInstrumentationTestCase2}, call this before + * {@code tearDown()} because {@code tearDown()} finishes activities created + * by {@link android.test.ActivityInstrumentationTestCase2#getActivity()}. * * @param path the path of file to save screenshot * @return true if screen shot is created successfully diff --git a/src/com/google/android/droiddriver/scroll/DynamicSentinelStrategy.java b/src/com/google/android/droiddriver/scroll/DynamicSentinelStrategy.java index 7970e26..488b231 100644 --- a/src/com/google/android/droiddriver/scroll/DynamicSentinelStrategy.java +++ b/src/com/google/android/droiddriver/scroll/DynamicSentinelStrategy.java @@ -97,11 +97,14 @@ public class DynamicSentinelStrategy extends AbstractSentinelStrategy { } String newString = getUniqueStringFromSentinel(newSentinel); - // If newString is null, newSentinel must be partially shown. In this case - // we return true to allow further scrolling. But program error could also - // cause this, e.g. a bad choice of GetStrategy. log for debugging. + // A legitimate case for newString being null is when newSentinel is + // partially shown. We return true to allow further scrolling. But program + // error could also cause this, e.g. a bad choice of GetStrategy, which + // results in unnecessary scroll actions that have no visual effect. This + // log helps troubleshooting in the latter case. if (newString == null) { - Logs.logfmt(Log.WARN, "Unique String under sentinel %s is null", newSentinel); + Logs.logfmt(Log.WARN, "Unique String is null: sentinel=%s, uniqueStringFinder=%s", + newSentinel, uniqueStringFinder); return true; } if (newString.equals(getUniqueStringFromSentinel(oldSentinel))) { diff --git a/src/com/google/android/droiddriver/uiautomation/UiAutomationDriver.java b/src/com/google/android/droiddriver/uiautomation/UiAutomationDriver.java index f9c7578..49b04ac 100644 --- a/src/com/google/android/droiddriver/uiautomation/UiAutomationDriver.java +++ b/src/com/google/android/droiddriver/uiautomation/UiAutomationDriver.java @@ -26,6 +26,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import com.google.android.droiddriver.base.BaseDroidDriver; import com.google.android.droiddriver.exceptions.TimeoutException; +import com.google.android.droiddriver.util.Logs; import com.google.common.primitives.Longs; /** @@ -89,6 +90,7 @@ public class UiAutomationDriver extends BaseDroidDriver { * clear the AccessibilityNodeInfoCache. */ public void clearAccessibilityNodeInfoCache() { + Logs.call(this, "clearAccessibilityNodeInfoCache"); uiDevice.sleep(); uiDevice.wakeUp(); } @@ -100,6 +102,7 @@ public class UiAutomationDriver extends BaseDroidDriver { * discretion. */ public void clearAccessibilityNodeInfoCacheHack() { + Logs.call(this, "clearAccessibilityNodeInfoCacheHack"); AccessibilityManager accessibilityManager = (AccessibilityManager) context.getInstrumentation().getTargetContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); |