update one more test for default account changes
Change-Id: I36344a9c0a29d718ec9dd3d51d9abfbc435252f0
This commit is contained in:
parent
04bd9aa8b3
commit
acd985efb4
|
@ -1486,21 +1486,24 @@ public class ProviderTests extends ProviderTestCase2<EmailProvider> {
|
||||||
public void testSetGetDefaultAccount() {
|
public void testSetGetDefaultAccount() {
|
||||||
// There should be no default account if there are no accounts
|
// There should be no default account if there are no accounts
|
||||||
long defaultAccountId = Account.getDefaultAccountId(mMockContext);
|
long defaultAccountId = Account.getDefaultAccountId(mMockContext);
|
||||||
assertEquals(-1, defaultAccountId);
|
assertEquals(Account.NO_ACCOUNT, defaultAccountId);
|
||||||
|
|
||||||
Account account1 = ProviderTestUtils.setupAccount("account-default-1", true, mMockContext);
|
Account account1 = ProviderTestUtils.setupAccount("account-default-1", false, mMockContext);
|
||||||
|
account1.mIsDefault = false;
|
||||||
|
account1.save(mMockContext);
|
||||||
long account1Id = account1.mId;
|
long account1Id = account1.mId;
|
||||||
Account account2 = ProviderTestUtils.setupAccount("account-default-2", true, mMockContext);
|
Account account2 = ProviderTestUtils.setupAccount("account-default-2", false, mMockContext);
|
||||||
|
account2.mIsDefault = false;
|
||||||
|
account2.save(mMockContext);
|
||||||
long account2Id = account2.mId;
|
long account2Id = account2.mId;
|
||||||
Account account3 = ProviderTestUtils.setupAccount("account-default-3", true, mMockContext);
|
Account account3 = ProviderTestUtils.setupAccount("account-default-3", false, mMockContext);
|
||||||
|
account3.mIsDefault = false;
|
||||||
|
account3.save(mMockContext);
|
||||||
long account3Id = account3.mId;
|
long account3Id = account3.mId;
|
||||||
|
|
||||||
// With three accounts, but none marked default, confirm that some default account
|
// With three accounts, but none marked default, confirm that the first one is the default.
|
||||||
// is returned. Which one is undefined here.
|
|
||||||
defaultAccountId = Account.getDefaultAccountId(mMockContext);
|
defaultAccountId = Account.getDefaultAccountId(mMockContext);
|
||||||
assertTrue(defaultAccountId == account1Id
|
assertTrue(defaultAccountId == account1Id);
|
||||||
|| defaultAccountId == account2Id
|
|
||||||
|| defaultAccountId == account3Id);
|
|
||||||
|
|
||||||
updateIsDefault(account1, true);
|
updateIsDefault(account1, true);
|
||||||
defaultAccountId = Account.getDefaultAccountId(mMockContext);
|
defaultAccountId = Account.getDefaultAccountId(mMockContext);
|
||||||
|
|
Loading…
Reference in New Issue