diff options
author | John Reck <jreck@google.com> | 2011-02-17 13:32:58 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-17 13:32:58 -0800 |
commit | 7de6ed00f051c97d44ae579c003d1fed68352bec (patch) | |
tree | 33d0faa9ab70c570d68fded558926fd5284e16b2 | |
parent | 4f774a737497050d69acecbef4f54673c170544f (diff) | |
parent | 7dd30cb0bd011e5fbd817fa64863b4c266dd76b7 (diff) | |
download | packages_apps_Browser-7de6ed00f051c97d44ae579c003d1fed68352bec.zip packages_apps_Browser-7de6ed00f051c97d44ae579c003d1fed68352bec.tar.gz packages_apps_Browser-7de6ed00f051c97d44ae579c003d1fed68352bec.tar.bz2 |
Merge "Fix shouldUpdateImage check"
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 3 | ||||
-rw-r--r-- | tests/src/com/android/browser/tests/BP2ProviderTests.java | 46 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index 10b3821..3033db4 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -1441,6 +1441,9 @@ public class BrowserProvider2 extends SQLiteContentProvider { byte[] cthumb = null; byte[] ctouch = null; try { + if (cursor.getCount() <= 0) { + return nfavicon != null || nthumb != null || ntouch != null; + } while (cursor.moveToNext()) { if (nfavicon != null) { cfavicon = cursor.getBlob(0); diff --git a/tests/src/com/android/browser/tests/BP2ProviderTests.java b/tests/src/com/android/browser/tests/BP2ProviderTests.java new file mode 100644 index 0000000..a468fcd --- /dev/null +++ b/tests/src/com/android/browser/tests/BP2ProviderTests.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.browser.tests; + +import com.android.browser.tests.utils.BP2TestCaseHelper; + +import android.content.ContentValues; +import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; +import android.provider.BrowserContract.Images; +import android.test.suitebuilder.annotation.SmallTest; + +import java.io.ByteArrayOutputStream; + +@SmallTest +public class BP2ProviderTests extends BP2TestCaseHelper { + + public void testUpdateImage() { + String url = "http://stub1.com"; + insertBookmark(url, "stub 1"); + ContentValues values = new ContentValues(); + values.put(Images.URL, url); + Bitmap bitmap = Bitmap.createBitmap(1, 1, Config.ARGB_8888); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); + values.put(Images.THUMBNAIL, os.toByteArray()); + // Use updateBookmarks because the bookmarks URI observer should + // be triggered, even though we aren't giving it a bookmarks URI + assertTrue(updateBookmark(Images.CONTENT_URI, values)); + } + +} |