chromium/chrome/browser/download/download_request_limiter_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/download/download_request_limiter.h"

#include <memory>

#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/download/download_permission_request.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/permissions/permission_request_manager.h"
#include "components/permissions/test/mock_permission_prompt_factory.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_touch_event.h"

#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/flags/android/chrome_feature_list.h"
#endif

WebContents;

namespace {
enum TestingAction {};
}  // namespace

class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {};

TEST_F(DownloadRequestLimiterTest, Allow) {}

TEST_F(DownloadRequestLimiterTest, ResetOnNavigation) {}

TEST_F(DownloadRequestLimiterTest, RendererInitiated) {}

// Test that history back will not change the tab download state if all the
// previous navigations are renderer-initiated.
TEST_F(DownloadRequestLimiterTest, HistoryBack) {}

// Tab download state shouldn't change when forward/back between to a
// renderer-initiated page.
TEST_F(DownloadRequestLimiterTest, HistoryForwardBack) {}

TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_ResetOnUserGesture) {}

TEST_F(DownloadRequestLimiterTest, ResetOnReload) {}

TEST_F(DownloadRequestLimiterTest, RawWebContents) {}

TEST_F(DownloadRequestLimiterTest, SetHostContentSetting) {}

TEST_F(DownloadRequestLimiterTest, ContentSettingChanged) {}

// Test that renderer initiated download from another origin are handled
// properly.
TEST_F(DownloadRequestLimiterTest, RendererInitiatedDownloadFromAnotherOrigin) {}

// Test that user interaction on the current page won't reset download status
// for another origin.
TEST_F(DownloadRequestLimiterTest,
       DownloadStatusForOtherOriginsNotResetOnUserInteraction) {}

// Test that renderer initiated download from opaque origins are correctly
// limited.
TEST_F(DownloadRequestLimiterTest, OpaqueOrigins) {}