nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "base/android/path_utils.h" |
brettw@chromium.org | 59eef1f | 2013-02-24 14:40:52 +0900 | [diff] [blame] | 6 | #include "base/files/file_path.h" |
brettw@chromium.org | 01f3da4 | 2014-08-14 05:22:14 +0900 | [diff] [blame^] | 7 | #include "base/files/file_util.h" |
nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 8 | |
| 9 | #include "testing/gtest/include/gtest/gtest.h" |
| 10 | |
| 11 | namespace base { |
| 12 | namespace android { |
| 13 | |
| 14 | typedef testing::Test PathUtilsTest; |
| 15 | |
| 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 |
aurimas@chromium.org | e91c48c | 2012-10-03 07:03:33 +0900 | [diff] [blame] | 20 | FilePath path; |
| 21 | GetDataDirectory(&path); |
nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 22 | EXPECT_STREQ("/data/data/org.chromium.native_test/app_chrome", |
aurimas@chromium.org | e91c48c | 2012-10-03 07:03:33 +0900 | [diff] [blame] | 23 | path.value().c_str()); |
nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 24 | } |
| 25 | |
| 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 |
aurimas@chromium.org | e91c48c | 2012-10-03 07:03:33 +0900 | [diff] [blame] | 30 | FilePath path; |
| 31 | GetCacheDirectory(&path); |
nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 32 | EXPECT_STREQ("/data/data/org.chromium.native_test/cache", |
aurimas@chromium.org | e91c48c | 2012-10-03 07:03:33 +0900 | [diff] [blame] | 33 | path.value().c_str()); |
nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 34 | } |
| 35 | |
aurimas@chromium.org | 59cc7cf | 2012-07-03 05:04:04 +0900 | [diff] [blame] | 36 | TEST_F(PathUtilsTest, TestGetNativeLibraryDirectory) { |
| 37 | // The string comes from the Java side and depends on the APK |
jknotten@chromium.org | d8e1523 | 2012-11-21 23:16:01 +0900 | [diff] [blame] | 38 | // we are running in. Assumes that the directory contains |
| 39 | // the base tests shared object. |
aurimas@chromium.org | e91c48c | 2012-10-03 07:03:33 +0900 | [diff] [blame] | 40 | FilePath path; |
| 41 | GetNativeLibraryDirectory(&path); |
eugenis@chromium.org | 3452ee3 | 2014-02-20 05:22:34 +0900 | [diff] [blame] | 42 | EXPECT_TRUE(base::PathExists(path.Append(("libbase_unittests.so"))) || |
| 43 | base::PathExists(path.Append(("libbase_unittests.cr.so")))); |
aurimas@chromium.org | 59cc7cf | 2012-07-03 05:04:04 +0900 | [diff] [blame] | 44 | } |
| 45 | |
nileshagrawal@chromium.org | 77ab0bc | 2012-04-27 05:19:47 +0900 | [diff] [blame] | 46 | } // namespace android |
| 47 | } // namespace base |