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

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

Issue 10409031: Fix crash when download from popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/download/download_request_limiter.h" 6 #include "chrome/browser/download/download_request_limiter.h"
7 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" 7 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/test/test_browser_thread.h" 10 #include "content/test/test_browser_thread.h"
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 virtual void TearDown() { 35 virtual void TearDown() {
36 DownloadRequestLimiter::SetTestingDelegate(NULL); 36 DownloadRequestLimiter::SetTestingDelegate(NULL);
37 37
38 TabContentsWrapperTestHarness::TearDown(); 38 TabContentsWrapperTestHarness::TearDown();
39 } 39 }
40 40
41 void CanDownload() { 41 void CanDownload() {
42 download_request_limiter_->CanDownloadImpl( 42 download_request_limiter_->CanDownloadImpl(
43 contents_wrapper(), 43 web_contents(),
44 -1, // request id 44 -1, // request id
45 "GET", // request method 45 "GET", // request method
46 base::Bind(&DownloadRequestLimiterTest::ContinueDownload, 46 base::Bind(&DownloadRequestLimiterTest::ContinueDownload,
47 base::Unretained(this))); 47 base::Unretained(this)));
48 message_loop_.RunAllPending(); 48 message_loop_.RunAllPending();
49 } 49 }
50 50
51 bool ShouldAllowDownload() { 51 bool ShouldAllowDownload() {
52 ask_allow_count_++; 52 ask_allow_count_++;
53 return allow_download_; 53 return allow_download_;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // And make sure we really can't download. 200 // And make sure we really can't download.
201 ask_allow_count_ = continue_count_ = cancel_count_ = 0; 201 ask_allow_count_ = continue_count_ = cancel_count_ = 0;
202 CanDownload(); 202 CanDownload();
203 ASSERT_EQ(0, ask_allow_count_); 203 ASSERT_EQ(0, ask_allow_count_);
204 ASSERT_EQ(0, continue_count_); 204 ASSERT_EQ(0, continue_count_);
205 ASSERT_EQ(1, cancel_count_); 205 ASSERT_EQ(1, cancel_count_);
206 // And the state shouldn't have changed. 206 // And the state shouldn't have changed.
207 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, 207 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED,
208 download_request_limiter_->GetDownloadStatus(contents())); 208 download_request_limiter_->GetDownloadStatus(contents()));
209 } 209 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698