Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "brave/components/brave_ads/core/internal/account/deposits/cash_deposit.h"

#include "base/test/run_until.h"
#include "base/test/test_future.h"
#include "brave/components/brave_ads/core/internal/ad_units/test/ad_test_constants.h"
#include "brave/components/brave_ads/core/internal/catalog/catalog_url_request_builder_util.h"
Expand Down Expand Up @@ -36,16 +35,11 @@ TEST_F(BraveAdsCashDepositIntegrationTest, GetValue) {
CashDeposit deposit;

// Act & Assert
ASSERT_TRUE(base::test::RunUntil([&] {
base::test::TestFuture<bool, double> test_future;
deposit.GetValue(test::kCreativeInstanceId, test_future.GetCallback());
const auto [success, value] = test_future.Take();
if (!success) {
return false;
}
EXPECT_DOUBLE_EQ(test::kValue, value);
return true;
}));
base::test::TestFuture<bool, double> test_future;
deposit.GetValue(test::kCreativeInstanceId, test_future.GetCallback());
const auto [success, value] = test_future.Take();
EXPECT_TRUE(success);
EXPECT_DOUBLE_EQ(test::kValue, value);
}

TEST_F(BraveAdsCashDepositIntegrationTest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,7 @@ void TestBase::FlushImmediateTasks() {
// sequence, even for fire-and-forget calls with `base::DoNothing`. Those
// replies arrive with a 0ms delay and must be flushed so that callers see
// only genuinely scheduled tasks.
if (task_environment_.NextMainThreadPendingTaskDelay().is_zero()) {
task_environment_.FastForwardBy(base::TimeDelta());
}
task_environment_.FastForwardBy(base::TimeDelta());
}

} // namespace brave_ads::test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "brave/components/brave_ads/core/internal/creatives/conversions/creative_set_conversion_database_table.h"

#include "base/test/run_until.h"
#include "base/test/test_future.h"
#include "brave/components/brave_ads/core/internal/catalog/catalog_url_request_builder_util.h"
#include "brave/components/brave_ads/core/internal/common/test/mock_test_util.h"
Expand Down Expand Up @@ -36,17 +35,12 @@ TEST_F(BraveAdsConversionsDatabaseTableIntegrationTest,
const database::table::CreativeSetConversions database_table;

// Act & Assert
ASSERT_TRUE(base::test::RunUntil([&] {
base::test::TestFuture<bool, CreativeSetConversionList> test_future;
database_table.GetUnexpired(
test_future.GetCallback<bool, const CreativeSetConversionList&>());
const auto [success, creative_set_conversions] = test_future.Take();
if (!success || creative_set_conversions.empty()) {
return false;
}
EXPECT_THAT(creative_set_conversions, ::testing::SizeIs(2));
return true;
}));
base::test::TestFuture<bool, CreativeSetConversionList> test_future;
database_table.GetUnexpired(
test_future.GetCallback<bool, const CreativeSetConversionList&>());
const auto [success, creative_set_conversions] = test_future.Take();
EXPECT_TRUE(success);
EXPECT_THAT(creative_set_conversions, ::testing::SizeIs(2));
}

} // namespace brave_ads
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "brave/components/brave_ads/core/internal/creatives/notification_ads/creative_notification_ads_database_table.h"

#include "base/test/run_until.h"
#include "base/test/test_future.h"
#include "brave/components/brave_ads/core/internal/catalog/catalog_url_request_builder_util.h"
#include "brave/components/brave_ads/core/internal/common/test/mock_test_util.h"
Expand Down Expand Up @@ -36,20 +35,15 @@ TEST_F(BraveAdsCreativeNotificationAdsDatabaseTableIntegrationTest,
const database::table::CreativeNotificationAds database_table;

// Act & Assert
ASSERT_TRUE(base::test::RunUntil([&] {
base::test::TestFuture<bool, SegmentList, CreativeNotificationAdList>
test_future;
database_table.GetForSegments(
/*segments=*/{"technology & computing"},
test_future.GetCallback<bool, const SegmentList&,
CreativeNotificationAdList>());
const auto [success, segments, creative_ads] = test_future.Take();
if (!success || creative_ads.empty()) {
return false;
}
EXPECT_THAT(creative_ads, ::testing::SizeIs(2));
return true;
}));
base::test::TestFuture<bool, SegmentList, CreativeNotificationAdList>
test_future;
database_table.GetForSegments(
/*segments=*/{"technology & computing"},
test_future
.GetCallback<bool, const SegmentList&, CreativeNotificationAdList>());
const auto [success, segments, creative_ads] = test_future.Take();
EXPECT_TRUE(success);
EXPECT_THAT(creative_ads, ::testing::SizeIs(2));
}

} // namespace brave_ads
Loading