Restriction.java revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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 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 low end devices that have less memory. */ 28 public static final String RESTRICTION_TYPE_LOW_END_DEVICE = "Low_End_Device"; 29 30 /** Specifies the test is only valid on non-low end devices. */ 31 public static final String RESTRICTION_TYPE_NON_LOW_END_DEVICE = "Non_Low_End_Device"; 32 33 /** 34 * @return A list of restrictions. 35 */ 36 public String[] value(); 37}