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

Side by Side Diff: chrome/browser/download/save_page_browsertest.cc

Issue 11363222: Persist download interrupt reason, both target and current paths, and url_chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to r180302 Created 7 years, 10 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/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool DownloadStoredProperly( 143 bool DownloadStoredProperly(
144 const GURL& expected_url, 144 const GURL& expected_url,
145 const FilePath& expected_path, 145 const FilePath& expected_path,
146 int64 num_files, 146 int64 num_files,
147 DownloadItem::DownloadState expected_state, 147 DownloadItem::DownloadState expected_state,
148 DownloadItem* item, 148 DownloadItem* item,
149 const history::DownloadRow& info) { 149 const history::DownloadRow& info) {
150 // This function may be called multiple times for a given test. Returning 150 // This function may be called multiple times for a given test. Returning
151 // false doesn't necessarily mean that the test has failed or will fail, it 151 // false doesn't necessarily mean that the test has failed or will fail, it
152 // might just mean that the test hasn't passed yet. 152 // might just mean that the test hasn't passed yet.
153 if (info.path != expected_path) { 153 if (info.target_path != expected_path) {
154 VLOG(20) << __FUNCTION__ << " " << info.path.value() 154 VLOG(20) << __FUNCTION__ << " " << info.target_path.value()
155 << " != " << expected_path.value(); 155 << " != " << expected_path.value();
156 return false; 156 return false;
157 } 157 }
158 if (info.url != expected_url) { 158 if (info.url_chain.size() != 1u) {
159 VLOG(20) << __FUNCTION__ << " " << info.url.spec() 159 VLOG(20) << __FUNCTION__ << " " << info.url_chain.size()
160 << " != 1";
161 return false;
162 }
163 if (info.url_chain[0] != expected_url) {
164 VLOG(20) << __FUNCTION__ << " " << info.url_chain[0].spec()
160 << " != " << expected_url.spec(); 165 << " != " << expected_url.spec();
161 return false; 166 return false;
162 } 167 }
163 if ((num_files >= 0) && (info.received_bytes != num_files)) { 168 if ((num_files >= 0) && (info.received_bytes != num_files)) {
164 VLOG(20) << __FUNCTION__ << " " << num_files 169 VLOG(20) << __FUNCTION__ << " " << num_files
165 << " != " << info.received_bytes; 170 << " != " << info.received_bytes;
166 return false; 171 return false;
167 } 172 }
168 if (info.state != expected_state) { 173 if (info.state != expected_state) {
169 VLOG(20) << __FUNCTION__ << " " << info.state 174 VLOG(20) << __FUNCTION__ << " " << info.state
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 persisted.WaitForPersisted(); 769 persisted.WaitForPersisted();
765 770
766 EXPECT_TRUE(file_util::PathExists(full_file_name)); 771 EXPECT_TRUE(file_util::PathExists(full_file_name));
767 int64 actual_file_size = -1; 772 int64 actual_file_size = -1;
768 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); 773 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size));
769 EXPECT_LE(kFileSizeMin, actual_file_size); 774 EXPECT_LE(kFileSizeMin, actual_file_size);
770 } 775 }
771 776
772 } // namespace 777 } // namespace
773 778
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698