#include <bitset>
#include <string_view>
#include <vector>
#include "base/base64.h"
#include "base/command_line.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/embedder_support/origin_trials/pref_names.h"
#include "components/embedder_support/switches.h"
#include "components/prefs/pref_service.h"
#include "content/public/common/content_client.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/origin_trials/origin_trial_policy.h"
namespace {
struct DisabledItemsTestData { … };
static const char kNewPublicKey[] = …;
const DisabledItemsTestData kDisabledFeaturesTests[] = …;
const uint8_t kTokenSignatureSize = …;
struct DisabledTokensTestData { … };
const char kToken1Encoded[] = …;
const uint8_t kToken1Signature[kTokenSignatureSize] = …;
const char kToken2Encoded[] = …;
const uint8_t kToken2Signature[kTokenSignatureSize] = …;
const DisabledTokensTestData kDisabledTokensTests[] = …;
class ChromeOriginTrialsTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsTest, NoPublicKeySet) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsTest, NoDisabledFeatures) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsTest, NoDisabledTokens) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsTest, PRE_PublicKeySetOnCommandLine) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsTest, PublicKeySetOnCommandLine) { … }
class ChromeOriginTrialsDisabledFeaturesTest
: public ChromeOriginTrialsTest,
public ::testing::WithParamInterface<DisabledItemsTestData> { … };
IN_PROC_BROWSER_TEST_P(ChromeOriginTrialsDisabledFeaturesTest,
PRE_DisabledFeaturesSetOnCommandLine) { … }
IN_PROC_BROWSER_TEST_P(ChromeOriginTrialsDisabledFeaturesTest,
DisabledFeaturesSetOnCommandLine) { … }
INSTANTIATE_TEST_SUITE_P(…);
class ChromeOriginTrialsDisabledTokensTest
: public ChromeOriginTrialsTest,
public ::testing::WithParamInterface<DisabledTokensTestData> { … };
IN_PROC_BROWSER_TEST_P(ChromeOriginTrialsDisabledTokensTest,
PRE_DisabledTokensInPolicy) { … }
IN_PROC_BROWSER_TEST_P(ChromeOriginTrialsDisabledTokensTest,
DisabledTokensInPolicy) { … }
INSTANTIATE_TEST_SUITE_P(…);
const uint16_t kMaxTokensToProduce = …;
const uint16_t kAboveMaxTokensToProduce = …;
class ChromeOriginTrialsDisabledTokensLimitTest
: public ChromeOriginTrialsTest { … };
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsDisabledTokensLimitTest,
PRE_DisabledTokensMaxTokensAppliedToPolicy) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsDisabledTokensLimitTest,
DisabledTokensMaxTokensAppliedToPolicy) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsDisabledTokensLimitTest,
PRE_DisabledTokensOverSizeLimitAreIgnored) { … }
IN_PROC_BROWSER_TEST_F(ChromeOriginTrialsDisabledTokensLimitTest,
DisabledTokensOverSizeLimitAreIgnored) { … }
}