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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 bitmap_data_element.icon_url = GURL(); | 255 bitmap_data_element.icon_url = GURL(); |
256 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; | 256 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; |
257 favicon_bitmap_data.push_back(bitmap_data_element); | 257 favicon_bitmap_data.push_back(bitmap_data_element); |
258 | 258 |
259 history_backend->SetFavicons(url2, chrome::FAVICON, favicon_bitmap_data); | 259 history_backend->SetFavicons(url2, chrome::FAVICON, favicon_bitmap_data); |
260 history_backend->Closing(); | 260 history_backend->Closing(); |
261 } | 261 } |
262 | 262 |
263 // The history_db_name and thumbnail_db_name files should be created by | 263 // The history_db_name and thumbnail_db_name files should be created by |
264 // HistoryBackend. We need to open the same database files. | 264 // HistoryBackend. We need to open the same database files. |
265 ASSERT_TRUE(file_util::PathExists(history_db_name_)); | 265 ASSERT_TRUE(base::PathExists(history_db_name_)); |
266 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); | 266 ASSERT_TRUE(base::PathExists(thumbnail_db_name_)); |
267 | 267 |
268 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); | 268 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); |
269 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, | 269 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, |
270 &history_db_)); | 270 &history_db_)); |
271 // Set url1 as bookmark. | 271 // Set url1 as bookmark. |
272 AddBookmark(url1); | 272 AddBookmark(url1); |
273 scoped_ptr<AndroidProviderBackend> backend( | 273 scoped_ptr<AndroidProviderBackend> backend( |
274 new AndroidProviderBackend(android_cache_db_name_, &history_db_, | 274 new AndroidProviderBackend(android_cache_db_name_, &history_db_, |
275 &thumbnail_db_, bookmark_model_, &delegate_)); | 275 &thumbnail_db_, bookmark_model_, &delegate_)); |
276 | 276 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 bitmap_data_element.icon_url = GURL(); | 405 bitmap_data_element.icon_url = GURL(); |
406 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; | 406 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; |
407 favicon_bitmap_data.push_back(bitmap_data_element); | 407 favicon_bitmap_data.push_back(bitmap_data_element); |
408 | 408 |
409 history_backend->SetFavicons(url2, chrome::FAVICON, favicon_bitmap_data); | 409 history_backend->SetFavicons(url2, chrome::FAVICON, favicon_bitmap_data); |
410 history_backend->Closing(); | 410 history_backend->Closing(); |
411 } | 411 } |
412 | 412 |
413 // The history_db_name and thumbnail_db_name files should be created by | 413 // The history_db_name and thumbnail_db_name files should be created by |
414 // HistoryBackend. We need to open the same database files. | 414 // HistoryBackend. We need to open the same database files. |
415 ASSERT_TRUE(file_util::PathExists(history_db_name_)); | 415 ASSERT_TRUE(base::PathExists(history_db_name_)); |
416 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); | 416 ASSERT_TRUE(base::PathExists(thumbnail_db_name_)); |
417 | 417 |
418 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); | 418 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); |
419 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, | 419 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, |
420 &history_db_)); | 420 &history_db_)); |
421 // Set url1 as bookmark. | 421 // Set url1 as bookmark. |
422 AddBookmark(url1); | 422 AddBookmark(url1); |
423 | 423 |
424 scoped_ptr<AndroidProviderBackend> backend( | 424 scoped_ptr<AndroidProviderBackend> backend( |
425 new AndroidProviderBackend(android_cache_db_name_, &history_db_, | 425 new AndroidProviderBackend(android_cache_db_name_, &history_db_, |
426 &thumbnail_db_, bookmark_model_, &delegate_)); | 426 &thumbnail_db_, bookmark_model_, &delegate_)); |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 bitmap_data_element.icon_url = GURL(); | 1819 bitmap_data_element.icon_url = GURL(); |
1820 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; | 1820 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; |
1821 favicon_bitmap_data.push_back(bitmap_data_element); | 1821 favicon_bitmap_data.push_back(bitmap_data_element); |
1822 | 1822 |
1823 history_backend->SetFavicons(url2, chrome::FAVICON, favicon_bitmap_data); | 1823 history_backend->SetFavicons(url2, chrome::FAVICON, favicon_bitmap_data); |
1824 history_backend->Closing(); | 1824 history_backend->Closing(); |
1825 } | 1825 } |
1826 | 1826 |
1827 // The history_db_name and thumbnail_db_name files should be created by | 1827 // The history_db_name and thumbnail_db_name files should be created by |
1828 // HistoryBackend. We need to open the same database files. | 1828 // HistoryBackend. We need to open the same database files. |
1829 ASSERT_TRUE(file_util::PathExists(history_db_name_)); | 1829 ASSERT_TRUE(base::PathExists(history_db_name_)); |
1830 ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); | 1830 ASSERT_TRUE(base::PathExists(thumbnail_db_name_)); |
1831 | 1831 |
1832 // Only creates the history database | 1832 // Only creates the history database |
1833 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); | 1833 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); |
1834 | 1834 |
1835 // Set url1 as bookmark. | 1835 // Set url1 as bookmark. |
1836 AddBookmark(url1); | 1836 AddBookmark(url1); |
1837 | 1837 |
1838 scoped_ptr<AndroidProviderBackend> backend( | 1838 scoped_ptr<AndroidProviderBackend> backend( |
1839 new AndroidProviderBackend(android_cache_db_name_, &history_db_, NULL, | 1839 new AndroidProviderBackend(android_cache_db_name_, &history_db_, NULL, |
1840 bookmark_model_, &delegate_)); | 1840 bookmark_model_, &delegate_)); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 update_args, &update_count)); | 2071 update_args, &update_count)); |
2072 // Verify notifications. | 2072 // Verify notifications. |
2073 EXPECT_FALSE(delegate_.deleted_details()); | 2073 EXPECT_FALSE(delegate_.deleted_details()); |
2074 ASSERT_TRUE(delegate_.modified_details()); | 2074 ASSERT_TRUE(delegate_.modified_details()); |
2075 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); | 2075 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); |
2076 // No favicon will be updated as thumbnail database is missing. | 2076 // No favicon will be updated as thumbnail database is missing. |
2077 EXPECT_FALSE(delegate_.favicon_details()); | 2077 EXPECT_FALSE(delegate_.favicon_details()); |
2078 } | 2078 } |
2079 | 2079 |
2080 } // namespace history | 2080 } // namespace history |
OLD | NEW |