OLD | NEW |
---|---|
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 "chrome/browser/download/download_request_limiter.h" | 5 #include "chrome/browser/download/download_request_limiter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 ChromeRenderViewHostTestHarness::SetUp(); | 144 ChromeRenderViewHostTestHarness::SetUp(); |
145 profile_.reset(new TestingProfile()); | 145 profile_.reset(new TestingProfile()); |
146 testing_delegate_.SetUp(web_contents()); | 146 testing_delegate_.SetUp(web_contents()); |
147 | 147 |
148 UpdateExpectations(ACCEPT); | 148 UpdateExpectations(ACCEPT); |
149 cancel_count_ = continue_count_ = 0; | 149 cancel_count_ = continue_count_ = 0; |
150 download_request_limiter_ = new DownloadRequestLimiter(); | 150 download_request_limiter_ = new DownloadRequestLimiter(); |
151 | 151 |
152 content_settings_ = new HostContentSettingsMap( | 152 content_settings_ = new HostContentSettingsMap( |
153 profile_->GetPrefs(), false /* incognito_profile */, | 153 profile_->GetPrefs(), false /* incognito_profile */, |
154 false /* guest_profile */); | 154 false /* guest_profile */, nullptr /* PrefServiceSyncable* */); |
raymes
2016/06/29 03:50:01
nit: usually just put the name of the variable in
lshang
2016/06/30 05:03:35
We've changed to not pass in the pointer, so no ne
| |
155 DownloadRequestLimiter::SetContentSettingsForTesting( | 155 DownloadRequestLimiter::SetContentSettingsForTesting( |
156 content_settings_.get()); | 156 content_settings_.get()); |
157 } | 157 } |
158 | 158 |
159 void TearDown() override { | 159 void TearDown() override { |
160 content_settings_->ShutdownOnUIThread(); | 160 content_settings_->ShutdownOnUIThread(); |
161 content_settings_ = nullptr; | 161 content_settings_ = nullptr; |
162 testing_delegate_.TearDown(); | 162 testing_delegate_.TearDown(); |
163 ChromeRenderViewHostTestHarness::TearDown(); | 163 ChromeRenderViewHostTestHarness::TearDown(); |
164 } | 164 } |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
716 // changing the content setting). | 716 // changing the content setting). |
717 UpdateContentSettings(web_contents(), CONTENT_SETTING_ASK); | 717 UpdateContentSettings(web_contents(), CONTENT_SETTING_ASK); |
718 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 718 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
719 download_request_limiter_->GetDownloadStatus(web_contents())); | 719 download_request_limiter_->GetDownloadStatus(web_contents())); |
720 UpdateExpectations(WAIT); | 720 UpdateExpectations(WAIT); |
721 CanDownload(); | 721 CanDownload(); |
722 ExpectAndResetCounts(0, 0, 1, __LINE__); | 722 ExpectAndResetCounts(0, 0, 1, __LINE__); |
723 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 723 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
724 download_request_limiter_->GetDownloadStatus(web_contents())); | 724 download_request_limiter_->GetDownloadStatus(web_contents())); |
725 } | 725 } |
OLD | NEW |