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

Unified Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 10961030: Avoid accessing uninitialized memory during DownloadManagerTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions_mac.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_manager_impl_unittest.cc
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index a5c3025b9bd258c76ea0cc5e97df565054f0dcc4..2f25f3d909b33850f907ee304f621f2bab2a23ed 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -40,8 +40,6 @@
using ::testing::AllOf;
using ::testing::DoAll;
using ::testing::Eq;
-using ::testing::Field;
-using ::testing::Pointee;
using ::testing::Ref;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -59,6 +57,13 @@ class ByteStreamReader;
namespace {
+// Matches a DownloadCreateInfo* that points to the same object as |info| and
+// has a |default_download_directory| that matches |download_directory|.
+MATCHER_P2(DownloadCreateInfoWithDefaultPath, info, download_directory, "") {
+ return arg == info &&
+ arg->default_download_directory == download_directory;
+}
+
class MockDownloadItemImpl : public DownloadItemImpl {
public:
// Use history constructor for minimal base object.
@@ -590,12 +595,11 @@ TEST_F(DownloadManagerTest, StartDownload) {
.WillOnce(Return(true));
EXPECT_CALL(GetMockDownloadManagerDelegate(), GetSaveDir(_,_,_,_))
.WillOnce(SetArgPointee<2>(download_path));
+
// The CreateDownloadFile call should specify a DownloadCreateInfo that
// includes the result of the GetSaveDir() call.
EXPECT_CALL(GetMockDownloadFileManager(), MockCreateDownloadFile(
- AllOf(Eq(info.get()),
- Pointee(Field(&DownloadCreateInfo::default_download_directory,
- download_path))),
+ DownloadCreateInfoWithDefaultPath(info.get(), download_path),
static_cast<content::ByteStreamReader*>(NULL),
download_manager_.get(), true, _, _));
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions_mac.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698