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

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

Issue 2523093002: TestBrowserThreads must outlive TestProfiles and TestProfileManagers (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_unittest.cc » ('j') | 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 "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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 profile_->GetPrefs(), false /* incognito_profile */, 154 profile_->GetPrefs(), false /* incognito_profile */,
155 false /* guest_profile */); 155 false /* guest_profile */);
156 DownloadRequestLimiter::SetContentSettingsForTesting( 156 DownloadRequestLimiter::SetContentSettingsForTesting(
157 content_settings_.get()); 157 content_settings_.get());
158 } 158 }
159 159
160 void TearDown() override { 160 void TearDown() override {
161 content_settings_->ShutdownOnUIThread(); 161 content_settings_->ShutdownOnUIThread();
162 content_settings_ = nullptr; 162 content_settings_ = nullptr;
163 testing_delegate_.TearDown(); 163 testing_delegate_.TearDown();
164
165 // |profile_| must be teared down before
166 // |RenderViewHostTestHarness::thread_bundle_|.
167 profile_.reset();
168
164 ChromeRenderViewHostTestHarness::TearDown(); 169 ChromeRenderViewHostTestHarness::TearDown();
165 } 170 }
166 171
167 void CanDownload() { 172 void CanDownload() {
168 CanDownloadFor(web_contents()); 173 CanDownloadFor(web_contents());
169 } 174 }
170 175
171 void CanDownloadFor(WebContents* web_contents) { 176 void CanDownloadFor(WebContents* web_contents) {
172 download_request_limiter_->CanDownloadImpl( 177 download_request_limiter_->CanDownloadImpl(
173 web_contents, 178 web_contents,
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // changing the content setting). 714 // changing the content setting).
710 UpdateContentSettings(web_contents(), CONTENT_SETTING_ASK); 715 UpdateContentSettings(web_contents(), CONTENT_SETTING_ASK);
711 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 716 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
712 download_request_limiter_->GetDownloadStatus(web_contents())); 717 download_request_limiter_->GetDownloadStatus(web_contents()));
713 UpdateExpectations(WAIT); 718 UpdateExpectations(WAIT);
714 CanDownload(); 719 CanDownload();
715 ExpectAndResetCounts(0, 0, 1, __LINE__); 720 ExpectAndResetCounts(0, 0, 1, __LINE__);
716 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 721 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
717 download_request_limiter_->GetDownloadStatus(web_contents())); 722 download_request_limiter_->GetDownloadStatus(web_contents()));
718 } 723 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698