chromium/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_unittest.cc

// Copyright 2021 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/enterprise/connectors/device_trust/device_trust_connector_service.h"

#include <utility>

#include "base/values.h"
#include "components/enterprise/device_trust/prefs.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace enterprise_connectors {

namespace {

constexpr char kExampleDomain1[] =;
constexpr char kExampleDomain2[] =;
constexpr char kExampleDomain3[] =;
constexpr char kExampleDomain4[] =;

constexpr char kExampleUrl1[] =;
constexpr char kExampleUrl2[] =;
constexpr char kExampleUrl3[] =;
constexpr char kExampleUrl4[] =;

base::Value::List GetOrigins() {}

base::Value::List GetMoreOrigins() {}

base::Value::List GetDifferentOrigins() {}

void SetPolicy(TestingPrefServiceSimple* prefs,
               const std::string& pref_name,
               base::Value::List list = base::Value::List()) {}

class MockPolicyObserver : public DeviceTrustConnectorService::PolicyObserver {};

}  // namespace

class DeviceTrustConnectorServiceTest : public testing::Test {};

// Tests that the DTC policy levels set is enabled at the correct levels for the
// UserContextAwareAccessSignalsAllowlist policy.
TEST_F(DeviceTrustConnectorServiceTest, UserPolicy_Matches_Update) {}

// Tests that the DTC policy levels set is enabled at the correct levels for the
// BrowserContextAwareAccessSignalsAllowlist policy.
TEST_F(DeviceTrustConnectorServiceTest, BrowserPolicy_Matches_Update) {}

// Tests that the DTC policy levels set is enabled at the correct levels when
// both the UserContextAwareAccessSignalsAllowlist and the
// BrowserContextAwareAccessSignalsAllowlist policy are enabled at the same time
// with the same policy values.
TEST_F(DeviceTrustConnectorServiceTest,
       UserAndBrowserPolicy_SameURLsMatches_Update) {}

// Tests that the DTC policy levels set is enabled at the correct levels when
// both the UserContextAwareAccessSignalsAllowlist and the
// BrowserContextAwareAccessSignalsAllowlist policy are enabled at the same time
// with different policy values.
TEST_F(DeviceTrustConnectorServiceTest,
       UserAndBrowserPolicy_DifferentURLsMatches_Update) {}

// Tests that the policy observer behaves as intended for the
// UserContextAwareAccessSignalsAllowlist policy.
TEST_F(DeviceTrustConnectorServiceTest, UserPolicy_PolicyObserver_Notified) {}

// Tests that the policy observer behaves as intended for the
// BrowserAwareAccessSignalsAllowlist policy.
TEST_F(DeviceTrustConnectorServiceTest, BrowserPolicy_PolicyObserver_Notified) {}

class DeviceTrustConnectorServiceFlagTest
    : public DeviceTrustConnectorServiceTest,
      public ::testing::WithParamInterface<bool> {};

// Parameterized test covering a matrix of enabled/disabled states depending on
// both the feature flag and the policy values for the
// UserContextAwareAccessSignalsAllowlist policy.
TEST_P(DeviceTrustConnectorServiceFlagTest,
       UserPolicy_IsConnectorEnabled_Update) {}

// Parameterized test covering a matrix of enabled/disabled states depending on
// both the feature flag and the policy values for the
// BrowserContextAwareAccessSignalsAllowlist policy.
TEST_P(DeviceTrustConnectorServiceFlagTest,
       BrowserPolicy_IsConnectorEnabled_Update) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace enterprise_connectors