#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/lazy_instance.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/test_safe_browsing_database_helper.h"
#include "chrome/browser/subresource_filter/subresource_filter_browser_test_harness.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/blocked_content/safe_browsing_triggered_popup_blocker.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_types.h"
#include "components/safe_browsing/core/browser/db/util.h"
#include "components/subresource_filter/core/browser/subresource_filter_constants.h"
#include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "components/url_pattern_index/proto/rules.pb.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
SubresourceFilterType;
SubresourceFilterLevel;
namespace subresource_filter {
namespace {
void RoundTripAndVerifyLogMessages(
const content::WebContentsConsoleObserver& observer,
content::WebContents* web_contents,
std::set<std::string> messages_expected,
std::set<std::string> messages_not_expected) { … }
}
class SubresourceFilterPopupBrowserTest
: public SubresourceFilterListInsertingBrowserTest { … };
IN_PROC_BROWSER_TEST_F(SubresourceFilterPopupBrowserTest,
NoConfiguration_AllowCreatingNewWindows) { … }
class SubresourceFilterPopupBrowserTestWithParam
: public SubresourceFilterPopupBrowserTest,
public ::testing::WithParamInterface<
bool > { … };
IN_PROC_BROWSER_TEST_P(SubresourceFilterPopupBrowserTestWithParam,
BlockCreatingNewWindows) { … }
IN_PROC_BROWSER_TEST_F(SubresourceFilterPopupBrowserTest,
BlockCreatingNewWindows_LogsToConsole) { … }
IN_PROC_BROWSER_TEST_F(SubresourceFilterPopupBrowserTest,
WarningDoNotBlockCreatingNewWindows_LogsToConsole) { … }
IN_PROC_BROWSER_TEST_F(SubresourceFilterPopupBrowserTest,
WarnAbusiveAndBetterAds_LogsToConsole) { … }
IN_PROC_BROWSER_TEST_F(SubresourceFilterPopupBrowserTest,
AllowCreatingNewWindows_NoLogToConsole) { … }
IN_PROC_BROWSER_TEST_P(SubresourceFilterPopupBrowserTestWithParam,
BlockOpenURLFromTab) { … }
IN_PROC_BROWSER_TEST_P(SubresourceFilterPopupBrowserTestWithParam,
BlockOpenURLFromTabInIframe) { … }
IN_PROC_BROWSER_TEST_P(SubresourceFilterPopupBrowserTestWithParam,
TraditionalWindowOpen_NotBlocked) { … }
INSTANTIATE_TEST_SUITE_P(…);
}