| 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.webapps; | 5 package org.chromium.chrome.browser.webapps; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 import android.net.Uri; | 8 import android.net.Uri; |
| 9 import android.view.ViewGroup; | 9 import android.view.ViewGroup; |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 }); | 120 }); |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * Waits until any loads in progress have completed. | 124 * Waits until any loads in progress have completed. |
| 125 */ | 125 */ |
| 126 protected void waitUntilIdle() { | 126 protected void waitUntilIdle() { |
| 127 getInstrumentation().waitForIdleSync(); | 127 getInstrumentation().waitForIdleSync(); |
| 128 try { | 128 try { |
| 129 CriteriaHelper.pollForCriteria(new Criteria() { | 129 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
| 130 @Override | 130 @Override |
| 131 public boolean isSatisfied() { | 131 public boolean isSatisfied() { |
| 132 return getActivity().getActivityTab() != null | 132 return getActivity().getActivityTab() != null |
| 133 && !getActivity().getActivityTab().isLoading(); | 133 && !getActivity().getActivityTab().isLoading(); |
| 134 } | 134 } |
| 135 }); | 135 }); |
| 136 } catch (InterruptedException exception) { | 136 } catch (InterruptedException exception) { |
| 137 fail(); | 137 fail(); |
| 138 } | 138 } |
| 139 | 139 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 @Override | 179 @Override |
| 180 public final void startMainActivity() throws InterruptedException { | 180 public final void startMainActivity() throws InterruptedException { |
| 181 // Do nothing; the WebappActivity may not have been completely set up, y
et. | 181 // Do nothing; the WebappActivity may not have been completely set up, y
et. |
| 182 } | 182 } |
| 183 | 183 |
| 184 /** | 184 /** |
| 185 * Waits for the splash screen to be hidden. | 185 * Waits for the splash screen to be hidden. |
| 186 */ | 186 */ |
| 187 protected void waitUntilSplashscreenHides() throws InterruptedException { | 187 protected void waitUntilSplashscreenHides() throws InterruptedException { |
| 188 CriteriaHelper.pollForCriteria(new Criteria() { | 188 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
| 189 @Override | 189 @Override |
| 190 public boolean isSatisfied() { | 190 public boolean isSatisfied() { |
| 191 return !getActivity().isSplashScreenVisibleForTests(); | 191 return !getActivity().isSplashScreenVisibleForTests(); |
| 192 } | 192 } |
| 193 }); | 193 }); |
| 194 } | 194 } |
| 195 | 195 |
| 196 protected ViewGroup waitUntilSplashScreenAppears() { | 196 protected ViewGroup waitUntilSplashScreenAppears() { |
| 197 try { | 197 try { |
| 198 CriteriaHelper.pollForCriteria(new Criteria() { | 198 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
| 199 @Override | 199 @Override |
| 200 public boolean isSatisfied() { | 200 public boolean isSatisfied() { |
| 201 return getActivity().getSplashScreenForTests() != null; | 201 return getActivity().getSplashScreenForTests() != null; |
| 202 } | 202 } |
| 203 }); | 203 }); |
| 204 } catch (InterruptedException e) { | 204 } catch (InterruptedException e) { |
| 205 fail(); | 205 fail(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); | 208 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); |
| 209 if (splashScreen == null) { | 209 if (splashScreen == null) { |
| 210 fail("No splash screen available."); | 210 fail("No splash screen available."); |
| 211 } | 211 } |
| 212 return splashScreen; | 212 return splashScreen; |
| 213 } | 213 } |
| 214 } | 214 } |
| OLD | NEW |