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

Side by Side Diff: net/base/upload_file_element_reader_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
« no previous file with comments | « net/base/elements_upload_data_stream_unittest.cc ('k') | net/disk_cache/backend_unittest.cc » ('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 "net/base/upload_file_element_reader.h" 5 #include "net/base/upload_file_element_reader.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 17 matching lines...) Expand all
28 class UploadFileElementReaderTest : public PlatformTest { 28 class UploadFileElementReaderTest : public PlatformTest {
29 protected: 29 protected:
30 void SetUp() override { 30 void SetUp() override {
31 PlatformTest::SetUp(); 31 PlatformTest::SetUp();
32 // Some tests (*.ReadPartially) rely on bytes_.size() being even. 32 // Some tests (*.ReadPartially) rely on bytes_.size() being even.
33 const char kData[] = "123456789abcdefghi"; 33 const char kData[] = "123456789abcdefghi";
34 bytes_.assign(kData, kData + arraysize(kData) - 1); 34 bytes_.assign(kData, kData + arraysize(kData) - 1);
35 35
36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
37 37
38 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), 38 ASSERT_TRUE(
39 &temp_file_path_)); 39 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &temp_file_path_));
40 ASSERT_EQ( 40 ASSERT_EQ(
41 static_cast<int>(bytes_.size()), 41 static_cast<int>(bytes_.size()),
42 base::WriteFile(temp_file_path_, &bytes_[0], bytes_.size())); 42 base::WriteFile(temp_file_path_, &bytes_[0], bytes_.size()));
43 43
44 reader_.reset(new UploadFileElementReader( 44 reader_.reset(new UploadFileElementReader(
45 base::ThreadTaskRunnerHandle::Get().get(), temp_file_path_, 0, 45 base::ThreadTaskRunnerHandle::Get().get(), temp_file_path_, 0,
46 std::numeric_limits<uint64_t>::max(), base::Time())); 46 std::numeric_limits<uint64_t>::max(), base::Time()));
47 TestCompletionCallback callback; 47 TestCompletionCallback callback;
48 ASSERT_THAT(reader_->Init(callback.callback()), IsError(ERR_IO_PENDING)); 48 ASSERT_THAT(reader_->Init(callback.callback()), IsError(ERR_IO_PENDING));
49 EXPECT_THAT(callback.WaitForResult(), IsOk()); 49 EXPECT_THAT(callback.WaitForResult(), IsOk());
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const base::FilePath wrong_path(FILE_PATH_LITERAL("wrong_path")); 241 const base::FilePath wrong_path(FILE_PATH_LITERAL("wrong_path"));
242 reader_.reset(new UploadFileElementReader( 242 reader_.reset(new UploadFileElementReader(
243 base::ThreadTaskRunnerHandle::Get().get(), wrong_path, 0, 243 base::ThreadTaskRunnerHandle::Get().get(), wrong_path, 0,
244 std::numeric_limits<uint64_t>::max(), base::Time())); 244 std::numeric_limits<uint64_t>::max(), base::Time()));
245 TestCompletionCallback init_callback; 245 TestCompletionCallback init_callback;
246 ASSERT_THAT(reader_->Init(init_callback.callback()), IsError(ERR_IO_PENDING)); 246 ASSERT_THAT(reader_->Init(init_callback.callback()), IsError(ERR_IO_PENDING));
247 EXPECT_THAT(init_callback.WaitForResult(), IsError(ERR_FILE_NOT_FOUND)); 247 EXPECT_THAT(init_callback.WaitForResult(), IsError(ERR_FILE_NOT_FOUND));
248 } 248 }
249 249
250 } // namespace net 250 } // namespace net
OLDNEW
« no previous file with comments | « net/base/elements_upload_data_stream_unittest.cc ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698