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

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

Issue 16703020: Rewrite scoped_ptr<T>(NULL) to use the default ctor in content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up insanity Created 7 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 | 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.h" 6 #include "base/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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 input_stream_ = new StrictMock<MockByteStreamReader>(); 124 input_stream_ = new StrictMock<MockByteStreamReader>();
125 125
126 // TODO: Need to actually create a function that'll set the variables 126 // TODO: Need to actually create a function that'll set the variables
127 // based on the inputs from the callback. 127 // based on the inputs from the callback.
128 EXPECT_CALL(*input_stream_, RegisterCallback(_)) 128 EXPECT_CALL(*input_stream_, RegisterCallback(_))
129 .WillOnce(Invoke(this, &DownloadFileTest::RegisterCallback)) 129 .WillOnce(Invoke(this, &DownloadFileTest::RegisterCallback))
130 .RetiresOnSaturation(); 130 .RetiresOnSaturation();
131 131
132 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); 132 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
133 download_file_.reset( 133 download_file_.reset(
134 new DownloadFileImpl( 134 new DownloadFileImpl(save_info.Pass(),
135 save_info.Pass(), 135 base::FilePath(),
136 base::FilePath(), 136 GURL(), // Source
137 GURL(), // Source 137 GURL(), // Referrer
138 GURL(), // Referrer 138 calculate_hash,
139 calculate_hash, 139 scoped_ptr<ByteStreamReader>(input_stream_),
140 scoped_ptr<ByteStreamReader>(input_stream_), 140 net::BoundNetLog(),
141 net::BoundNetLog(), 141 scoped_ptr<PowerSaveBlocker>().Pass(),
142 scoped_ptr<PowerSaveBlocker>(NULL).Pass(), 142 observer_factory_.GetWeakPtr()));
143 observer_factory_.GetWeakPtr()));
144 143
145 EXPECT_CALL(*input_stream_, Read(_, _)) 144 EXPECT_CALL(*input_stream_, Read(_, _))
146 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) 145 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY))
147 .RetiresOnSaturation(); 146 .RetiresOnSaturation();
148 147
149 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this); 148 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this);
150 bool called = false; 149 bool called = false;
151 DownloadInterruptReason result; 150 DownloadInterruptReason result;
152 download_file_->Initialize(base::Bind( 151 download_file_->Initialize(base::Bind(
153 &DownloadFileTest::SetInterruptReasonCallback, 152 &DownloadFileTest::SetInterruptReasonCallback,
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 596
598 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), 597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)),
599 bytes_); 598 bytes_);
600 EXPECT_EQ(download_file_->GetHashState(), hash_state_); 599 EXPECT_EQ(download_file_->GetHashState(), hash_state_);
601 600
602 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); 601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true);
603 DestroyDownloadFile(0); 602 DestroyDownloadFile(0);
604 } 603 }
605 604
606 } // namespace content 605 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_protocol.cc ('k') | content/browser/download/drag_download_file_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698