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

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

Issue 1322033003: Stop compiling dead download infobar code on desktop Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn Created 5 years, 4 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
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 527de058a27f6a36c96f724bbe2ea666b185617f..019ecff44299e7252294b282417e7eeb329bca5c 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -8,8 +8,6 @@
#include "base/command_line.h"
#include "base/run_loop.h"
#include "chrome/browser/download/download_permission_request.h"
-#include "chrome/browser/download/download_request_infobar_delegate.h"
-#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -21,6 +19,11 @@
#include "content/public/common/frame_navigate_params.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_ANDROID)
+#include "chrome/browser/download/download_request_infobar_delegate.h"
+#include "chrome/browser/infobars/infobar_service.h"
+#endif
+
using content::WebContents;
class DownloadRequestLimiterTest;
@@ -82,7 +85,6 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
void SetUp() override {
ChromeRenderViewHostTestHarness::SetUp();
profile_.reset(new TestingProfile());
- InfoBarService::CreateForWebContents(web_contents());
PermissionBubbleManager::CreateForWebContents(web_contents());
scoped_refptr<FakePermissionBubbleView::Factory> factory =
@@ -95,10 +97,15 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
testing_action_ = ACCEPT;
ask_allow_count_ = cancel_count_ = continue_count_ = 0;
download_request_limiter_ = new DownloadRequestLimiter();
+
+#if defined(OS_ANDROID)
+ InfoBarService::CreateForWebContents(web_contents());
fake_create_callback_ = base::Bind(
&DownloadRequestLimiterTest::FakeCreate, base::Unretained(this));
DownloadRequestInfoBarDelegate::SetCallbackForTesting(
&fake_create_callback_);
+#endif
+
content_settings_ = new HostContentSettingsMap(profile_->GetPrefs(), false);
DownloadRequestLimiter::SetContentSettingsForTesting(
content_settings_.get());
@@ -112,6 +119,16 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
ask_allow_count_++;
}
+ void TearDown() override {
+ content_settings_->ShutdownOnUIThread();
+ content_settings_ = NULL;
+#if defined(OS_ANDROID)
+ UnsetDelegate();
+#endif
+ ChromeRenderViewHostTestHarness::TearDown();
+ }
+
+#if defined(OS_ANDROID)
void FakeCreate(
InfoBarService* infobar_service,
base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) {
@@ -128,16 +145,10 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
}
}
- void TearDown() override {
- content_settings_->ShutdownOnUIThread();
- content_settings_ = NULL;
- UnsetDelegate();
- ChromeRenderViewHostTestHarness::TearDown();
- }
-
virtual void UnsetDelegate() {
DownloadRequestInfoBarDelegate::SetCallbackForTesting(NULL);
}
+#endif
void CanDownload() {
CanDownloadFor(web_contents());
@@ -216,7 +227,10 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
scoped_refptr<HostContentSettingsMap> content_settings_;
private:
+#if defined(OS_ANDROID)
DownloadRequestInfoBarDelegate::FakeCreateCallback fake_create_callback_;
+#endif
+
scoped_ptr<TestingProfile> profile_;
};
@@ -417,6 +431,7 @@ TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_ResetOnReload) {
download_request_limiter_->GetDownloadStatus(web_contents()));
}
+#if defined(OS_ANDROID)
TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_RawWebContents) {
scoped_ptr<WebContents> web_contents(CreateTestWebContents());
@@ -454,6 +469,7 @@ TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_RawWebContents) {
EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
download_request_limiter_->GetDownloadStatus(web_contents.get()));
}
+#endif
TEST_F(DownloadRequestLimiterTest,
DownloadRequestLimiter_SetHostContentSetting) {
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698