chromium/content/services/auction_worklet/trusted_signals_unittest.cc

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

#include "content/services/auction_worklet/trusted_signals.h"

#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "content/common/features.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "content/services/auction_worklet/worklet_test_util.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/http/http_status_code.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-forward.h"

namespace auction_worklet {
namespace {

// Json response using bidding format version 1. Keys and values should match
// those in kBaseBiddingJson.
const char kBiddingJsonV1[] =;

// Common JSON used for most bidding signals tests using the latest bidding
// format version (version 2). key4 and name4 entries are deliberately missing.
const char kBaseBiddingJson[] =;

// Common JSON used for most scoring signals tests.
const char kBaseScoringJsonOldNames[] =;

const char kBaseScoringJson[] =;

const char kBaseScoringJsonNewAndOldNames[] =;

const char kHostname[] =;

class TrustedSignalsTest : public testing::Test {};

TEST_F(TrustedSignalsTest, BiddingSignalsNetworkError) {}

TEST_F(TrustedSignalsTest, ScoringSignalsNetworkError) {}

TEST_F(TrustedSignalsTest, BiddingSignalsResponseNotJsonObject) {}

TEST_F(TrustedSignalsTest, ScoringSignalsResponseNotJsonObject) {}

TEST_F(TrustedSignalsTest, BiddingSignalsInvalidVersion) {}

TEST_F(TrustedSignalsTest, BiddingSignalsResponseNotObject) {}

TEST_F(TrustedSignalsTest, ScoringSignalsResponseNotObject) {}

TEST_F(TrustedSignalsTest, BiddingSignalsExpectedEntriesNotPresent) {}

TEST_F(TrustedSignalsTest, ScoringSignalsExpectedEntriesNotPresent) {}

TEST_F(TrustedSignalsTest, BiddingSignalsNestedEntriesNotObject) {}

TEST_F(TrustedSignalsTest, BiddingSignalsInvalidPriorityVectors) {}

TEST_F(TrustedSignalsTest, ScoringSignalsNestedEntriesNotObjects) {}

TEST_F(TrustedSignalsTest, BiddingSignalsKeyMissing) {}

TEST_F(TrustedSignalsTest, BiddingSignalsKeyMissingNameInProto) {}

TEST_F(TrustedSignalsTest, ScoringSignalsKeysMissing) {}

TEST_F(TrustedSignalsTest, BiddingSignalsOneKey) {}

TEST_F(TrustedSignalsTest, BiddingSignalsOneKeyOldHeaderName) {}

TEST_F(TrustedSignalsTest, BiddingSignalsOneKeyHeaderName) {}

TEST_F(TrustedSignalsTest, BiddingSignalsOneKeyBothOldAndNewHeaderNames) {}

TEST_F(TrustedSignalsTest, ScoringSignalsForOneRenderUrl) {}

TEST_F(TrustedSignalsTest, BiddingSignalsMultipleKeys) {}

TEST_F(TrustedSignalsTest, ScoringSignalsMultipleUrls) {}

TEST_F(TrustedSignalsTest, ScoringSignalsOldNames) {}

TEST_F(TrustedSignalsTest, ScoringSignalsNewAndOldNames) {}

TEST_F(TrustedSignalsTest, BiddingSignalsDuplicateKeys) {}

TEST_F(TrustedSignalsTest, ScoringSignalsDuplicateKeys) {}

// Test when a single URL is used as both a `renderURL` and
// `adComponentRenderURL`.
TEST_F(TrustedSignalsTest, ScoringSignalsSharedUrl) {}

TEST_F(TrustedSignalsTest, BiddingSignalsEscapeQueryParams) {}

TEST_F(TrustedSignalsTest, ScoringSignalsEscapeQueryParams) {}

// Testcase where the loader is deleted after it queued the parsing of
// the script on V8 thread, but before it gets to finish.
TEST_F(TrustedSignalsTest, BiddingSignalsDeleteBeforeCallback) {}

// Testcase where the loader is deleted after it queued the parsing of
// the script on V8 thread, but before it gets to finish.
TEST_F(TrustedSignalsTest, ScoringSignalsDeleteBeforeCallback) {}

TEST_F(TrustedSignalsTest, ScoringSignalsWithDataVersion) {}

TEST_F(TrustedSignalsTest, ScoringSignalsWithInvalidDataVersion) {}

TEST_F(TrustedSignalsTest, BiddingSignalsExperimentId) {}

TEST_F(TrustedSignalsTest, ScoringSignalsExperimentId) {}

TEST_F(TrustedSignalsTest, BiddingSignalsAdditionalQueryParams) {}

TEST_F(TrustedSignalsTest, BiddingSignalsV1) {}

TEST_F(TrustedSignalsTest, BiddingSignalsV1WithV1Header) {}

// A V2 header with a V1 body treats all values as null (since it can't find
// keys).
TEST_F(TrustedSignalsTest, BiddingSignalsV2HeaderV1Body) {}

// A V1 header (i.e., no version header) with a V2 body treats all values as
// null (since it can't find keys).
TEST_F(TrustedSignalsTest, BiddingSignalsV1HeaderV2Body) {}

}  // namespace
}  // namespace auction_worklet