chromium/components/origin_trials/common/persisted_trial_token.h

// Copyright 2022 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_ORIGIN_TRIALS_COMMON_PERSISTED_TRIAL_TOKEN_H_
#define COMPONENTS_ORIGIN_TRIALS_COMMON_PERSISTED_TRIAL_TOKEN_H_

#include <string>

#include "base/containers/flat_set.h"
#include "base/time/time.h"
#include "third_party/blink/public/common/origin_trials/trial_token.h"

namespace origin_trials {

// Parsed information about a token to be persisted.
//
// The token stores partitioning information as a set of strings, but this is
// not part of the tokens sort order with respect to being inserted in sorted
// sets.
struct PersistedTrialToken {};

// Comparison operator to let us store PersistedTokens in a flat_set.
// Does not take partitioning metadata into account.
bool operator<(const PersistedTrialToken& a, const PersistedTrialToken& b);

// Equality operator for testing.
bool operator==(const PersistedTrialToken& a, const PersistedTrialToken& b);

// In-equality operator for testing
bool operator!=(const PersistedTrialToken& a, const PersistedTrialToken& b);

// Stream operator, mainly for GTEST output
std::ostream& operator<<(std::ostream& out, const PersistedTrialToken& token);

}  // namespace origin_trials

#endif  // COMPONENTS_ORIGIN_TRIALS_COMMON_PERSISTED_TRIAL_TOKEN_H_