| Index: chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java
|
| diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java
|
| index abbdc747d0d19c2503f807bc8465040420586a89..a0635e399c28a204be59becb1d9c62b498d57220 100644
|
| --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java
|
| +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java
|
| @@ -87,6 +87,7 @@ public class ContextMenuUtils {
|
| * @param tab The tab to open a context menu for.
|
| * @param openerDOMNodeId The DOM node to long press to open the context menu for.
|
| * @param itemId The context menu item ID to select.
|
| + * @param activity The activity to assert for gaining focus after click or null.
|
| * @throws InterruptedException
|
| * @throws TimeoutException
|
| */
|
| @@ -103,6 +104,7 @@ public class ContextMenuUtils {
|
| * @param jsCode The javascript to get the DOM node to long press
|
| * to open the context menu for.
|
| * @param itemId The context menu item ID to select.
|
| + * @param activity The activity to assert for gaining focus after click or null.
|
| * @throws InterruptedException
|
| * @throws TimeoutException
|
| */
|
| @@ -157,11 +159,14 @@ public class ContextMenuUtils {
|
| }
|
| });
|
|
|
| - CriteriaHelper.pollInstrumentationThread(new Criteria("Activity did not regain focus.") {
|
| - @Override
|
| - public boolean isSatisfied() {
|
| - return activity.hasWindowFocus();
|
| - }
|
| - });
|
| + if (activity != null) {
|
| + CriteriaHelper.pollInstrumentationThread(
|
| + new Criteria("Activity did not regain focus.") {
|
| + @Override
|
| + public boolean isSatisfied() {
|
| + return activity.hasWindowFocus();
|
| + }
|
| + });
|
| + }
|
| }
|
| }
|
|
|