#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include <memory>
#include <string_view>
#include <vector>
#include "base/containers/span.h"
#include "base/ranges/algorithm.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/origin_trials/origin_trials.h"
#include "third_party/blink/public/common/origin_trials/trial_token.h"
#include "third_party/blink/public/common/origin_trials/trial_token_result.h"
#include "third_party/blink/public/common/origin_trials/trial_token_validator.h"
#include "third_party/blink/public/mojom/origin_trial_feature/origin_trial_feature.mojom-shared.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/html_head_element.h"
#include "third_party/blink/renderer/core/html/html_meta_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "third_party/blink/renderer/core/testing/null_execution_context.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
namespace {
const char kUnknownTrialName[] = …;
const char kFrobulateTrialName[] = …;
const char kFrobulateThirdPartyTrialName[] = …;
const char kFrobulateNavigationTrialName[] = …;
const char kFrobulateDeprecationTrialName[] = …;
const char kFrobulateBrowserReadWriteTrialName[] = …;
const char kFrobulateEnabledOrigin[] = …;
const char kFrobulateEnabledOriginInsecure[] = …;
const char kUnrelatedSecureOrigin[] = …;
const base::Time kBaseTokenExpiryTime = …;
const char kTokenPlaceholder[] = …;
class MockTokenValidator : public TrialTokenValidator { … };
}
class OriginTrialContextTest : public testing::Test { … };
TEST_F(OriginTrialContextTest, ValidatorGetsCorrectInfo) { … }
TEST_F(OriginTrialContextTest,
ValidatorGetsCorrectSecurityInfoForInsecureOrigins) { … }
TEST_F(OriginTrialContextTest, ValidatorGetsCorrectSecurityInfoThirdParty) { … }
TEST_F(OriginTrialContextTest, EnabledNonExistingTrial) { … }
TEST_F(OriginTrialContextTest, EnabledSecureRegisteredOrigin) { … }
TEST_F(OriginTrialContextTest, ThirdPartyTrialWithThirdPartyTokenEnabled) { … }
TEST_F(OriginTrialContextTest, InvalidTokenResponseFromPlatform) { … }
TEST_F(OriginTrialContextTest, FeatureNotEnableOnInsecureOrigin) { … }
TEST_F(OriginTrialContextTest, FeatureNotEnableOnInsecureThirdPartyOrigin) { … }
TEST_F(OriginTrialContextTest, ParseHeaderValue) { … }
TEST_F(OriginTrialContextTest, ParseHeaderValue_NotCommaSeparated) { … }
TEST_F(OriginTrialContextTest, PermissionsPolicy) { … }
TEST_F(OriginTrialContextTest, GetEnabledNavigationFeatures) { … }
TEST_F(OriginTrialContextTest, ActivateNavigationFeature) { … }
TEST_F(OriginTrialContextTest, GetTokenExpiryTimeIgnoresIrrelevantTokens) { … }
TEST_F(OriginTrialContextTest, LastExpiryForFeatureIsUsed) { … }
TEST_F(OriginTrialContextTest, ImpliedFeatureExpiryTimesAreUpdated) { … }
TEST_F(OriginTrialContextTest, SettingFeatureUpdatesDocumentSettings) { … }
TEST_F(OriginTrialContextTest, AddedFeaturesAreMappedToTokens) { … }
class OriginTrialContextDevtoolsTest : public OriginTrialContextTest { … };
TEST_F(OriginTrialContextDevtoolsTest, DependentFeatureNotEnabled) { … }
TEST_F(OriginTrialContextDevtoolsTest, TrialNameNotRecognized) { … }
TEST_F(OriginTrialContextDevtoolsTest, NoValidToken) { … }
TEST_F(OriginTrialContextDevtoolsTest, Enabled) { … }
TEST_F(OriginTrialContextDevtoolsTest, UnparsableToken) { … }
TEST_F(OriginTrialContextDevtoolsTest, InsecureOrigin) { … }
}