Commit 32977338 authored by sdefresne's avatar sdefresne Committed by Commit bot

Order returning profiles and card by descending date_modified

The unittests (WebDataServiceAutofillTest.CreditUpdate) assume that the
newly modified credit card information will be the first one returned.
Since it has the highest date_modified value, this imply a descending
ordering of the cards when iterating.

The unittests were previously flaky as the precision of date_modified
is not high enough and both card ended up with the same value most of
the time. When the test was taking slightly more time to run, then the
modified car would end up last and the test would fail.

BUG=None

Review URL: https://codereview.chromium.org/600873002

Cr-Commit-Position: refs/heads/master@{#296623}
parent 7a6ab650
...@@ -930,7 +930,7 @@ bool AutofillTable::GetAutofillProfiles( ...@@ -930,7 +930,7 @@ bool AutofillTable::GetAutofillProfiles(
sql::Statement s(db_->GetUniqueStatement( sql::Statement s(db_->GetUniqueStatement(
"SELECT guid " "SELECT guid "
"FROM autofill_profiles " "FROM autofill_profiles "
"ORDER BY date_modified, guid")); "ORDER BY date_modified DESC, guid"));
while (s.Step()) { while (s.Step()) {
std::string guid = s.ColumnString(0); std::string guid = s.ColumnString(0);
...@@ -1069,7 +1069,7 @@ bool AutofillTable::GetCreditCards( ...@@ -1069,7 +1069,7 @@ bool AutofillTable::GetCreditCards(
sql::Statement s(db_->GetUniqueStatement( sql::Statement s(db_->GetUniqueStatement(
"SELECT guid " "SELECT guid "
"FROM credit_cards " "FROM credit_cards "
"ORDER BY date_modified, guid")); "ORDER BY date_modified DESC, guid"));
while (s.Step()) { while (s.Step()) {
std::string guid = s.ColumnString(0); std::string guid = s.ColumnString(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment