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

Side by Side Diff: webrtc/base/file_unittest.cc

Issue 2533213005: Add File::Open / Create functions to take an rtc::Pathname (Closed)
Patch Set: Resolve review comments Created 4 years 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/base/file.cc ('k') | webrtc/base/fileutils.h » ('j') | 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 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 EXPECT_EQ(4u, file.WriteAt(data, 4, 4)); 157 EXPECT_EQ(4u, file.WriteAt(data, 4, 4));
158 EXPECT_EQ(4u, file.ReadAt(out, 4, 4)); 158 EXPECT_EQ(4u, file.ReadAt(out, 4, 4));
159 EXPECT_TRUE(VerifyBuffer(out, 4, 0)); 159 EXPECT_TRUE(VerifyBuffer(out, 4, 0));
160 160
161 EXPECT_EQ(2u, file.WriteAt(data, 2, 8)); 161 EXPECT_EQ(2u, file.WriteAt(data, 2, 8));
162 EXPECT_EQ(2u, file.ReadAt(out, 2, 8)); 162 EXPECT_EQ(2u, file.ReadAt(out, 2, 8));
163 EXPECT_TRUE(VerifyBuffer(out, 2, 0)); 163 EXPECT_TRUE(VerifyBuffer(out, 2, 0));
164 } 164 }
165 165
166 TEST_F(FileTest, OpenFromPathname) {
167 {
168 File file = File::Open(Pathname(path_));
169 ASSERT_TRUE(file.IsOpen()) << "Error: " << LastError();
170 }
171
172 {
173 Pathname path(path_);
174 File file = File::Open(path);
175 ASSERT_TRUE(file.IsOpen()) << "Error: " << LastError();
176 }
177 }
178
179 TEST_F(FileTest, CreateFromPathname) {
180 {
181 File file = File::Create(Pathname(path_));
182 ASSERT_TRUE(file.IsOpen()) << "Error: " << LastError();
183 }
184
185 {
186 Pathname path(path_);
187 File file = File::Create(path);
188 ASSERT_TRUE(file.IsOpen()) << "Error: " << LastError();
189 }
190 }
191
166 } // namespace rtc 192 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/file.cc ('k') | webrtc/base/fileutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698