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

Side by Side Diff: components/history/core/browser/history_backend_unittest.cc

Issue 2856873002: [Thumbnails DB] Allow setting last_requested time when accessing favicons. (Closed)
Patch Set: Minor touches Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 EXPECT_EQ(kLargeSize, favicon_bitmaps[1].pixel_size); 1924 EXPECT_EQ(kLargeSize, favicon_bitmaps[1].pixel_size);
1925 1925
1926 // Call SetFavicons() with bitmap data for only the large bitmap. Check that 1926 // Call SetFavicons() with bitmap data for only the large bitmap. Check that
1927 // the small bitmap is in fact deleted. 1927 // the small bitmap is in fact deleted.
1928 bitmaps.clear(); 1928 bitmaps.clear();
1929 bitmaps.push_back(CreateBitmap(SK_ColorWHITE, kLargeEdgeSize)); 1929 bitmaps.push_back(CreateBitmap(SK_ColorWHITE, kLargeEdgeSize));
1930 backend_->SetFavicons(page_url, favicon_base::FAVICON, icon_url, bitmaps); 1930 backend_->SetFavicons(page_url, favicon_base::FAVICON, icon_url, bitmaps);
1931 1931
1932 scoped_refptr<base::RefCountedMemory> bitmap_data_out; 1932 scoped_refptr<base::RefCountedMemory> bitmap_data_out;
1933 gfx::Size pixel_size_out; 1933 gfx::Size pixel_size_out;
1934 EXPECT_FALSE(backend_->thumbnail_db_->GetFaviconBitmap(small_bitmap_id, 1934 EXPECT_FALSE(backend_->thumbnail_db_->GetFaviconBitmap(
1935 NULL, NULL, &bitmap_data_out, &pixel_size_out)); 1935 small_bitmap_id, /*access_time=*/base::Time::Now(), NULL,
1936 EXPECT_TRUE(backend_->thumbnail_db_->GetFaviconBitmap(large_bitmap_id, 1936 &bitmap_data_out, &pixel_size_out));
1937 NULL, NULL, &bitmap_data_out, &pixel_size_out)); 1937 EXPECT_TRUE(backend_->thumbnail_db_->GetFaviconBitmap(
1938 large_bitmap_id, /*access_time=*/base::Time::Now(), NULL,
1939 &bitmap_data_out, &pixel_size_out));
1938 EXPECT_TRUE(BitmapColorEqual(SK_ColorWHITE, bitmap_data_out)); 1940 EXPECT_TRUE(BitmapColorEqual(SK_ColorWHITE, bitmap_data_out));
1939 EXPECT_EQ(kLargeSize, pixel_size_out); 1941 EXPECT_EQ(kLargeSize, pixel_size_out);
1940 1942
1941 icon_mappings.clear(); 1943 icon_mappings.clear();
1942 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL(page_url, 1944 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL(page_url,
1943 &icon_mappings)); 1945 &icon_mappings));
1944 EXPECT_EQ(1u, icon_mappings.size()); 1946 EXPECT_EQ(1u, icon_mappings.size());
1945 EXPECT_EQ(favicon_id, icon_mappings[0].icon_id); 1947 EXPECT_EQ(favicon_id, icon_mappings[0].icon_id);
1946 } 1948 }
1947 1949
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
3925 backend_->QueryMostVisitedURLs(100, 100, &most_visited); 3927 backend_->QueryMostVisitedURLs(100, 100, &most_visited);
3926 3928
3927 const base::string16 kSomeTitle; // Ignored by equality operator. 3929 const base::string16 kSomeTitle; // Ignored by equality operator.
3928 EXPECT_THAT( 3930 EXPECT_THAT(
3929 most_visited, 3931 most_visited,
3930 ElementsAre(MostVisitedURL(GURL("http://example1.com"), kSomeTitle), 3932 ElementsAre(MostVisitedURL(GURL("http://example1.com"), kSomeTitle),
3931 MostVisitedURL(GURL("http://example5.com"), kSomeTitle))); 3933 MostVisitedURL(GURL("http://example5.com"), kSomeTitle)));
3932 } 3934 }
3933 3935
3934 } // namespace history 3936 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698