chromium/chrome/browser/permissions/permission_subscription_unittest.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/permissions/permission_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/permissions/permission_manager.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/permissions_client.h"
#include "components/permissions/test/permission_test_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/permissions_test_utils.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom.h"
#include "url/origin.h"

PermissionType;
PermissionsPolicyFeature;

// This class tests PermissionStatus.onChange observer.
class PermissionSubscriptionTest : public ChromeRenderViewHostTestHarness {};

TEST_F(PermissionSubscriptionTest,
       SubscriptionDestroyedCleanlyWithoutUnsubscribe) {}

TEST_F(PermissionSubscriptionTest, SubscribeUnsubscribeAfterShutdown) {}

TEST_F(PermissionSubscriptionTest, SameTypeChangeNotifies) {}

TEST_F(PermissionSubscriptionTest, DifferentTypeChangeDoesNotNotify) {}

TEST_F(PermissionSubscriptionTest, ChangeAfterUnsubscribeDoesNotNotify) {}

TEST_F(PermissionSubscriptionTest,
       ChangeAfterUnsubscribeOnlyNotifiesActiveSubscribers) {}

TEST_F(PermissionSubscriptionTest, DifferentPrimaryUrlDoesNotNotify) {}

TEST_F(PermissionSubscriptionTest, DifferentSecondaryUrlDoesNotNotify) {}

TEST_F(PermissionSubscriptionTest, WildCardPatternNotifies) {}

TEST_F(PermissionSubscriptionTest, ClearSettingsNotifies) {}

TEST_F(PermissionSubscriptionTest, NewValueCorrectlyPassed) {}

TEST_F(PermissionSubscriptionTest, ChangeWithoutPermissionChangeDoesNotNotify) {}

TEST_F(PermissionSubscriptionTest, ChangesBackAndForth) {}

TEST_F(PermissionSubscriptionTest, ChangesBackAndForthWorker) {}

TEST_F(PermissionSubscriptionTest, SubscribeMIDIPermission) {}

TEST_F(PermissionSubscriptionTest, SubscribeWithPermissionDelegation) {}

TEST_F(PermissionSubscriptionTest, SubscribeUnsubscribeAndResubscribe) {}

TEST_F(PermissionSubscriptionTest, SubscribersAreNotifedOfEmbargoEvents) {}

// TODO(b/339158416): Add back
// RequestableDevicePermissionChangesLazilyNotifiesObservers and
// NonrequestableDevicePermissionChangesLazilyNotifiesObservers tests once the
// implementation is finished.

TEST_F(PermissionSubscriptionTest,
       SubscribeUnsubscribeForNotAddedPermissionContext) {}

// TODO(https://crbug.com/359831269): Fix new tab page test for Android.
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_SubscribeUnsubscribeForNewTabPage
#else
#define MAYBE_SubscribeUnsubscribeForNewTabPage
#endif
TEST_F(PermissionSubscriptionTest, MAYBE_SubscribeUnsubscribeForNewTabPage) {}