// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
interface OriginTrialsTest {
[RuntimeEnabled=OriginTrialsSampleAPI, Exposed=Window] constructor();
[RuntimeEnabled=OriginTrialsSampleAPI] readonly attribute boolean normalAttribute;
[RuntimeEnabled=OriginTrialsSampleAPI] static readonly attribute boolean staticAttribute;
[RuntimeEnabled=OriginTrialsSampleAPI] boolean normalMethod();
[RuntimeEnabled=OriginTrialsSampleAPI] static boolean staticMethod();
// This attribute uses native code to test whether the trial is enabled,
// and throws an exception in JavaScript if it is not.
[CallWith=ScriptState, RaisesException] readonly attribute boolean throwingAttribute;
// This method returns a dictionary, to allow inspection of trial-controlled
// members.
OriginTrialsTestDictionary getDictionaryMethod();
// This method takes a dictionary as input, to test if trial-controlled
// members are accessed.
void checkDictionaryMethod(OriginTrialsTestDictionary dict);
// These are available whether or not the trial is enabled.
readonly attribute boolean unconditionalAttribute;
static readonly attribute boolean staticUnconditionalAttribute;
boolean unconditionalMethod();
void unconditionalDictionaryMethod(OriginTrialsTestDictionary dict);
static boolean staticUnconditionalMethod();
// These are available whether or not the trial is enabled, but only in a
// secure context.
[SecureContext] readonly attribute boolean secureUnconditionalAttribute;
// TODO(chasej): Add [SecureContext] when that attribute is fixed to work on
// static attributes. That problem is not related to [RuntimeEnabled].
static readonly attribute boolean secureStaticUnconditionalAttribute;
[SecureContext] boolean secureUnconditionalMethod();
[SecureContext] static boolean secureStaticUnconditionalMethod();
// These are only available if the trial is enabled, as well as in secure
// context.
[SecureContext, RuntimeEnabled=OriginTrialsSampleAPI] readonly attribute boolean secureAttribute;
[SecureContext, RuntimeEnabled=OriginTrialsSampleAPI] static readonly attribute boolean secureStaticAttribute;
[SecureContext, RuntimeEnabled=OriginTrialsSampleAPI] boolean secureMethod();
[SecureContext, RuntimeEnabled=OriginTrialsSampleAPI] static boolean secureStaticMethod();
// These are available if the associated deprecation trial is available,
// even for insecure contexts.
[RuntimeEnabled=OriginTrialsSampleAPIDeprecation] readonly attribute boolean deprecationAttribute;
// These are available if the specified trial is available, and also if the
// implied by trial is enabled.
[RuntimeEnabled=OriginTrialsSampleAPIImplied] readonly attribute boolean impliedAttribute;
// These are not available even with the token present.
[RuntimeEnabled=OriginTrialsSampleAPIInvalidOS] readonly attribute boolean invalidOSAttribute;
// These are available if the associated navigation trial is available.
[RuntimeEnabled=OriginTrialsSampleAPINavigation] boolean navigationMethod();
// These are available if the associated third-party trial is available.
[RuntimeEnabled=OriginTrialsSampleAPIThirdParty] readonly attribute boolean thirdPartyAttribute;
};