OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.sync.notifier.signin; | 5 package org.chromium.components.sync.notifier.signin; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.test.InstrumentationTestCase; | 9 import android.test.InstrumentationTestCase; |
10 import android.test.suitebuilder.annotation.SmallTest; | 10 import android.test.suitebuilder.annotation.SmallTest; |
11 | 11 |
12 import org.chromium.sync.signin.AccountManagerHelper; | 12 import org.chromium.components.sync.signin.AccountManagerHelper; |
13 import org.chromium.sync.test.util.AccountHolder; | 13 import org.chromium.components.sync.test.util.AccountHolder; |
14 import org.chromium.sync.test.util.MockAccountManager; | 14 import org.chromium.components.sync.test.util.MockAccountManager; |
15 import org.chromium.sync.test.util.SimpleFuture; | 15 import org.chromium.components.sync.test.util.SimpleFuture; |
16 | 16 |
17 /** | 17 /** |
18 * Test class for {@link AccountManagerHelper}. | 18 * Test class for {@link AccountManagerHelper}. |
19 */ | 19 */ |
20 public class AccountManagerHelperTest extends InstrumentationTestCase { | 20 public class AccountManagerHelperTest extends InstrumentationTestCase { |
21 | |
22 private MockAccountManager mAccountManager; | 21 private MockAccountManager mAccountManager; |
23 private AccountManagerHelper mHelper; | 22 private AccountManagerHelper mHelper; |
24 | 23 |
25 @Override | 24 @Override |
26 protected void setUp() throws Exception { | 25 protected void setUp() throws Exception { |
27 super.setUp(); | 26 super.setUp(); |
28 | 27 |
29 Context context = getInstrumentation().getTargetContext(); | 28 Context context = getInstrumentation().getTargetContext(); |
30 mAccountManager = new MockAccountManager(context, context); | 29 mAccountManager = new MockAccountManager(context, context); |
31 AccountManagerHelper.overrideAccountManagerHelperForTests(context, mAcco
untManager); | 30 AccountManagerHelper.overrideAccountManagerHelperForTests(context, mAcco
untManager); |
(...skipping 28 matching lines...) Expand all Loading... |
60 mAccountManager.addAccountHolderExplicitly(accountHolder.build()); | 59 mAccountManager.addAccountHolderExplicitly(accountHolder.build()); |
61 return account; | 60 return account; |
62 } | 61 } |
63 | 62 |
64 private boolean hasAccountForName(String accountName) throws InterruptedExce
ption { | 63 private boolean hasAccountForName(String accountName) throws InterruptedExce
ption { |
65 SimpleFuture<Boolean> result = new SimpleFuture<Boolean>(); | 64 SimpleFuture<Boolean> result = new SimpleFuture<Boolean>(); |
66 mHelper.hasAccountForName(accountName, result.createCallback()); | 65 mHelper.hasAccountForName(accountName, result.createCallback()); |
67 return result.get(); | 66 return result.get(); |
68 } | 67 } |
69 } | 68 } |
OLD | NEW |