Skip to content

Commit

Permalink
Merge pull request #10089 from /issues/17812
Browse files Browse the repository at this point in the history
Remove Brave ads dev environment
  • Loading branch information
tmancey authored Sep 15, 2021
2 parents e4186c5 + 5c6758c commit 119585d
Show file tree
Hide file tree
Showing 19 changed files with 22 additions and 86 deletions.
4 changes: 1 addition & 3 deletions components/brave_adaptive_captcha/server_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ std::string GetServerUrl(const std::string& path) {
std::string url = REWARDS_GRANT_PROD_ENDPOINT;

auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(brave_ads::switches::kDevelopment)) {
url = REWARDS_GRANT_DEV_ENDPOINT;
} else if (command_line->HasSwitch(brave_ads::switches::kStaging)) {
if (command_line->HasSwitch(brave_ads::switches::kStaging)) {
url = REWARDS_GRANT_STAGING_ENDPOINT;
} else if (command_line->HasSwitch(brave_ads::switches::kProduction)) {
url = REWARDS_GRANT_PROD_ENDPOINT;
Expand Down
2 changes: 0 additions & 2 deletions components/brave_ads/browser/ads_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,6 @@ void AdsServiceImpl::SetEnvironment() {
environment = ads::mojom::Environment::kProduction;
} else if (command_line.HasSwitch(switches::kStaging)) {
environment = ads::mojom::Environment::kStaging;
} else if (command_line.HasSwitch(switches::kDevelopment)) {
environment = ads::mojom::Environment::kDevelopment;
}
#endif

Expand Down
1 change: 0 additions & 1 deletion components/brave_ads/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace switches {

const char kProduction[] = "brave-ads-production";
const char kStaging[] = "brave-ads-staging";
const char kDevelopment[] = "brave-ads-development";
const char kDebug[] = "brave-ads-debug";

} // namespace switches
Expand Down
1 change: 0 additions & 1 deletion components/brave_ads/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace switches {

extern const char kProduction[];
extern const char kStaging[];
extern const char kDevelopment[];
extern const char kDebug[];
extern const char kTesting[];

Expand Down
6 changes: 0 additions & 6 deletions vendor/bat-native-ads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ Use staging Ads server. Default for non official builds, i.e. Debug
--brave-ads-staging
```

Use development Ads server.

```
--brave-ads-development
```

Collect initial activity after 25 seconds instead of 1 hour as defined by
`kDebugOneHourInSeconds` in `static_values.h`. Download the catalog after 15
minutes instead of 2 hours as defined by `kDebugCatalogPing` in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ module ads.mojom;

enum Environment {
kStaging = 0,
kProduction,
kDevelopment
kProduction
};

struct SysInfo {
Expand Down
2 changes: 1 addition & 1 deletion vendor/bat-native-ads/src/bat/ads/ads.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace ads {

mojom::Environment g_environment = mojom::Environment::kDevelopment;
mojom::Environment g_environment = mojom::Environment::kStaging;

mojom::SysInfo g_sys_info;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace {

const char kProductionHost[] = "https://ads-serve.brave.com";
const char kStagingHost[] = "https://ads-serve.bravesoftware.com";
const char kDevelopmentHost[] = "https://ads-serve.brave.software";

} // namespace

Expand All @@ -29,10 +28,6 @@ std::string GetHost() {
case mojom::Environment::kStaging: {
return kStagingHost;
}

case mojom::Environment::kDevelopment: {
return kDevelopmentHost;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,4 @@ TEST(BatAdsServeServerUtilTest, Staging) {
EXPECT_EQ(expected_host, host);
}

TEST(BatAdsServeServerUtilTest, Development) {
// Arrange
SetEnvironment(mojom::Environment::kDevelopment);

// Act
const std::string host = serve::server::GetHost();

// Assert
const std::string expected_host = "https://ads-serve.brave.software";
EXPECT_EQ(expected_host, host);
}

} // namespace ads
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace {

const char kProductionHost[] = "https://ads-static.brave.com";
const char kStagingHost[] = "https://ads-serve.bravesoftware.com";
const char kDevelopmentHost[] = "https://ads-serve.brave.software";

} // namespace

Expand All @@ -28,10 +27,6 @@ std::string GetHost() {
case mojom::Environment::kStaging: {
return kStagingHost;
}

case mojom::Environment::kDevelopment: {
return kDevelopmentHost;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,4 @@ TEST(BatAdsServerUtilTest, Staging) {
EXPECT_EQ(expected_host, host);
}

TEST(BatAdsServerUtilTest, Development) {
// Arrange
SetEnvironment(mojom::Environment::kDevelopment);

// Act
const std::string host = server::GetHost();

// Assert
const std::string expected_host = "https://ads-serve.brave.software";
EXPECT_EQ(expected_host, host);
}

} // namespace ads
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace {

const char kProductionHost[] = "https://ads-serve.brave.com";
const char kStagingHost[] = "https://ads-serve.bravesoftware.com";
const char kDevelopmentHost[] = "https://ads-serve.brave.software";

} // namespace

Expand All @@ -29,10 +28,6 @@ std::string GetHost() {
case mojom::Environment::kStaging: {
return kStagingHost;
}

case mojom::Environment::kDevelopment: {
return kDevelopmentHost;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,4 @@ TEST(BatAdsConfirmationsServerUtilTest, Staging) {
EXPECT_EQ(expected_host, host);
}

TEST(BatAdsConfirmationsServerUtilTest, Development) {
// Arrange
SetEnvironment(mojom::Environment::kDevelopment);

// Act
const std::string host = confirmations::server::GetHost();

// Assert
const std::string expected_host = "https://ads-serve.brave.software";
EXPECT_EQ(expected_host, host);
}

} // namespace ads
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TEST(BatAdsRedeemUnblindedPaymentTokensRequestTest, BuildUrlForRPill) {
// Assert
mojom::UrlRequestPtr expected_url_request = mojom::UrlRequest::New();
expected_url_request->url =
R"(https://ads-serve.brave.software/v1/confirmation/payment/d4ed0af0-bfa9-464b-abd7-67b29d891b8b)";
R"(https://ads-serve.bravesoftware.com/v1/confirmation/payment/d4ed0af0-bfa9-464b-abd7-67b29d891b8b)";
expected_url_request->headers = {
R"(Via: 1.1 brave, 1.1 ads-serve.brave.com (Apache/1.1))",
R"(accept: application/json)"};
Expand Down Expand Up @@ -121,7 +121,7 @@ TEST(BatAdsRedeemUnblindedPaymentTokensRequestTest, BuildUrlForBPill) {
// Assert
mojom::UrlRequestPtr expected_url_request = mojom::UrlRequest::New();
expected_url_request->url =
R"(https://ads-serve.brave.software/v1/confirmation/payment/d4ed0af0-bfa9-464b-abd7-67b29d891b8b)";
R"(https://ads-serve.bravesoftware.com/v1/confirmation/payment/d4ed0af0-bfa9-464b-abd7-67b29d891b8b)";
expected_url_request->headers = {
R"(Via: 1.0 brave, 1.1 ads-serve.brave.com (Apache/1.1))",
R"(accept: application/json)"};
Expand Down
Loading

0 comments on commit 119585d

Please sign in to comment.