chromium/components/sync/test/test_matchers.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SYNC_TEST_TEST_MATCHERS_H_
#define COMPONENTS_SYNC_TEST_TEST_MATCHERS_H_

#include <map>
#include <memory>
#include <string>
#include <utility>

#include "components/sync/model/metadata_batch.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/deletion_origin.pb.h"
#include "components/sync/protocol/entity_metadata.pb.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace syncer {

// Matcher for std::optional<ModelError>: verifies that it contains no error.
MATCHER(NoModelError, "") {}

// Matcher for MetadataBatch: verifies that it is empty (i.e. contains neither
// entity metadata nor global model state.
MATCHER(IsEmptyMetadataBatch, "") {}

// Matcher for MetadataBatch: general purpose verification given two matchers,
// of type Matcher<DataTypeState> and Matcher<EntityMetadataMap> respectively.
MATCHER_P2(MetadataBatchContains, state, entities, "") {}

// Matcher for sync_pb::DataTypeState: verifies that field
// |encryption_key_name| is equal to the provided string |expected_key_name|.
MATCHER_P(HasEncryptionKeyName, expected_key_name, "") {}

// Matcher for sync_pb::DataTypeState: verifies that initial sync is done.
MATCHER(HasInitialSyncDone, "") {}

// Matcher for sync_pb::DataTypeState: verifies that initial sync is not done.
MATCHER(HasNotInitialSyncDone, "") {}

MATCHER_P2(MatchesDeletionOrigin, expected_version, expected_location, "") {}

}  // namespace syncer

#endif  // COMPONENTS_SYNC_TEST_TEST_MATCHERS_H_