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

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

Issue 10272004: Move RefCountedMemory class to base namespace. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 CancelableRequestConsumer consumer_; 107 CancelableRequestConsumer consumer_;
108 MostVisitedURLList urls_; 108 MostVisitedURLList urls_;
109 int number_of_callbacks_; 109 int number_of_callbacks_;
110 bool waiting_; 110 bool waiting_;
111 111
112 DISALLOW_COPY_AND_ASSIGN(TopSitesQuerier); 112 DISALLOW_COPY_AND_ASSIGN(TopSitesQuerier);
113 }; 113 };
114 114
115 // Extracts the data from |t1| into a SkBitmap. This is intended for usage of 115 // Extracts the data from |t1| into a SkBitmap. This is intended for usage of
116 // thumbnail data, which is stored as jpgs. 116 // thumbnail data, which is stored as jpgs.
117 SkBitmap ExtractThumbnail(const RefCountedMemory& t1) { 117 SkBitmap ExtractThumbnail(const base::RefCountedMemory& t1) {
118 scoped_ptr<SkBitmap> image(gfx::JPEGCodec::Decode(t1.front(), 118 scoped_ptr<SkBitmap> image(gfx::JPEGCodec::Decode(t1.front(),
119 t1.size())); 119 t1.size()));
120 return image.get() ? *image : SkBitmap(); 120 return image.get() ? *image : SkBitmap();
121 } 121 }
122 122
123 // Returns true if t1 and t2 contain the same data. 123 // Returns true if t1 and t2 contain the same data.
124 bool ThumbnailsAreEqual(RefCountedMemory* t1, RefCountedMemory* t2) { 124 bool ThumbnailsAreEqual(base::RefCountedMemory* t1, RefCountedMemory* t2) {
125 if (!t1 || !t2) 125 if (!t1 || !t2)
126 return false; 126 return false;
127 if (t1->size() != t2->size()) 127 if (t1->size() != t2->size())
128 return false; 128 return false;
129 return !memcmp(t1->front(), t2->front(), t1->size()); 129 return !memcmp(t1->front(), t2->front(), t1->size());
130 } 130 }
131 131
132 } // namespace 132 } // namespace
133 133
134 class TopSitesTest : public HistoryUnitTestBase { 134 class TopSitesTest : public HistoryUnitTestBase {
(...skipping 16 matching lines...) Expand all
151 profile_.reset(); 151 profile_.reset();
152 } 152 }
153 153
154 // Returns true if history and top sites should be created in SetUp. 154 // Returns true if history and top sites should be created in SetUp.
155 virtual bool CreateHistoryAndTopSites() { 155 virtual bool CreateHistoryAndTopSites() {
156 return true; 156 return true;
157 } 157 }
158 158
159 // Gets the thumbnail for |url| from TopSites. 159 // Gets the thumbnail for |url| from TopSites.
160 SkBitmap GetThumbnail(const GURL& url) { 160 SkBitmap GetThumbnail(const GURL& url) {
161 scoped_refptr<RefCountedMemory> data; 161 scoped_refptr<base::RefCountedMemory> data;
162 return top_sites()->GetPageThumbnail(url, &data) ? 162 return top_sites()->GetPageThumbnail(url, &data) ?
163 ExtractThumbnail(*data.get()) : SkBitmap(); 163 ExtractThumbnail(*data.get()) : SkBitmap();
164 } 164 }
165 165
166 // Creates a bitmap of the specified color. Caller takes ownership. 166 // Creates a bitmap of the specified color. Caller takes ownership.
167 gfx::Image CreateBitmap(SkColor color) { 167 gfx::Image CreateBitmap(SkColor color) {
168 SkBitmap* thumbnail = new SkBitmap; 168 SkBitmap* thumbnail = new SkBitmap;
169 thumbnail->setConfig(SkBitmap::kARGB_8888_Config, 4, 4); 169 thumbnail->setConfig(SkBitmap::kARGB_8888_Config, 4, 4);
170 thumbnail->allocPixels(); 170 thumbnail->allocPixels();
171 thumbnail->eraseColor(color); 171 thumbnail->eraseColor(color);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 redirects, history::SOURCE_BROWSED, false); 264 redirects, history::SOURCE_BROWSED, false);
265 history_service()->SetPageTitle(url, title); 265 history_service()->SetPageTitle(url, title);
266 } 266 }
267 267
268 // Delets a url. 268 // Delets a url.
269 void DeleteURL(const GURL& url) { 269 void DeleteURL(const GURL& url) {
270 history_service()->DeleteURL(url); 270 history_service()->DeleteURL(url);
271 } 271 }
272 272
273 // Returns true if the thumbnail equals the specified bytes. 273 // Returns true if the thumbnail equals the specified bytes.
274 bool ThumbnailEqualsBytes(const gfx::Image& image, RefCountedMemory* bytes) { 274 bool ThumbnailEqualsBytes(const gfx::Image& image,
275 base::RefCountedMemory* bytes) {
275 scoped_refptr<base::RefCountedBytes> encoded_image; 276 scoped_refptr<base::RefCountedBytes> encoded_image;
276 gfx::Image copy(image); // EncodeBitmap() doesn't accept const images. 277 gfx::Image copy(image); // EncodeBitmap() doesn't accept const images.
277 TopSites::EncodeBitmap(&copy, &encoded_image); 278 TopSites::EncodeBitmap(&copy, &encoded_image);
278 return ThumbnailsAreEqual(encoded_image, bytes); 279 return ThumbnailsAreEqual(encoded_image, bytes);
279 } 280 }
280 281
281 // Recreates top sites. This forces top sites to reread from the db. 282 // Recreates top sites. This forces top sites to reread from the db.
282 void RecreateTopSitesAndBlock() { 283 void RecreateTopSitesAndBlock() {
283 // Recreate TopSites and wait for it to load. 284 // Recreate TopSites and wait for it to load.
284 profile()->CreateTopSites(); 285 profile()->CreateTopSites();
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 533
533 base::Time now = base::Time::Now(); 534 base::Time now = base::Time::Now();
534 ThumbnailScore low_score(1.0, true, true, now); 535 ThumbnailScore low_score(1.0, true, true, now);
535 ThumbnailScore medium_score(0.5, true, true, now); 536 ThumbnailScore medium_score(0.5, true, true, now);
536 ThumbnailScore high_score(0.0, true, true, now); 537 ThumbnailScore high_score(0.0, true, true, now);
537 538
538 // Set the thumbnail. 539 // Set the thumbnail.
539 EXPECT_TRUE(top_sites()->SetPageThumbnail(url, &thumbnail, medium_score)); 540 EXPECT_TRUE(top_sites()->SetPageThumbnail(url, &thumbnail, medium_score));
540 541
541 // Make sure the thumbnail was actually set. 542 // Make sure the thumbnail was actually set.
542 scoped_refptr<RefCountedMemory> result; 543 scoped_refptr<base::RefCountedMemory> result;
543 EXPECT_TRUE(top_sites()->GetPageThumbnail(url, &result)); 544 EXPECT_TRUE(top_sites()->GetPageThumbnail(url, &result));
544 EXPECT_TRUE(ThumbnailEqualsBytes(thumbnail, result.get())); 545 EXPECT_TRUE(ThumbnailEqualsBytes(thumbnail, result.get()));
545 546
546 // Reset the thumbnails and make sure we don't get it back. 547 // Reset the thumbnails and make sure we don't get it back.
547 SetTopSites(MostVisitedURLList()); 548 SetTopSites(MostVisitedURLList());
548 RefreshTopSitesAndRecreate(); 549 RefreshTopSitesAndRecreate();
549 EXPECT_FALSE(top_sites()->GetPageThumbnail(url, &result)); 550 EXPECT_FALSE(top_sites()->GetPageThumbnail(url, &result));
550 } 551 }
551 552
552 // Tests GetPageThumbnail. 553 // Tests GetPageThumbnail.
553 TEST_F(TopSitesTest, GetPageThumbnail) { 554 TEST_F(TopSitesTest, GetPageThumbnail) {
554 MostVisitedURLList url_list; 555 MostVisitedURLList url_list;
555 MostVisitedURL url1; 556 MostVisitedURL url1;
556 url1.url = GURL("http://asdf.com"); 557 url1.url = GURL("http://asdf.com");
557 url1.redirects.push_back(url1.url); 558 url1.redirects.push_back(url1.url);
558 url_list.push_back(url1); 559 url_list.push_back(url1);
559 560
560 MostVisitedURL url2; 561 MostVisitedURL url2;
561 url2.url = GURL("http://gmail.com"); 562 url2.url = GURL("http://gmail.com");
562 url2.redirects.push_back(url2.url); 563 url2.redirects.push_back(url2.url);
563 url2.redirects.push_back(GURL("http://mail.google.com")); 564 url2.redirects.push_back(GURL("http://mail.google.com"));
564 url_list.push_back(url2); 565 url_list.push_back(url2);
565 566
566 SetTopSites(url_list); 567 SetTopSites(url_list);
567 568
568 // Create a dummy thumbnail. 569 // Create a dummy thumbnail.
569 gfx::Image thumbnail(CreateBitmap(SK_ColorWHITE)); 570 gfx::Image thumbnail(CreateBitmap(SK_ColorWHITE));
570 ThumbnailScore score(0.5, true, true, base::Time::Now()); 571 ThumbnailScore score(0.5, true, true, base::Time::Now());
571 572
572 scoped_refptr<RefCountedMemory> result; 573 scoped_refptr<base::RefCountedMemory> result;
573 EXPECT_TRUE(top_sites()->SetPageThumbnail(url1.url, &thumbnail, score)); 574 EXPECT_TRUE(top_sites()->SetPageThumbnail(url1.url, &thumbnail, score));
574 EXPECT_TRUE(top_sites()->GetPageThumbnail(url1.url, &result)); 575 EXPECT_TRUE(top_sites()->GetPageThumbnail(url1.url, &result));
575 576
576 EXPECT_TRUE(top_sites()->SetPageThumbnail(GURL("http://gmail.com"), 577 EXPECT_TRUE(top_sites()->SetPageThumbnail(GURL("http://gmail.com"),
577 &thumbnail, score)); 578 &thumbnail, score));
578 EXPECT_TRUE(top_sites()->GetPageThumbnail(GURL("http://gmail.com"), 579 EXPECT_TRUE(top_sites()->GetPageThumbnail(GURL("http://gmail.com"),
579 &result)); 580 &result));
580 // Get a thumbnail via a redirect. 581 // Get a thumbnail via a redirect.
581 EXPECT_TRUE(top_sites()->GetPageThumbnail(GURL("http://mail.google.com"), 582 EXPECT_TRUE(top_sites()->GetPageThumbnail(GURL("http://mail.google.com"),
582 &result)); 583 &result));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 RecreateTopSitesAndBlock(); 637 RecreateTopSitesAndBlock();
637 638
638 { 639 {
639 TopSitesQuerier querier; 640 TopSitesQuerier querier;
640 querier.QueryTopSites(top_sites(), false); 641 querier.QueryTopSites(top_sites(), false);
641 ASSERT_EQ(1u + GetPrepopulatePages().size(), querier.urls().size()); 642 ASSERT_EQ(1u + GetPrepopulatePages().size(), querier.urls().size());
642 EXPECT_EQ(asdf_url, querier.urls()[0].url); 643 EXPECT_EQ(asdf_url, querier.urls()[0].url);
643 EXPECT_EQ(asdf_title, querier.urls()[0].title); 644 EXPECT_EQ(asdf_title, querier.urls()[0].title);
644 ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 1)); 645 ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 1));
645 646
646 scoped_refptr<RefCountedMemory> read_data; 647 scoped_refptr<base::RefCountedMemory> read_data;
647 EXPECT_TRUE(top_sites()->GetPageThumbnail(asdf_url, &read_data)); 648 EXPECT_TRUE(top_sites()->GetPageThumbnail(asdf_url, &read_data));
648 EXPECT_TRUE(ThumbnailEqualsBytes(tmp_bitmap, read_data.get())); 649 EXPECT_TRUE(ThumbnailEqualsBytes(tmp_bitmap, read_data.get()));
649 } 650 }
650 651
651 MostVisitedURL url2; 652 MostVisitedURL url2;
652 url2.url = google_url; 653 url2.url = google_url;
653 url2.title = google_title; 654 url2.title = google_title;
654 url2.redirects.push_back(url2.url); 655 url2.redirects.push_back(url2.url);
655 656
656 AddPageToHistory(url2.url, url2.title); 657 AddPageToHistory(url2.url, url2.title);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 702
702 { 703 {
703 TopSitesQuerier querier; 704 TopSitesQuerier querier;
704 querier.QueryTopSites(top_sites(), false); 705 querier.QueryTopSites(top_sites(), false);
705 706
706 ASSERT_EQ(1u + GetPrepopulatePages().size(), querier.urls().size()); 707 ASSERT_EQ(1u + GetPrepopulatePages().size(), querier.urls().size());
707 EXPECT_EQ(asdf_url, querier.urls()[0].url); 708 EXPECT_EQ(asdf_url, querier.urls()[0].url);
708 EXPECT_EQ(asdf_title, querier.urls()[0].title); 709 EXPECT_EQ(asdf_title, querier.urls()[0].title);
709 ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 1)); 710 ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 1));
710 711
711 scoped_refptr<RefCountedMemory> read_data; 712 scoped_refptr<base::RefCountedMemory> read_data;
712 EXPECT_TRUE(top_sites()->GetPageThumbnail(asdf_url, &read_data)); 713 EXPECT_TRUE(top_sites()->GetPageThumbnail(asdf_url, &read_data));
713 EXPECT_TRUE(ThumbnailEqualsBytes(asdf_thumbnail, read_data.get())); 714 EXPECT_TRUE(ThumbnailEqualsBytes(asdf_thumbnail, read_data.get()));
714 } 715 }
715 716
716 MostVisitedURL url2; 717 MostVisitedURL url2;
717 url2.url = google3_url; 718 url2.url = google3_url;
718 url2.title = google_title; 719 url2.title = google_title;
719 url2.redirects.push_back(google1_url); 720 url2.redirects.push_back(google1_url);
720 url2.redirects.push_back(google2_url); 721 url2.redirects.push_back(google2_url);
721 url2.redirects.push_back(google3_url); 722 url2.redirects.push_back(google3_url);
722 723
723 AddPageToHistory(google3_url, url2.title, url2.redirects, 724 AddPageToHistory(google3_url, url2.title, url2.redirects,
724 add_time - base::TimeDelta::FromMinutes(1)); 725 add_time - base::TimeDelta::FromMinutes(1));
725 // Add google twice so that it becomes the first visited site. 726 // Add google twice so that it becomes the first visited site.
726 AddPageToHistory(google3_url, url2.title, url2.redirects, 727 AddPageToHistory(google3_url, url2.title, url2.redirects,
727 add_time - base::TimeDelta::FromMinutes(2)); 728 add_time - base::TimeDelta::FromMinutes(2));
728 729
729 gfx::Image google_thumbnail(CreateBitmap(SK_ColorBLUE)); 730 gfx::Image google_thumbnail(CreateBitmap(SK_ColorBLUE));
730 ASSERT_TRUE(top_sites()->SetPageThumbnail( 731 ASSERT_TRUE(top_sites()->SetPageThumbnail(
731 url2.url, &google_thumbnail, ThumbnailScore())); 732 url2.url, &google_thumbnail, ThumbnailScore()));
732 733
733 RefreshTopSitesAndRecreate(); 734 RefreshTopSitesAndRecreate();
734 735
735 { 736 {
736 scoped_refptr<RefCountedMemory> read_data; 737 scoped_refptr<base::RefCountedMemory> read_data;
737 TopSitesQuerier querier; 738 TopSitesQuerier querier;
738 querier.QueryTopSites(top_sites(), false); 739 querier.QueryTopSites(top_sites(), false);
739 740
740 ASSERT_EQ(2u + GetPrepopulatePages().size(), querier.urls().size()); 741 ASSERT_EQ(2u + GetPrepopulatePages().size(), querier.urls().size());
741 EXPECT_EQ(google1_url, querier.urls()[0].url); 742 EXPECT_EQ(google1_url, querier.urls()[0].url);
742 EXPECT_EQ(google_title, querier.urls()[0].title); 743 EXPECT_EQ(google_title, querier.urls()[0].title);
743 ASSERT_EQ(3u, querier.urls()[0].redirects.size()); 744 ASSERT_EQ(3u, querier.urls()[0].redirects.size());
744 EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data)); 745 EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data));
745 EXPECT_TRUE(ThumbnailEqualsBytes(google_thumbnail, read_data.get())); 746 EXPECT_TRUE(ThumbnailEqualsBytes(google_thumbnail, read_data.get()));
746 747
747 EXPECT_EQ(asdf_url, querier.urls()[1].url); 748 EXPECT_EQ(asdf_url, querier.urls()[1].url);
748 EXPECT_EQ(asdf_title, querier.urls()[1].title); 749 EXPECT_EQ(asdf_title, querier.urls()[1].title);
749 ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 2)); 750 ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 2));
750 } 751 }
751 752
752 gfx::Image weewar_bitmap(CreateBitmap(SK_ColorYELLOW)); 753 gfx::Image weewar_bitmap(CreateBitmap(SK_ColorYELLOW));
753 754
754 base::Time thumbnail_time(base::Time::Now()); 755 base::Time thumbnail_time(base::Time::Now());
755 ThumbnailScore low_score(1.0, true, true, thumbnail_time); 756 ThumbnailScore low_score(1.0, true, true, thumbnail_time);
756 ThumbnailScore medium_score(0.5, true, true, thumbnail_time); 757 ThumbnailScore medium_score(0.5, true, true, thumbnail_time);
757 ThumbnailScore high_score(0.0, true, true, thumbnail_time); 758 ThumbnailScore high_score(0.0, true, true, thumbnail_time);
758 759
759 // 1. Set to weewar. (Writes the thumbnail to the DB.) 760 // 1. Set to weewar. (Writes the thumbnail to the DB.)
760 EXPECT_TRUE(top_sites()->SetPageThumbnail(google3_url, 761 EXPECT_TRUE(top_sites()->SetPageThumbnail(google3_url,
761 &weewar_bitmap, 762 &weewar_bitmap,
762 medium_score)); 763 medium_score));
763 RefreshTopSitesAndRecreate(); 764 RefreshTopSitesAndRecreate();
764 { 765 {
765 scoped_refptr<RefCountedMemory> read_data; 766 scoped_refptr<base::RefCountedMemory> read_data;
766 EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data)); 767 EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data));
767 EXPECT_TRUE(ThumbnailEqualsBytes(weewar_bitmap, read_data.get())); 768 EXPECT_TRUE(ThumbnailEqualsBytes(weewar_bitmap, read_data.get()));
768 } 769 }
769 770
770 gfx::Image green_bitmap(CreateBitmap(SK_ColorGREEN)); 771 gfx::Image green_bitmap(CreateBitmap(SK_ColorGREEN));
771 772
772 // 2. Set to google - low score. 773 // 2. Set to google - low score.
773 EXPECT_FALSE(top_sites()->SetPageThumbnail(google3_url, 774 EXPECT_FALSE(top_sites()->SetPageThumbnail(google3_url,
774 &green_bitmap, 775 &green_bitmap,
775 low_score)); 776 low_score));
776 777
777 // 3. Set to google - high score. 778 // 3. Set to google - high score.
778 EXPECT_TRUE(top_sites()->SetPageThumbnail(google1_url, 779 EXPECT_TRUE(top_sites()->SetPageThumbnail(google1_url,
779 &green_bitmap, 780 &green_bitmap,
780 high_score)); 781 high_score));
781 782
782 // Check that the thumbnail was updated. 783 // Check that the thumbnail was updated.
783 RefreshTopSitesAndRecreate(); 784 RefreshTopSitesAndRecreate();
784 { 785 {
785 scoped_refptr<RefCountedMemory> read_data; 786 scoped_refptr<base::RefCountedMemory> read_data;
786 EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data)); 787 EXPECT_TRUE(top_sites()->GetPageThumbnail(google3_url, &read_data));
787 EXPECT_FALSE(ThumbnailEqualsBytes(weewar_bitmap, read_data.get())); 788 EXPECT_FALSE(ThumbnailEqualsBytes(weewar_bitmap, read_data.get()));
788 EXPECT_TRUE(ThumbnailEqualsBytes(green_bitmap, read_data.get())); 789 EXPECT_TRUE(ThumbnailEqualsBytes(green_bitmap, read_data.get()));
789 } 790 }
790 } 791 }
791 792
792 TEST_F(TopSitesTest, DeleteNotifications) { 793 TEST_F(TopSitesTest, DeleteNotifications) {
793 GURL google1_url("http://google.com"); 794 GURL google1_url("http://google.com");
794 GURL google2_url("http://google.com/redirect"); 795 GURL google2_url("http://google.com/redirect");
795 GURL google3_url("http://www.google.com"); 796 GURL google3_url("http://www.google.com");
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 EXPECT_FALSE(top_sites()->SetPageThumbnail(invalid_url, 1040 EXPECT_FALSE(top_sites()->SetPageThumbnail(invalid_url,
1040 &thumbnail, 1041 &thumbnail,
1041 medium_score)); 1042 medium_score));
1042 // Store thumbnails for unknown (but valid) URLs temporarily - calls 1043 // Store thumbnails for unknown (but valid) URLs temporarily - calls
1043 // AddTemporaryThumbnail. 1044 // AddTemporaryThumbnail.
1044 EXPECT_TRUE(top_sites()->SetPageThumbnail(unknown_url, 1045 EXPECT_TRUE(top_sites()->SetPageThumbnail(unknown_url,
1045 &thumbnail, 1046 &thumbnail,
1046 medium_score)); 1047 medium_score));
1047 1048
1048 // We shouldn't get the thumnail back though (the url isn't in to sites yet). 1049 // We shouldn't get the thumnail back though (the url isn't in to sites yet).
1049 scoped_refptr<RefCountedMemory> out; 1050 scoped_refptr<base::RefCountedMemory> out;
1050 EXPECT_FALSE(top_sites()->GetPageThumbnail(unknown_url, &out)); 1051 EXPECT_FALSE(top_sites()->GetPageThumbnail(unknown_url, &out));
1051 // But we should be able to get the temporary page thumbnail score. 1052 // But we should be able to get the temporary page thumbnail score.
1052 ThumbnailScore out_score; 1053 ThumbnailScore out_score;
1053 EXPECT_TRUE(top_sites()->GetTemporaryPageThumbnailScore(unknown_url, 1054 EXPECT_TRUE(top_sites()->GetTemporaryPageThumbnailScore(unknown_url,
1054 &out_score)); 1055 &out_score));
1055 EXPECT_TRUE(medium_score.Equals(out_score)); 1056 EXPECT_TRUE(medium_score.Equals(out_score));
1056 1057
1057 std::vector<MostVisitedURL> list; 1058 std::vector<MostVisitedURL> list;
1058 1059
1059 MostVisitedURL mv; 1060 MostVisitedURL mv;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 ui_test_utils::WindowedNotificationObserver observer( 1237 ui_test_utils::WindowedNotificationObserver observer(
1237 chrome::NOTIFICATION_TOP_SITES_LOADED, 1238 chrome::NOTIFICATION_TOP_SITES_LOADED,
1238 content::Source<Profile>(profile())); 1239 content::Source<Profile>(profile()));
1239 profile()->CreateTopSites(); 1240 profile()->CreateTopSites();
1240 profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)->UnloadBackend(); 1241 profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)->UnloadBackend();
1241 profile()->BlockUntilHistoryProcessesPendingRequests(); 1242 profile()->BlockUntilHistoryProcessesPendingRequests();
1242 observer.Wait(); 1243 observer.Wait();
1243 } 1244 }
1244 1245
1245 } // namespace history 1246 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698