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

Unified Diff: chrome/browser/history/history_backend_unittest.cc

Issue 8469018: Provide assumed favicon for intents if service provider page was never visited. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review nits Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/thumbnail_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_backend_unittest.cc
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index 9840e09f2ac30fa493dec43bdb2ae1c9a7272709..e5484bf834a928c88dbbeb428cffc0160d2901e5 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -1134,4 +1134,35 @@ TEST_F(HistoryBackendTest, GetFaviconForURL) {
EXPECT_EQ(icon_url, favicon.icon_url);
EXPECT_EQ(blob_data, touchicon_data);
}
+
+TEST_F(HistoryBackendTest, CloneFaviconIsRestrictedToSameDomain) {
+ const GURL url("http://www.google.com/");
+ const GURL icon_url("http://www.google.com/icon");
+ const GURL same_domain_url("http://www.google.com/subdir/index.html");
+ const GURL foreign_domain_url("http://www.not-google.com/");
+
+ // Add a favicon
+ std::vector<unsigned char> data(blob1, blob1 + sizeof(blob1));
+ scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes(data));
+ backend_->SetFavicon(
+ url, icon_url, bytes.get(), FAVICON);
+ EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingForPageURL(
+ url, FAVICON, NULL));
+
+ // Validate starting state.
+ FaviconData favicon;
+ EXPECT_TRUE(backend_->GetFaviconFromDB(url, FAVICON, &favicon));
+ EXPECT_FALSE(backend_->GetFaviconFromDB(same_domain_url, FAVICON, &favicon));
+ EXPECT_FALSE(backend_->GetFaviconFromDB(foreign_domain_url,
+ FAVICON, &favicon));
+
+ // Same-domain cloning should work.
+ backend_->CloneFavicon(url, same_domain_url);
+ EXPECT_TRUE(backend_->GetFaviconFromDB(same_domain_url, FAVICON, &favicon));
+
+ // Foreign-domain cloning is forbidden.
+ backend_->CloneFavicon(url, foreign_domain_url);
+ EXPECT_FALSE(backend_->GetFaviconFromDB(foreign_domain_url,
+ FAVICON, &favicon));
+}
} // namespace history
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/thumbnail_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698