diff options
Diffstat (limited to 'tests/src/com/android/camera/gallery')
3 files changed, 0 insertions, 259 deletions
diff --git a/tests/src/com/android/camera/gallery/LruCacheUnitTests.java b/tests/src/com/android/camera/gallery/LruCacheUnitTests.java deleted file mode 100644 index c437553..0000000 --- a/tests/src/com/android/camera/gallery/LruCacheUnitTests.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.android.camera.gallery; - -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; -import android.util.Log; - -public class LruCacheUnitTests extends AndroidTestCase { - - @SmallTest - public void testPut() { - LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(2); - Integer key = Integer.valueOf(1); - Integer value = Integer.valueOf(3); - cache.put(key, value); - assertEquals(value, cache.get(key)); - } - - @SmallTest - public void testTracingInUsedObject() { - LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(2); - Integer key = Integer.valueOf(1); - Integer value = new Integer(3); - cache.put(key, value); - for (int i = 0; i < 3; ++i) { - cache.put(i + 10, i * i); - } - System.gc(); - assertEquals(value, cache.get(key)); - } - - @SmallTest - public void testLruAlgorithm() { - LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(2); - cache.put(0, new Integer(0)); - for (int i = 0; i < 3; ++i) { - cache.put(i + 1, i * i); - cache.get(0); - } - System.gc(); - assertEquals(Integer.valueOf(0), cache.get(0)); - } - - private static final int TEST_COUNT = 10000; - - static class Accessor extends Thread { - private final LruCache<Integer,Integer> mMap; - - public Accessor(LruCache<Integer, Integer> map) { - mMap = map; - } - - @Override - public void run() { - Log.v("TAG", "start get " + this); - for (int i = 0; i < TEST_COUNT; ++i) { - mMap.get(i % 2); - } - Log.v("TAG", "finish get " + this); - } - } - - @SuppressWarnings("unchecked") - public void testConcurrentAccess() throws Exception { - LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(4); - cache.put(0, 0); - cache.put(1, 1); - Accessor accessor[] = new Accessor[4]; - for (int i = 0; i < accessor.length; ++i) { - accessor[i] = new Accessor(cache); - } - for (int i = 0; i < accessor.length; ++i) { - accessor[i].start(); - } - for (int i = 0; i < accessor.length; ++i) { - accessor[i].join(); - } - } -} diff --git a/tests/src/com/android/camera/gallery/MockImage.java b/tests/src/com/android/camera/gallery/MockImage.java deleted file mode 100644 index ad68e55..0000000 --- a/tests/src/com/android/camera/gallery/MockImage.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.android.camera.gallery; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; - -import java.io.InputStream; - -public class MockImage implements IImage { - private final long mId; - private final long mTakenDate; - private IImageList mContainer; - - public MockImage(long id, long takenDate) { - mId = id; - mTakenDate = takenDate; - } - - public int getDegreesRotated() { - return 0; - } - - protected void setContainer(IImageList container) { - this.mContainer = container; - } - - public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels) { - return null; - } - - public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels, - boolean rotateAsNeeded) { - return null; - } - - public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels, - boolean rotateAsNeeded, boolean useNative) { - return null; - } - - public InputStream fullSizeImageData() { - return null; - } - - public long fullSizeImageId() { - return mId; - } - - public Uri fullSizeImageUri() { - return null; - } - - public IImageList getContainer() { - return mContainer; - } - - public String getDataPath() { - return null; - } - - public long getDateTaken() { - return mTakenDate; - } - - public String getDisplayName() { - return null; - } - - public int getHeight() { - return 0; - } - - public String getMimeType() { - return null; - } - - public String getTitle() { - return null; - } - - public int getWidth() { - return 0; - } - - public boolean isDrm() { - return false; - } - - public boolean isReadonly() { - return false; - } - - public Bitmap miniThumbBitmap() { - return null; - } - - public boolean rotateImageBy(int degrees) { - return false; - } - - public void setTitle(String name) { - } - - public Bitmap thumbBitmap(boolean rotateAsNeeded) { - return null; - } - - public Uri thumbUri() { - return null; - } -} diff --git a/tests/src/com/android/camera/gallery/MockImageList.java b/tests/src/com/android/camera/gallery/MockImageList.java deleted file mode 100644 index b9a7846..0000000 --- a/tests/src/com/android/camera/gallery/MockImageList.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.android.camera.gallery; - -import android.content.ContentResolver; -import android.net.Uri; -import android.os.Parcel; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MockImageList implements IImageList { - - private final ArrayList<IImage> mList = new ArrayList<IImage>(); - - public void checkThumbnail(int index) { - } - - public void deactivate() { - } - - public HashMap<String, String> getBucketIds() { - return null; - } - - public int getCount() { - return mList.size(); - } - - public IImage getImageAt(int i) { - return mList.get(i); - } - - public IImage getImageForUri(Uri uri) { - return null; - } - - public int getImageIndex(IImage image) { - return mList.indexOf(image); - } - - public boolean isEmpty() { - return mList.isEmpty(); - } - - public boolean removeImage(IImage image) { - return mList.remove(image); - } - - public boolean removeImageAt(int i) { - return mList.remove(i) != null; - } - - public void addImage(MockImage image) { - mList.add(image); - image.setContainer(this); - } - - public void open(ContentResolver resolver) { - } - - public void close() { - } - - public void writeToParcel(Parcel out, int flags) { - throw new UnsupportedOperationException(); - } - - public int describeContents() { - return 0; - } -} |