Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: base/files/file_util_unittest.cc

Issue 2086103002: Add base::ExecutableExistsInPath (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <fstream> 9 #include <fstream>
10 #include <set> 10 #include <set>
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 FileEnumerator f2(subdir_path, true, FileEnumerator::FILES); 831 FileEnumerator f2(subdir_path, true, FileEnumerator::FILES);
832 FindResultCollector c2(&f2); 832 FindResultCollector c2(&f2);
833 EXPECT_TRUE(c2.HasFile(file_name)); 833 EXPECT_TRUE(c2.HasFile(file_name));
834 EXPECT_EQ(1, c2.size()); 834 EXPECT_EQ(1, c2.size());
835 835
836 // Delete the file. 836 // Delete the file.
837 EXPECT_TRUE(DeleteFile(subdir_path, true)); 837 EXPECT_TRUE(DeleteFile(subdir_path, true));
838 EXPECT_FALSE(PathExists(subdir_path)); 838 EXPECT_FALSE(PathExists(subdir_path));
839 } 839 }
840 840
841 TEST_F(FileUtilTest, ExecutableExistsInPath) {
Tom (Use chromium acct) 2016/06/22 16:57:56 Not much to it at this point... Maybe it would be
842 EXPECT_TRUE(ExecutableExistsInPath("sh"));
843 EXPECT_FALSE(ExecutableExistsInPath("foobar"));
844 }
845
841 #endif // defined(OS_POSIX) 846 #endif // defined(OS_POSIX)
842 847
843 #if defined(OS_WIN) 848 #if defined(OS_WIN)
844 // Tests that the Delete function works for wild cards, especially 849 // Tests that the Delete function works for wild cards, especially
845 // with the recursion flag. Also coincidentally tests PathExists. 850 // with the recursion flag. Also coincidentally tests PathExists.
846 // TODO(erikkay): see if anyone's actually using this feature of the API 851 // TODO(erikkay): see if anyone's actually using this feature of the API
847 TEST_F(FileUtilTest, DeleteWildCard) { 852 TEST_F(FileUtilTest, DeleteWildCard) {
848 // Create a file and a directory 853 // Create a file and a directory
849 FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteWildCard.txt")); 854 FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteWildCard.txt"));
850 CreateTextFile(file_name, bogus_content); 855 CreateTextFile(file_name, bogus_content);
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 // Trying to close it should crash. This is important for security. 2583 // Trying to close it should crash. This is important for security.
2579 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); 2584 EXPECT_DEATH(CloseWithScopedFD(fds[1]), "");
2580 #endif 2585 #endif
2581 } 2586 }
2582 2587
2583 #endif // defined(OS_POSIX) 2588 #endif // defined(OS_POSIX)
2584 2589
2585 } // namespace 2590 } // namespace
2586 2591
2587 } // namespace base 2592 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698