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

Side by Side Diff: base/files/important_file_writer_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: Comments 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 | « base/files/file_util_unittest.cc ('k') | base/files/scoped_temp_dir.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 // 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 "base/files/important_file_writer.h" 5 #include "base/files/important_file_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return was_successful_write_observed; 81 return was_successful_write_observed;
82 } 82 }
83 83
84 } // namespace 84 } // namespace
85 85
86 class ImportantFileWriterTest : public testing::Test { 86 class ImportantFileWriterTest : public testing::Test {
87 public: 87 public:
88 ImportantFileWriterTest() { } 88 ImportantFileWriterTest() { }
89 void SetUp() override { 89 void SetUp() override {
90 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 90 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
91 file_ = temp_dir_.path().AppendASCII("test-file"); 91 file_ = temp_dir_.GetPath().AppendASCII("test-file");
92 } 92 }
93 93
94 protected: 94 protected:
95 SuccessfulWriteObserver successful_write_observer_; 95 SuccessfulWriteObserver successful_write_observer_;
96 FilePath file_; 96 FilePath file_;
97 MessageLoop loop_; 97 MessageLoop loop_;
98 98
99 private: 99 private:
100 ScopedTempDir temp_dir_; 100 ScopedTempDir temp_dir_;
101 }; 101 };
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 writer.ScheduleWrite(&baz); 189 writer.ScheduleWrite(&baz);
190 ThreadTaskRunnerHandle::Get()->PostDelayedTask( 190 ThreadTaskRunnerHandle::Get()->PostDelayedTask(
191 FROM_HERE, MessageLoop::QuitWhenIdleClosure(), 191 FROM_HERE, MessageLoop::QuitWhenIdleClosure(),
192 TimeDelta::FromMilliseconds(100)); 192 TimeDelta::FromMilliseconds(100));
193 RunLoop().Run(); 193 RunLoop().Run();
194 ASSERT_TRUE(PathExists(writer.path())); 194 ASSERT_TRUE(PathExists(writer.path()));
195 EXPECT_EQ("baz", GetFileContent(writer.path())); 195 EXPECT_EQ("baz", GetFileContent(writer.path()));
196 } 196 }
197 197
198 } // namespace base 198 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_util_unittest.cc ('k') | base/files/scoped_temp_dir.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698