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

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: Incorporated Ben's comments. Created 8 years 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool DownloadStoredProperly( 141 bool DownloadStoredProperly(
142 const GURL& expected_url, 142 const GURL& expected_url,
143 const FilePath& expected_path, 143 const FilePath& expected_path,
144 int64 num_files, 144 int64 num_files,
145 DownloadItem::DownloadState expected_state, 145 DownloadItem::DownloadState expected_state,
146 DownloadItem* item, 146 DownloadItem* item,
147 const history::DownloadRow& info) { 147 const history::DownloadRow& info) {
148 // This function may be called multiple times for a given test. Returning 148 // This function may be called multiple times for a given test. Returning
149 // false doesn't necessarily mean that the test has failed or will fail, it 149 // false doesn't necessarily mean that the test has failed or will fail, it
150 // might just mean that the test hasn't passed yet. 150 // might just mean that the test hasn't passed yet.
151 if (info.path != expected_path) { 151 if (info.target_path != expected_path) {
152 VLOG(20) << __FUNCTION__ << " " << info.path.value() 152 VLOG(20) << __FUNCTION__ << " " << info.target_path.value()
153 << " != " << expected_path.value(); 153 << " != " << expected_path.value();
154 return false; 154 return false;
155 } 155 }
156 if (info.url != expected_url) { 156 if (info.url_chain.size() != 1u) {
157 VLOG(20) << __FUNCTION__ << " " << info.url.spec() 157 VLOG(20) << __FUNCTION__ << " " << info.url_chain.size()
158 << " != 1";
159 return false;
160 }
161 if (info.url_chain[0] != expected_url) {
162 VLOG(20) << __FUNCTION__ << " " << info.url_chain[0].spec()
158 << " != " << expected_url.spec(); 163 << " != " << expected_url.spec();
159 return false; 164 return false;
160 } 165 }
161 if ((num_files >= 0) && (info.received_bytes != num_files)) { 166 if ((num_files >= 0) && (info.received_bytes != num_files)) {
162 VLOG(20) << __FUNCTION__ << " " << num_files 167 VLOG(20) << __FUNCTION__ << " " << num_files
163 << " != " << info.received_bytes; 168 << " != " << info.received_bytes;
164 return false; 169 return false;
165 } 170 }
166 if (info.state != expected_state) { 171 if (info.state != expected_state) {
167 VLOG(20) << __FUNCTION__ << " " << info.state 172 VLOG(20) << __FUNCTION__ << " " << info.state
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 DownloadItem::COMPLETE)); 694 DownloadItem::COMPLETE));
690 chrome::SavePage(browser()); 695 chrome::SavePage(browser());
691 ASSERT_TRUE(WaitForSavePackageToFinish(browser(), url)); 696 ASSERT_TRUE(WaitForSavePackageToFinish(browser(), url));
692 persisted.WaitForPersisted(); 697 persisted.WaitForPersisted();
693 698
694 EXPECT_TRUE(file_util::PathExists(full_file_name)); 699 EXPECT_TRUE(file_util::PathExists(full_file_name));
695 int64 actual_file_size = -1; 700 int64 actual_file_size = -1;
696 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); 701 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size));
697 EXPECT_LE(kFileSizeMin, actual_file_size); 702 EXPECT_LE(kFileSizeMin, actual_file_size);
698 } 703 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698