OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.content.Context; | 7 import android.content.Context; |
8 import android.support.test.InstrumentationRegistry; | 8 import android.support.test.InstrumentationRegistry; |
9 import android.support.test.filters.LargeTest; | 9 import android.support.test.filters.LargeTest; |
10 import android.util.SparseArray; | 10 import android.util.SparseArray; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // On Svelte devices the background tab would not be loaded auto
matically, so | 187 // On Svelte devices the background tab would not be loaded auto
matically, so |
188 // trigger the load manually. | 188 // trigger the load manually. |
189 tabs[1].show(TabSelectionType.FROM_USER); | 189 tabs[1].show(TabSelectionType.FROM_USER); |
190 tabs[1].hide(); | 190 tabs[1].hide(); |
191 } | 191 } |
192 }); | 192 }); |
193 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); | 193 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); |
194 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); | 194 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); |
195 | 195 |
196 // Wait for the new tab animations on phones to finish. | 196 // Wait for the new tab animations on phones to finish. |
197 if (!DeviceFormFactor.isTablet(mActivityTestRule.getActivity())) { | 197 if (!DeviceFormFactor.isTablet()) { |
198 final ChromeActivity activity = mActivityTestRule.getActivity(); | 198 final ChromeActivity activity = mActivityTestRule.getActivity(); |
199 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ | 199 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ |
200 @Override | 200 @Override |
201 public boolean isSatisfied() { | 201 public boolean isSatisfied() { |
202 Layout layout = activity.getCompositorViewHolder() | 202 Layout layout = activity.getCompositorViewHolder() |
203 .getLayoutManager().getActiveLayout(); | 203 .getLayoutManager().getActiveLayout(); |
204 return !layout.isLayoutAnimating(); | 204 return !layout.isLayoutAnimating(); |
205 } | 205 } |
206 }); | 206 }); |
207 } | 207 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // On Svelte devices the background tab would not be loaded auto
matically, so | 260 // On Svelte devices the background tab would not be loaded auto
matically, so |
261 // trigger the load manually. | 261 // trigger the load manually. |
262 tabs[1].show(TabSelectionType.FROM_USER); | 262 tabs[1].show(TabSelectionType.FROM_USER); |
263 tabs[1].hide(); | 263 tabs[1].hide(); |
264 } | 264 } |
265 }); | 265 }); |
266 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); | 266 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); |
267 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); | 267 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); |
268 | 268 |
269 // Wait for the new tab animations on phones to finish. | 269 // Wait for the new tab animations on phones to finish. |
270 if (!DeviceFormFactor.isTablet(mActivityTestRule.getActivity())) { | 270 if (!DeviceFormFactor.isTablet()) { |
271 final ChromeActivity activity = mActivityTestRule.getActivity(); | 271 final ChromeActivity activity = mActivityTestRule.getActivity(); |
272 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ | 272 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ |
273 @Override | 273 @Override |
274 public boolean isSatisfied() { | 274 public boolean isSatisfied() { |
275 Layout layout = activity.getCompositorViewHolder() | 275 Layout layout = activity.getCompositorViewHolder() |
276 .getLayoutManager().getActiveLayout(); | 276 .getLayoutManager().getActiveLayout(); |
277 return !layout.isLayoutAnimating(); | 277 return !layout.isLayoutAnimating(); |
278 } | 278 } |
279 }); | 279 }); |
280 } | 280 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 mTestServer.stopAndDestroyServer(); | 561 mTestServer.stopAndDestroyServer(); |
562 } | 562 } |
563 | 563 |
564 /** | 564 /** |
565 * @return the index of the given tab in the current tab model | 565 * @return the index of the given tab in the current tab model |
566 */ | 566 */ |
567 private int indexOf(Tab tab) { | 567 private int indexOf(Tab tab) { |
568 return mActivityTestRule.getActivity().getCurrentTabModel().indexOf(tab)
; | 568 return mActivityTestRule.getActivity().getCurrentTabModel().indexOf(tab)
; |
569 } | 569 } |
570 } | 570 } |
OLD | NEW |