chromium/components/services/app_service/public/cpp/app_capability_access_cache_unittest.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 <set>
#include <utility>

#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "components/services/app_service/public/cpp/app_capability_access_cache.h"
#include "components/services/app_service/public/cpp/capability_access.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

class AppCapabilityAccessCacheTest
    : public testing::Test,
      public apps::AppCapabilityAccessCache::Observer {};

// Responds to a app_capability_access's OnCapabilityAccessUpdate to call back
// into AppCapabilityAccessCache, checking that AppCapabilityAccessCache
// presents a self-consistent snapshot. For example, the camera should match for
// the outer and inner CapabilityAccessUpdate.
//
// In the tests below, just "recursive" means that
// app_capability_access.OnCapabilityAccesses calls
// observer.OnCapabilityAccessUpdate which calls
// app_capability_access.ForEachApp and app_capability_access.ForOneApp.
// "Super-recursive" means that app_capability_access.OnCapabilityAccesses calls
// observer.OnCapabilityAccessUpdate calls
// app_capability_access.OnCapabilityAccesses which calls
// observer.OnCapabilityAccessUpdate.
class CapabilityAccessRecursiveObserver
    : public apps::AppCapabilityAccessCache::Observer {};

TEST_F(AppCapabilityAccessCacheTest, ForEachApp) {}

TEST_F(AppCapabilityAccessCacheTest, Observer) {}

TEST_F(AppCapabilityAccessCacheTest, Recursive) {}

TEST_F(AppCapabilityAccessCacheTest, SuperRecursive) {}

TEST_F(AppCapabilityAccessCacheTest, GetAppsAccessingCapabilities_Empty) {}

TEST_F(AppCapabilityAccessCacheTest,
       GetAppsAccessingCapabilities_CameraAndMicrophone) {}