Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: chrome/browser/history/android/android_provider_backend_unittest.cc

Issue 531493002: Move encoding SkBitmaps to PNG out of FaviconService::SetFavicons() and onto the history thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/android/android_provider_backend_unittest.cc
diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc
index 9eaf6c7db26fbae7ece8913a0f7c4148ee524649..0d23c2600f3bc3f5eec5e4a4ac4dc9ccd19413a6 100644
--- a/chrome/browser/history/android/android_provider_backend_unittest.cc
+++ b/chrome/browser/history/android/android_provider_backend_unittest.cc
@@ -31,6 +31,7 @@
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/skia/include/core/SkBitmap.h"
using base::Time;
using base::TimeDelta;
@@ -55,6 +56,14 @@ struct BookmarkCacheRow {
favicon_base::FaviconID favicon_id_;
};
+// Creates a 16x16 bitmap.
+SkBitmap CreateBitmap() {
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(16, 16);
+ bitmap.eraseColor(SK_ColorBLUE);
+ return bitmap;
+}
+
} // namespace
class AndroidProviderBackendDelegate : public HistoryBackend::Delegate {
@@ -256,17 +265,8 @@ TEST_F(AndroidProviderBackendTest, UpdateTables) {
url_id2 = url_row.id();
// Set favicon to url2.
- std::vector<unsigned char> data;
- data.push_back('1');
- favicon_base::FaviconRawBitmapData bitmap_data_element;
- bitmap_data_element.bitmap_data = new base::RefCountedBytes(data);
- bitmap_data_element.pixel_size = gfx::Size();
- bitmap_data_element.icon_url = GURL();
- std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data;
- favicon_bitmap_data.push_back(bitmap_data_element);
-
- history_backend->SetFavicons(
- url2, favicon_base::FAVICON, favicon_bitmap_data);
+ std::vector<SkBitmap> bitmaps(1u, CreateBitmap());
+ history_backend->SetFavicons(url2, favicon_base::FAVICON, GURL(), bitmaps);
history_backend->Closing();
}
@@ -403,17 +403,8 @@ TEST_F(AndroidProviderBackendTest, QueryHistoryAndBookmarks) {
ASSERT_EQ(2u, history_backend->UpdateURLs(url_rows));
// Set favicon to url2.
- std::vector<unsigned char> data;
- data.push_back('1');
- favicon_base::FaviconRawBitmapData bitmap_data_element;
- bitmap_data_element.bitmap_data = new base::RefCountedBytes(data);
- bitmap_data_element.pixel_size = gfx::Size();
- bitmap_data_element.icon_url = GURL();
- std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data;
- favicon_bitmap_data.push_back(bitmap_data_element);
-
- history_backend->SetFavicons(
- url2, favicon_base::FAVICON, favicon_bitmap_data);
+ std::vector<SkBitmap> bitmaps(1u, CreateBitmap());
+ history_backend->SetFavicons(url2, favicon_base::FAVICON, GURL(), bitmaps);
history_backend->Closing();
}
@@ -1849,17 +1840,8 @@ TEST_F(AndroidProviderBackendTest, QueryWithoutThumbnailDB) {
ASSERT_EQ(2u, history_backend->UpdateURLs(url_rows));
// Set favicon to url2.
- std::vector<unsigned char> data;
- data.push_back('1');
- favicon_base::FaviconRawBitmapData bitmap_data_element;
- bitmap_data_element.bitmap_data = new base::RefCountedBytes(data);
- bitmap_data_element.pixel_size = gfx::Size();
- bitmap_data_element.icon_url = GURL();
- std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data;
- favicon_bitmap_data.push_back(bitmap_data_element);
-
- history_backend->SetFavicons(
- url2, favicon_base::FAVICON, favicon_bitmap_data);
+ std::vector<SkBitmap> bitmaps(1u, CreateBitmap());
+ history_backend->SetFavicons(url2, favicon_base::FAVICON, GURL(), bitmaps);
history_backend->Closing();
}
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698