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

Side by Side Diff: chrome/browser/sync/glue/autofill_model_associator.cc

Issue 661410: Improve autofill unit test (Closed)
Patch Set: Remove TODO. Created 10 years, 9 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
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sync/glue/autofill_model_associator.h" 5 #include "chrome/browser/sync/glue/autofill_model_associator.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/sync/engine/syncapi.h" 9 #include "chrome/browser/sync/engine/syncapi.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 23 matching lines...) Expand all
34 LOG(INFO) << "Associating Autofill Models"; 34 LOG(INFO) << "Associating Autofill Models";
35 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); 35 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
36 36
37 // TODO(zork): Attempt to load the model association from storage. 37 // TODO(zork): Attempt to load the model association from storage.
38 std::vector<AutofillEntry> entries; 38 std::vector<AutofillEntry> entries;
39 if (!web_database_->GetAllAutofillEntries(&entries)) { 39 if (!web_database_->GetAllAutofillEntries(&entries)) {
40 LOG(ERROR) << "Could not get the autofill entries."; 40 LOG(ERROR) << "Could not get the autofill entries.";
41 return false; 41 return false;
42 } 42 }
43 43
44 int64 root_id;
45 if (!GetSyncIdForTaggedNode(kAutofillTag, &root_id)) {
46 sync_service_->OnUnrecoverableError();
47 LOG(ERROR) << "Server did not create the top-level autofill node. We "
48 << "might be running against an out-of-date server.";
49 return false;
50 }
51
52 sync_api::WriteTransaction trans( 44 sync_api::WriteTransaction trans(
53 sync_service_->backend()->GetUserShareHandle()); 45 sync_service_->backend()->GetUserShareHandle());
54 sync_api::ReadNode autofill_root(&trans); 46 sync_api::ReadNode autofill_root(&trans);
55 if (!autofill_root.InitByIdLookup(root_id)) { 47 if (!autofill_root.InitByTagLookup(kAutofillTag)) {
56 error_handler_->OnUnrecoverableError(); 48 error_handler_->OnUnrecoverableError();
57 LOG(ERROR) << "Server did not create the top-level autofill node. We " 49 LOG(ERROR) << "Server did not create the top-level autofill node. We "
58 << "might be running against an out-of-date server."; 50 << "might be running against an out-of-date server.";
59 return false; 51 return false;
60 } 52 }
61 53
62 std::set<AutofillKey> current_entries; 54 std::set<AutofillKey> current_entries;
63 std::vector<AutofillEntry> new_entries; 55 std::vector<AutofillEntry> new_entries;
64 56
65 for (std::vector<AutofillEntry>::iterator ix = entries.begin(); 57 for (std::vector<AutofillEntry>::iterator ix = entries.begin();
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 279
288 if (different) { 280 if (different) {
289 new_timestamps->insert(new_timestamps->begin(), 281 new_timestamps->insert(new_timestamps->begin(),
290 timestamp_union.begin(), 282 timestamp_union.begin(),
291 timestamp_union.end()); 283 timestamp_union.end());
292 } 284 }
293 return different; 285 return different;
294 } 286 }
295 287
296 } // namespace browser_sync 288 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698