chromium/chrome/browser/privacy_sandbox/browsing_topics_settings_interactive_uitest.cc

// Copyright 2024 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/privacy_sandbox/privacy_sandbox_service.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/canonical_topic.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "content/public/test/browser_test.h"

namespace {

DeepQuery;

DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();
DEFINE_LOCAL_CUSTOM_ELEMENT_EVENT_TYPE();

constexpr char BlockedTopicsListLengthFunc[] =;
constexpr char BlockedTopicsListFirstTopicIdFunc[] =;

DeepQuery GetManageTopicsPageQuery() {}

DeepQuery GetAdTopicsPageQuery() {}

class PrivacySandboxSettingsTopicsInteractiveTest
    : public InteractiveBrowserTest {};

// Block topic(1) and topic(57) through PS service and validate that it's
// toggled OFF (checked == false) on the Manage Topics Page.
IN_PROC_BROWSER_TEST_F(PrivacySandboxSettingsTopicsInteractiveTest,
                       StartWithTwoBlockedTopics) {}

// Block first topic on Manage Topics Page. Validate that it is toggled off
// (checked == false). Validate that the PS service returns only 1 blocked topic
// with an ID of 1. Navigate to the Ad Topics Page and validate topic(1) is
// blocked topics list.
IN_PROC_BROWSER_TEST_F(PrivacySandboxSettingsTopicsInteractiveTest,
                       BlockFirstTopicOnManageTopicsPage) {}

// Block topic(1) through PS service and validate it is shown in the blocked
// topics list of the Ad Topics Page. Unblock the topic and validate PS service
// has 0 blocked topics. Navigate to Manage Topics Page and make sure the first
// topic toggle is ON (checked == true).
IN_PROC_BROWSER_TEST_F(PrivacySandboxSettingsTopicsInteractiveTest,
                       UnblockOneTopicOnAdTopicsPage) {}

// Validate that first icon is shown to confirm we are querying correctly, then
// check all icons to make sure default one is not used.
IN_PROC_BROWSER_TEST_F(PrivacySandboxSettingsTopicsInteractiveTest,
                       ConfirmDefaultIconIsNotUsed) {}

// TODO(b/334129738): clean up / re-enable tests

// Pixel test for Manage Topics Page with all topics set to their default state.
IN_PROC_BROWSER_TEST_F(PrivacySandboxSettingsTopicsInteractiveTest,
                       DISABLED_ValidateScreenshotDefaultManageTopicsPage) {}

// Pixel test for Manage Topics Page and Ad Topics Page with blocking the first
// topic through JS commands.
IN_PROC_BROWSER_TEST_F(
    PrivacySandboxSettingsTopicsInteractiveTest,
    DISABLED_ValidateScreenshotsWithFirstTopicBlockedWithJS) {}
}  // namespace