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

Side by Side Diff: content/public/test/download_test_observer.cc

Issue 26938003: Don't prompt to save malicious downloads on exit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Testing for CrOS Created 7 years, 2 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 "content/public/test/download_test_observer.h" 5 #include "content/public/test/download_test_observer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 base::Bind(&DownloadTestObserver::DenyDangerousDownload, 163 base::Bind(&DownloadTestObserver::DenyDangerousDownload,
164 weak_factory_.GetWeakPtr(), 164 weak_factory_.GetWeakPtr(),
165 download->GetId())); 165 download->GetId()));
166 break; 166 break;
167 167
168 case ON_DANGEROUS_DOWNLOAD_FAIL: 168 case ON_DANGEROUS_DOWNLOAD_FAIL:
169 ADD_FAILURE() << "Unexpected dangerous download item."; 169 ADD_FAILURE() << "Unexpected dangerous download item.";
170 break; 170 break;
171 171
172 case ON_DANGEROUS_DOWNLOAD_IGNORE: 172 case ON_DANGEROUS_DOWNLOAD_IGNORE:
173 case ON_DANGEROUS_DOWNLOAD_QUIT:
173 break; 174 break;
174 175
175 default: 176 default:
176 NOTREACHED(); 177 NOTREACHED();
177 } 178 }
178 } 179 }
179 180
180 if (IsDownloadInFinalState(download)) 181 if (IsDownloadInFinalState(download) ||
182 dangerous_download_action_ == ON_DANGEROUS_DOWNLOAD_QUIT) {
181 DownloadInFinalState(download); 183 DownloadInFinalState(download);
184 }
182 } 185 }
183 186
184 size_t DownloadTestObserver::NumDangerousDownloadsSeen() const { 187 size_t DownloadTestObserver::NumDangerousDownloadsSeen() const {
185 return dangerous_downloads_seen_.size(); 188 return dangerous_downloads_seen_.size();
186 } 189 }
187 190
188 size_t DownloadTestObserver::NumDownloadsSeenInState( 191 size_t DownloadTestObserver::NumDownloadsSeenInState(
189 DownloadItem::DownloadState state) const { 192 DownloadItem::DownloadState state) const {
190 StateMap::const_iterator it = states_observed_.find(state); 193 StateMap::const_iterator it = states_observed_.find(state);
191 194
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 base::MessageLoopForUI::current()->Quit(); 445 base::MessageLoopForUI::current()->Quit();
443 } 446 }
444 447
445 const DownloadUrlParameters::OnStartedCallback 448 const DownloadUrlParameters::OnStartedCallback
446 DownloadTestItemCreationObserver::callback() { 449 DownloadTestItemCreationObserver::callback() {
447 return base::Bind( 450 return base::Bind(
448 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); 451 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this);
449 } 452 }
450 453
451 } // namespace content 454 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698