| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // the same score on the redirect destination, which in turn should not | 411 // the same score on the redirect destination, which in turn should not |
| 412 // be replaced by the source again. | 412 // be replaced by the source again. |
| 413 EXPECT_TRUE(top_sites().SetPageThumbnail(url1a, thumbnail, medium_score)); | 413 EXPECT_TRUE(top_sites().SetPageThumbnail(url1a, thumbnail, medium_score)); |
| 414 EXPECT_TRUE(top_sites().SetPageThumbnail(url1b, thumbnail, medium_score)); | 414 EXPECT_TRUE(top_sites().SetPageThumbnail(url1b, thumbnail, medium_score)); |
| 415 EXPECT_FALSE(top_sites().SetPageThumbnail(url1a, thumbnail, medium_score)); | 415 EXPECT_FALSE(top_sites().SetPageThumbnail(url1a, thumbnail, medium_score)); |
| 416 } | 416 } |
| 417 | 417 |
| 418 TEST_F(TopSitesTest, GetPageThumbnail) { | 418 TEST_F(TopSitesTest, GetPageThumbnail) { |
| 419 BrowserThread db_loop(BrowserThread::DB, MessageLoop::current()); | 419 BrowserThread db_loop(BrowserThread::DB, MessageLoop::current()); |
| 420 MostVisitedURLList url_list; | 420 MostVisitedURLList url_list; |
| 421 MostVisitedURL url1 = {GURL("http://asdf.com")}; | 421 MostVisitedURL url1(GURL("http://asdf.com"), GURL(), string16()); |
| 422 url1.redirects.push_back(url1.url); | 422 url1.redirects.push_back(url1.url); |
| 423 url_list.push_back(url1); | 423 url_list.push_back(url1); |
| 424 | 424 |
| 425 MostVisitedURL url2 = {GURL("http://gmail.com")}; | 425 MostVisitedURL url2(GURL("http://gmail.com"), GURL(), string16()); |
| 426 url2.redirects.push_back(url2.url); | 426 url2.redirects.push_back(url2.url); |
| 427 url2.redirects.push_back(GURL("http://mail.google.com")); | 427 url2.redirects.push_back(GURL("http://mail.google.com")); |
| 428 url_list.push_back(url2); | 428 url_list.push_back(url2); |
| 429 | 429 |
| 430 top_sites().UpdateMostVisited(url_list); | 430 top_sites().UpdateMostVisited(url_list); |
| 431 MessageLoop::current()->RunAllPending(); | 431 MessageLoop::current()->RunAllPending(); |
| 432 | 432 |
| 433 // Create a dummy thumbnail. | 433 // Create a dummy thumbnail. |
| 434 SkBitmap thumbnail; | 434 SkBitmap thumbnail; |
| 435 thumbnail.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); | 435 thumbnail.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 | 1319 |
| 1320 TEST_F(TopSitesTest, AddPrepopulatedPages) { | 1320 TEST_F(TopSitesTest, AddPrepopulatedPages) { |
| 1321 MostVisitedURLList pages; | 1321 MostVisitedURLList pages; |
| 1322 top_sites().AddPrepopulatedPages(&pages); | 1322 top_sites().AddPrepopulatedPages(&pages); |
| 1323 ASSERT_EQ(2u, pages.size()); | 1323 ASSERT_EQ(2u, pages.size()); |
| 1324 EXPECT_EQ(welcome_url(), pages[0].url); | 1324 EXPECT_EQ(welcome_url(), pages[0].url); |
| 1325 EXPECT_EQ(themes_url(), pages[1].url); | 1325 EXPECT_EQ(themes_url(), pages[1].url); |
| 1326 | 1326 |
| 1327 pages.clear(); | 1327 pages.clear(); |
| 1328 | 1328 |
| 1329 MostVisitedURL url = {themes_url()}; | 1329 MostVisitedURL url(themes_url(), GURL(), string16()); |
| 1330 pages.push_back(url); | 1330 pages.push_back(url); |
| 1331 | 1331 |
| 1332 top_sites().AddPrepopulatedPages(&pages); | 1332 top_sites().AddPrepopulatedPages(&pages); |
| 1333 | 1333 |
| 1334 // Themes URL is already in pages; should not be added twice. | 1334 // Themes URL is already in pages; should not be added twice. |
| 1335 ASSERT_EQ(2u, pages.size()); | 1335 ASSERT_EQ(2u, pages.size()); |
| 1336 EXPECT_EQ(themes_url(), pages[0].url); | 1336 EXPECT_EQ(themes_url(), pages[0].url); |
| 1337 EXPECT_EQ(welcome_url(), pages[1].url); | 1337 EXPECT_EQ(welcome_url(), pages[1].url); |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 } // namespace history | 1340 } // namespace history |
| OLD | NEW |