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

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

Issue 663563002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "base/files/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/test/test_file_util.h" 10 #include "base/test/test_file_util.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 scoped_ptr<TestDownloadFileImpl> download_file_impl( 175 scoped_ptr<TestDownloadFileImpl> download_file_impl(
176 new TestDownloadFileImpl(save_info.Pass(), 176 new TestDownloadFileImpl(save_info.Pass(),
177 base::FilePath(), 177 base::FilePath(),
178 GURL(), // Source 178 GURL(), // Source
179 GURL(), // Referrer 179 GURL(), // Referrer
180 calculate_hash, 180 calculate_hash,
181 scoped_ptr<ByteStreamReader>(input_stream_), 181 scoped_ptr<ByteStreamReader>(input_stream_),
182 net::BoundNetLog(), 182 net::BoundNetLog(),
183 observer_factory_.GetWeakPtr())); 183 observer_factory_.GetWeakPtr()));
184 download_file_impl->SetClientGuid("12345678-ABCD-1234-DCBA-123456789ABC"); 184 download_file_impl->SetClientGuid("12345678-ABCD-1234-DCBA-123456789ABC");
185 download_file_ = download_file_impl.PassAs<DownloadFile>(); 185 download_file_ = download_file_impl.Pass();
186 186
187 EXPECT_CALL(*input_stream_, Read(_, _)) 187 EXPECT_CALL(*input_stream_, Read(_, _))
188 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) 188 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY))
189 .RetiresOnSaturation(); 189 .RetiresOnSaturation();
190 190
191 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this); 191 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this);
192 DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE; 192 DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE;
193 base::RunLoop loop_runner; 193 base::RunLoop loop_runner;
194 download_file_->Initialize(base::Bind( 194 download_file_->Initialize(base::Bind(
195 &DownloadFileTest::SetInterruptReasonCallback, 195 &DownloadFileTest::SetInterruptReasonCallback,
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 785
786 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), 786 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)),
787 bytes_); 787 bytes_);
788 EXPECT_EQ(download_file_->GetHashState(), hash_state_); 788 EXPECT_EQ(download_file_->GetHashState(), hash_state_);
789 789
790 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); 790 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true);
791 DestroyDownloadFile(0); 791 DestroyDownloadFile(0);
792 } 792 }
793 793
794 } // namespace content 794 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698