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