summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2013-01-16 14:10:30 -0800
committerJohn Reck <jreck@google.com>2013-01-16 18:05:07 -0800
commit9686d9d07e344fae2f2310ca544e5401b5e11d30 (patch)
tree7bc66a807f33e3aa016d0e9c977f85cfffbe62f1 /tests/src
parent9003bd581c00a31db4c8291c99a30d5e74fe2dde (diff)
downloadandroid_packages_apps_Snap-9686d9d07e344fae2f2310ca544e5401b5e11d30.zip
android_packages_apps_Snap-9686d9d07e344fae2f2310ca544e5401b5e11d30.tar.gz
android_packages_apps_Snap-9686d9d07e344fae2f2310ca544e5401b5e11d30.tar.bz2
New loading model
Rename reload() to loadIfDirty() loadIfDirty is implemented by MediaSet and is final loadIfDirty is now blocking instead of async Subclasses must implement two protected methods, isDirtyLocked() and load() The change from async reload() to sync loadIfDirty() should be fine since all users of reload() were doing so from a background thread already, and the longest load() is PicasaAlbumSet which is still a fairly brisk 40ms or so Change-Id: If5cc596a1c13e52e5f4efff1a144bd086d37cfb7
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/gallery3d/data/LocalDataTest.java6
-rw-r--r--tests/src/com/android/gallery3d/data/MockSet.java9
-rw-r--r--tests/src/com/android/gallery3d/data/RealDataTest.java6
3 files changed, 13 insertions, 8 deletions
diff --git a/tests/src/com/android/gallery3d/data/LocalDataTest.java b/tests/src/com/android/gallery3d/data/LocalDataTest.java
index 8f6a46b..67fc97a 100644
--- a/tests/src/com/android/gallery3d/data/LocalDataTest.java
+++ b/tests/src/com/android/gallery3d/data/LocalDataTest.java
@@ -66,7 +66,7 @@ public class LocalDataTest extends AndroidTestCase {
Path path = Path.fromString(
mIsImage ? "/local/image" : "/local/video");
mAlbumSet = new LocalAlbumSet(path, mApp);
- mAlbumSet.reload();
+ mAlbumSet.loadIfDirty();
verifyResult();
}
@@ -200,7 +200,7 @@ public class LocalDataTest extends AndroidTestCase {
sub.delete();
mAlbumSet.fakeChange();
latch.isOnContentDirtyBeCalled(DEFAULT_TIMEOUT);
- mAlbumSet.reload();
+ mAlbumSet.loadIfDirty();
assertEquals(1, mAlbumSet.getSubMediaSetCount());
}
}
@@ -220,7 +220,7 @@ public class LocalDataTest extends AndroidTestCase {
assertEquals(1, sub.getMediaItemCount());
assertTrue((sub.getSupportedOperations() & MediaSet.SUPPORT_DELETE) != 0);
sub.delete();
- sub.reload();
+ sub.loadIfDirty();
assertEquals(0, sub.getMediaItemCount());
}
}
diff --git a/tests/src/com/android/gallery3d/data/MockSet.java b/tests/src/com/android/gallery3d/data/MockSet.java
index fa83c79..42f874b 100644
--- a/tests/src/com/android/gallery3d/data/MockSet.java
+++ b/tests/src/com/android/gallery3d/data/MockSet.java
@@ -82,7 +82,12 @@ public class MockSet extends MediaSet {
}
@Override
- public long reload() {
- return 0;
+ protected boolean isDirtyLocked() {
+ return false;
}
+
+ @Override
+ protected void load() throws InterruptedException {
+ }
+
}
diff --git a/tests/src/com/android/gallery3d/data/RealDataTest.java b/tests/src/com/android/gallery3d/data/RealDataTest.java
index 526cfe3..7a984ef 100644
--- a/tests/src/com/android/gallery3d/data/RealDataTest.java
+++ b/tests/src/com/android/gallery3d/data/RealDataTest.java
@@ -53,7 +53,7 @@ public class RealDataTest extends AndroidTestCase {
class TestLocalImage {
public void run() {
MediaSet set = mDataManager.getMediaSet("/local/image");
- set.reload();
+ set.loadIfDirty();
Log.v(TAG, "LocalAlbumSet (Image)");
dumpMediaSet(set, "");
}
@@ -62,7 +62,7 @@ public class RealDataTest extends AndroidTestCase {
class TestLocalVideo {
public void run() {
MediaSet set = mDataManager.getMediaSet("/local/video");
- set.reload();
+ set.loadIfDirty();
Log.v(TAG, "LocalAlbumSet (Video)");
dumpMediaSet(set, "");
}
@@ -71,7 +71,7 @@ public class RealDataTest extends AndroidTestCase {
class TestPicasa implements Runnable {
public void run() {
MediaSet set = mDataManager.getMediaSet("/picasa");
- set.reload();
+ set.loadIfDirty();
Log.v(TAG, "PicasaAlbumSet");
dumpMediaSet(set, "");
}