#include "components/feed/core/v2/protocol_translator.h"
#include <initializer_list>
#include <sstream>
#include <string>
#include <utility>
#include "base/base_paths.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "components/feed/core/proto/v2/wire/feed_response.pb.h"
#include "components/feed/core/proto/v2/wire/response.pb.h"
#include "components/feed/core/v2/ios_shared_experiments_translator.h"
#include "components/feed/core/v2/proto_util.h"
#include "components/feed/core/v2/test/proto_printer.h"
#include "components/feed/feed_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace feed {
namespace {
const char kResponsePbPath[] = …;
const base::Time kCurrentTime = …;
AccountInfo TestAccountInfo() { … }
feedwire::Response TestWireResponse() { … }
feedwire::Response EmptyWireResponse() { … }
feedwire::DataOperation MakeDataOperation(
feedwire::DataOperation::Operation operation) { … }
feedwire::DataOperation MakeDataOperationWithContent(
feedwire::DataOperation::Operation operation,
std::string xsurface_content = "content") { … }
feedwire::DataOperation MakeDataOperationWithRenderData(
feedwire::DataOperation::Operation operation,
std::string xsurface_render_data = "renderdata") { … }
RefreshResponseData TranslateWireResponse(feedwire::Response response,
const AccountInfo& account_info) { … }
RefreshResponseData TranslateWireResponse(feedwire::Response response) { … }
std::optional<feedstore::DataOperation> TranslateDataOperation(
feedwire::DataOperation operation) { … }
}
class ProtocolTranslatorTest : public testing::Test { … };
TEST_F(ProtocolTranslatorTest, NextPageToken) { … }
TEST_F(ProtocolTranslatorTest, EmptyResponse) { … }
TEST_F(ProtocolTranslatorTest, RootEventIdPresent) { … }
TEST_F(ProtocolTranslatorTest, RootEventIdNotPresent) { … }
TEST_F(ProtocolTranslatorTest, WasSignedInRequest) { … }
TEST_F(ProtocolTranslatorTest, ActivityLoggingEnabled) { … }
TEST_F(ProtocolTranslatorTest, PrivacyNoticeFulfilled) { … }
TEST_F(ProtocolTranslatorTest, ExperimentsAreTranslated) { … }
TEST_F(ProtocolTranslatorTest, ExperimentsAreNotTranslatedGroupAndIDMissing) { … }
TEST_F(ProtocolTranslatorTest, MissingResponseVersion) { … }
TEST_F(ProtocolTranslatorTest, TranslateContent) { … }
TEST_F(ProtocolTranslatorTest, TranslateContentFailsWhenMissingContent) { … }
TEST_F(ProtocolTranslatorTest, TranslateRenderData) { … }
TEST_F(ProtocolTranslatorTest, TranslateContentLifetime) { … }
TEST_F(ProtocolTranslatorTest, TranslateMissingContentLifetime) { … }
TEST_F(ProtocolTranslatorTest, TranslateRenderDataFailsWithUnknownType) { … }
TEST_F(ProtocolTranslatorTest, RenderDataOperationCanOnlyComeFromFullResponse) { … }
TEST_F(ProtocolTranslatorTest, TranslateOperationFailsWithNoPayload) { … }
TEST_F(ProtocolTranslatorTest, TranslateOperationWithoutContentId) { … }
TEST_F(ProtocolTranslatorTest, TranslateOperationFailsWithUnknownOperation) { … }
TEST_F(ProtocolTranslatorTest, TranslateRealResponse) { … }
TEST_F(ProtocolTranslatorTest, TranslateDismissData) { … }
}