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

Side by Side 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: Address review issues 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 unified diff | Download patch | Annotate | Revision Log
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 <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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 // Test the touch icon for this URL. 1127 // Test the touch icon for this URL.
1128 ASSERT_TRUE(backend_->GetFaviconFromDB(url, TOUCH_ICON, &favicon)); 1128 ASSERT_TRUE(backend_->GetFaviconFromDB(url, TOUCH_ICON, &favicon));
1129 std::string touchicon_data( 1129 std::string touchicon_data(
1130 favicon.image_data->front(), 1130 favicon.image_data->front(),
1131 favicon.image_data->front() + favicon.image_data->size()); 1131 favicon.image_data->front() + favicon.image_data->size());
1132 1132
1133 EXPECT_EQ(TOUCH_ICON, favicon.icon_type); 1133 EXPECT_EQ(TOUCH_ICON, favicon.icon_type);
1134 EXPECT_EQ(icon_url, favicon.icon_url); 1134 EXPECT_EQ(icon_url, favicon.icon_url);
1135 EXPECT_EQ(blob_data, touchicon_data); 1135 EXPECT_EQ(blob_data, touchicon_data);
1136 } 1136 }
1137
1138 TEST_F(HistoryBackendTest, CloneFaviconIsRestrictedToSameDomain) {
1139 const GURL url("http://www.google.com/");
1140 const GURL icon_url("http://www.google.com/icon");
1141 const GURL same_domain_url("http://www.google.com/subdir/index.html");
1142 const GURL foreign_domain_url("http://www.not-google.com/");
1143
sky 2011/11/17 04:49:01 nit: remove one line.
groby-ooo-7-16 2011/11/18 01:11:19 Done.
1144
1145 // Add a favicon
1146 std::vector<unsigned char> data(blob1, blob1 + sizeof(blob1));
1147 scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes(data));
1148 backend_->SetFavicon(
1149 url, icon_url, bytes.get(), FAVICON);
1150 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingForPageURL(
1151 url, FAVICON, NULL));
1152
1153 // Validate starting state.
1154 FaviconData favicon;
1155 EXPECT_TRUE(backend_->GetFaviconFromDB(url, FAVICON, &favicon));
1156 EXPECT_FALSE(backend_->GetFaviconFromDB(same_domain_url, FAVICON, &favicon));
1157 EXPECT_FALSE(backend_->GetFaviconFromDB(foreign_domain_url,
1158 FAVICON, &favicon));
1159
1160 // Same-domain cloning should work.
1161 backend_->CloneFavicon(url, same_domain_url);
1162 EXPECT_TRUE(backend_->GetFaviconFromDB(same_domain_url, FAVICON, &favicon));
1163
1164 // Foreign-domain cloning is forbidden.
1165 backend_->CloneFavicon(url, foreign_domain_url);
1166 EXPECT_FALSE(backend_->GetFaviconFromDB(foreign_domain_url,
1167 FAVICON, &favicon));
1168 }
1137 } // namespace history 1169 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698