summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-02-17 13:32:58 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-02-17 13:32:58 -0800
commit7de6ed00f051c97d44ae579c003d1fed68352bec (patch)
tree33d0faa9ab70c570d68fded558926fd5284e16b2 /tests
parent4f774a737497050d69acecbef4f54673c170544f (diff)
parent7dd30cb0bd011e5fbd817fa64863b4c266dd76b7 (diff)
downloadpackages_apps_Browser-7de6ed00f051c97d44ae579c003d1fed68352bec.tar.gz
packages_apps_Browser-7de6ed00f051c97d44ae579c003d1fed68352bec.tar.bz2
packages_apps_Browser-7de6ed00f051c97d44ae579c003d1fed68352bec.zip
Merge "Fix shouldUpdateImage check"
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/browser/tests/BP2ProviderTests.java46
1 files changed, 46 insertions, 0 deletions
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 000000000..a468fcdee
--- /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));
+ }
+
+}