| 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 <string> | 5 #include <string> |
| 6 #include <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 KeyedService* BuildHistoryService(content::BrowserContext* profile) { | 136 KeyedService* BuildHistoryService(content::BrowserContext* profile) { |
| 137 return new HistoryServiceMock(NULL, static_cast<Profile*>(profile)); | 137 return new HistoryServiceMock(NULL, static_cast<Profile*>(profile)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 class TestTypedUrlModelAssociator : public TypedUrlModelAssociator { | 140 class TestTypedUrlModelAssociator : public TypedUrlModelAssociator { |
| 141 public: | 141 public: |
| 142 TestTypedUrlModelAssociator( | 142 TestTypedUrlModelAssociator( |
| 143 ProfileSyncService* sync_service, | 143 ProfileSyncService* sync_service, |
| 144 history::HistoryBackend* history_backend, | 144 history::HistoryBackend* history_backend, |
| 145 browser_sync::DataTypeErrorHandler* error_handler) : | 145 sync_driver::DataTypeErrorHandler* error_handler) : |
| 146 TypedUrlModelAssociator(sync_service, history_backend, error_handler) {} | 146 TypedUrlModelAssociator(sync_service, history_backend, error_handler) {} |
| 147 | 147 |
| 148 protected: | 148 protected: |
| 149 // Don't clear error stats - that way we can verify their values in our | 149 // Don't clear error stats - that way we can verify their values in our |
| 150 // tests. | 150 // tests. |
| 151 virtual void ClearErrorStats() OVERRIDE {} | 151 virtual void ClearErrorStats() OVERRIDE {} |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 void RunOnDBThreadCallback(HistoryBackend* backend, | 154 void RunOnDBThreadCallback(HistoryBackend* backend, |
| 155 scoped_refptr<history::HistoryDBTask> task) { | 155 scoped_refptr<history::HistoryDBTask> task) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 content::PAGE_TRANSITION_TYPED, 0)); | 341 content::PAGE_TRANSITION_TYPED, 0)); |
| 342 history_url.set_visit_count(visits->size()); | 342 history_url.set_visit_count(visits->size()); |
| 343 return history_url; | 343 return history_url; |
| 344 } | 344 } |
| 345 | 345 |
| 346 scoped_ptr<Thread> history_thread_; | 346 scoped_ptr<Thread> history_thread_; |
| 347 TestingProfileManager profile_manager_; | 347 TestingProfileManager profile_manager_; |
| 348 TestingProfile* profile_; | 348 TestingProfile* profile_; |
| 349 scoped_refptr<HistoryBackendMock> history_backend_; | 349 scoped_refptr<HistoryBackendMock> history_backend_; |
| 350 HistoryServiceMock* history_service_; | 350 HistoryServiceMock* history_service_; |
| 351 browser_sync::DataTypeErrorHandlerMock error_handler_; | 351 sync_driver::DataTypeErrorHandlerMock error_handler_; |
| 352 }; | 352 }; |
| 353 | 353 |
| 354 void AddTypedUrlEntries(ProfileSyncServiceTypedUrlTest* test, | 354 void AddTypedUrlEntries(ProfileSyncServiceTypedUrlTest* test, |
| 355 const history::URLRows& entries) { | 355 const history::URLRows& entries) { |
| 356 test->CreateRoot(syncer::TYPED_URLS); | 356 test->CreateRoot(syncer::TYPED_URLS); |
| 357 for (size_t i = 0; i < entries.size(); ++i) { | 357 for (size_t i = 0; i < entries.size(); ++i) { |
| 358 history::VisitVector visits; | 358 history::VisitVector visits; |
| 359 visits.push_back(history::VisitRow( | 359 visits.push_back(history::VisitRow( |
| 360 entries[i].id(), entries[i].last_visit(), 0, | 360 entries[i].id(), entries[i].last_visit(), 0, |
| 361 content::PageTransitionFromInt(0), 0)); | 361 content::PageTransitionFromInt(0), 0)); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, | 1124 notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, |
| 1125 content::Source<Profile>(profile_), | 1125 content::Source<Profile>(profile_), |
| 1126 content::Details<history::URLsModifiedDetails>(&details)); | 1126 content::Details<history::URLsModifiedDetails>(&details)); |
| 1127 | 1127 |
| 1128 history::URLRows new_sync_entries; | 1128 history::URLRows new_sync_entries; |
| 1129 GetTypedUrlsFromSyncDB(&new_sync_entries); | 1129 GetTypedUrlsFromSyncDB(&new_sync_entries); |
| 1130 | 1130 |
| 1131 // The change should be ignored. | 1131 // The change should be ignored. |
| 1132 ASSERT_EQ(0U, new_sync_entries.size()); | 1132 ASSERT_EQ(0U, new_sync_entries.size()); |
| 1133 } | 1133 } |
| OLD | NEW |