OLD | NEW |
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 URLRow url_row; | 241 URLRow url_row; |
242 | 242 |
243 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); | 243 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); |
244 url_id1 = url_row.id(); | 244 url_id1 = url_row.id(); |
245 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); | 245 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); |
246 url_id2 = url_row.id(); | 246 url_id2 = url_row.id(); |
247 | 247 |
248 // Set favicon to url2. | 248 // Set favicon to url2. |
249 std::vector<unsigned char> data; | 249 std::vector<unsigned char> data; |
250 data.push_back('1'); | 250 data.push_back('1'); |
251 history_backend->SetFavicon(url2, | 251 FaviconBitmapData bitmap_data_element; |
252 GURL(), | 252 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); |
253 new base::RefCountedBytes(data), | 253 bitmap_data_element.pixel_size = gfx::Size(); |
254 FAVICON); | 254 bitmap_data_element.icon_url = GURL(); |
| 255 std::vector<FaviconBitmapData> favicon_bitmap_data; |
| 256 favicon_bitmap_data.push_back(bitmap_data_element); |
| 257 |
| 258 IconURLSizesMap icon_url_sizes; |
| 259 icon_url_sizes[GURL()] = GetDefaultFaviconSizes(); |
| 260 |
| 261 history_backend->SetFavicons(url2, |
| 262 FAVICON, |
| 263 favicon_bitmap_data, |
| 264 icon_url_sizes); |
255 history_backend->Closing(); | 265 history_backend->Closing(); |
256 } | 266 } |
257 | 267 |
258 // The history_db_name and thumbnail_db_name files should be created by | 268 // The history_db_name and thumbnail_db_name files should be created by |
259 // HistoryBackend. We need to open the same database files. | 269 // HistoryBackend. We need to open the same database files. |
260 ASSERT_TRUE(file_util::PathExists(history_db_name_)); | 270 ASSERT_TRUE(file_util::PathExists(history_db_name_)); |
261 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); | 271 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); |
262 | 272 |
263 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); | 273 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); |
264 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, | 274 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 // Query by folder=1, the row2 should returned. | 1761 // Query by folder=1, the row2 should returned. |
1752 statement.reset(backend->QueryHistoryAndBookmarks( | 1762 statement.reset(backend->QueryHistoryAndBookmarks( |
1753 projections, std::string("folder=1"), std::vector<string16>(), | 1763 projections, std::string("folder=1"), std::vector<string16>(), |
1754 std::string("url ASC"))); | 1764 std::string("url ASC"))); |
1755 ASSERT_TRUE(statement->statement()->Step()); | 1765 ASSERT_TRUE(statement->statement()->Step()); |
1756 EXPECT_EQ(row2.url(), GURL(statement->statement()->ColumnString(0))); | 1766 EXPECT_EQ(row2.url(), GURL(statement->statement()->ColumnString(0))); |
1757 EXPECT_FALSE(statement->statement()->Step()); | 1767 EXPECT_FALSE(statement->statement()->Step()); |
1758 } | 1768 } |
1759 | 1769 |
1760 } // namespace history | 1770 } // namespace history |
OLD | NEW |