Restriction.java revision 1e9bf3e0803691d0a228da41fc608347b6db4340
1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package org.chromium.base.test.util;
6
7import java.lang.annotation.ElementType;
8import java.lang.annotation.Retention;
9import java.lang.annotation.RetentionPolicy;
10import java.lang.annotation.Target;
11
12/**
13 * An annotation for listing restrictions for a test method. For example, if a test method is only
14 * applicable on a phone with small memory:
15 *     @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_SMALL_MEMORY})
16 * Test classes are free to define restrictions and enforce them using reflection at runtime.
17 */
18@Target(ElementType.METHOD)
19@Retention(RetentionPolicy.RUNTIME)
20public @interface Restriction {
21    /** Specifies the test is only valid on phone form factors. */
22    public static final String RESTRICTION_TYPE_PHONE = "Phone";
23
24    /** Specifies the test is only valid on tablet form factors. */
25    public static final String RESTRICTION_TYPE_TABLET = "Tablet";
26
27    /** Specifies the test is only valid on devices with a small amount of memory. */
28    public static final String RESTRICTION_TYPE_SMALL_MEMORY = "Small_Memory";
29
30    /**
31     * @return A list of restrictions.
32     */
33    public String[] value();
34}