Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / base / android / path_utils_unittest.cc
blobc678ce21ec8088f657fe4d931e7b8a2dde68dfd2
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/android/path_utils.h"
6 #include "base/files/file_path.h"
7 #include "base/files/file_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace base {
12 namespace android {
14 typedef testing::Test PathUtilsTest;
16 TEST_F(PathUtilsTest, TestGetDataDirectory) {
17 // The string comes from the Java side and depends on the APK
18 // we are running in. Assumes that we are packaged in
19 // org.chromium.native_test
20 FilePath path;
21 GetDataDirectory(&path);
22 EXPECT_STREQ("/data/data/org.chromium.native_test/app_chrome",
23 path.value().c_str());
26 TEST_F(PathUtilsTest, TestGetCacheDirectory) {
27 // The string comes from the Java side and depends on the APK
28 // we are running in. Assumes that we are packaged in
29 // org.chromium.native_test
30 FilePath path;
31 GetCacheDirectory(&path);
32 EXPECT_STREQ("/data/data/org.chromium.native_test/cache",
33 path.value().c_str());
36 TEST_F(PathUtilsTest, TestGetNativeLibraryDirectory) {
37 // The string comes from the Java side and depends on the APK
38 // we are running in. Assumes that the directory contains
39 // the base tests shared object.
40 FilePath path;
41 GetNativeLibraryDirectory(&path);
42 EXPECT_TRUE(base::PathExists(path.Append(("libbase_unittests.so"))) ||
43 base::PathExists(path.Append(("libbase_unittests.cr.so"))));
46 } // namespace android
47 } // namespace base