xref: /aosp_15_r20/external/cronet/base/test/android/url_utils.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #include "base/test/android/url_utils.h"
6 
7 #include "base/android/jni_string.h"
8 #include "base/android/scoped_java_ref.h"
9 #include "base/test/test_support_jni_headers/UrlUtils_jni.h"
10 
11 namespace base {
12 namespace android {
13 
GetIsolatedTestRoot()14 FilePath GetIsolatedTestRoot() {
15   JNIEnv* env = jni_zero::AttachCurrentThread();
16   ScopedJavaLocalRef<jstring> jtest_data_dir =
17       Java_UrlUtils_getIsolatedTestRoot(env);
18   base::FilePath test_data_dir(
19       base::android::ConvertJavaStringToUTF8(env, jtest_data_dir));
20   return test_data_dir;
21 }
22 
23 }  // namespace android
24 }  // namespace base
25