| 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.test.MoreAsserts; | 10 import android.test.MoreAsserts; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // On Svelte devices the background tab would not be loaded auto
matically, so | 197 // On Svelte devices the background tab would not be loaded auto
matically, so |
| 198 // trigger the load manually. | 198 // trigger the load manually. |
| 199 tabs[1].show(TabSelectionType.FROM_USER); | 199 tabs[1].show(TabSelectionType.FROM_USER); |
| 200 tabs[1].hide(); | 200 tabs[1].hide(); |
| 201 } | 201 } |
| 202 }); | 202 }); |
| 203 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); | 203 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); |
| 204 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); | 204 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); |
| 205 | 205 |
| 206 // Wait for the new tab animations on phones to finish. | 206 // Wait for the new tab animations on phones to finish. |
| 207 if (!DeviceFormFactor.isTablet(mActivityTestRule.getActivity())) { | 207 if (!DeviceFormFactor.isTablet()) { |
| 208 final ChromeActivity activity = mActivityTestRule.getActivity(); | 208 final ChromeActivity activity = mActivityTestRule.getActivity(); |
| 209 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ | 209 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ |
| 210 @Override | 210 @Override |
| 211 public boolean isSatisfied() { | 211 public boolean isSatisfied() { |
| 212 Layout layout = activity.getCompositorViewHolder() | 212 Layout layout = activity.getCompositorViewHolder() |
| 213 .getLayoutManager().getActiveLayout(); | 213 .getLayoutManager().getActiveLayout(); |
| 214 return !layout.isLayoutAnimating(); | 214 return !layout.isLayoutAnimating(); |
| 215 } | 215 } |
| 216 }); | 216 }); |
| 217 } | 217 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // On Svelte devices the background tab would not be loaded auto
matically, so | 270 // On Svelte devices the background tab would not be loaded auto
matically, so |
| 271 // trigger the load manually. | 271 // trigger the load manually. |
| 272 tabs[1].show(TabSelectionType.FROM_USER); | 272 tabs[1].show(TabSelectionType.FROM_USER); |
| 273 tabs[1].hide(); | 273 tabs[1].hide(); |
| 274 } | 274 } |
| 275 }); | 275 }); |
| 276 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); | 276 ChromeTabUtils.waitForTabPageLoaded(tabs[0], mTestServer.getURL(FILE_PAT
H)); |
| 277 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); | 277 ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PAT
H)); |
| 278 | 278 |
| 279 // Wait for the new tab animations on phones to finish. | 279 // Wait for the new tab animations on phones to finish. |
| 280 if (!DeviceFormFactor.isTablet(mActivityTestRule.getActivity())) { | 280 if (!DeviceFormFactor.isTablet()) { |
| 281 final ChromeActivity activity = mActivityTestRule.getActivity(); | 281 final ChromeActivity activity = mActivityTestRule.getActivity(); |
| 282 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ | 282 CriteriaHelper.pollUiThread(new Criteria("Did not finish animation")
{ |
| 283 @Override | 283 @Override |
| 284 public boolean isSatisfied() { | 284 public boolean isSatisfied() { |
| 285 Layout layout = activity.getCompositorViewHolder() | 285 Layout layout = activity.getCompositorViewHolder() |
| 286 .getLayoutManager().getActiveLayout(); | 286 .getLayoutManager().getActiveLayout(); |
| 287 return !layout.isLayoutAnimating(); | 287 return !layout.isLayoutAnimating(); |
| 288 } | 288 } |
| 289 }); | 289 }); |
| 290 } | 290 } |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 mTestServer.stopAndDestroyServer(); | 665 mTestServer.stopAndDestroyServer(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 /** | 668 /** |
| 669 * @return the index of the given tab in the current tab model | 669 * @return the index of the given tab in the current tab model |
| 670 */ | 670 */ |
| 671 private int indexOf(Tab tab) { | 671 private int indexOf(Tab tab) { |
| 672 return mActivityTestRule.getActivity().getCurrentTabModel().indexOf(tab)
; | 672 return mActivityTestRule.getActivity().getCurrentTabModel().indexOf(tab)
; |
| 673 } | 673 } |
| 674 } | 674 } |
| OLD | NEW |