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.signin; | 5 package org.chromium.chrome.browser.signin; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.DialogFragment; | 8 import android.app.DialogFragment; |
9 import android.app.Fragment; | 9 import android.app.Fragment; |
10 import android.app.Instrumentation.ActivityMonitor; | 10 import android.app.Instrumentation.ActivityMonitor; |
11 import android.content.Context; | 11 import android.content.Context; |
12 import android.content.DialogInterface; | 12 import android.content.DialogInterface; |
13 import android.preference.Preference; | 13 import android.preference.Preference; |
14 import android.support.v7.app.AlertDialog; | 14 import android.support.v7.app.AlertDialog; |
15 import android.test.suitebuilder.annotation.MediumTest; | 15 import android.test.suitebuilder.annotation.MediumTest; |
16 import android.widget.Button; | 16 import android.widget.Button; |
17 | 17 |
18 import org.chromium.base.ThreadUtils; | 18 import org.chromium.base.ThreadUtils; |
| 19 import org.chromium.base.test.util.Restriction; |
19 import org.chromium.chrome.R; | 20 import org.chromium.chrome.R; |
20 import org.chromium.chrome.browser.bookmarks.BookmarkBridge; | 21 import org.chromium.chrome.browser.bookmarks.BookmarkBridge; |
21 import org.chromium.chrome.browser.preferences.MainPreferences; | 22 import org.chromium.chrome.browser.preferences.MainPreferences; |
22 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 23 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
23 import org.chromium.chrome.browser.preferences.Preferences; | 24 import org.chromium.chrome.browser.preferences.Preferences; |
24 import org.chromium.chrome.browser.preferences.SignInPreference; | 25 import org.chromium.chrome.browser.preferences.SignInPreference; |
25 import org.chromium.chrome.browser.profiles.Profile; | 26 import org.chromium.chrome.browser.profiles.Profile; |
26 import org.chromium.chrome.browser.sync.ProfileSyncService; | 27 import org.chromium.chrome.browser.sync.ProfileSyncService; |
27 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; | 28 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; |
28 import org.chromium.chrome.test.util.ActivityUtils; | 29 import org.chromium.chrome.test.util.ActivityUtils; |
| 30 import org.chromium.chrome.test.util.ChromeRestriction; |
29 import org.chromium.chrome.test.util.browser.signin.SigninTestUtil; | 31 import org.chromium.chrome.test.util.browser.signin.SigninTestUtil; |
30 import org.chromium.components.bookmarks.BookmarkId; | 32 import org.chromium.components.bookmarks.BookmarkId; |
31 import org.chromium.content.browser.test.util.TestTouchUtils; | 33 import org.chromium.content.browser.test.util.TestTouchUtils; |
32 import org.chromium.sync.signin.ChromeSigninController; | 34 import org.chromium.sync.signin.ChromeSigninController; |
33 import org.chromium.sync.test.util.MockAccountManager; | 35 import org.chromium.sync.test.util.MockAccountManager; |
34 | 36 |
35 /** | 37 /** |
36 * Test suite for sign in tests. | 38 * Test suite for sign in tests. |
37 * | 39 * |
38 * These tests cover the sign in flow for both consumer and managed accounts. Th
ey also verify | 40 * These tests cover the sign in flow for both consumer and managed accounts. Th
ey also verify |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 }); | 279 }); |
278 super.tearDown(); | 280 super.tearDown(); |
279 } | 281 } |
280 | 282 |
281 @Override | 283 @Override |
282 public void startMainActivity() throws InterruptedException { | 284 public void startMainActivity() throws InterruptedException { |
283 startMainActivityOnBlankPage(); | 285 startMainActivityOnBlankPage(); |
284 } | 286 } |
285 | 287 |
286 @MediumTest | 288 @MediumTest |
| 289 @Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) |
287 public void testConsumerSignin() throws InterruptedException { | 290 public void testConsumerSignin() throws InterruptedException { |
288 SigninTestUtil.addTestAccount(); | 291 SigninTestUtil.addTestAccount(); |
289 signInToSingleAccount(); | 292 signInToSingleAccount(); |
290 | 293 |
291 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 294 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
292 @Override | 295 @Override |
293 public void run() { | 296 public void run() { |
294 // Verify that the account isn't managed. | 297 // Verify that the account isn't managed. |
295 assertNull(mSigninManager.getManagementDomain()); | 298 assertNull(mSigninManager.getManagementDomain()); |
296 | 299 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 getInstrumentation().waitForIdleSync(); | 440 getInstrumentation().waitForIdleSync(); |
438 DialogFragment fragment = ActivityUtils.waitForFragment(activity, tag); | 441 DialogFragment fragment = ActivityUtils.waitForFragment(activity, tag); |
439 AlertDialog dialog = (AlertDialog) fragment.getDialog(); | 442 AlertDialog dialog = (AlertDialog) fragment.getDialog(); |
440 assertTrue(dialog != null); | 443 assertTrue(dialog != null); |
441 assertTrue(dialog.isShowing()); | 444 assertTrue(dialog.isShowing()); |
442 Button button = dialog.getButton(DialogInterface.BUTTON_POSITIVE); | 445 Button button = dialog.getButton(DialogInterface.BUTTON_POSITIVE); |
443 assertNotNull("Could not find the accept button.", button); | 446 assertNotNull("Could not find the accept button.", button); |
444 TestTouchUtils.performClickOnMainSync(getInstrumentation(), button); | 447 TestTouchUtils.performClickOnMainSync(getInstrumentation(), button); |
445 } | 448 } |
446 } | 449 } |
OLD | NEW |