| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.test.suitebuilder.annotation.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
| 8 import android.view.KeyEvent; | 8 import android.view.KeyEvent; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
| 11 | 11 |
| 12 import org.chromium.base.test.util.Feature; | 12 import org.chromium.base.test.util.Feature; |
| 13 import org.chromium.base.test.util.RetryOnFailure; |
| 13 import org.chromium.base.test.util.UrlUtils; | 14 import org.chromium.base.test.util.UrlUtils; |
| 14 import org.chromium.content.browser.test.util.Criteria; | 15 import org.chromium.content.browser.test.util.Criteria; |
| 15 import org.chromium.content.browser.test.util.CriteriaHelper; | 16 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 16 import org.chromium.content.browser.test.util.DOMUtils; | 17 import org.chromium.content.browser.test.util.DOMUtils; |
| 17 import org.chromium.content_shell_apk.ContentShellTestBase; | 18 import org.chromium.content_shell_apk.ContentShellTestBase; |
| 18 | 19 |
| 19 import java.util.concurrent.TimeoutException; | 20 import java.util.concurrent.TimeoutException; |
| 20 | 21 |
| 21 /** | 22 /** |
| 22 * Class which provides test coverage for Popup Zoomer. | 23 * Class which provides test coverage for Popup Zoomer. |
| 23 */ | 24 */ |
| 25 @RetryOnFailure |
| 24 public class ContentViewPopupZoomerTest extends ContentShellTestBase { | 26 public class ContentViewPopupZoomerTest extends ContentShellTestBase { |
| 25 private static PopupZoomer findPopupZoomer(ViewGroup view) { | 27 private static PopupZoomer findPopupZoomer(ViewGroup view) { |
| 26 assert view != null; | 28 assert view != null; |
| 27 for (int i = 0; i < view.getChildCount(); i++) { | 29 for (int i = 0; i < view.getChildCount(); i++) { |
| 28 View child = view.getChildAt(i); | 30 View child = view.getChildAt(i); |
| 29 if (child instanceof PopupZoomer) return (PopupZoomer) child; | 31 if (child instanceof PopupZoomer) return (PopupZoomer) child; |
| 30 } | 32 } |
| 31 return null; | 33 return null; |
| 32 } | 34 } |
| 33 | 35 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 final ViewGroup view = viewCore.getContainerView(); | 118 final ViewGroup view = viewCore.getContainerView(); |
| 117 | 119 |
| 118 CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view,
false)); | 120 CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view,
false)); |
| 119 DOMUtils.clickNode(this, viewCore, "clickme"); | 121 DOMUtils.clickNode(this, viewCore, "clickme"); |
| 120 CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view,
true)); | 122 CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view,
true)); |
| 121 sendKeys(KeyEvent.KEYCODE_BACK); | 123 sendKeys(KeyEvent.KEYCODE_BACK); |
| 122 // When device key is pressed, popup zoomer should hide if already showi
ng. | 124 // When device key is pressed, popup zoomer should hide if already showi
ng. |
| 123 CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view,
false)); | 125 CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view,
false)); |
| 124 } | 126 } |
| 125 } | 127 } |
| OLD | NEW |