chromium/chrome/browser/ui/content_settings/content_setting_bubble_model_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/ui/content_settings/content_setting_bubble_model.h"

#include <stddef.h>

#include <memory>

#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/functional/callback.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/content_settings/page_specific_content_settings_delegate.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/webrtc/media_stream_capture_indicator.h"
#include "chrome/browser/permissions/permission_decision_auto_blocker_factory.h"
#include "chrome/browser/permissions/system/mock_platform_handle.h"
#include "chrome/browser/permissions/system/system_permission_settings.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/blocked_content/blocked_window_params.h"
#include "chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.h"
#include "chrome/browser/ui/content_settings/fake_owner.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_browser_process_platform_part.h"
#include "chrome/test/base/testing_profile.h"
#include "components/blocked_content/popup_blocker.h"
#include "components/blocked_content/popup_blocker_tab_helper.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/common/features.h"
#include "components/custom_handlers/protocol_handler_registry.h"
#include "components/custom_handlers/test_protocol_handler_registry_delegate.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/infobars/core/infobar_delegate.h"
#include "components/permissions/permission_decision_auto_blocker.h"
#include "components/permissions/permission_recovery_success_rate_tracker.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/web_contents_tester.h"
#include "net/base/schemeful_site.h"
#include "services/device/public/cpp/device_features.h"
#include "services/device/public/cpp/geolocation/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#include "ui/base/l10n/l10n_util.h"

#if !BUILDFLAG(IS_ANDROID)
#include "base/test/gmock_expected_support.h"
#include "chrome/browser/ui/web_applications/test/isolated_web_app_test_utils.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/browser/web_applications/isolated_web_apps/test/isolated_web_app_builder.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#endif  // !BUILDFLAG(IS_ANDROID)

WebContentsTester;
PageSpecificContentSettings;
ProtocolHandler;
Pair;
Return;
UnorderedElementsAre;
ContentSettingBubbleAction;

class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness {};

TEST_F(ContentSettingBubbleModelTest, ImageRadios) {}

TEST_F(ContentSettingBubbleModelTest, Cookies) {}

TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) {}

TEST_F(ContentSettingBubbleModelTest, BlockedMediastreamMicAndCamera) {}

// Tests whether a changed setting in the setting bubble is displayed again when
// the bubble is re-opened.
TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) {}

TEST_F(ContentSettingBubbleModelTest, MediastreamMic) {}

TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) {}

TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) {}

// Enable geolocation bubble tests to be run with OS-level permission
// integration enabled or disabled on platforms where support is toggleable.
class ContentSettingGeolocationBubbleModelTest
    : public ContentSettingBubbleModelTest,
      public testing::WithParamInterface<bool> {};

TEST_P(ContentSettingGeolocationBubbleModelTest, Geolocation) {}

INSTANTIATE_TEST_SUITE_P();

TEST_F(ContentSettingBubbleModelTest, FileURL) {}

#if !BUILDFLAG(IS_ANDROID)
class ContentSettingBubbleModelIsolatedWebAppTest
    : public ContentSettingBubbleModelTest {};

TEST_F(ContentSettingBubbleModelIsolatedWebAppTest, IsolatedWebAppUrl) {}
#endif  // !BUILDFLAG(IS_ANDROID)

TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) {}

TEST_F(ContentSettingBubbleModelTest, RPHAllow) {}

TEST_F(ContentSettingBubbleModelTest, RPHDefaultDone) {}

TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) {}

class GenericSensorContentSettingBubbleModelTest
    : public ContentSettingBubbleModelTest {};

// Regression test for https://crbug.com/955408
// See also: ContentSettingImageModelTest.SensorAccessPermissionsChanged
TEST_F(GenericSensorContentSettingBubbleModelTest,
       SensorAccessPermissionsChanged) {}

TEST_F(ContentSettingBubbleModelTest, PopupBubbleModelListItems) {}

TEST_F(ContentSettingBubbleModelTest, ValidUrl) {}

TEST_F(ContentSettingBubbleModelTest, InvalidUrl) {}

TEST_F(ContentSettingBubbleModelTest, StorageAccess) {}