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

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

Issue 8351052: Created a DownloadManager interface, for use in unit tests.. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Mac & Clang issues. Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "content/browser/download/download_create_info.h" 8 #include "content/browser/download/download_create_info.h"
9 #include "content/browser/download/download_file.h" 9 #include "content/browser/download/download_file.h"
10 #include "content/browser/download/download_id.h" 10 #include "content/browser/download/download_id.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 EXPECT_TRUE((*file)->in_progress()); 95 EXPECT_TRUE((*file)->in_progress());
96 (*file)->AppendDataToFile(data.data(), data.size()); 96 (*file)->AppendDataToFile(data.data(), data.size());
97 expected_data_ += data; 97 expected_data_ += data;
98 EXPECT_EQ(static_cast<int64>(expected_data_.size()), 98 EXPECT_EQ(static_cast<int64>(expected_data_.size()),
99 (*file)->bytes_so_far()); 99 (*file)->bytes_so_far());
100 } 100 }
101 101
102 protected: 102 protected:
103 DownloadStatusUpdater download_status_updater_; 103 DownloadStatusUpdater download_status_updater_;
104 scoped_ptr<MockDownloadManagerDelegate> download_manager_delegate_; 104 scoped_ptr<MockDownloadManagerDelegate> download_manager_delegate_;
105 scoped_refptr<DownloadManager> download_manager_; 105 scoped_refptr<DownloadManagerInterface> download_manager_;
106 106
107 linked_ptr<net::FileStream> file_stream_; 107 linked_ptr<net::FileStream> file_stream_;
108 108
109 // DownloadFile instance we are testing. 109 // DownloadFile instance we are testing.
110 scoped_ptr<DownloadFile> download_file_; 110 scoped_ptr<DownloadFile> download_file_;
111 111
112 private: 112 private:
113 MessageLoop loop_; 113 MessageLoop loop_;
114 scoped_refptr<DownloadIdFactory> id_factory_; 114 scoped_refptr<DownloadIdFactory> id_factory_;
115 // UI thread. 115 // UI thread.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Check the files. 191 // Check the files.
192 EXPECT_FALSE(file_util::PathExists(path_3)); 192 EXPECT_FALSE(file_util::PathExists(path_3));
193 EXPECT_TRUE(file_util::PathExists(path_4)); 193 EXPECT_TRUE(file_util::PathExists(path_4));
194 194
195 // Check the hash. 195 // Check the hash.
196 EXPECT_TRUE(download_file_->GetSha256Hash(&hash)); 196 EXPECT_TRUE(download_file_->GetSha256Hash(&hash));
197 EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size())); 197 EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size()));
198 198
199 DestroyDownloadFile(&download_file_, 0); 199 DestroyDownloadFile(&download_file_, 0);
200 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698