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

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

Issue 11746010: Cleanup history favicon code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::FaviconBitmapData bitmap_data_element; 251 history::FaviconBitmapData bitmap_data_element;
252 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); 252 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data);
253 bitmap_data_element.pixel_size = gfx::Size(); 253 bitmap_data_element.pixel_size = gfx::Size();
254 bitmap_data_element.icon_url = GURL(); 254 bitmap_data_element.icon_url = GURL();
255 std::vector<history::FaviconBitmapData> favicon_bitmap_data; 255 std::vector<history::FaviconBitmapData> favicon_bitmap_data;
256 favicon_bitmap_data.push_back(bitmap_data_element); 256 favicon_bitmap_data.push_back(bitmap_data_element);
257 257
258 FaviconSizes favicon_sizes; 258 history_backend->SetFavicons(url2, FAVICON, favicon_bitmap_data);
259 favicon_sizes.push_back(gfx::Size());
260 IconURLSizesMap icon_url_sizes;
261 icon_url_sizes[GURL()] = favicon_sizes;
262
263 history_backend->SetFavicons(url2,
264 FAVICON,
265 favicon_bitmap_data,
266 icon_url_sizes);
267 history_backend->Closing(); 259 history_backend->Closing();
268 } 260 }
269 261
270 // The history_db_name and thumbnail_db_name files should be created by 262 // The history_db_name and thumbnail_db_name files should be created by
271 // HistoryBackend. We need to open the same database files. 263 // HistoryBackend. We need to open the same database files.
272 ASSERT_TRUE(file_util::PathExists(history_db_name_)); 264 ASSERT_TRUE(file_util::PathExists(history_db_name_));
273 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); 265 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_));
274 266
275 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL)); 267 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL));
276 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, 268 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // Set favicon to url2. 398 // Set favicon to url2.
407 std::vector<unsigned char> data; 399 std::vector<unsigned char> data;
408 data.push_back('1'); 400 data.push_back('1');
409 history::FaviconBitmapData bitmap_data_element; 401 history::FaviconBitmapData bitmap_data_element;
410 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); 402 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data);
411 bitmap_data_element.pixel_size = gfx::Size(); 403 bitmap_data_element.pixel_size = gfx::Size();
412 bitmap_data_element.icon_url = GURL(); 404 bitmap_data_element.icon_url = GURL();
413 std::vector<history::FaviconBitmapData> favicon_bitmap_data; 405 std::vector<history::FaviconBitmapData> favicon_bitmap_data;
414 favicon_bitmap_data.push_back(bitmap_data_element); 406 favicon_bitmap_data.push_back(bitmap_data_element);
415 407
416 FaviconSizes favicon_sizes; 408 history_backend->SetFavicons(url2, FAVICON, favicon_bitmap_data);
417 favicon_sizes.push_back(gfx::Size());
418 IconURLSizesMap icon_url_sizes;
419 icon_url_sizes[GURL()] = favicon_sizes;
420
421 history_backend->SetFavicons(url2,
422 FAVICON,
423 favicon_bitmap_data,
424 icon_url_sizes);
425 history_backend->Closing(); 409 history_backend->Closing();
426 } 410 }
427 411
428 // The history_db_name and thumbnail_db_name files should be created by 412 // The history_db_name and thumbnail_db_name files should be created by
429 // HistoryBackend. We need to open the same database files. 413 // HistoryBackend. We need to open the same database files.
430 ASSERT_TRUE(file_util::PathExists(history_db_name_)); 414 ASSERT_TRUE(file_util::PathExists(history_db_name_));
431 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); 415 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_));
432 416
433 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL)); 417 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL));
434 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, 418 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL,
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 // Set favicon to url2. 1812 // Set favicon to url2.
1829 std::vector<unsigned char> data; 1813 std::vector<unsigned char> data;
1830 data.push_back('1'); 1814 data.push_back('1');
1831 history::FaviconBitmapData bitmap_data_element; 1815 history::FaviconBitmapData bitmap_data_element;
1832 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); 1816 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data);
1833 bitmap_data_element.pixel_size = gfx::Size(); 1817 bitmap_data_element.pixel_size = gfx::Size();
1834 bitmap_data_element.icon_url = GURL(); 1818 bitmap_data_element.icon_url = GURL();
1835 std::vector<history::FaviconBitmapData> favicon_bitmap_data; 1819 std::vector<history::FaviconBitmapData> favicon_bitmap_data;
1836 favicon_bitmap_data.push_back(bitmap_data_element); 1820 favicon_bitmap_data.push_back(bitmap_data_element);
1837 1821
1838 FaviconSizes favicon_sizes; 1822 history_backend->SetFavicons(url2, FAVICON, favicon_bitmap_data);
1839 favicon_sizes.push_back(gfx::Size());
1840 IconURLSizesMap icon_url_sizes;
1841 icon_url_sizes[GURL()] = favicon_sizes;
1842
1843 history_backend->SetFavicons(url2,
1844 FAVICON,
1845 favicon_bitmap_data,
1846 icon_url_sizes);
1847 history_backend->Closing(); 1823 history_backend->Closing();
1848 } 1824 }
1849 1825
1850 // The history_db_name and thumbnail_db_name files should be created by 1826 // The history_db_name and thumbnail_db_name files should be created by
1851 // HistoryBackend. We need to open the same database files. 1827 // HistoryBackend. We need to open the same database files.
1852 ASSERT_TRUE(file_util::PathExists(history_db_name_)); 1828 ASSERT_TRUE(file_util::PathExists(history_db_name_));
1853 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); 1829 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_));
1854 1830
1855 // Only creates the history database 1831 // Only creates the history database
1856 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL)); 1832 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL));
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 update_args, &update_count)); 2070 update_args, &update_count));
2095 // Verify notifications. 2071 // Verify notifications.
2096 EXPECT_FALSE(delegate_.deleted_details()); 2072 EXPECT_FALSE(delegate_.deleted_details());
2097 ASSERT_TRUE(delegate_.modified_details()); 2073 ASSERT_TRUE(delegate_.modified_details());
2098 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); 2074 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size());
2099 // No favicon will be updated as thumbnail database is missing. 2075 // No favicon will be updated as thumbnail database is missing.
2100 EXPECT_FALSE(delegate_.favicon_details()); 2076 EXPECT_FALSE(delegate_.favicon_details());
2101 } 2077 }
2102 2078
2103 } // namespace history 2079 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698