Commit 7e5581fb authored by Florian Uunk's avatar Florian Uunk Committed by Commit Bot

Use the wallet datatype to read wallet metadata

Fixing a bug where the wallet data bridge was reading address metadata.

Change-Id: I1a8dc41a59b4bb8f5855eb7c5f0fa81a3611a419
Bug: 876300
Reviewed-on: https://chromium-review.googlesource.com/1183437
Commit-Queue: Florian Uunk <feuunk@chromium.org>
Reviewed-by: default avatarTim Schumann <tschumann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584743}
parent 71a945b8
......@@ -300,7 +300,7 @@ void AutofillWalletSyncBridge::LoadMetadata() {
}
auto batch = std::make_unique<syncer::MetadataBatch>();
if (!GetAutofillTable()->GetAllSyncMetadata(syncer::AUTOFILL_PROFILE,
if (!GetAutofillTable()->GetAllSyncMetadata(syncer::AUTOFILL_WALLET_DATA,
batch.get())) {
change_processor()->ReportError(
{FROM_HERE, "Failed reading autofill metadata from WebDatabase."});
......
......@@ -34,6 +34,7 @@
#include "components/sync/model_impl/client_tag_based_model_type_processor.h"
#include "components/sync/protocol/autofill_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/test/test_matchers.h"
#include "components/webdata/common/web_database.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -42,13 +43,17 @@ namespace {
using base::ScopedTempDir;
using sync_pb::AutofillWalletSpecifics;
using sync_pb::EntityMetadata;
using sync_pb::ModelTypeState;
using syncer::DataBatch;
using syncer::EntityChange;
using syncer::EntityData;
using syncer::EntityDataPtr;
using syncer::HasInitialSyncDone;
using syncer::KeyAndData;
using syncer::MockModelTypeChangeProcessor;
using syncer::ModelType;
using testing::SizeIs;
using testing::UnorderedElementsAre;
// Base64 encodings of the server IDs, used as ids in WalletMetadataSpecifics
......@@ -533,4 +538,19 @@ TEST_F(AutofillWalletSyncBridgeTest, MergeSyncData_SetsAllWalletCardData) {
EXPECT_FALSE(card.bank_name().empty());
}
TEST_F(AutofillWalletSyncBridgeTest, LoadMetadataCalled) {
ModelTypeState model_type_state;
model_type_state.set_initial_sync_done(true);
EXPECT_TRUE(table()->UpdateModelTypeState(syncer::AUTOFILL_WALLET_DATA,
model_type_state));
EXPECT_TRUE(table()->UpdateSyncMetadata(syncer::AUTOFILL_WALLET_DATA, "key",
EntityMetadata()));
ResetProcessor();
EXPECT_CALL(mock_processor(), ModelReadyToSync(MetadataBatchContains(
/*state=*/HasInitialSyncDone(),
/*entities=*/SizeIs(1))));
ResetBridge();
}
} // namespace autofill
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