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.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.Instrumentation; | 8 import android.app.Instrumentation; |
9 import android.app.Instrumentation.ActivityMonitor; | 9 import android.app.Instrumentation.ActivityMonitor; |
10 import android.content.Context; | 10 import android.content.Context; |
11 import android.content.Intent; | 11 import android.content.Intent; |
12 import android.net.Uri; | 12 import android.net.Uri; |
13 import android.os.Bundle; | 13 import android.os.Bundle; |
14 import android.support.customtabs.CustomTabsIntent; | 14 import android.support.customtabs.CustomTabsIntent; |
15 import android.support.test.InstrumentationRegistry; | |
15 import android.support.test.filters.MediumTest; | 16 import android.support.test.filters.MediumTest; |
16 import android.support.test.filters.SmallTest; | 17 import android.support.test.filters.SmallTest; |
17 import android.widget.Button; | 18 import android.widget.Button; |
18 | 19 |
20 import org.junit.After; | |
21 import org.junit.Assert; | |
22 import org.junit.Before; | |
23 import org.junit.Rule; | |
24 import org.junit.Test; | |
25 import org.junit.runner.RunWith; | |
26 | |
19 import org.chromium.base.ThreadUtils; | 27 import org.chromium.base.ThreadUtils; |
20 import org.chromium.base.test.util.CommandLineFlags; | |
21 import org.chromium.chrome.R; | 28 import org.chromium.chrome.R; |
22 import org.chromium.chrome.browser.ChromeSwitches; | |
23 import org.chromium.chrome.browser.ChromeTabbedActivity; | 29 import org.chromium.chrome.browser.ChromeTabbedActivity; |
24 import org.chromium.chrome.browser.customtabs.CustomTabActivity; | 30 import org.chromium.chrome.browser.customtabs.CustomTabActivity; |
25 import org.chromium.chrome.browser.document.ChromeLauncherActivity; | 31 import org.chromium.chrome.browser.document.ChromeLauncherActivity; |
26 import org.chromium.chrome.browser.searchwidget.SearchActivity; | 32 import org.chromium.chrome.browser.searchwidget.SearchActivity; |
27 import org.chromium.chrome.test.MultiActivityTestBase; | 33 import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
34 import org.chromium.chrome.test.MultiActivityTestRule; | |
28 import org.chromium.content.browser.test.util.Criteria; | 35 import org.chromium.content.browser.test.util.Criteria; |
29 import org.chromium.content.browser.test.util.CriteriaHelper; | 36 import org.chromium.content.browser.test.util.CriteriaHelper; |
30 | 37 |
31 /** | 38 /** |
32 * Integration test suite for the first run experience. | 39 * Integration test suite for the first run experience. |
33 */ | 40 */ |
34 @CommandLineFlags.Remove(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) | 41 @RunWith(ChromeJUnit4ClassRunner.class) |
gone
2017/04/30 02:00:14
This file explicitly removed the flag because it t
the real yoland
2017/05/01 23:35:36
There is no more base class to add the flags at th
| |
35 public class FirstRunIntegrationTest extends MultiActivityTestBase { | 42 public class FirstRunIntegrationTest { |
43 | |
44 @Rule | |
45 @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") | |
46 public MultiActivityTestRule mTestRule = new MultiActivityTestRule(); | |
47 | |
36 private FirstRunActivityTestObserver mTestObserver = new FirstRunActivityTes tObserver(); | 48 private FirstRunActivityTestObserver mTestObserver = new FirstRunActivityTes tObserver(); |
37 private Activity mActivity; | 49 private Activity mActivity; |
38 | 50 |
39 @Override | 51 @Before |
40 public void setUp() throws Exception { | 52 public void setUp() throws Exception { |
41 super.setUp(); | |
42 FirstRunActivity.setObserverForTest(mTestObserver); | 53 FirstRunActivity.setObserverForTest(mTestObserver); |
43 } | 54 } |
44 | 55 |
45 @Override | 56 @After |
46 public void tearDown() throws Exception { | 57 public void tearDown() throws Exception { |
47 if (mActivity != null) mActivity.finish(); | 58 if (mActivity != null) mActivity.finish(); |
48 super.tearDown(); | |
49 } | 59 } |
50 | 60 |
61 @Test | |
51 @SmallTest | 62 @SmallTest |
52 public void testGenericViewIntentGoesToFirstRun() { | 63 public void testGenericViewIntentGoesToFirstRun() { |
53 final String asyncClassName = ChromeLauncherActivity.class.getName(); | 64 final String asyncClassName = ChromeLauncherActivity.class.getName(); |
54 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { | 65 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { |
55 @Override | 66 @Override |
56 public void run() { | 67 public void run() { |
57 final Context context = getInstrumentation().getTargetContext(); | 68 final Context context = |
69 InstrumentationRegistry.getInstrumentation().getTargetCo ntext(); | |
58 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http:/ /test.com")); | 70 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http:/ /test.com")); |
59 intent.setPackage(context.getPackageName()); | 71 intent.setPackage(context.getPackageName()); |
60 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 72 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
61 context.startActivity(intent); | 73 context.startActivity(intent); |
62 } | 74 } |
63 }); | 75 }); |
64 } | 76 } |
65 | 77 |
78 @Test | |
66 @SmallTest | 79 @SmallTest |
67 public void testRedirectCustomTabActivityToFirstRun() { | 80 public void testRedirectCustomTabActivityToFirstRun() { |
68 final String asyncClassName = ChromeLauncherActivity.class.getName(); | 81 final String asyncClassName = ChromeLauncherActivity.class.getName(); |
69 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { | 82 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { |
70 @Override | 83 @Override |
71 public void run() { | 84 public void run() { |
72 Context context = getInstrumentation().getTargetContext(); | 85 Context context = InstrumentationRegistry.getInstrumentation().g etTargetContext(); |
73 CustomTabsIntent customTabIntent = new CustomTabsIntent.Builder( ).build(); | 86 CustomTabsIntent customTabIntent = new CustomTabsIntent.Builder( ).build(); |
74 customTabIntent.intent.setPackage(context.getPackageName()); | 87 customTabIntent.intent.setPackage(context.getPackageName()); |
75 customTabIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 88 customTabIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
76 customTabIntent.launchUrl(context, Uri.parse("http://test.com")) ; | 89 customTabIntent.launchUrl(context, Uri.parse("http://test.com")) ; |
77 } | 90 } |
78 }); | 91 }); |
79 } | 92 } |
80 | 93 |
94 @Test | |
81 @SmallTest | 95 @SmallTest |
82 public void testRedirectChromeTabbedActivityToFirstRun() { | 96 public void testRedirectChromeTabbedActivityToFirstRun() { |
83 final String asyncClassName = ChromeTabbedActivity.class.getName(); | 97 final String asyncClassName = ChromeTabbedActivity.class.getName(); |
84 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { | 98 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { |
85 @Override | 99 @Override |
86 public void run() { | 100 public void run() { |
87 final Context context = getInstrumentation().getTargetContext(); | 101 final Context context = |
102 InstrumentationRegistry.getInstrumentation().getTargetCo ntext(); | |
88 Intent intent = new Intent(); | 103 Intent intent = new Intent(); |
89 intent.setClassName(context, asyncClassName); | 104 intent.setClassName(context, asyncClassName); |
90 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 105 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
91 context.startActivity(intent); | 106 context.startActivity(intent); |
92 } | 107 } |
93 }); | 108 }); |
94 } | 109 } |
95 | 110 |
111 @Test | |
96 @SmallTest | 112 @SmallTest |
97 public void testRedirectSearchActivityToFirstRun() { | 113 public void testRedirectSearchActivityToFirstRun() { |
98 final String asyncClassName = SearchActivity.class.getName(); | 114 final String asyncClassName = SearchActivity.class.getName(); |
99 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { | 115 runFirstRunRedirectTestForActivity(asyncClassName, new Runnable() { |
100 @Override | 116 @Override |
101 public void run() { | 117 public void run() { |
102 final Context context = getInstrumentation().getTargetContext(); | 118 final Context context = |
119 InstrumentationRegistry.getInstrumentation().getTargetCo ntext(); | |
103 Intent intent = new Intent(); | 120 Intent intent = new Intent(); |
104 intent.setClassName(context, asyncClassName); | 121 intent.setClassName(context, asyncClassName); |
105 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 122 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
106 context.startActivity(intent); | 123 context.startActivity(intent); |
107 } | 124 } |
108 }); | 125 }); |
109 } | 126 } |
110 | 127 |
111 /** | 128 /** |
112 * Tests that an AsyncInitializationActivity subclass that attempts to be ru n without first | 129 * Tests that an AsyncInitializationActivity subclass that attempts to be ru n without first |
113 * having gone through First Run kicks the user out into the FRE. | 130 * having gone through First Run kicks the user out into the FRE. |
114 * @param asyncClassName Name of the class to expect. | 131 * @param asyncClassName Name of the class to expect. |
115 * @param runnable Runnable that launches the Activity. | 132 * @param runnable Runnable that launches the Activity. |
116 */ | 133 */ |
117 private void runFirstRunRedirectTestForActivity(String asyncClassName, Runna ble runnable) { | 134 private void runFirstRunRedirectTestForActivity(String asyncClassName, Runna ble runnable) { |
118 final ActivityMonitor activityMonitor = new ActivityMonitor(asyncClassNa me, null, false); | 135 final ActivityMonitor activityMonitor = new ActivityMonitor(asyncClassNa me, null, false); |
119 final ActivityMonitor freMonitor = | 136 final ActivityMonitor freMonitor = |
120 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); | 137 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); |
121 | 138 |
122 Instrumentation instrumentation = getInstrumentation(); | 139 Instrumentation instrumentation = InstrumentationRegistry.getInstrumenta tion(); |
123 instrumentation.addMonitor(activityMonitor); | 140 instrumentation.addMonitor(activityMonitor); |
124 instrumentation.addMonitor(freMonitor); | 141 instrumentation.addMonitor(freMonitor); |
125 runnable.run(); | 142 runnable.run(); |
126 | 143 |
127 // The original activity should be started because it was directly speci fied. | 144 // The original activity should be started because it was directly speci fied. |
128 final Activity original = instrumentation.waitForMonitorWithTimeout( | 145 final Activity original = instrumentation.waitForMonitorWithTimeout( |
129 activityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); | 146 activityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); |
130 assertNotNull(original); | 147 Assert.assertNotNull(original); |
131 CriteriaHelper.pollInstrumentationThread(new Criteria() { | 148 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
132 @Override | 149 @Override |
133 public boolean isSatisfied() { | 150 public boolean isSatisfied() { |
134 return original.isFinishing(); | 151 return original.isFinishing(); |
135 } | 152 } |
136 }); | 153 }); |
137 | 154 |
138 // Because the AsyncInitializationActivity notices that the FRE hasn't b een run yet, it | 155 // Because the AsyncInitializationActivity notices that the FRE hasn't b een run yet, it |
139 // redirects to it. Ideally, we would grab the Activity here, but it se ems that the | 156 // redirects to it. Ideally, we would grab the Activity here, but it se ems that the |
140 // First Run Activity doesn't live long enough to be grabbed. | 157 // First Run Activity doesn't live long enough to be grabbed. |
141 CriteriaHelper.pollInstrumentationThread(new Criteria() { | 158 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
142 @Override | 159 @Override |
143 public boolean isSatisfied() { | 160 public boolean isSatisfied() { |
144 return freMonitor.getHits() == 1; | 161 return freMonitor.getHits() == 1; |
145 } | 162 } |
146 }); | 163 }); |
147 } | 164 } |
148 | 165 |
166 @Test | |
149 @SmallTest | 167 @SmallTest |
150 public void testHelpPageSkipsFirstRun() { | 168 public void testHelpPageSkipsFirstRun() { |
151 final ActivityMonitor customTabActivityMonitor = | 169 final ActivityMonitor customTabActivityMonitor = |
152 new ActivityMonitor(CustomTabActivity.class.getName(), null, fal se); | 170 new ActivityMonitor(CustomTabActivity.class.getName(), null, fal se); |
153 final ActivityMonitor freMonitor = | 171 final ActivityMonitor freMonitor = |
154 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); | 172 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); |
155 | 173 |
156 Instrumentation instrumentation = getInstrumentation(); | 174 Instrumentation instrumentation = InstrumentationRegistry.getInstrumenta tion(); |
157 instrumentation.addMonitor(customTabActivityMonitor); | 175 instrumentation.addMonitor(customTabActivityMonitor); |
158 instrumentation.addMonitor(freMonitor); | 176 instrumentation.addMonitor(freMonitor); |
159 | 177 |
160 // Fire an Intent to load a generic URL. | 178 // Fire an Intent to load a generic URL. |
161 final Context context = instrumentation.getTargetContext(); | 179 final Context context = instrumentation.getTargetContext(); |
162 CustomTabActivity.showInfoPage(context, "http://google.com"); | 180 CustomTabActivity.showInfoPage(context, "http://google.com"); |
163 | 181 |
164 // The original activity should be started because it's a "help page". | 182 // The original activity should be started because it's a "help page". |
165 final Activity original = instrumentation.waitForMonitorWithTimeout( | 183 final Activity original = instrumentation.waitForMonitorWithTimeout( |
166 customTabActivityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POL L); | 184 customTabActivityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POL L); |
167 assertNotNull(original); | 185 Assert.assertNotNull(original); |
168 assertFalse(original.isFinishing()); | 186 Assert.assertFalse(original.isFinishing()); |
169 | 187 |
170 // First run should be skipped for this Activity. | 188 // First run should be skipped for this Activity. |
171 assertEquals(0, freMonitor.getHits()); | 189 Assert.assertEquals(0, freMonitor.getHits()); |
172 } | 190 } |
173 | 191 |
192 @Test | |
174 @SmallTest | 193 @SmallTest |
175 public void testAbortFirstRun() throws Exception { | 194 public void testAbortFirstRun() throws Exception { |
176 final ActivityMonitor freMonitor = | 195 final ActivityMonitor freMonitor = |
177 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); | 196 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); |
178 Instrumentation instrumentation = getInstrumentation(); | 197 Instrumentation instrumentation = InstrumentationRegistry.getInstrumenta tion(); |
179 instrumentation.addMonitor(freMonitor); | 198 instrumentation.addMonitor(freMonitor); |
180 | 199 |
181 final Context context = instrumentation.getTargetContext(); | 200 final Context context = instrumentation.getTargetContext(); |
182 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://test.co m")); | 201 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://test.co m")); |
183 intent.setPackage(context.getPackageName()); | 202 intent.setPackage(context.getPackageName()); |
184 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 203 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
185 context.startActivity(intent); | 204 context.startActivity(intent); |
186 | 205 |
187 // Because the AsyncInitializationActivity notices that the FRE hasn't b een run yet, it | 206 // Because the AsyncInitializationActivity notices that the FRE hasn't b een run yet, it |
188 // redirects to it. Once the user closes the FRE, the user should be ki cked back into the | 207 // redirects to it. Once the user closes the FRE, the user should be ki cked back into the |
189 // startup flow where they were interrupted. | 208 // startup flow where they were interrupted. |
190 mActivity = instrumentation.waitForMonitorWithTimeout( | 209 mActivity = instrumentation.waitForMonitorWithTimeout( |
191 freMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); | 210 freMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); |
192 instrumentation.removeMonitor(freMonitor); | 211 instrumentation.removeMonitor(freMonitor); |
193 ActivityMonitor activityMonitor = | 212 ActivityMonitor activityMonitor = |
194 new ActivityMonitor(ChromeLauncherActivity.class.getName(), null , false); | 213 new ActivityMonitor(ChromeLauncherActivity.class.getName(), null , false); |
195 instrumentation.addMonitor(activityMonitor); | 214 instrumentation.addMonitor(activityMonitor); |
196 | 215 |
197 assertEquals(0, mTestObserver.abortFirstRunExperienceCallback.getCallCou nt()); | 216 Assert.assertEquals(0, mTestObserver.abortFirstRunExperienceCallback.get CallCount()); |
198 mActivity.onBackPressed(); | 217 mActivity.onBackPressed(); |
199 mTestObserver.abortFirstRunExperienceCallback.waitForCallback( | 218 mTestObserver.abortFirstRunExperienceCallback.waitForCallback( |
200 "FirstRunActivity didn't abort", 0); | 219 "FirstRunActivity didn't abort", 0); |
201 | 220 |
202 mActivity = instrumentation.waitForMonitorWithTimeout( | 221 mActivity = instrumentation.waitForMonitorWithTimeout( |
203 activityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); | 222 activityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); |
204 CriteriaHelper.pollInstrumentationThread(new Criteria() { | 223 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
205 @Override | 224 @Override |
206 public boolean isSatisfied() { | 225 public boolean isSatisfied() { |
207 return mActivity.isFinishing(); | 226 return mActivity.isFinishing(); |
208 } | 227 } |
209 }); | 228 }); |
210 } | 229 } |
211 | 230 |
231 @Test | |
212 @MediumTest | 232 @MediumTest |
213 public void testClickThroughFirstRun() throws Exception { | 233 public void testClickThroughFirstRun() throws Exception { |
214 final ActivityMonitor freMonitor = | 234 final ActivityMonitor freMonitor = |
215 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); | 235 new ActivityMonitor(FirstRunActivity.class.getName(), null, fals e); |
216 Instrumentation instrumentation = getInstrumentation(); | 236 Instrumentation instrumentation = InstrumentationRegistry.getInstrumenta tion(); |
217 instrumentation.addMonitor(freMonitor); | 237 instrumentation.addMonitor(freMonitor); |
218 | 238 |
219 final Context context = instrumentation.getTargetContext(); | 239 final Context context = instrumentation.getTargetContext(); |
220 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://test.co m")); | 240 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://test.co m")); |
221 intent.setPackage(context.getPackageName()); | 241 intent.setPackage(context.getPackageName()); |
222 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 242 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
223 context.startActivity(intent); | 243 context.startActivity(intent); |
224 | 244 |
225 // Because the AsyncInitializationActivity notices that the FRE hasn't b een run yet, it | 245 // Because the AsyncInitializationActivity notices that the FRE hasn't b een run yet, it |
226 // redirects to it. Once the user closes the FRE, the user should be ki cked back into the | 246 // redirects to it. Once the user closes the FRE, the user should be ki cked back into the |
227 // startup flow where they were interrupted. | 247 // startup flow where they were interrupted. |
228 mActivity = instrumentation.waitForMonitorWithTimeout( | 248 mActivity = instrumentation.waitForMonitorWithTimeout( |
229 freMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); | 249 freMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); |
230 instrumentation.removeMonitor(freMonitor); | 250 instrumentation.removeMonitor(freMonitor); |
231 ActivityMonitor activityMonitor = | 251 ActivityMonitor activityMonitor = |
232 new ActivityMonitor(ChromeTabbedActivity.class.getName(), null, false); | 252 new ActivityMonitor(ChromeTabbedActivity.class.getName(), null, false); |
233 instrumentation.addMonitor(activityMonitor); | 253 instrumentation.addMonitor(activityMonitor); |
234 | 254 |
235 mTestObserver.flowIsKnownCallback.waitForCallback("Failed to finalize th e flow", 0); | 255 mTestObserver.flowIsKnownCallback.waitForCallback("Failed to finalize th e flow", 0); |
236 Bundle freProperties = mTestObserver.freProperties; | 256 Bundle freProperties = mTestObserver.freProperties; |
237 assertEquals(0, mTestObserver.updateCachedEngineCallback.getCallCount()) ; | 257 Assert.assertEquals(0, mTestObserver.updateCachedEngineCallback.getCallC ount()); |
238 | 258 |
239 // Accept the ToS. | 259 // Accept the ToS. |
240 if (freProperties.getBoolean(FirstRunActivity.SHOW_WELCOME_PAGE)) { | 260 if (freProperties.getBoolean(FirstRunActivity.SHOW_WELCOME_PAGE)) { |
241 clickButton(mActivity, R.id.terms_accept, "Failed to accept ToS"); | 261 clickButton(mActivity, R.id.terms_accept, "Failed to accept ToS"); |
242 mTestObserver.acceptTermsOfServiceCallback.waitForCallback( | 262 mTestObserver.acceptTermsOfServiceCallback.waitForCallback( |
243 "Failed to accept the ToS", 0); | 263 "Failed to accept the ToS", 0); |
244 mTestObserver.jumpToPageCallback.waitForCallback( | 264 mTestObserver.jumpToPageCallback.waitForCallback( |
245 "Failed to try moving to the next screen", 0); | 265 "Failed to try moving to the next screen", 0); |
246 } | 266 } |
247 | 267 |
(...skipping 13 matching lines...) Expand all Loading... | |
261 "Failed to try moving to next screen", jumpCallCount); | 281 "Failed to try moving to next screen", jumpCallCount); |
262 } | 282 } |
263 | 283 |
264 // FRE should be completed now, which will kick the user back into the i nterrupted flow. | 284 // FRE should be completed now, which will kick the user back into the i nterrupted flow. |
265 // In this case, the user gets sent to the ChromeTabbedActivity after a View Intent is | 285 // In this case, the user gets sent to the ChromeTabbedActivity after a View Intent is |
266 // processed by ChromeLauncherActivity. | 286 // processed by ChromeLauncherActivity. |
267 mTestObserver.updateCachedEngineCallback.waitForCallback( | 287 mTestObserver.updateCachedEngineCallback.waitForCallback( |
268 "Failed to alert search widgets that an update is necessary", 0) ; | 288 "Failed to alert search widgets that an update is necessary", 0) ; |
269 mActivity = instrumentation.waitForMonitorWithTimeout( | 289 mActivity = instrumentation.waitForMonitorWithTimeout( |
270 activityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); | 290 activityMonitor, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL); |
271 assertNotNull(mActivity); | 291 Assert.assertNotNull(mActivity); |
272 } | 292 } |
273 | 293 |
274 private void clickButton(final Activity activity, final int id, final String message) { | 294 private void clickButton(final Activity activity, final int id, final String message) { |
275 CriteriaHelper.pollUiThread(new Criteria() { | 295 CriteriaHelper.pollUiThread(new Criteria() { |
276 @Override | 296 @Override |
277 public boolean isSatisfied() { | 297 public boolean isSatisfied() { |
278 return activity.findViewById(id) != null; | 298 return activity.findViewById(id) != null; |
279 } | 299 } |
280 }); | 300 }); |
281 | 301 |
282 ThreadUtils.runOnUiThread(new Runnable() { | 302 ThreadUtils.runOnUiThread(new Runnable() { |
283 @Override | 303 @Override |
284 public void run() { | 304 public void run() { |
285 Button button = (Button) activity.findViewById(id); | 305 Button button = (Button) activity.findViewById(id); |
286 assertNotNull(message, button); | 306 Assert.assertNotNull(message, button); |
287 button.performClick(); | 307 button.performClick(); |
288 } | 308 } |
289 }); | 309 }); |
290 } | 310 } |
291 } | 311 } |
OLD | NEW |