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 <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 25 matching lines...) Expand all Loading... |
36 #include "components/sync/core/read_node.h" | 36 #include "components/sync/core/read_node.h" |
37 #include "components/sync/core/read_transaction.h" | 37 #include "components/sync/core/read_transaction.h" |
38 #include "components/sync/core/write_node.h" | 38 #include "components/sync/core/write_node.h" |
39 #include "components/sync/core/write_transaction.h" | 39 #include "components/sync/core/write_transaction.h" |
40 #include "components/sync/driver/data_type_manager_impl.h" | 40 #include "components/sync/driver/data_type_manager_impl.h" |
41 #include "components/sync/protocol/typed_url_specifics.pb.h" | 41 #include "components/sync/protocol/typed_url_specifics.pb.h" |
42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "url/gurl.h" | 44 #include "url/gurl.h" |
45 | 45 |
46 using browser_sync::TypedUrlDataTypeController; | |
47 using history::HistoryBackend; | 46 using history::HistoryBackend; |
48 using history::HistoryBackendNotifier; | 47 using history::HistoryBackendNotifier; |
49 using history::TypedUrlSyncableService; | 48 using history::TypedUrlSyncableService; |
50 using testing::DoAll; | 49 using testing::DoAll; |
51 using testing::Return; | 50 using testing::Return; |
52 using testing::SetArgumentPointee; | 51 using testing::SetArgumentPointee; |
53 using testing::_; | 52 using testing::_; |
54 | 53 |
| 54 namespace browser_sync { |
| 55 |
55 namespace { | 56 namespace { |
56 | 57 |
57 const char kDummySavingBrowserHistoryDisabled[] = "dummyPref"; | 58 const char kDummySavingBrowserHistoryDisabled[] = "dummyPref"; |
58 | 59 |
59 // Visits with this timestamp are treated as expired. | 60 // Visits with this timestamp are treated as expired. |
60 static const int EXPIRED_VISIT = -1; | 61 static const int EXPIRED_VISIT = -1; |
61 | 62 |
62 ACTION(ReturnNewDataTypeManager) { | 63 ACTION(ReturnNewDataTypeManager) { |
63 return new sync_driver::DataTypeManagerImpl(arg0, arg1, arg2, arg3, arg4); | 64 return new sync_driver::DataTypeManagerImpl(arg0, arg1, arg2, arg3, arg4); |
64 } | 65 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 data_type_thread()->task_runner()->PostTaskAndReply( | 179 data_type_thread()->task_runner()->PostTaskAndReply( |
179 FROM_HERE, | 180 FROM_HERE, |
180 base::Bind(&ProfileSyncServiceTypedUrlTest::CreateHistoryService, | 181 base::Bind(&ProfileSyncServiceTypedUrlTest::CreateHistoryService, |
181 base::Unretained(this)), | 182 base::Unretained(this)), |
182 run_loop.QuitClosure()); | 183 run_loop.QuitClosure()); |
183 run_loop.Run(); | 184 run_loop.Run(); |
184 history_service_ = base::WrapUnique(new HistoryServiceMock); | 185 history_service_ = base::WrapUnique(new HistoryServiceMock); |
185 history_service_->set_task_runner(data_type_thread()->task_runner()); | 186 history_service_->set_task_runner(data_type_thread()->task_runner()); |
186 history_service_->set_backend(history_backend_); | 187 history_service_->set_backend(history_backend_); |
187 | 188 |
188 browser_sync::ProfileSyncServiceBundle::SyncClientBuilder builder( | 189 ProfileSyncServiceBundle::SyncClientBuilder builder( |
189 profile_sync_service_bundle()); | 190 profile_sync_service_bundle()); |
190 builder.SetHistoryService(history_service_.get()); | 191 builder.SetHistoryService(history_service_.get()); |
191 builder.SetSyncServiceCallback(GetSyncServiceCallback()); | 192 builder.SetSyncServiceCallback(GetSyncServiceCallback()); |
192 builder.SetSyncableServiceCallback( | 193 builder.SetSyncableServiceCallback( |
193 base::Bind(&ProfileSyncServiceTypedUrlTest::GetSyncableServiceForType, | 194 base::Bind(&ProfileSyncServiceTypedUrlTest::GetSyncableServiceForType, |
194 base::Unretained(this))); | 195 base::Unretained(this))); |
195 builder.set_activate_model_creation(); | 196 builder.set_activate_model_creation(); |
196 sync_client_ = builder.Build(); | 197 sync_client_ = builder.Build(); |
197 } | 198 } |
198 | 199 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 history::URLRows changed_urls; | 1044 history::URLRows changed_urls; |
1044 changed_urls.push_back(updated_url_entry); | 1045 changed_urls.push_back(updated_url_entry); |
1045 SendNotificationURLsModified(changed_urls); | 1046 SendNotificationURLsModified(changed_urls); |
1046 | 1047 |
1047 history::URLRows new_sync_entries; | 1048 history::URLRows new_sync_entries; |
1048 GetTypedUrlsFromSyncDB(&new_sync_entries); | 1049 GetTypedUrlsFromSyncDB(&new_sync_entries); |
1049 | 1050 |
1050 // The change should be ignored. | 1051 // The change should be ignored. |
1051 ASSERT_EQ(0U, new_sync_entries.size()); | 1052 ASSERT_EQ(0U, new_sync_entries.size()); |
1052 } | 1053 } |
| 1054 |
| 1055 } // namespace browser_sync |
OLD | NEW |