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