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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator_unittest.cc

Issue 10349013: Prevent browser thumbnailer from trying to read from frontbuffer (surface texture) when none exists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming HasSurface to IsSurfaceAvailableForCopy Created 8 years, 8 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
Index: chrome/browser/tab_contents/thumbnail_generator_unittest.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
index e79b77def93f00dca0005d08e8e2d877af4d774b..7963506525d376c21302df7e458e3002b8fe0197 100644
--- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
@@ -191,23 +191,27 @@ TEST_F(ThumbnailGeneratorTest, ShouldUpdateThumbnail) {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
scoped_refptr<MockTopSites> top_sites(new MockTopSites(&profile));
+ // Should be false when we don't have a surface available for copy
+ EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail(
+ &profile, top_sites.get(), kBadURL, false));
+
// Should be false because it's a bad URL.
EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kBadURL));
+ &profile, top_sites.get(), kBadURL, true));
// Should be true, as it's a good URL.
EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kGoodURL));
+ &profile, top_sites.get(), kGoodURL, true));
// Should be false, if it's in the incognito mode.
profile.set_incognito(true);
EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kGoodURL));
+ &profile, top_sites.get(), kGoodURL, true));
// Should be true again, once turning off the incognito mode.
profile.set_incognito(false);
EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kGoodURL));
+ &profile, top_sites.get(), kGoodURL, true));
// Add a known URL. This makes the top sites data full.
ThumbnailScore bad_score;
@@ -219,11 +223,11 @@ TEST_F(ThumbnailGeneratorTest, ShouldUpdateThumbnail) {
// not known.
const GURL kAnotherGoodURL("http://www.youtube.com/");
EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kAnotherGoodURL));
+ &profile, top_sites.get(), kAnotherGoodURL, true));
// Should be true, as the existing thumbnail is bad (i.e need a better one).
EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kGoodURL));
+ &profile, top_sites.get(), kGoodURL, true));
// Replace the thumbnail score with a really good one.
ThumbnailScore good_score;
@@ -237,5 +241,5 @@ TEST_F(ThumbnailGeneratorTest, ShouldUpdateThumbnail) {
// Should be false, as the existing thumbnail is good enough (i.e. don't
// need to replace the existing thumbnail which is new and good).
EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail(
- &profile, top_sites.get(), kGoodURL));
+ &profile, top_sites.get(), kGoodURL, true));
}

Powered by Google App Engine
This is Rietveld 408576698