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

Unified Diff: chrome/browser/download/download_request_limiter_unittest.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_request_limiter_unittest.cc
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc
index 5e9a2beb1fecd86c1f3dceeca08462a7076b983d..ca6a9ef1d8738a42e37e237f53e160d05a6cfc24 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/bind.h"
+#include "base/run_loop.h"
#include "chrome/browser/download/download_request_infobar_delegate.h"
#include "chrome/browser/download/download_request_limiter.h"
#include "chrome/browser/infobars/infobar_service.h"
@@ -11,10 +12,8 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/test/test_browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-using content::BrowserThread;
using content::WebContents;
class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
@@ -25,13 +24,6 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
WAIT
};
- DownloadRequestLimiterTest()
- : ui_thread_(BrowserThread::UI, &message_loop_),
- file_user_blocking_thread_(
- BrowserThread::FILE_USER_BLOCKING, &message_loop_),
- io_thread_(BrowserThread::IO, &message_loop_) {
- }
-
virtual void SetUp() {
ChromeRenderViewHostTestHarness::SetUp();
BlockedContentTabHelper::CreateForWebContents(web_contents());
@@ -81,7 +73,7 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
"GET", // request method
base::Bind(&DownloadRequestLimiterTest::ContinueDownload,
base::Unretained(this)));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
void OnUserGesture() {
@@ -136,10 +128,6 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
// Number of times ShouldAllowDownload was invoked.
int ask_allow_count_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread file_user_blocking_thread_;
- content::TestBrowserThread io_thread_;
-
private:
DownloadRequestInfoBarDelegate::FakeCreateCallback fake_create_callback_;
};
@@ -294,7 +282,7 @@ TEST_F(DownloadRequestLimiterTest,
download_request_limiter_->GetDownloadStatus(web_contents()));
AboutToNavigateRenderView();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ExpectAndResetCounts(0, 1, 0, __LINE__);
ASSERT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
download_request_limiter_->GetDownloadStatus(web_contents()));
@@ -311,7 +299,7 @@ TEST_F(DownloadRequestLimiterTest,
ExpectAndResetCounts(0, 1, 1, __LINE__);
AboutToNavigateRenderView();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED,
download_request_limiter_->GetDownloadStatus(web_contents()));
CanDownload();

Powered by Google App Engine
This is Rietveld 408576698