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_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 URLRow url_row; | 249 URLRow url_row; |
250 | 250 |
251 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); | 251 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); |
252 url_id1 = url_row.id(); | 252 url_id1 = url_row.id(); |
253 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); | 253 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); |
254 url_id2 = url_row.id(); | 254 url_id2 = url_row.id(); |
255 | 255 |
256 // Set favicon to url2. | 256 // Set favicon to url2. |
257 std::vector<unsigned char> data; | 257 std::vector<unsigned char> data; |
258 data.push_back('1'); | 258 data.push_back('1'); |
259 favicon_base::FaviconBitmapData bitmap_data_element; | 259 favicon_base::FaviconRawBitmapData bitmap_data_element; |
260 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); | 260 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); |
261 bitmap_data_element.pixel_size = gfx::Size(); | 261 bitmap_data_element.pixel_size = gfx::Size(); |
262 bitmap_data_element.icon_url = GURL(); | 262 bitmap_data_element.icon_url = GURL(); |
263 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; | 263 std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; |
264 favicon_bitmap_data.push_back(bitmap_data_element); | 264 favicon_bitmap_data.push_back(bitmap_data_element); |
265 | 265 |
266 history_backend->SetFavicons( | 266 history_backend->SetFavicons( |
267 url2, favicon_base::FAVICON, favicon_bitmap_data); | 267 url2, favicon_base::FAVICON, favicon_bitmap_data); |
268 history_backend->Closing(); | 268 history_backend->Closing(); |
269 } | 269 } |
270 | 270 |
271 // The history_db_name and thumbnail_db_name files should be created by | 271 // The history_db_name and thumbnail_db_name files should be created by |
272 // HistoryBackend. We need to open the same database files. | 272 // HistoryBackend. We need to open the same database files. |
273 ASSERT_TRUE(base::PathExists(history_db_name_)); | 273 ASSERT_TRUE(base::PathExists(history_db_name_)); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 ASSERT_TRUE(history_backend->UpdateURL(url_id1, url_row)); | 402 ASSERT_TRUE(history_backend->UpdateURL(url_id1, url_row)); |
403 | 403 |
404 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); | 404 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); |
405 url_id2 = url_row.id(); | 405 url_id2 = url_row.id(); |
406 url_row.set_title(title2); | 406 url_row.set_title(title2); |
407 ASSERT_TRUE(history_backend->UpdateURL(url_id2, url_row)); | 407 ASSERT_TRUE(history_backend->UpdateURL(url_id2, url_row)); |
408 | 408 |
409 // Set favicon to url2. | 409 // Set favicon to url2. |
410 std::vector<unsigned char> data; | 410 std::vector<unsigned char> data; |
411 data.push_back('1'); | 411 data.push_back('1'); |
412 favicon_base::FaviconBitmapData bitmap_data_element; | 412 favicon_base::FaviconRawBitmapData bitmap_data_element; |
413 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); | 413 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); |
414 bitmap_data_element.pixel_size = gfx::Size(); | 414 bitmap_data_element.pixel_size = gfx::Size(); |
415 bitmap_data_element.icon_url = GURL(); | 415 bitmap_data_element.icon_url = GURL(); |
416 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; | 416 std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; |
417 favicon_bitmap_data.push_back(bitmap_data_element); | 417 favicon_bitmap_data.push_back(bitmap_data_element); |
418 | 418 |
419 history_backend->SetFavicons( | 419 history_backend->SetFavicons( |
420 url2, favicon_base::FAVICON, favicon_bitmap_data); | 420 url2, favicon_base::FAVICON, favicon_bitmap_data); |
421 history_backend->Closing(); | 421 history_backend->Closing(); |
422 } | 422 } |
423 | 423 |
424 // The history_db_name and thumbnail_db_name files should be created by | 424 // The history_db_name and thumbnail_db_name files should be created by |
425 // HistoryBackend. We need to open the same database files. | 425 // HistoryBackend. We need to open the same database files. |
426 ASSERT_TRUE(base::PathExists(history_db_name_)); | 426 ASSERT_TRUE(base::PathExists(history_db_name_)); |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1853 ASSERT_TRUE(history_backend->UpdateURL(url_id1, url_row)); | 1853 ASSERT_TRUE(history_backend->UpdateURL(url_id1, url_row)); |
1854 | 1854 |
1855 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); | 1855 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); |
1856 url_id2 = url_row.id(); | 1856 url_id2 = url_row.id(); |
1857 url_row.set_title(title2); | 1857 url_row.set_title(title2); |
1858 ASSERT_TRUE(history_backend->UpdateURL(url_id2, url_row)); | 1858 ASSERT_TRUE(history_backend->UpdateURL(url_id2, url_row)); |
1859 | 1859 |
1860 // Set favicon to url2. | 1860 // Set favicon to url2. |
1861 std::vector<unsigned char> data; | 1861 std::vector<unsigned char> data; |
1862 data.push_back('1'); | 1862 data.push_back('1'); |
1863 favicon_base::FaviconBitmapData bitmap_data_element; | 1863 favicon_base::FaviconRawBitmapData bitmap_data_element; |
1864 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); | 1864 bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); |
1865 bitmap_data_element.pixel_size = gfx::Size(); | 1865 bitmap_data_element.pixel_size = gfx::Size(); |
1866 bitmap_data_element.icon_url = GURL(); | 1866 bitmap_data_element.icon_url = GURL(); |
1867 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; | 1867 std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; |
1868 favicon_bitmap_data.push_back(bitmap_data_element); | 1868 favicon_bitmap_data.push_back(bitmap_data_element); |
1869 | 1869 |
1870 history_backend->SetFavicons( | 1870 history_backend->SetFavicons( |
1871 url2, favicon_base::FAVICON, favicon_bitmap_data); | 1871 url2, favicon_base::FAVICON, favicon_bitmap_data); |
1872 history_backend->Closing(); | 1872 history_backend->Closing(); |
1873 } | 1873 } |
1874 | 1874 |
1875 // The history_db_name and thumbnail_db_name files should be created by | 1875 // The history_db_name and thumbnail_db_name files should be created by |
1876 // HistoryBackend. We need to open the same database files. | 1876 // HistoryBackend. We need to open the same database files. |
1877 ASSERT_TRUE(base::PathExists(history_db_name_)); | 1877 ASSERT_TRUE(base::PathExists(history_db_name_)); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 update_args, &update_count)); | 2135 update_args, &update_count)); |
2136 // Verify notifications. | 2136 // Verify notifications. |
2137 EXPECT_FALSE(delegate_.deleted_details()); | 2137 EXPECT_FALSE(delegate_.deleted_details()); |
2138 ASSERT_TRUE(delegate_.modified_details()); | 2138 ASSERT_TRUE(delegate_.modified_details()); |
2139 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); | 2139 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); |
2140 // No favicon will be updated as thumbnail database is missing. | 2140 // No favicon will be updated as thumbnail database is missing. |
2141 EXPECT_FALSE(delegate_.favicon_details()); | 2141 EXPECT_FALSE(delegate_.favicon_details()); |
2142 } | 2142 } |
2143 | 2143 |
2144 } // namespace history | 2144 } // namespace history |
OLD | NEW |