From 6e5b7a69a33b5364bffa55c76a08ab6fe3ee59bb Mon Sep 17 00:00:00 2001 From: agrieve Date: Fri, 17 Jul 2015 07:18:03 -0700 Subject: Fix base/android/path_utils_unittest.cc when running on an M device BUG= Review URL: https://codereview.chromium.org/1238123002 Cr-Commit-Position: refs/heads/master@{#339247} --- base/android/path_utils_unittest.cc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'base') diff --git a/base/android/path_utils_unittest.cc b/base/android/path_utils_unittest.cc index c678ce2..d991810 100644 --- a/base/android/path_utils_unittest.cc +++ b/base/android/path_utils_unittest.cc @@ -5,6 +5,7 @@ #include "base/android/path_utils.h" #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/strings/string_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -13,14 +14,27 @@ namespace android { typedef testing::Test PathUtilsTest; +namespace { +void ExpectEither(const std::string& expected1, + const std::string& expected2, + const std::string& actual) { + EXPECT_TRUE(expected1 == actual || expected2 == actual) + << "Value of: " << actual << std::endl + << "Expected either: " << expected1 << std::endl + << "or: " << expected2; +} +} // namespace + TEST_F(PathUtilsTest, TestGetDataDirectory) { // The string comes from the Java side and depends on the APK // we are running in. Assumes that we are packaged in // org.chromium.native_test FilePath path; GetDataDirectory(&path); - EXPECT_STREQ("/data/data/org.chromium.native_test/app_chrome", - path.value().c_str()); + + ExpectEither("/data/data/org.chromium.native_test/app_chrome", + "/data/user/0/org.chromium.native_test/app_chrome", + path.value()); } TEST_F(PathUtilsTest, TestGetCacheDirectory) { @@ -29,8 +43,9 @@ TEST_F(PathUtilsTest, TestGetCacheDirectory) { // org.chromium.native_test FilePath path; GetCacheDirectory(&path); - EXPECT_STREQ("/data/data/org.chromium.native_test/cache", - path.value().c_str()); + ExpectEither("/data/data/org.chromium.native_test/cache", + "/data/user/0/org.chromium.native_test/cache", + path.value()); } TEST_F(PathUtilsTest, TestGetNativeLibraryDirectory) { -- cgit v1.1