1 // Copyright 2017 The Chromium Authors 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.testing.local; 6 7 import java.io.File; 8 9 /** Tools to get the junit test path. */ 10 public class TestDir { 11 private static final String TEST_FOLDER = "/chrome/test/data/"; 12 13 /** 14 * Construct the full path of a test data file. 15 * @param path Pathname relative to chrome/test/data. 16 */ getTestFilePath(String path)17 public static String getTestFilePath(String path) { 18 String junitRoot = System.getProperty("dir.source.root"); 19 if (junitRoot == null) { 20 junitRoot = ""; 21 } 22 return new File(junitRoot + TEST_FOLDER + path).getPath(); 23 } 24 } 25