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

Side by Side Diff: net/url_request/url_fetcher_response_writer_unittest.cc

Issue 2319513003: //[chrome/browser/]net: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased 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 "net/url_request/url_fetcher_response_writer.h" 5 #include "net/url_request/url_fetcher_response_writer.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Initialize() again to reset. 53 // Initialize() again to reset.
54 rv = writer_->Initialize(callback.callback()); 54 rv = writer_->Initialize(callback.callback());
55 EXPECT_THAT(callback.GetResult(rv), IsOk()); 55 EXPECT_THAT(callback.GetResult(rv), IsOk());
56 EXPECT_TRUE(writer_->data().empty()); 56 EXPECT_TRUE(writer_->data().empty());
57 } 57 }
58 58
59 class URLFetcherFileWriterTest : public PlatformTest { 59 class URLFetcherFileWriterTest : public PlatformTest {
60 protected: 60 protected:
61 void SetUp() override { 61 void SetUp() override {
62 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 62 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
63 file_path_ = temp_dir_.path().AppendASCII("test.txt"); 63 file_path_ = temp_dir_.GetPath().AppendASCII("test.txt");
64 writer_.reset(new URLFetcherFileWriter(base::ThreadTaskRunnerHandle::Get(), 64 writer_.reset(new URLFetcherFileWriter(base::ThreadTaskRunnerHandle::Get(),
65 file_path_)); 65 file_path_));
66 buf_ = new StringIOBuffer(kData); 66 buf_ = new StringIOBuffer(kData);
67 } 67 }
68 68
69 base::ScopedTempDir temp_dir_; 69 base::ScopedTempDir temp_dir_;
70 base::FilePath file_path_; 70 base::FilePath file_path_;
71 std::unique_ptr<URLFetcherFileWriter> writer_; 71 std::unique_ptr<URLFetcherFileWriter> writer_;
72 scoped_refptr<StringIOBuffer> buf_; 72 scoped_refptr<StringIOBuffer> buf_;
73 }; 73 };
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 EXPECT_EQ(kData, file_contents); 175 EXPECT_EQ(kData, file_contents);
176 176
177 // Destroy the writer. File should be deleted. 177 // Destroy the writer. File should be deleted.
178 const base::FilePath file_path = writer_->file_path(); 178 const base::FilePath file_path = writer_->file_path();
179 writer_.reset(); 179 writer_.reset();
180 base::RunLoop().RunUntilIdle(); 180 base::RunLoop().RunUntilIdle();
181 EXPECT_FALSE(base::PathExists(file_path)); 181 EXPECT_FALSE(base::PathExists(file_path));
182 } 182 }
183 183
184 } // namespace net 184 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher_impl_unittest.cc ('k') | net/url_request/url_request_file_dir_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698