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

Side by Side Diff: webrtc/test/testsupport/fileutils_unittest.cc

Issue 2749163003: FileUtilsTest DirExists function added (Closed)
Patch Set: OS-generic test Created 3 years, 9 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
« no previous file with comments | « webrtc/test/testsupport/fileutils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 "Failed to write to file: " << temp_filename; 143 "Failed to write to file: " << temp_filename;
144 fclose(file); 144 fclose(file);
145 ASSERT_GT(webrtc::test::GetFileSize(std::string(temp_filename.c_str())), 0u); 145 ASSERT_GT(webrtc::test::GetFileSize(std::string(temp_filename.c_str())), 0u);
146 remove(temp_filename.c_str()); 146 remove(temp_filename.c_str());
147 } 147 }
148 148
149 TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) { 149 TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) {
150 ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp")); 150 ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp"));
151 } 151 }
152 152
153 TEST_F(FileUtilsTest, DirExists) {
154 // Check that an existing directory is recognized as such.
155 ASSERT_TRUE(webrtc::test::DirExists(webrtc::test::OutputPath()))
156 << "Existing directory not found";
157
158 // Check that a non-existing directory is recognized as such.
159 std::string directory = "direxists-unittest-non_existing-dir";
160 ASSERT_FALSE(webrtc::test::DirExists(directory))
161 << "Non-existing directory found";
162
163 // Check that an existing file is not recognized as an existing directory.
164 std::string temp_filename = webrtc::test::TempFilename(
165 webrtc::test::OutputPath(), "TempFilenameTest");
166 ASSERT_TRUE(webrtc::test::FileExists(temp_filename))
167 << "Couldn't find file: " << temp_filename;
168 ASSERT_FALSE(webrtc::test::DirExists(temp_filename))
169 << "Existing file recognized as existing directory";
170 remove(temp_filename.c_str());
171 }
172
153 } // namespace webrtc 173 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/testsupport/fileutils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698