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

Side by Side Diff: content/browser/download/download_file_unittest.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/test/test_file_util.h" 8 #include "base/test/test_file_util.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/byte_stream.h" 10 #include "content/browser/byte_stream.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 SetArgPointee<1>(length), 188 SetArgPointee<1>(length),
189 Return(ByteStreamReader::STREAM_HAS_DATA))) 189 Return(ByteStreamReader::STREAM_HAS_DATA)))
190 .RetiresOnSaturation(); 190 .RetiresOnSaturation();
191 expected_data_ += source_data; 191 expected_data_ += source_data;
192 } 192 }
193 } 193 }
194 194
195 void VerifyStreamAndSize() { 195 void VerifyStreamAndSize() {
196 ::testing::Mock::VerifyAndClearExpectations(input_stream_); 196 ::testing::Mock::VerifyAndClearExpectations(input_stream_);
197 int64 size; 197 int64 size;
198 EXPECT_TRUE(file_util::GetFileSize(download_file_->FullPath(), &size)); 198 EXPECT_TRUE(base::GetFileSize(download_file_->FullPath(), &size));
199 EXPECT_EQ(expected_data_.size(), static_cast<size_t>(size)); 199 EXPECT_EQ(expected_data_.size(), static_cast<size_t>(size));
200 } 200 }
201 201
202 // TODO(rdsmith): Manage full percentage issues properly. 202 // TODO(rdsmith): Manage full percentage issues properly.
203 void AppendDataToFile(const char **data_chunks, size_t num_chunks) { 203 void AppendDataToFile(const char **data_chunks, size_t num_chunks) {
204 ::testing::Sequence s1; 204 ::testing::Sequence s1;
205 SetupDataAppend(data_chunks, num_chunks, s1); 205 SetupDataAppend(data_chunks, num_chunks, s1);
206 EXPECT_CALL(*input_stream_, Read(_, _)) 206 EXPECT_CALL(*input_stream_, Read(_, _))
207 .InSequence(s1) 207 .InSequence(s1)
208 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) 208 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY))
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 596
597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), 597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)),
598 bytes_); 598 bytes_);
599 EXPECT_EQ(download_file_->GetHashState(), hash_state_); 599 EXPECT_EQ(download_file_->GetHashState(), hash_state_);
600 600
601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); 601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true);
602 DestroyDownloadFile(0); 602 DestroyDownloadFile(0);
603 } 603 }
604 604
605 } // namespace content 605 } // namespace content
OLDNEW
« no previous file with comments | « components/breakpad/browser/crash_dump_manager_android.cc ('k') | content/browser/download/mhtml_generation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698