1// Copyright 2024 The Chromium Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "crypto/apple_keychain_util.h" 6 7#include "crypto/fake_apple_keychain_v2.h" 8#include "crypto/scoped_fake_apple_keychain_v2.h" 9#include "testing/gtest/include/gtest/gtest.h" 10 11namespace { 12 13constexpr char kTestKeychainAccessGroup[] = "test-keychain-access-group"; 14 15class AppleKeychainUtilTest : public testing::Test { 16 protected: 17 crypto::ScopedFakeAppleKeychainV2 scoped_fake_apple_keychain_{ 18 kTestKeychainAccessGroup}; 19}; 20 21#if !BUILDFLAG(IS_IOS) 22TEST_F(AppleKeychainUtilTest, ExecutableHasKeychainAccessGroupEntitlement) { 23 EXPECT_TRUE(crypto::ExecutableHasKeychainAccessGroupEntitlement( 24 kTestKeychainAccessGroup)); 25 EXPECT_FALSE(crypto::ExecutableHasKeychainAccessGroupEntitlement( 26 "some-other-keychain-access-group")); 27} 28#endif // !BUILDFLAG(IS_IOS) 29 30} // namespace 31