chromium/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_browsertest.cc

// Copyright 2022 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/safe_browsing/extension_telemetry/extension_telemetry_service.h"

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/protobuf_matchers.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/enterprise/connectors/core/reporting_constants.h"
#include "components/metrics/content/subprocess_metrics_provider.h"
#include "components/safe_browsing/content/browser/web_ui/safe_browsing_ui.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/extensions_test.h"
#include "extensions/common/api/declarative_net_request/test_utils.h"
#include "extensions/common/extension_features.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace safe_browsing {

namespace {

constexpr const char kExtensionName[] =;
constexpr const char kExtensionVersion[] =;
constexpr const char kExtensionContactedHost[] =;

}  // namespace

EqualsProto;
JSCallStack;
CookiesGetAllInfo;
DeclarativeNetRequestInfo;
DeclarativeNetRequestActionInfo;
GetAllArgsInfo;
CookiesGetInfo;
GetArgsInfo;
RemoteHostContactedInfo;
RemoteHostInfo;
TestRule;
TestHeaderInfo;

class ExtensionTelemetryServiceBrowserTest
    : public extensions::ExtensionApiTest {};

IN_PROC_BROWSER_TEST_F(ExtensionTelemetryServiceBrowserTest,
                       DetectsAndReportsRemoteHostContactedSignal) {}

IN_PROC_BROWSER_TEST_F(ExtensionTelemetryServiceBrowserTest,
                       DetectsAndReportsCookiesGetAllSignal) {}

IN_PROC_BROWSER_TEST_F(ExtensionTelemetryServiceBrowserTest,
                       DetectsAndReportsCookiesGetSignal) {}

IN_PROC_BROWSER_TEST_F(ExtensionTelemetryServiceBrowserTest,
                       DetectsAndReportsDeclarativeNetRequestSignal) {}

IN_PROC_BROWSER_TEST_F(ExtensionTelemetryServiceBrowserTest,
                       DetectsAndReportsDeclarativeNetRequestActionSignal) {}

IN_PROC_BROWSER_TEST_F(ExtensionTelemetryServiceBrowserTest,
                       DetectsAndReportsTabsApiSignal) {}

// Test fixture with kExtensionTelemetryInterceptRemoteHostsContactedInRenderer
// enabled.
class
    ExtensionTelemetryServiceBrowserTestWithInterceptRemoteHostsContactedInRendererEnabled
    : public ExtensionTelemetryServiceBrowserTest {};

IN_PROC_BROWSER_TEST_F(
    ExtensionTelemetryServiceBrowserTestWithInterceptRemoteHostsContactedInRendererEnabled,
    InterceptsRemoteHostContactedSignalInRenderer) {}

IN_PROC_BROWSER_TEST_F(
    ExtensionTelemetryServiceBrowserTestWithInterceptRemoteHostsContactedInRendererEnabled,
    DetectsWebRequestFromContentScript) {}

}  // namespace safe_browsing