1 // Copyright 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 5 package org.chromium.base.test.util; 6 7 import java.lang.annotation.ElementType; 8 import java.lang.annotation.Retention; 9 import java.lang.annotation.RetentionPolicy; 10 import 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 low-end phone: 15 * <code> 16 * \@Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_LOW_END_DEVICE}) 17 * </code> 18 * See {@link org.chromium.ui.test.util.UiRestriction} for more restriction types. 19 * Test classes are free to define restrictions and enforce them using reflection at runtime. 20 * If the test is temporarily failing in some configurations, use {@link DisableIf} instead. 21 */ 22 @Target({ElementType.METHOD, ElementType.TYPE}) 23 @Retention(RetentionPolicy.RUNTIME) 24 public @interface Restriction { 25 /** Specifies the test is only valid on low end devices that have less memory. */ 26 public static final String RESTRICTION_TYPE_LOW_END_DEVICE = "Low_End_Device"; 27 28 /** Specifies the test is only valid on non-low end devices. */ 29 public static final String RESTRICTION_TYPE_NON_LOW_END_DEVICE = "Non_Low_End_Device"; 30 31 /** Specifies the test is only valid on a device that can reach the internet. */ 32 public static final String RESTRICTION_TYPE_INTERNET = "Internet"; 33 34 /** Specifies the test is only valid on a device that has a camera. */ 35 public static final String RESTRICTION_TYPE_HAS_CAMERA = "Has_Camera"; 36 37 /** 38 * @return A list of restrictions. 39 */ value()40 public String[] value(); 41 } 42