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

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

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 <set> 5 #include <set>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 // Add a touch_icon 1227 // Add a touch_icon
1228 backend_->SetFavicon( 1228 backend_->SetFavicon(
1229 url, icon_url, bytes.get(), TOUCH_ICON); 1229 url, icon_url, bytes.get(), TOUCH_ICON);
1230 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingForPageURL( 1230 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingForPageURL(
1231 url, TOUCH_ICON, NULL)); 1231 url, TOUCH_ICON, NULL));
1232 1232
1233 // Test the Fav icon for this URL. 1233 // Test the Fav icon for this URL.
1234 FaviconData favicon; 1234 FaviconData favicon;
1235 ASSERT_TRUE(backend_->GetFaviconFromDB(url, FAVICON, &favicon)); 1235 ASSERT_TRUE(backend_->GetFaviconFromDB(url, FAVICON, &favicon));
1236 std::string favicon_data( 1236 std::string favicon_data(
1237 favicon.image_data->front(), 1237 favicon.first_bitmap()->front(),
1238 favicon.image_data->front() + favicon.image_data->size()); 1238 favicon.first_bitmap()->front() + favicon.first_bitmap()->size());
1239 1239
1240 EXPECT_EQ(FAVICON, favicon.icon_type); 1240 EXPECT_EQ(FAVICON, favicon.icon_type);
1241 EXPECT_EQ(icon_url, favicon.icon_url); 1241 EXPECT_EQ(icon_url, favicon.icon_url);
1242 EXPECT_EQ(blob_data, favicon_data); 1242 EXPECT_EQ(blob_data, favicon_data);
1243 1243
1244 // Test the touch icon for this URL. 1244 // Test the touch icon for this URL.
1245 ASSERT_TRUE(backend_->GetFaviconFromDB(url, TOUCH_ICON, &favicon)); 1245 ASSERT_TRUE(backend_->GetFaviconFromDB(url, TOUCH_ICON, &favicon));
1246 std::string touchicon_data( 1246 std::string touchicon_data(
1247 favicon.image_data->front(), 1247 favicon.first_bitmap()->front(),
1248 favicon.image_data->front() + favicon.image_data->size()); 1248 favicon.first_bitmap()->front() + favicon.first_bitmap()->size());
1249 1249
1250 EXPECT_EQ(TOUCH_ICON, favicon.icon_type); 1250 EXPECT_EQ(TOUCH_ICON, favicon.icon_type);
1251 EXPECT_EQ(icon_url, favicon.icon_url); 1251 EXPECT_EQ(icon_url, favicon.icon_url);
1252 EXPECT_EQ(blob_data, touchicon_data); 1252 EXPECT_EQ(blob_data, touchicon_data);
1253 } 1253 }
1254 1254
1255 TEST_F(HistoryBackendTest, CloneFaviconIsRestrictedToSameDomain) { 1255 TEST_F(HistoryBackendTest, CloneFaviconIsRestrictedToSameDomain) {
1256 const GURL url("http://www.google.com/"); 1256 const GURL url("http://www.google.com/");
1257 const GURL icon_url("http://www.google.com/icon"); 1257 const GURL icon_url("http://www.google.com/icon");
1258 const GURL same_domain_url("http://www.google.com/subdir/index.html"); 1258 const GURL same_domain_url("http://www.google.com/subdir/index.html");
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 1607
1608 backend_->DeleteURL(url); 1608 backend_->DeleteURL(url);
1609 backend_->AddPageNoVisitForBookmark(url, string16()); 1609 backend_->AddPageNoVisitForBookmark(url, string16());
1610 backend_->GetURL(url, &row); 1610 backend_->GetURL(url, &row);
1611 EXPECT_EQ(url, row.url()); 1611 EXPECT_EQ(url, row.url());
1612 EXPECT_EQ(UTF8ToUTF16(url.spec()), row.title()); 1612 EXPECT_EQ(UTF8ToUTF16(url.spec()), row.title());
1613 EXPECT_EQ(0, row.visit_count()); 1613 EXPECT_EQ(0, row.visit_count());
1614 } 1614 }
1615 1615
1616 } // namespace history 1616 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698