xref: /aosp_15_r20/external/cronet/components/cronet/android/test/src/org/chromium/net/TestFilesInstaller.java (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 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.net;
6 
7 import android.content.Context;
8 
9 import org.chromium.base.test.util.UrlUtils;
10 
11 /** Helper class to install test files. */
12 public final class TestFilesInstaller {
13     // Name of the asset directory in which test files are stored.
14     private static final String TEST_FILE_ASSET_PATH = "components/cronet/testing/test_server/data";
15 
16     /** Installs test files if files have not been installed. */
installIfNeeded(Context context)17     public static void installIfNeeded(Context context) {
18         // Do nothing.
19         // NOTE(pauljensen): This hook is used (overridden) when tests are run in other
20         // configurations, so it should not be removed.
21     }
22 
23     /** Returns the installed path of the test files. */
getInstalledPath(Context context)24     public static String getInstalledPath(Context context) {
25         return UrlUtils.getIsolatedTestRoot() + "/" + TEST_FILE_ASSET_PATH;
26     }
27 }
28