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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 new TypedUrlChangeProcessor(profile, *model_associator, hb, dtc); | 202 new TypedUrlChangeProcessor(profile, *model_associator, hb, dtc); |
203 return ProfileSyncComponentsFactory::SyncComponents(*model_associator, | 203 return ProfileSyncComponentsFactory::SyncComponents(*model_associator, |
204 change_processor); | 204 change_processor); |
205 } | 205 } |
206 | 206 |
207 class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest { | 207 class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest { |
208 public: | 208 public: |
209 void AddTypedUrlSyncNode(const history::URLRow& url, | 209 void AddTypedUrlSyncNode(const history::URLRow& url, |
210 const history::VisitVector& visits) { | 210 const history::VisitVector& visits) { |
211 syncer::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 211 syncer::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
212 syncer::ReadNode typed_url_root(&trans); | |
213 ASSERT_EQ(syncer::BaseNode::INIT_OK, | |
214 typed_url_root.InitTypeRoot(syncer::TYPED_URLS)); | |
215 | 212 |
216 syncer::WriteNode node(&trans); | 213 syncer::WriteNode node(&trans); |
217 std::string tag = url.url().spec(); | 214 std::string tag = url.url().spec(); |
218 syncer::WriteNode::InitUniqueByCreationResult result = | 215 syncer::WriteNode::InitUniqueByCreationResult result = |
219 node.InitUniqueByCreation(syncer::TYPED_URLS, typed_url_root, tag); | 216 node.InitUniqueByCreation(syncer::TYPED_URLS, tag); |
220 ASSERT_EQ(syncer::WriteNode::INIT_SUCCESS, result); | 217 ASSERT_EQ(syncer::WriteNode::INIT_SUCCESS, result); |
221 TypedUrlModelAssociator::WriteToSyncNode(url, visits, &node); | 218 TypedUrlModelAssociator::WriteToSyncNode(url, visits, &node); |
222 } | 219 } |
223 | 220 |
224 protected: | 221 protected: |
225 ProfileSyncServiceTypedUrlTest() | 222 ProfileSyncServiceTypedUrlTest() |
226 : profile_manager_(TestingBrowserProcess::GetGlobal()) { | 223 : profile_manager_(TestingBrowserProcess::GetGlobal()) { |
227 history_thread_.reset(new Thread("history")); | 224 history_thread_.reset(new Thread("history")); |
228 } | 225 } |
229 | 226 |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 history::URLRows changed_urls; | 1122 history::URLRows changed_urls; |
1126 changed_urls.push_back(updated_url_entry); | 1123 changed_urls.push_back(updated_url_entry); |
1127 SendNotificationURLsModified(changed_urls); | 1124 SendNotificationURLsModified(changed_urls); |
1128 | 1125 |
1129 history::URLRows new_sync_entries; | 1126 history::URLRows new_sync_entries; |
1130 GetTypedUrlsFromSyncDB(&new_sync_entries); | 1127 GetTypedUrlsFromSyncDB(&new_sync_entries); |
1131 | 1128 |
1132 // The change should be ignored. | 1129 // The change should be ignored. |
1133 ASSERT_EQ(0U, new_sync_entries.size()); | 1130 ASSERT_EQ(0U, new_sync_entries.size()); |
1134 } | 1131 } |
OLD | NEW |