Loading adb/adb_utils_test.cpp +19 −9 Original line number Diff line number Diff line Loading @@ -52,25 +52,35 @@ TEST(adb_utils, directory_exists) { ASSERT_TRUE(directory_exists(profiles_dir)); ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist"))); #else ASSERT_TRUE(directory_exists("/proc")); ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link. ASSERT_FALSE(directory_exists("/proc/does-not-exist")); #endif } #if defined(_WIN32) TEST(adb_utils, directory_exists_win32_symlink_junction) { char profiles_dir[MAX_PATH]; DWORD cch = arraysize(profiles_dir); // On typical Windows 7, returns C:\Users ASSERT_TRUE(GetProfilesDirectoryA(profiles_dir, &cch)); // On modern (English?) Windows, this is a directory symbolic link to // C:\ProgramData. Symbolic links are rare on Windows and the user requires // a special permission (by default granted to Administrative users) to // create symbolic links. ASSERT_FALSE(directory_exists(subdir(profiles_dir, "All Users"))); EXPECT_FALSE(directory_exists(subdir(profiles_dir, "All Users"))); // On modern (English?) Windows, this is a directory junction to // C:\Users\Default. Junctions are used throughout user profile directories // for backwards compatibility and they don't require any special permissions // to create. ASSERT_FALSE(directory_exists(subdir(profiles_dir, "Default User"))); ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist"))); #else ASSERT_TRUE(directory_exists("/proc")); ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link. ASSERT_FALSE(directory_exists("/proc/does-not-exist")); #endif EXPECT_FALSE(directory_exists(subdir(profiles_dir, "Default User"))); } #endif TEST(adb_utils, escape_arg) { ASSERT_EQ(R"('')", escape_arg("")); Loading Loading
adb/adb_utils_test.cpp +19 −9 Original line number Diff line number Diff line Loading @@ -52,25 +52,35 @@ TEST(adb_utils, directory_exists) { ASSERT_TRUE(directory_exists(profiles_dir)); ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist"))); #else ASSERT_TRUE(directory_exists("/proc")); ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link. ASSERT_FALSE(directory_exists("/proc/does-not-exist")); #endif } #if defined(_WIN32) TEST(adb_utils, directory_exists_win32_symlink_junction) { char profiles_dir[MAX_PATH]; DWORD cch = arraysize(profiles_dir); // On typical Windows 7, returns C:\Users ASSERT_TRUE(GetProfilesDirectoryA(profiles_dir, &cch)); // On modern (English?) Windows, this is a directory symbolic link to // C:\ProgramData. Symbolic links are rare on Windows and the user requires // a special permission (by default granted to Administrative users) to // create symbolic links. ASSERT_FALSE(directory_exists(subdir(profiles_dir, "All Users"))); EXPECT_FALSE(directory_exists(subdir(profiles_dir, "All Users"))); // On modern (English?) Windows, this is a directory junction to // C:\Users\Default. Junctions are used throughout user profile directories // for backwards compatibility and they don't require any special permissions // to create. ASSERT_FALSE(directory_exists(subdir(profiles_dir, "Default User"))); ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist"))); #else ASSERT_TRUE(directory_exists("/proc")); ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link. ASSERT_FALSE(directory_exists("/proc/does-not-exist")); #endif EXPECT_FALSE(directory_exists(subdir(profiles_dir, "Default User"))); } #endif TEST(adb_utils, escape_arg) { ASSERT_EQ(R"('')", escape_arg("")); Loading