diff --git a/components/brave_vpn/BUILD.gn b/components/brave_vpn/BUILD.gn index 03317a087f6..12335530a9a 100644 --- a/components/brave_vpn/BUILD.gn +++ b/components/brave_vpn/BUILD.gn @@ -3,6 +3,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. +import("//brave/components/brave_vpn/buildflags/buildflags.gni") + static_library("brave_vpn") { sources = [ "brave_vpn_connection_info.cc", @@ -11,6 +13,8 @@ static_library("brave_vpn") { "brave_vpn_connection_manager.h", "brave_vpn_service.cc", "brave_vpn_service.h", + "features.cc", + "features.h", ] deps = [ @@ -63,6 +67,21 @@ source_set("brave_vpn_internal") { } } +source_set("unit_tests") { + if (enable_brave_vpn) { + testonly = true + + sources = [ "brave_vpn_unittest.cc" ] + + deps = [ + ":brave_vpn", + "//base", + "//content/test:test_support", + "//testing/gtest", + ] + } +} + executable("vpntool") { sources = [] deps = [ diff --git a/components/brave_vpn/brave_vpn_unittest.cc b/components/brave_vpn/brave_vpn_unittest.cc new file mode 100644 index 00000000000..d29e41d685d --- /dev/null +++ b/components/brave_vpn/brave_vpn_unittest.cc @@ -0,0 +1,17 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "base/feature_list.h" +#include "brave/components/brave_vpn/features.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace brave_vpn { + +TEST(BraveVPNTest, Basic) { + // Disable by default till we implement all brave vpn features. + EXPECT_FALSE(base::FeatureList::IsEnabled(kBraveVPNFeature)); +} + +} // namespace brave_vpn diff --git a/components/brave_vpn/features.cc b/components/brave_vpn/features.cc new file mode 100644 index 00000000000..01f243fdc46 --- /dev/null +++ b/components/brave_vpn/features.cc @@ -0,0 +1,15 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/components/brave_vpn/features.h" + +#include "base/feature_list.h" + +namespace brave_vpn { + +const base::Feature kBraveVPNFeature{"BraveVPN", + base::FEATURE_DISABLED_BY_DEFAULT}; + +} // namespace brave_vpn diff --git a/components/brave_vpn/features.h b/components/brave_vpn/features.h new file mode 100644 index 00000000000..51e44370d8d --- /dev/null +++ b/components/brave_vpn/features.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_COMPONENTS_BRAVE_VPN_FEATURES_H_ +#define BRAVE_COMPONENTS_BRAVE_VPN_FEATURES_H_ + +namespace base { +struct Feature; +} // namespace base + +namespace brave_vpn { + +extern const base::Feature kBraveVPNFeature; + +} // namespace brave_vpn + +#endif // BRAVE_COMPONENTS_BRAVE_VPN_FEATURES_H_ diff --git a/test/BUILD.gn b/test/BUILD.gn index 142416181ed..dc84b9ad319 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -180,6 +180,7 @@ test("brave_unit_tests") { "//brave/components/brave_search/common", "//brave/components/brave_shields/browser", "//brave/components/brave_shields/common", + "//brave/components/brave_vpn:unit_tests", "//brave/components/brave_wallet/browser/test:brave_wallet_unit_tests", "//brave/components/brave_wallet/common/buildflags", "//brave/components/child_process_monitor:unittests",