Index: testing/android/junit/java/src/org/chromium/testing/local/TestDir.java |
diff --git a/testing/android/junit/java/src/org/chromium/testing/local/TestDir.java b/testing/android/junit/java/src/org/chromium/testing/local/TestDir.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04ae55537f30c665a441e323d4009d53daab6433 |
--- /dev/null |
+++ b/testing/android/junit/java/src/org/chromium/testing/local/TestDir.java |
@@ -0,0 +1,26 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.testing.local; |
+ |
+import java.io.File; |
+ |
+/** |
+ * Tools to get the junit test path. |
+ */ |
+public class TestDir { |
+ private static final String TEST_FOLDER = "/chrome/test/data/"; |
+ |
+ /** |
+ * Construct the full path of a test data file. |
+ * @param path Pathname relative to chrome/test/data. |
+ */ |
+ public static String getTestFilePath(String path) { |
+ String junitRoot = System.getProperty("dir.source.root"); |
+ if (junitRoot == null) { |
+ junitRoot = ""; |
+ } |
+ return new File(junitRoot + TEST_FOLDER + path).getPath(); |
+ } |
+} |