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

Side by Side Diff: chrome/browser/history/top_sites_unittest.cc

Issue 8355031: Most Visited: remove over-eager optimization that causes a lot of blank thumbnails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test and remove unused function Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/top_sites_cache.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // Set the thumbnail. 540 // Set the thumbnail.
541 EXPECT_TRUE(top_sites()->SetPageThumbnail(url, &thumbnail, medium_score)); 541 EXPECT_TRUE(top_sites()->SetPageThumbnail(url, &thumbnail, medium_score));
542 542
543 // Make sure the thumbnail was actually set. 543 // Make sure the thumbnail was actually set.
544 scoped_refptr<RefCountedBytes> result; 544 scoped_refptr<RefCountedBytes> result;
545 EXPECT_TRUE(top_sites()->GetPageThumbnail(url, &result)); 545 EXPECT_TRUE(top_sites()->GetPageThumbnail(url, &result));
546 EXPECT_TRUE(ThumbnailEqualsBytes(thumbnail, result.get())); 546 EXPECT_TRUE(ThumbnailEqualsBytes(thumbnail, result.get()));
547 547
548 // Reset the thumbnails and make sure we don't get it back. 548 // Reset the thumbnails and make sure we don't get it back.
549 SetTopSites(MostVisitedURLList()); 549 SetTopSites(MostVisitedURLList());
550 RefreshTopSitesAndRecreate();
550 EXPECT_FALSE(top_sites()->GetPageThumbnail(url, &result)); 551 EXPECT_FALSE(top_sites()->GetPageThumbnail(url, &result));
551 } 552 }
552 553
553 // Tests GetPageThumbnail. 554 // Tests GetPageThumbnail.
554 TEST_F(TopSitesTest, GetPageThumbnail) { 555 TEST_F(TopSitesTest, GetPageThumbnail) {
555 MostVisitedURLList url_list; 556 MostVisitedURLList url_list;
556 MostVisitedURL url1; 557 MostVisitedURL url1;
557 url1.url = GURL("http://asdf.com"); 558 url1.url = GURL("http://asdf.com");
558 url1.redirects.push_back(url1.url); 559 url1.redirects.push_back(url1.url);
559 url_list.push_back(url1); 560 url_list.push_back(url1);
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 ui_test_utils::WindowedNotificationObserver observer( 1389 ui_test_utils::WindowedNotificationObserver observer(
1389 chrome::NOTIFICATION_TOP_SITES_LOADED, 1390 chrome::NOTIFICATION_TOP_SITES_LOADED,
1390 content::Source<Profile>(profile())); 1391 content::Source<Profile>(profile()));
1391 profile()->CreateTopSites(); 1392 profile()->CreateTopSites();
1392 profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)->UnloadBackend(); 1393 profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)->UnloadBackend();
1393 profile()->BlockUntilHistoryProcessesPendingRequests(); 1394 profile()->BlockUntilHistoryProcessesPendingRequests();
1394 observer.Wait(); 1395 observer.Wait();
1395 } 1396 }
1396 1397
1397 } // namespace history 1398 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698