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

Side by Side Diff: components/browser_sync/profile_sync_service_typed_url_unittest.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 namespace browser_sync { 54 namespace browser_sync {
55 55
56 namespace { 56 namespace {
57 57
58 const char kDummySavingBrowserHistoryDisabled[] = "dummyPref"; 58 const char kDummySavingBrowserHistoryDisabled[] = "dummyPref";
59 59
60 // Visits with this timestamp are treated as expired. 60 // Visits with this timestamp are treated as expired.
61 static const int EXPIRED_VISIT = -1; 61 static const int EXPIRED_VISIT = -1;
62 62
63 ACTION(ReturnNewDataTypeManager) { 63 ACTION(ReturnNewDataTypeManager) {
64 return new sync_driver::DataTypeManagerImpl(arg0, arg1, arg2, arg3, arg4); 64 return new syncer::DataTypeManagerImpl(arg0, arg1, arg2, arg3, arg4);
65 } 65 }
66 66
67 class HistoryBackendMock : public HistoryBackend { 67 class HistoryBackendMock : public HistoryBackend {
68 public: 68 public:
69 HistoryBackendMock() 69 HistoryBackendMock()
70 : HistoryBackend(nullptr, nullptr, base::ThreadTaskRunnerHandle::Get()) {} 70 : HistoryBackend(nullptr, nullptr, base::ThreadTaskRunnerHandle::Get()) {}
71 bool IsExpiredVisitTime(const base::Time& time) override { 71 bool IsExpiredVisitTime(const base::Time& time) override {
72 return time.ToInternalValue() == EXPIRED_VISIT; 72 return time.ToInternalValue() == EXPIRED_VISIT;
73 } 73 }
74 MOCK_METHOD1(GetAllTypedURLs, bool(history::URLRows* entries)); 74 MOCK_METHOD1(GetAllTypedURLs, bool(history::URLRows* entries));
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 ~ProfileSyncServiceTypedUrlTest() override { 211 ~ProfileSyncServiceTypedUrlTest() override {
212 history_service_->Shutdown(); 212 history_service_->Shutdown();
213 213
214 // Request stop to get deletion tasks related to the HistoryService posted 214 // Request stop to get deletion tasks related to the HistoryService posted
215 // on the Sync thread. It is important to not Shutdown at this moment, 215 // on the Sync thread. It is important to not Shutdown at this moment,
216 // because after shutdown the Sync thread is not returned to the sync 216 // because after shutdown the Sync thread is not returned to the sync
217 // service, so we could not get the thread's message loop to wait for the 217 // service, so we could not get the thread's message loop to wait for the
218 // deletions to be finished. 218 // deletions to be finished.
219 sync_service()->RequestStop(sync_driver::SyncService::CLEAR_DATA); 219 sync_service()->RequestStop(syncer::SyncService::CLEAR_DATA);
220 // Spin the sync thread. 220 // Spin the sync thread.
221 { 221 {
222 base::RunLoop run_loop; 222 base::RunLoop run_loop;
223 sync_service()->GetSyncLoopForTest()->task_runner()->PostTaskAndReply( 223 sync_service()->GetSyncLoopForTest()->task_runner()->PostTaskAndReply(
224 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure()); 224 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure());
225 run_loop.Run(); 225 run_loop.Run();
226 } 226 }
227 227
228 // Spin the loop again for deletion tasks posted from the Sync thread. 228 // Spin the loop again for deletion tasks posted from the Sync thread.
229 base::RunLoop().RunUntilIdle(); 229 base::RunLoop().RunUntilIdle();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 return syncable_service_->AsWeakPtr(); 374 return syncable_service_->AsWeakPtr();
375 } 375 }
376 376
377 HistoryBackendMock& history_backend() { return *history_backend_.get(); } 377 HistoryBackendMock& history_backend() { return *history_backend_.get(); }
378 378
379 private: 379 private:
380 scoped_refptr<HistoryBackendMock> history_backend_; 380 scoped_refptr<HistoryBackendMock> history_backend_;
381 std::unique_ptr<HistoryServiceMock> history_service_; 381 std::unique_ptr<HistoryServiceMock> history_service_;
382 syncer::DataTypeErrorHandlerMock error_handler_; 382 syncer::DataTypeErrorHandlerMock error_handler_;
383 std::unique_ptr<TestTypedUrlSyncableService> syncable_service_; 383 std::unique_ptr<TestTypedUrlSyncableService> syncable_service_;
384 std::unique_ptr<sync_driver::FakeSyncClient> sync_client_; 384 std::unique_ptr<syncer::FakeSyncClient> sync_client_;
385 385
386 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceTypedUrlTest); 386 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceTypedUrlTest);
387 }; 387 };
388 388
389 void AddTypedUrlEntries(ProfileSyncServiceTypedUrlTest* test, 389 void AddTypedUrlEntries(ProfileSyncServiceTypedUrlTest* test,
390 const history::URLRows& entries) { 390 const history::URLRows& entries) {
391 test->CreateRoot(syncer::TYPED_URLS); 391 test->CreateRoot(syncer::TYPED_URLS);
392 for (size_t i = 0; i < entries.size(); ++i) { 392 for (size_t i = 0; i < entries.size(); ++i) {
393 history::VisitVector visits; 393 history::VisitVector visits;
394 visits.push_back(history::VisitRow(entries[i].id(), entries[i].last_visit(), 394 visits.push_back(history::VisitRow(entries[i].id(), entries[i].last_visit(),
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 SendNotificationURLsModified(changed_urls); 1046 SendNotificationURLsModified(changed_urls);
1047 1047
1048 history::URLRows new_sync_entries; 1048 history::URLRows new_sync_entries;
1049 GetTypedUrlsFromSyncDB(&new_sync_entries); 1049 GetTypedUrlsFromSyncDB(&new_sync_entries);
1050 1050
1051 // The change should be ignored. 1051 // The change should be ignored.
1052 ASSERT_EQ(0U, new_sync_entries.size()); 1052 ASSERT_EQ(0U, new_sync_entries.size());
1053 } 1053 }
1054 1054
1055 } // namespace browser_sync 1055 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698