| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 base::string16 title3(UTF8ToUTF16("bookmark")); | 295 base::string16 title3(UTF8ToUTF16("bookmark")); |
| 296 ASSERT_TRUE(bookmark_model_->AddURL(bookmark_model_->bookmark_bar_node(), 0, | 296 ASSERT_TRUE(bookmark_model_->AddURL(bookmark_model_->bookmark_bar_node(), 0, |
| 297 title3, url3)); | 297 title3, url3)); |
| 298 // Only use the HistoryBackend to generate the test data. | 298 // Only use the HistoryBackend to generate the test data. |
| 299 // HistoryBackend will shutdown after that. | 299 // HistoryBackend will shutdown after that. |
| 300 { | 300 { |
| 301 scoped_refptr<HistoryBackend> history_backend; | 301 scoped_refptr<HistoryBackend> history_backend; |
| 302 history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(), | 302 history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(), |
| 303 history_client_->CreateBackendClient(), | 303 history_client_->CreateBackendClient(), |
| 304 message_loop_.task_runner()); | 304 message_loop_.task_runner()); |
| 305 history_backend->Init(std::string(), false, | 305 history_backend->Init(false, |
| 306 TestHistoryDatabaseParamsForPath(temp_dir_.path())); | 306 TestHistoryDatabaseParamsForPath(temp_dir_.path())); |
| 307 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); | 307 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); |
| 308 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); | 308 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); |
| 309 URLRow url_row; | 309 URLRow url_row; |
| 310 | 310 |
| 311 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); | 311 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); |
| 312 url_id1 = url_row.id(); | 312 url_id1 = url_row.id(); |
| 313 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); | 313 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); |
| 314 url_id2 = url_row.id(); | 314 url_id2 = url_row.id(); |
| 315 | 315 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 ui::PAGE_TRANSITION_LINK)); | 434 ui::PAGE_TRANSITION_LINK)); |
| 435 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK)); | 435 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK)); |
| 436 | 436 |
| 437 // Only use the HistoryBackend to generate the test data. | 437 // Only use the HistoryBackend to generate the test data. |
| 438 // HistoryBackend will shutdown after that. | 438 // HistoryBackend will shutdown after that. |
| 439 { | 439 { |
| 440 scoped_refptr<HistoryBackend> history_backend; | 440 scoped_refptr<HistoryBackend> history_backend; |
| 441 history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(), | 441 history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(), |
| 442 history_client_->CreateBackendClient(), | 442 history_client_->CreateBackendClient(), |
| 443 message_loop_.task_runner()); | 443 message_loop_.task_runner()); |
| 444 history_backend->Init(std::string(), false, | 444 history_backend->Init(false, |
| 445 TestHistoryDatabaseParamsForPath(temp_dir_.path())); | 445 TestHistoryDatabaseParamsForPath(temp_dir_.path())); |
| 446 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); | 446 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); |
| 447 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); | 447 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); |
| 448 | 448 |
| 449 history::URLRows url_rows(2u); | 449 history::URLRows url_rows(2u); |
| 450 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0])); | 450 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0])); |
| 451 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1])); | 451 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1])); |
| 452 url_rows[0].set_title(title1); | 452 url_rows[0].set_title(title1); |
| 453 url_rows[1].set_title(title2); | 453 url_rows[1].set_title(title2); |
| 454 ASSERT_EQ(2u, history_backend->UpdateURLs(url_rows)); | 454 ASSERT_EQ(2u, history_backend->UpdateURLs(url_rows)); |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 ui::PAGE_TRANSITION_LINK)); | 1872 ui::PAGE_TRANSITION_LINK)); |
| 1873 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK)); | 1873 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK)); |
| 1874 | 1874 |
| 1875 // Only use the HistoryBackend to generate the test data. | 1875 // Only use the HistoryBackend to generate the test data. |
| 1876 // HistoryBackend will shutdown after that. | 1876 // HistoryBackend will shutdown after that. |
| 1877 { | 1877 { |
| 1878 scoped_refptr<HistoryBackend> history_backend; | 1878 scoped_refptr<HistoryBackend> history_backend; |
| 1879 history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(), | 1879 history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(), |
| 1880 history_client_->CreateBackendClient(), | 1880 history_client_->CreateBackendClient(), |
| 1881 message_loop_.task_runner()); | 1881 message_loop_.task_runner()); |
| 1882 history_backend->Init(std::string(), false, | 1882 history_backend->Init(false, |
| 1883 TestHistoryDatabaseParamsForPath(temp_dir_.path())); | 1883 TestHistoryDatabaseParamsForPath(temp_dir_.path())); |
| 1884 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); | 1884 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); |
| 1885 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); | 1885 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); |
| 1886 URLRow url_row; | 1886 URLRow url_row; |
| 1887 | 1887 |
| 1888 history::URLRows url_rows(2u); | 1888 history::URLRows url_rows(2u); |
| 1889 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0])); | 1889 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0])); |
| 1890 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1])); | 1890 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1])); |
| 1891 url_rows[0].set_title(title1); | 1891 url_rows[0].set_title(title1); |
| 1892 url_rows[1].set_title(title2); | 1892 url_rows[1].set_title(title2); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 update_args, &update_count)); | 2161 update_args, &update_count)); |
| 2162 // Verify notifications. | 2162 // Verify notifications. |
| 2163 EXPECT_FALSE(notifier_.deleted_details()); | 2163 EXPECT_FALSE(notifier_.deleted_details()); |
| 2164 ASSERT_TRUE(notifier_.modified_details()); | 2164 ASSERT_TRUE(notifier_.modified_details()); |
| 2165 ASSERT_EQ(1u, notifier_.modified_details()->size()); | 2165 ASSERT_EQ(1u, notifier_.modified_details()->size()); |
| 2166 // No favicon will be updated as thumbnail database is missing. | 2166 // No favicon will be updated as thumbnail database is missing. |
| 2167 EXPECT_FALSE(notifier_.favicon_changed()); | 2167 EXPECT_FALSE(notifier_.favicon_changed()); |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 } // namespace history | 2170 } // namespace history |
| OLD | NEW |