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

Side by Side Diff: net/base/upload_file_element_reader_unittest.cc

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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 (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 "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/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_EQ(bytes_.size() - buf2.size(), reader_->BytesRemaining()); 171 EXPECT_EQ(bytes_.size() - buf2.size(), reader_->BytesRemaining());
172 EXPECT_EQ(std::vector<char>(bytes_.begin(), bytes_.begin() + buf2.size()), 172 EXPECT_EQ(std::vector<char>(bytes_.begin(), bytes_.begin() + buf2.size()),
173 buf2); 173 buf2);
174 174
175 // Make sure callbacks are not called for cancelled operations. 175 // Make sure callbacks are not called for cancelled operations.
176 EXPECT_FALSE(read_callback1.have_result()); 176 EXPECT_FALSE(read_callback1.have_result());
177 EXPECT_FALSE(init_callback1.have_result()); 177 EXPECT_FALSE(init_callback1.have_result());
178 } 178 }
179 179
180 TEST_F(UploadFileElementReaderTest, Range) { 180 TEST_F(UploadFileElementReaderTest, Range) {
181 const uint64 kOffset = 2; 181 const uint64_t kOffset = 2;
182 const uint64 kLength = bytes_.size() - kOffset * 3; 182 const uint64_t kLength = bytes_.size() - kOffset * 3;
183 reader_.reset( 183 reader_.reset(
184 new UploadFileElementReader(base::MessageLoopProxy::current().get(), 184 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
185 temp_file_path_, 185 temp_file_path_,
186 kOffset, 186 kOffset,
187 kLength, 187 kLength,
188 base::Time())); 188 base::Time()));
189 TestCompletionCallback init_callback; 189 TestCompletionCallback init_callback;
190 ASSERT_EQ(ERR_IO_PENDING, reader_->Init(init_callback.callback())); 190 ASSERT_EQ(ERR_IO_PENDING, reader_->Init(init_callback.callback()));
191 EXPECT_EQ(OK, init_callback.WaitForResult()); 191 EXPECT_EQ(OK, init_callback.WaitForResult());
192 EXPECT_EQ(kLength, reader_->GetContentLength()); 192 EXPECT_EQ(kLength, reader_->GetContentLength());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 const base::FilePath wrong_path(FILE_PATH_LITERAL("wrong_path")); 236 const base::FilePath wrong_path(FILE_PATH_LITERAL("wrong_path"));
237 reader_.reset( 237 reader_.reset(
238 new UploadFileElementReader(base::MessageLoopProxy::current().get(), 238 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
239 wrong_path, 0, kuint64max, base::Time())); 239 wrong_path, 0, kuint64max, base::Time()));
240 TestCompletionCallback init_callback; 240 TestCompletionCallback init_callback;
241 ASSERT_EQ(ERR_IO_PENDING, reader_->Init(init_callback.callback())); 241 ASSERT_EQ(ERR_IO_PENDING, reader_->Init(init_callback.callback()));
242 EXPECT_EQ(ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); 242 EXPECT_EQ(ERR_FILE_NOT_FOUND, init_callback.WaitForResult());
243 } 243 }
244 244
245 } // namespace net 245 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698