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

interface OriginTrialsTest {
    [OriginTrialEnabled=OriginTrialsSampleAPI] readonly attribute boolean normalAttribute;
    [OriginTrialEnabled=OriginTrialsSampleAPI] static readonly attribute boolean staticAttribute;
    [OriginTrialEnabled=OriginTrialsSampleAPI] boolean normalMethod();
    [OriginTrialEnabled=OriginTrialsSampleAPI] static boolean staticMethod();
    [OriginTrialEnabled=OriginTrialsSampleAPI] const unsigned short CONSTANT = 1;

    // 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;

    // These are available whether or not the trial is enabled.
    readonly attribute boolean unconditionalAttribute;
    static readonly attribute boolean staticUnconditionalAttribute;
    boolean unconditionalMethod();
    static boolean staticUnconditionalMethod();
    const unsigned short UNCONDITIONAL_CONSTANT = 99;

    // 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 [OriginTrialEnabled].
    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, OriginTrialEnabled=OriginTrialsSampleAPI] readonly attribute boolean secureAttribute;
    [SecureContext, OriginTrialEnabled=OriginTrialsSampleAPI] static readonly attribute boolean secureStaticAttribute;
    [SecureContext, OriginTrialEnabled=OriginTrialsSampleAPI] boolean secureMethod();
    [SecureContext, OriginTrialEnabled=OriginTrialsSampleAPI] static boolean secureStaticMethod();
};
