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

Side by Side Diff: chrome/browser/history/android/android_provider_backend_unittest.cc

Issue 10815068: Changes favicon database to support storing bitmaps of different sizes for the 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 "chrome/browser/history/android/android_provider_backend.h" 5 #include "chrome/browser/history/android/android_provider_backend.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 EXPECT_FALSE(delegate_.modified_details()); 1148 EXPECT_FALSE(delegate_.modified_details());
1149 ASSERT_TRUE(delegate_.favicon_details()); 1149 ASSERT_TRUE(delegate_.favicon_details());
1150 ASSERT_EQ(1u, delegate_.favicon_details()->urls.size()); 1150 ASSERT_EQ(1u, delegate_.favicon_details()->urls.size());
1151 ASSERT_TRUE(delegate_.favicon_details()->urls.end() != 1151 ASSERT_TRUE(delegate_.favicon_details()->urls.end() !=
1152 delegate_.favicon_details()->urls.find(row1.url())); 1152 delegate_.favicon_details()->urls.find(row1.url()));
1153 1153
1154 IconMapping icon_mapping; 1154 IconMapping icon_mapping;
1155 EXPECT_TRUE(thumbnail_db_.GetIconMappingForPageURL(row1.url(), FAVICON, 1155 EXPECT_TRUE(thumbnail_db_.GetIconMappingForPageURL(row1.url(), FAVICON,
1156 &icon_mapping)); 1156 &icon_mapping));
1157 Time last_updated; 1157 Time last_updated;
1158 std::vector<unsigned char> png_icon_data; 1158 scoped_refptr<base::RefCountedMemory> png_icon_data;
1159 EXPECT_TRUE(thumbnail_db_.GetFavicon(icon_mapping.icon_id, &last_updated, 1159 EXPECT_TRUE(thumbnail_db_.GetFavicon(icon_mapping.icon_id, &last_updated,
1160 &png_icon_data, NULL, NULL)); 1160 &png_icon_data, NULL, NULL));
1161 EXPECT_EQ(data, png_icon_data); 1161 std::string png_icon_data_as_string(png_icon_data->front(),
1162 png_icon_data->front() + png_icon_data->size());
1163 EXPECT_EQ(1u, png_icon_data_as_string.size());
1164 EXPECT_EQ('1', png_icon_data_as_string[0]);
1162 1165
1163 // Remove favicon. 1166 // Remove favicon.
1164 HistoryAndBookmarkRow update_row2; 1167 HistoryAndBookmarkRow update_row2;
1165 1168
1166 // Set favicon. 1169 // Set favicon.
1167 update_row1.set_favicon(new base::RefCountedBytes()); 1170 update_row1.set_favicon(new base::RefCountedBytes());
1168 update_args.clear(); 1171 update_args.clear();
1169 update_args.push_back(UTF8ToUTF16(row1.raw_url())); 1172 update_args.push_back(UTF8ToUTF16(row1.raw_url()));
1170 delegate_.ResetDetails(); 1173 delegate_.ResetDetails();
1171 ASSERT_TRUE(backend->UpdateHistoryAndBookmarks(update_row1, "url = ?", 1174 ASSERT_TRUE(backend->UpdateHistoryAndBookmarks(update_row1, "url = ?",
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 // Query by folder=1, the row2 should returned. 1754 // Query by folder=1, the row2 should returned.
1752 statement.reset(backend->QueryHistoryAndBookmarks( 1755 statement.reset(backend->QueryHistoryAndBookmarks(
1753 projections, std::string("folder=1"), std::vector<string16>(), 1756 projections, std::string("folder=1"), std::vector<string16>(),
1754 std::string("url ASC"))); 1757 std::string("url ASC")));
1755 ASSERT_TRUE(statement->statement()->Step()); 1758 ASSERT_TRUE(statement->statement()->Step());
1756 EXPECT_EQ(row2.url(), GURL(statement->statement()->ColumnString(0))); 1759 EXPECT_EQ(row2.url(), GURL(statement->statement()->ColumnString(0)));
1757 EXPECT_FALSE(statement->statement()->Step()); 1760 EXPECT_FALSE(statement->statement()->Step());
1758 } 1761 }
1759 1762
1760 } // namespace history 1763 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/android/android_provider_backend.cc ('k') | chrome/browser/history/android/favicon_sql_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698