• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Révision89b97677765cdc8d99319d85619f551ed5107d25 (tree)
l'heure2016-08-04 07:14:59
AuteurJosh Gao <jmgao@goog...>
CommiterJosh Gao

Message de Log

adb: extract Windows bits out of directory_exists test.

Bug: http://b/30481559
Bug: https://code.google.com/p/android/issues/detail?id=214633
Change-Id: I8f20b3cd5aef6a77c2b4f194b914b4295397d73f
(cherry picked from commit 3bdc76025b9b1a8416f00b5f1b57a51c6c9c604d)

Change Summary

Modification

--- a/adb/adb_utils_test.cpp
+++ b/adb/adb_utils_test.cpp
@@ -52,25 +52,35 @@ TEST(adb_utils, directory_exists) {
5252
5353 ASSERT_TRUE(directory_exists(profiles_dir));
5454
55+ ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist")));
56+#else
57+ ASSERT_TRUE(directory_exists("/proc"));
58+ ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link.
59+ ASSERT_FALSE(directory_exists("/proc/does-not-exist"));
60+#endif
61+}
62+
63+#if defined(_WIN32)
64+TEST(adb_utils, directory_exists_win32_symlink_junction) {
65+ char profiles_dir[MAX_PATH];
66+ DWORD cch = arraysize(profiles_dir);
67+
68+ // On typical Windows 7, returns C:\Users
69+ ASSERT_TRUE(GetProfilesDirectoryA(profiles_dir, &cch));
70+
5571 // On modern (English?) Windows, this is a directory symbolic link to
5672 // C:\ProgramData. Symbolic links are rare on Windows and the user requires
5773 // a special permission (by default granted to Administrative users) to
5874 // create symbolic links.
59- ASSERT_FALSE(directory_exists(subdir(profiles_dir, "All Users")));
75+ EXPECT_FALSE(directory_exists(subdir(profiles_dir, "All Users")));
6076
6177 // On modern (English?) Windows, this is a directory junction to
6278 // C:\Users\Default. Junctions are used throughout user profile directories
6379 // for backwards compatibility and they don't require any special permissions
6480 // to create.
65- ASSERT_FALSE(directory_exists(subdir(profiles_dir, "Default User")));
66-
67- ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist")));
68-#else
69- ASSERT_TRUE(directory_exists("/proc"));
70- ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link.
71- ASSERT_FALSE(directory_exists("/proc/does-not-exist"));
72-#endif
81+ EXPECT_FALSE(directory_exists(subdir(profiles_dir, "Default User")));
7382 }
83+#endif
7484
7585 TEST(adb_utils, escape_arg) {
7686 ASSERT_EQ(R"('')", escape_arg(""));