| Index: chrome/browser/history/top_sites_unittest.cc
|
| ===================================================================
|
| --- chrome/browser/history/top_sites_unittest.cc (revision 134496)
|
| +++ chrome/browser/history/top_sites_unittest.cc (working copy)
|
| @@ -114,14 +114,15 @@
|
|
|
| // Extracts the data from |t1| into a SkBitmap. This is intended for usage of
|
| // thumbnail data, which is stored as jpgs.
|
| -SkBitmap ExtractThumbnail(const RefCountedMemory& t1) {
|
| +SkBitmap ExtractThumbnail(const base::RefCountedMemory& t1) {
|
| scoped_ptr<SkBitmap> image(gfx::JPEGCodec::Decode(t1.front(),
|
| t1.size()));
|
| return image.get() ? *image : SkBitmap();
|
| }
|
|
|
| // Returns true if t1 and t2 contain the same data.
|
| -bool ThumbnailsAreEqual(RefCountedMemory* t1, RefCountedMemory* t2) {
|
| +bool ThumbnailsAreEqual(base::RefCountedMemory* t1,
|
| + base::RefCountedMemory* t2) {
|
| if (!t1 || !t2)
|
| return false;
|
| if (t1->size() != t2->size())
|
| @@ -158,7 +159,7 @@
|
|
|
| // Gets the thumbnail for |url| from TopSites.
|
| SkBitmap GetThumbnail(const GURL& url) {
|
| - scoped_refptr<RefCountedMemory> data;
|
| + scoped_refptr<base::RefCountedMemory> data;
|
| return top_sites()->GetPageThumbnail(url, &data) ?
|
| ExtractThumbnail(*data.get()) : SkBitmap();
|
| }
|
| @@ -271,7 +272,8 @@
|
| }
|
|
|
| // Returns true if the thumbnail equals the specified bytes.
|
| - bool ThumbnailEqualsBytes(const gfx::Image& image, RefCountedMemory* bytes) {
|
| + bool ThumbnailEqualsBytes(const gfx::Image& image,
|
| + base::RefCountedMemory* bytes) {
|
| scoped_refptr<base::RefCountedBytes> encoded_image;
|
| gfx::Image copy(image); // EncodeBitmap() doesn't accept const images.
|
| TopSites::EncodeBitmap(©, &encoded_image);
|
| @@ -539,7 +541,7 @@
|
| EXPECT_TRUE(top_sites()->SetPageThumbnail(url, &thumbnail, medium_score));
|
|
|
| // Make sure the thumbnail was actually set.
|
| - scoped_refptr<RefCountedMemory> result;
|
| + scoped_refptr<base::RefCountedMemory> result;
|
| EXPECT_TRUE(top_sites()->GetPageThumbnail(url, &result));
|
| EXPECT_TRUE(ThumbnailEqualsBytes(thumbnail, result.get()));
|
|
|
| @@ -569,7 +571,7 @@
|
| gfx::Image thumbnail(CreateBitmap(SK_ColorWHITE));
|
| ThumbnailScore score(0.5, true, true, base::Time::Now());
|
|
|
| - scoped_refptr<RefCountedMemory> result;
|
| + scoped_refptr<base::RefCountedMemory> result;
|
| EXPECT_TRUE(top_sites()->SetPageThumbnail(url1.url, &thumbnail, score));
|
| EXPECT_TRUE(top_sites()->GetPageThumbnail(url1.url, &result));
|
|
|
| @@ -643,7 +645,7 @@
|
| EXPECT_EQ(asdf_title, querier.urls()[0].title);
|
| ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 1));
|
|
|
| - scoped_refptr<RefCountedMemory> read_data;
|
| + scoped_refptr<base::RefCountedMemory> read_data;
|
| EXPECT_TRUE(top_sites()->GetPageThumbnail(asdf_url, &read_data));
|
| EXPECT_TRUE(ThumbnailEqualsBytes(tmp_bitmap, read_data.get()));
|
| }
|
| @@ -708,7 +710,7 @@
|
| EXPECT_EQ(asdf_title, querier.urls()[0].title);
|
| ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 1));
|
|
|
| - scoped_refptr<RefCountedMemory> read_data;
|
| + scoped_refptr<base::RefCountedMemory> read_data;
|
| EXPECT_TRUE(top_sites()->GetPageThumbnail(asdf_url, &read_data));
|
| EXPECT_TRUE(ThumbnailEqualsBytes(asdf_thumbnail, read_data.get()));
|
| }
|
| @@ -733,7 +735,7 @@
|
| RefreshTopSitesAndRecreate();
|
|
|
| {
|
| - scoped_refptr<RefCountedMemory> read_data;
|
| + scoped_refptr<base::RefCountedMemory> read_data;
|
| TopSitesQuerier querier;
|
| querier.QueryTopSites(top_sites(), false);
|
|
|
| @@ -762,7 +764,7 @@
|
| medium_score));
|
| RefreshTopSitesAndRecreate();
|
| {
|
| - scoped_refptr<RefCountedMemory> read_data;
|
| + scoped_refptr<base::RefCountedMemory> read_data;
|
| EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data));
|
| EXPECT_TRUE(ThumbnailEqualsBytes(weewar_bitmap, read_data.get()));
|
| }
|
| @@ -782,7 +784,7 @@
|
| // Check that the thumbnail was updated.
|
| RefreshTopSitesAndRecreate();
|
| {
|
| - scoped_refptr<RefCountedMemory> read_data;
|
| + scoped_refptr<base::RefCountedMemory> read_data;
|
| EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data));
|
| EXPECT_FALSE(ThumbnailEqualsBytes(weewar_bitmap, read_data.get()));
|
| EXPECT_TRUE(ThumbnailEqualsBytes(green_bitmap, read_data.get()));
|
| @@ -1046,7 +1048,7 @@
|
| medium_score));
|
|
|
| // We shouldn't get the thumnail back though (the url isn't in to sites yet).
|
| - scoped_refptr<RefCountedMemory> out;
|
| + scoped_refptr<base::RefCountedMemory> out;
|
| EXPECT_FALSE(top_sites()->GetPageThumbnail(unknown_url, &out));
|
| // But we should be able to get the temporary page thumbnail score.
|
| ThumbnailScore out_score;
|
|
|