Skip to content

Commit

Permalink
Uplift of #17244 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Feb 17, 2023
1 parent e25e603 commit 3b82607
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions components/brave_vpn/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ source_set("unit_tests") {
deps = [
":common",
"//base",
"//brave/components/skus/browser",
"//components/prefs",
"//components/prefs:test_support",
"//components/sync_preferences:test_support",
Expand Down
15 changes: 2 additions & 13 deletions components/brave_vpn/common/brave_vpn_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,8 @@ std::string GetManageUrl(const std::string& env) {
// When the vendor receives a credential from us during auth, it also includes
// the environment. The vendor then can do a lookup using Payment Service.
std::string GetBraveVPNPaymentsEnv(const std::string& env) {
if (env == skus::kEnvProduction)
return "";
// Use same value.
if (env == skus::kEnvStaging || env == skus::kEnvDevelopment)
return env;

NOTREACHED();

#if defined(OFFICIAL_BUILD)
return "";
#else
return "development";
#endif
// Use same string as payment env.
return env;
}

void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
Expand Down
7 changes: 7 additions & 0 deletions components/brave_vpn/common/brave_vpn_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "brave/components/brave_vpn/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
#include "components/skus/browser/skus_utils.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
Expand Down Expand Up @@ -187,3 +188,9 @@ TEST(BraveVPNUtilsUnitTest, AlreadyMigrated) {
EXPECT_TRUE(local_state_pref_service.HasPrefPath(
brave_vpn::prefs::kBraveVPNLocalStateMigrated));
}

TEST(BraveVPNUtilsUnitTest, VPNPaymentsEnv) {
EXPECT_EQ("production", GetBraveVPNPaymentsEnv(skus::kEnvProduction));
EXPECT_EQ("staging", GetBraveVPNPaymentsEnv(skus::kEnvStaging));
EXPECT_EQ("development", GetBraveVPNPaymentsEnv(skus::kEnvDevelopment));
}

0 comments on commit 3b82607

Please sign in to comment.