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

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

Issue 2275553005: //base: Make ScopedTempDir::path() a GetPath() with a DCHECK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a hint to the DCHECK 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/files/file_proxy.h" 5 #include "base/files/file_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 proxy->CreateOrOpen( 81 proxy->CreateOrOpen(
82 test_path(), flags, 82 test_path(), flags,
83 Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr())); 83 Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
84 RunLoop().Run(); 84 RunLoop().Run();
85 EXPECT_TRUE(proxy->IsValid()); 85 EXPECT_TRUE(proxy->IsValid());
86 } 86 }
87 87
88 TaskRunner* file_task_runner() const { 88 TaskRunner* file_task_runner() const {
89 return file_thread_.task_runner().get(); 89 return file_thread_.task_runner().get();
90 } 90 }
91 const FilePath& test_dir_path() const { return dir_.path(); } 91 const FilePath& test_dir_path() const { return dir_.GetPath(); }
danakj 2016/09/07 20:47:18 Can you name these not-hacker-case too?
vabr (Chromium) 2016/09/08 07:45:35 Done.
92 const FilePath test_path() const { return dir_.path().AppendASCII("test"); } 92 const FilePath test_path() const {
93 return dir_.GetPath().AppendASCII("test");
94 }
93 95
94 ScopedTempDir dir_; 96 ScopedTempDir dir_;
95 MessageLoopForIO message_loop_; 97 MessageLoopForIO message_loop_;
96 Thread file_thread_; 98 Thread file_thread_;
97 99
98 File::Error error_; 100 File::Error error_;
99 FilePath path_; 101 FilePath path_;
100 File::Info file_info_; 102 File::Info file_info_;
101 std::vector<char> buffer_; 103 std::vector<char> buffer_;
102 int bytes_written_; 104 int bytes_written_;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 char buffer[53]; 393 char buffer[53];
392 EXPECT_EQ(53, base::ReadFile(test_path(), buffer, 53)); 394 EXPECT_EQ(53, base::ReadFile(test_path(), buffer, 53));
393 int i = 0; 395 int i = 0;
394 for (; i < 10; ++i) 396 for (; i < 10; ++i)
395 EXPECT_EQ(kTestData[i], buffer[i]); 397 EXPECT_EQ(kTestData[i], buffer[i]);
396 for (; i < 53; ++i) 398 for (; i < 53; ++i)
397 EXPECT_EQ(0, buffer[i]); 399 EXPECT_EQ(0, buffer[i]);
398 } 400 }
399 401
400 } // namespace base 402 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698