chromium/components/optimization_guide/core/model_execution/substitution_unittest.cc

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

#include "components/optimization_guide/core/model_execution/substitution.h"

#include <cstdint>
#include <initializer_list>

#include "base/logging.h"
#include "base/test/test.pb.h"
#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h"
#include "components/optimization_guide/core/model_execution/test/feature_config_builder.h"
#include "components/optimization_guide/proto/descriptors.pb.h"
#include "components/optimization_guide/proto/features/compose.pb.h"
#include "components/optimization_guide/proto/features/tab_organization.pb.h"
#include "components/optimization_guide/proto/substitution.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace optimization_guide {

namespace {

class SubstitutionTest : public testing::Test {};

// ComposeRequest::page_metadata.page_title
auto PageTitleField() {}
// ComposeRequest::rewrite_params.tone
auto ToneField() {}
// ComposeRequest::rewrite_params.length
auto LengthField() {}
// TabOrganizationRequest::tabs
auto TabsField() {}
// Tab::tab_id
auto TabId() {}
// Tab::title
auto TabTitle() {}

auto Condition(proto::ProtoField&& p,
               proto::OperatorType op,
               proto::Value&& val) {}

auto ConditionList(proto::ConditionEvaluationType t,
                   std::initializer_list<proto::Condition> conds) {}

// A simple expression that evaluates to "Cond: {name} {matched/not_matched} ".
auto ConditionCheckExpr(const std::string& cond_name,
                        proto::ConditionList&& cond_list) {}

TEST_F(SubstitutionTest, RawString) {}

TEST_F(SubstitutionTest, BadTemplate) {}

TEST_F(SubstitutionTest, ProtoField) {}

TEST_F(SubstitutionTest, BadProtoField) {}

TEST_F(SubstitutionTest, Conditions) {}

// Make a simple request with two tabs.
proto::TabOrganizationRequest TwoTabRequest() {}

// Evaluate an expression over a list of tabs.
// The substititon should produce a string like "Tabs: E,E,"
// Where "E" is the 'expr' evaluated over the list of tabs.
proto::SubstitutedString TabsExpr(const proto::StringSubstitution& expr) {}

TEST_F(SubstitutionTest, RepeatedRawField) {}

TEST_F(SubstitutionTest, RepeatedProtoField) {}

TEST_F(SubstitutionTest, RepeatedZeroBasedIndexField) {}

TEST_F(SubstitutionTest, RepeatedOneBasedIndexField) {}

TEST_F(SubstitutionTest, RepeatedCondition) {}

}  // namespace

}  // namespace optimization_guide