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

Side by Side Diff: chromeos/binder/transaction_data_read_write_unittest.cc

Issue 2318023002: //chrome/browser/chromeos: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Address comment and also remove non-trivial cases Created 4 years, 3 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 | « chromeos/binder/test_service.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <vector> 8 #include <vector>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 static_cast<RemoteObject*>(result.get())->GetHandle()); 277 static_cast<RemoteObject*>(result.get())->GetHandle());
278 278
279 EXPECT_FALSE(reader.HasMoreData()); 279 EXPECT_FALSE(reader.HasMoreData());
280 } 280 }
281 281
282 TEST(BinderTransactionDataReadWriteTest, FileDescriptor) { 282 TEST(BinderTransactionDataReadWriteTest, FileDescriptor) {
283 // Prepare a test file. 283 // Prepare a test file.
284 base::ScopedTempDir temp_dir; 284 base::ScopedTempDir temp_dir;
285 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 285 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
286 base::FilePath path; 286 base::FilePath path;
287 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &path)); 287 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.GetPath(), &path));
288 288
289 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); 289 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
290 ASSERT_TRUE(file.IsValid()); 290 ASSERT_TRUE(file.IsValid());
291 291
292 base::ScopedFD scoped_fd(file.TakePlatformFile()); 292 base::ScopedFD scoped_fd(file.TakePlatformFile());
293 int kFdValue = scoped_fd.get(); 293 int kFdValue = scoped_fd.get();
294 294
295 // Write the file descriptor. 295 // Write the file descriptor.
296 WritableTransactionData data; 296 WritableTransactionData data;
297 data.WriteFileDescriptor(std::move(scoped_fd)); 297 data.WriteFileDescriptor(std::move(scoped_fd));
(...skipping 11 matching lines...) Expand all
309 EXPECT_EQ(kFdValue, result.handle); 309 EXPECT_EQ(kFdValue, result.handle);
310 } 310 }
311 // Read the file descriptor. 311 // Read the file descriptor.
312 TransactionDataReader reader(data); 312 TransactionDataReader reader(data);
313 int result = -1; 313 int result = -1;
314 EXPECT_TRUE(reader.ReadFileDescriptor(&result)); 314 EXPECT_TRUE(reader.ReadFileDescriptor(&result));
315 EXPECT_EQ(kFdValue, result); 315 EXPECT_EQ(kFdValue, result);
316 } 316 }
317 317
318 } // namespace binder 318 } // namespace binder
OLDNEW
« no previous file with comments | « chromeos/binder/test_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698