-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'android-5.1.1_r33' into HEAD
Ticket: CYNGNOS-1404 Android 5.1.1 release 33 Change-Id: I00d32ba39b5bc3c5bbbc0054fe4b91c4b9fd97
- Loading branch information
1 parent
ab44cbb
commit 3f045b5
Showing
3 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
services/tests/servicestests/src/com/android/server/content/SyncManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.android.server.content; | ||
|
||
import android.os.Bundle; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class SyncManagerTest extends TestCase { | ||
|
||
final String KEY_1 = "key_1"; | ||
final String KEY_2 = "key_2"; | ||
|
||
public void testSyncExtrasEquals_WithNull() throws Exception { | ||
Bundle b1 = new Bundle(); | ||
Bundle b2 = new Bundle(); | ||
|
||
b1.putString(KEY_1, null); | ||
b2.putString(KEY_1, null); | ||
|
||
assertTrue("Null extra not properly compared between bundles.", | ||
SyncManager.syncExtrasEquals(b1, b2, false /* don't care about system extras */)); | ||
} | ||
|
||
public void testSyncExtrasEqualsBigger_WithNull() throws Exception { | ||
Bundle b1 = new Bundle(); | ||
Bundle b2 = new Bundle(); | ||
|
||
b1.putString(KEY_1, null); | ||
b2.putString(KEY_1, null); | ||
|
||
b1.putString(KEY_2, "bla"); | ||
b2.putString(KEY_2, "bla"); | ||
|
||
assertTrue("Extras not properly compared between bundles.", | ||
SyncManager.syncExtrasEquals(b1, b2, false /* don't care about system extras */)); | ||
} | ||
|
||
public void testSyncExtrasEqualsFails_differentValues() throws Exception { | ||
Bundle b1 = new Bundle(); | ||
Bundle b2 = new Bundle(); | ||
|
||
b1.putString(KEY_1, null); | ||
b2.putString(KEY_1, null); | ||
|
||
b1.putString(KEY_2, "bla"); | ||
b2.putString(KEY_2, "ble"); // different key | ||
|
||
assertFalse("Extras considered equal when they are different.", | ||
SyncManager.syncExtrasEquals(b1, b2, false /* don't care about system extras */)); | ||
} | ||
|
||
public void testSyncExtrasEqualsFails_differentNulls() throws Exception { | ||
Bundle b1 = new Bundle(); | ||
Bundle b2 = new Bundle(); | ||
|
||
b1.putString(KEY_1, null); | ||
b2.putString(KEY_1, "bla"); // different key | ||
|
||
b1.putString(KEY_2, "ble"); | ||
b2.putString(KEY_2, "ble"); | ||
|
||
assertFalse("Extras considered equal when they are different.", | ||
SyncManager.syncExtrasEquals(b1, b2, false /* don't care about system extras */)); | ||
} | ||
} |