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

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

Issue 934083003: Cleanup HistoryService and HistoryBackend interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@android-backend-provider
Patch Set: Created 5 years, 10 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
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/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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 // Add a bookmark which is not in the history. 283 // Add a bookmark which is not in the history.
284 GURL url3("http://www.bookmark.com"); 284 GURL url3("http://www.bookmark.com");
285 base::string16 title3(UTF8ToUTF16("bookmark")); 285 base::string16 title3(UTF8ToUTF16("bookmark"));
286 ASSERT_TRUE(bookmark_model_->AddURL(bookmark_model_->bookmark_bar_node(), 0, 286 ASSERT_TRUE(bookmark_model_->AddURL(bookmark_model_->bookmark_bar_node(), 0,
287 title3, url3)); 287 title3, url3));
288 // Only use the HistoryBackend to generate the test data. 288 // Only use the HistoryBackend to generate the test data.
289 // HistoryBackend will shutdown after that. 289 // HistoryBackend will shutdown after that.
290 { 290 {
291 scoped_refptr<HistoryBackend> history_backend; 291 scoped_refptr<HistoryBackend> history_backend;
292 history_backend = new HistoryBackend( 292 history_backend =
293 temp_dir_.path(), new AndroidProviderBackendDelegate(), history_client_); 293 new HistoryBackend(new AndroidProviderBackendDelegate(), history_client_);
294 history_backend->Init(std::string(), false, 294 history_backend->Init(std::string(), false,
295 TestHistoryDatabaseParamsForPath(temp_dir_.path())); 295 TestHistoryDatabaseParamsForPath(temp_dir_.path()));
296 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); 296 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED);
297 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); 297 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED);
298 URLRow url_row; 298 URLRow url_row;
299 299
300 ASSERT_TRUE(history_backend->GetURL(url1, &url_row)); 300 ASSERT_TRUE(history_backend->GetURL(url1, &url_row));
301 url_id1 = url_row.id(); 301 url_id1 = url_row.id();
302 ASSERT_TRUE(history_backend->GetURL(url2, &url_row)); 302 ASSERT_TRUE(history_backend->GetURL(url2, &url_row));
303 url_id2 = url_row.id(); 303 url_id2 = url_row.id();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 Time created2 = last_visited2 - TimeDelta::FromDays(10); 420 Time created2 = last_visited2 - TimeDelta::FromDays(10);
421 visits2.push_back(VisitInfo(created2, ui::PAGE_TRANSITION_LINK)); 421 visits2.push_back(VisitInfo(created2, ui::PAGE_TRANSITION_LINK));
422 visits2.push_back(VisitInfo(last_visited2 - TimeDelta::FromDays(5), 422 visits2.push_back(VisitInfo(last_visited2 - TimeDelta::FromDays(5),
423 ui::PAGE_TRANSITION_LINK)); 423 ui::PAGE_TRANSITION_LINK));
424 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK)); 424 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK));
425 425
426 // Only use the HistoryBackend to generate the test data. 426 // Only use the HistoryBackend to generate the test data.
427 // HistoryBackend will shutdown after that. 427 // HistoryBackend will shutdown after that.
428 { 428 {
429 scoped_refptr<HistoryBackend> history_backend; 429 scoped_refptr<HistoryBackend> history_backend;
430 history_backend = new HistoryBackend( 430 history_backend =
431 temp_dir_.path(), new AndroidProviderBackendDelegate(), history_client_); 431 new HistoryBackend(new AndroidProviderBackendDelegate(), history_client_);
432 history_backend->Init(std::string(), false, 432 history_backend->Init(std::string(), false,
433 TestHistoryDatabaseParamsForPath(temp_dir_.path())); 433 TestHistoryDatabaseParamsForPath(temp_dir_.path()));
434 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); 434 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED);
435 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); 435 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED);
436 436
437 history::URLRows url_rows(2u); 437 history::URLRows url_rows(2u);
438 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0])); 438 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0]));
439 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1])); 439 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1]));
440 url_rows[0].set_title(title1); 440 url_rows[0].set_title(title1);
441 url_rows[1].set_title(title2); 441 url_rows[1].set_title(title2);
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 Time created2 = last_visited2 - TimeDelta::FromDays(10); 1857 Time created2 = last_visited2 - TimeDelta::FromDays(10);
1858 visits2.push_back(VisitInfo(created2, ui::PAGE_TRANSITION_LINK)); 1858 visits2.push_back(VisitInfo(created2, ui::PAGE_TRANSITION_LINK));
1859 visits2.push_back(VisitInfo(last_visited2 - TimeDelta::FromDays(5), 1859 visits2.push_back(VisitInfo(last_visited2 - TimeDelta::FromDays(5),
1860 ui::PAGE_TRANSITION_LINK)); 1860 ui::PAGE_TRANSITION_LINK));
1861 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK)); 1861 visits2.push_back(VisitInfo(last_visited2, ui::PAGE_TRANSITION_LINK));
1862 1862
1863 // Only use the HistoryBackend to generate the test data. 1863 // Only use the HistoryBackend to generate the test data.
1864 // HistoryBackend will shutdown after that. 1864 // HistoryBackend will shutdown after that.
1865 { 1865 {
1866 scoped_refptr<HistoryBackend> history_backend; 1866 scoped_refptr<HistoryBackend> history_backend;
1867 history_backend = new HistoryBackend( 1867 history_backend =
1868 temp_dir_.path(), new AndroidProviderBackendDelegate(), history_client_); 1868 new HistoryBackend(new AndroidProviderBackendDelegate(), history_client_);
1869 history_backend->Init(std::string(), false, 1869 history_backend->Init(std::string(), false,
1870 TestHistoryDatabaseParamsForPath(temp_dir_.path())); 1870 TestHistoryDatabaseParamsForPath(temp_dir_.path()));
1871 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED); 1871 history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED);
1872 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED); 1872 history_backend->AddVisits(url2, visits2, history::SOURCE_SYNCED);
1873 URLRow url_row; 1873 URLRow url_row;
1874 1874
1875 history::URLRows url_rows(2u); 1875 history::URLRows url_rows(2u);
1876 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0])); 1876 ASSERT_TRUE(history_backend->GetURL(url1, &url_rows[0]));
1877 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1])); 1877 ASSERT_TRUE(history_backend->GetURL(url2, &url_rows[1]));
1878 url_rows[0].set_title(title1); 1878 url_rows[0].set_title(title1);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 update_args, &update_count)); 2148 update_args, &update_count));
2149 // Verify notifications. 2149 // Verify notifications.
2150 EXPECT_FALSE(notifier_.deleted_details()); 2150 EXPECT_FALSE(notifier_.deleted_details());
2151 ASSERT_TRUE(notifier_.modified_details()); 2151 ASSERT_TRUE(notifier_.modified_details());
2152 ASSERT_EQ(1u, notifier_.modified_details()->size()); 2152 ASSERT_EQ(1u, notifier_.modified_details()->size());
2153 // No favicon will be updated as thumbnail database is missing. 2153 // No favicon will be updated as thumbnail database is missing.
2154 EXPECT_FALSE(notifier_.favicon_changed()); 2154 EXPECT_FALSE(notifier_.favicon_changed());
2155 } 2155 }
2156 2156
2157 } // namespace history 2157 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698