aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java')
-rw-r--r--tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java b/tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java
index 4dc91ce3..574dac8d 100644
--- a/tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java
+++ b/tests/unit/src/com/android/tv/data/ChannelDataManagerTest.java
@@ -206,6 +206,8 @@ public class ChannelDataManagerTest extends AndroidTestCase {
channelListener.reset();
// Test {@link ChannelDataManager#applyUpdatedValuesToDb}
+ // Disable the update notification to avoid the unwanted call of "onLoadFinished".
+ mContentResolver.mNotifyDisabled = true;
mChannelDataManager.applyUpdatedValuesToDb();
restart();
browsableChannelList = mChannelDataManager.getBrowsableChannelList();
@@ -240,6 +242,8 @@ public class ChannelDataManagerTest extends AndroidTestCase {
assertFalse(browsableChannelList.contains(channel2));
// Test {@link ChannelDataManager#applyUpdatedValuesToDb}
+ // Disable the update notification to avoid the unwanted call of "onLoadFinished".
+ mContentResolver.mNotifyDisabled = true;
mChannelDataManager.applyUpdatedValuesToDb();
restart();
browsableChannelList = mChannelDataManager.getBrowsableChannelList();
@@ -270,6 +274,8 @@ public class ChannelDataManagerTest extends AndroidTestCase {
assertTrue(mChannelDataManager.getChannel(channel.getId()).isLocked());
// Test {@link ChannelDataManager#applyUpdatedValuesToDb}.
+ // Disable the update notification to avoid the unwanted call of "onLoadFinished".
+ mContentResolver.mNotifyDisabled = true;
mChannelDataManager.applyUpdatedValuesToDb();
restart();
assertTrue(mChannelDataManager.getChannel(channel.getId()).isLocked());
@@ -343,11 +349,17 @@ public class ChannelDataManagerTest extends AndroidTestCase {
}
private class FakeContentResolver extends MockContentResolver {
+ boolean mNotifyDisabled;
+
@Override
public void notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork) {
super.notifyChange(uri, observer, syncToNetwork);
if (DEBUG) {
- Log.d(TAG, "onChanged(uri=" + uri + ", observer=" + observer + ")");
+ Log.d(TAG, "onChanged(uri=" + uri + ", observer=" + observer + ") - Notification "
+ + (mNotifyDisabled ? "disabled" : "enabled"));
+ }
+ if (mNotifyDisabled) {
+ return;
}
// Do not call {@link ContentObserver#onChange} directly to run it on the correct
// thread.