| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 | 9 |
| 10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 }); | 106 }); |
| 107 TouchCommon.singleClickView(infobar.getView().findViewById(R.id.button_p
rimary)); | 107 TouchCommon.singleClickView(infobar.getView().findViewById(R.id.button_p
rimary)); |
| 108 | 108 |
| 109 // Document mode popups appear slowly and sequentially to prevent Androi
d from throwing them | 109 // Document mode popups appear slowly and sequentially to prevent Androi
d from throwing them |
| 110 // away, so use a long timeout. http://crbug.com/498920. | 110 // away, so use a long timeout. http://crbug.com/498920. |
| 111 CriteriaHelper.pollUiThread(new Criteria() { | 111 CriteriaHelper.pollUiThread(new Criteria() { |
| 112 @Override | 112 @Override |
| 113 public boolean isSatisfied() { | 113 public boolean isSatisfied() { |
| 114 if (getNumInfobarsShowing() != 0) return false; | 114 if (getNumInfobarsShowing() != 0) return false; |
| 115 return TextUtils.equals("Popup #3", selector.getCurrentTab().get
Title()); | 115 return TextUtils.equals("Three", selector.getCurrentTab().getTit
le()); |
| 116 } | 116 } |
| 117 }, 7500, CriteriaHelper.DEFAULT_POLLING_INTERVAL); | 117 }, 7500, CriteriaHelper.DEFAULT_POLLING_INTERVAL); |
| 118 | 118 |
| 119 assertEquals(4, selector.getTotalTabCount()); | 119 assertEquals(4, selector.getTotalTabCount()); |
| 120 int currentTabId = selector.getCurrentTab().getId(); | 120 int currentTabId = selector.getCurrentTab().getId(); |
| 121 | 121 |
| 122 // Test that revisiting the original page makes popup windows immediatel
y. | 122 // Test that revisiting the original page makes popup windows immediatel
y. |
| 123 loadUrl(mPopupHtmlUrl); | 123 loadUrl(mPopupHtmlUrl); |
| 124 CriteriaHelper.pollUiThread(new Criteria() { | 124 CriteriaHelper.pollUiThread(new Criteria() { |
| 125 @Override | 125 @Override |
| 126 public boolean isSatisfied() { | 126 public boolean isSatisfied() { |
| 127 if (getNumInfobarsShowing() != 0) return false; | 127 if (getNumInfobarsShowing() != 0) return false; |
| 128 if (selector.getTotalTabCount() != 7) return false; | 128 if (selector.getTotalTabCount() != 7) return false; |
| 129 return TextUtils.equals("Popup #3", selector.getCurrentTab().get
Title()); | 129 return TextUtils.equals("Three", selector.getCurrentTab().getTit
le()); |
| 130 } | 130 } |
| 131 }, 7500, CriteriaHelper.DEFAULT_POLLING_INTERVAL); | 131 }, 7500, CriteriaHelper.DEFAULT_POLLING_INTERVAL); |
| 132 assertNotSame(currentTabId, selector.getCurrentTab().getId()); | 132 assertNotSame(currentTabId, selector.getCurrentTab().getId()); |
| 133 } | 133 } |
| 134 } | 134 } |
| OLD | NEW |