Fix unit test for default account setting change.
BUG 21932040
Change-Id: I405188b9b10295129de9c395d75834c16f0bfcf9
diff --git a/tests/src/com/android/contacts/editor/ContactEditorUtilsTest.java b/tests/src/com/android/contacts/editor/ContactEditorUtilsTest.java
index c41c836..55e26ef 100644
--- a/tests/src/com/android/contacts/editor/ContactEditorUtilsTest.java
+++ b/tests/src/com/android/contacts/editor/ContactEditorUtilsTest.java
@@ -195,8 +195,8 @@
// User added a new writable account, ACCOUNT_1_B.
setAccounts(ACCOUNT_1_A, ACCOUNT_1_B);
- // Now we show the notification again.
- assertTrue(mTarget.shouldShowAccountChangedNotification());
+ // Since default account is still ACCOUNT_1_A, we don't show the notification.
+ assertFalse(mTarget.shouldShowAccountChangedNotification());
// User saved a new contact. We update the account list and the default account.
mTarget.saveDefaultAndAllAccounts(ACCOUNT_1_B);
@@ -211,8 +211,8 @@
// Add new accounts: ACCOUNT_2_A, ACCOUNT_2EX_A.
setAccounts(ACCOUNT_1_A, ACCOUNT_1_B, ACCOUNT_2_A, ACCOUNT_2EX_A);
- // New account means another notification.
- assertTrue(mTarget.shouldShowAccountChangedNotification());
+ // New added account but default account is still not changed, so no notification.
+ assertFalse(mTarget.shouldShowAccountChangedNotification());
// User saves a new contact, with a different default account.
mTarget.saveDefaultAndAllAccounts(ACCOUNT_2_A);
@@ -233,6 +233,13 @@
// Now we show the notification.
assertTrue(mTarget.shouldShowAccountChangedNotification());
+
+ // Do not save the default account, and add a new account now.
+ setAccountTypes(TYPE1, TYPE2, TYPE2EX);
+ setAccounts(ACCOUNT_1_A, ACCOUNT_1_B, ACCOUNT_2EX_A);
+
+ // No default account, so show notification.
+ assertTrue(mTarget.shouldShowAccountChangedNotification());
}
/**