blob: e6321dda682c1133a0972dcb795dbfe6a888b88b [file] [log] [blame]
David Bienvenu2b7c9af2025-03-20 16:10:221// Copyright 2025 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 "chrome/browser/win/limited_access_features.h"
6
7#include "base/win/scoped_com_initializer.h"
8#include "build/branding_buildflags.h"
9#include "testing/gtest/include/gtest/gtest.h"
10
11// Because accessing limited access features requires adding a resource
12// to the .rc file, and tests don't have .rc files, all we can test
13// is that requesting access to a feature fails gracefully.
14// Use the taskbar pinning limited access feature since it's the only
15// one we currently have a token for.
16TEST(LimitedAccessFeatures, UnregisteredFeature) {
17 const std::wstring taskbar_api_token =
18#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
19 L"InBNYixzyiUzivxj5T/HqA==";
20#else
21 L"ILzQYl3daXqTIyjmNj5xwg==";
22#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
23 base::win::ScopedCOMInitializer com_initializer;
24 ASSERT_TRUE(com_initializer.Succeeded());
25 EXPECT_FALSE(TryToUnlockLimitedAccessFeature(
26 L"com.microsoft.windows.taskbar.pin", taskbar_api_token));
27}