Add missing RemoveObserver calls from Brave Ads tests
This commit is contained in:
@@ -61,6 +61,12 @@ class BatAdsAccountTest : public AccountObserver, public UnitTestBase {
|
||||
account_->AddObserver(this);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
account_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void Save(const CreativeNotificationAdList& creative_ads) {
|
||||
database::table::CreativeNotificationAds database_table;
|
||||
database_table.Save(creative_ads,
|
||||
|
||||
+13
-3
@@ -37,12 +37,22 @@ constexpr char kInvalidCreativeInstanceId[] = "";
|
||||
class BatAdsInlineContentAdTest : public InlineContentAdObserver,
|
||||
public UnitTestBase {
|
||||
protected:
|
||||
BatAdsInlineContentAdTest()
|
||||
: inline_content_ad_(std::make_unique<InlineContentAd>()) {
|
||||
BatAdsInlineContentAdTest() = default;
|
||||
|
||||
~BatAdsInlineContentAdTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
UnitTestBase::SetUp();
|
||||
|
||||
inline_content_ad_ = std::make_unique<InlineContentAd>();
|
||||
inline_content_ad_->AddObserver(this);
|
||||
}
|
||||
|
||||
~BatAdsInlineContentAdTest() override = default;
|
||||
void TearDown() override {
|
||||
inline_content_ad_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void OnInlineContentAdServed(const InlineContentAdInfo& ad) override {
|
||||
ad_ = ad;
|
||||
|
||||
+6
@@ -55,6 +55,12 @@ class BatAdsNewTabPageAdIfAdsDisabledTest : public NewTabPageAdObserver,
|
||||
new_tab_page_ad_->AddObserver(this);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
new_tab_page_ad_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void OnNewTabPageAdServed(const NewTabPageAdInfo& ad) override {
|
||||
ad_ = ad;
|
||||
did_serve_ad_ = true;
|
||||
|
||||
Vendored
+13
-3
@@ -40,12 +40,22 @@ constexpr char kInvalidCreativeInstanceId[] = "";
|
||||
class BatAdsNewTabPageAdTest : public NewTabPageAdObserver,
|
||||
public UnitTestBase {
|
||||
protected:
|
||||
BatAdsNewTabPageAdTest()
|
||||
: new_tab_page_ad_(std::make_unique<NewTabPageAd>()) {
|
||||
BatAdsNewTabPageAdTest() = default;
|
||||
|
||||
~BatAdsNewTabPageAdTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
UnitTestBase::SetUp();
|
||||
|
||||
new_tab_page_ad_ = std::make_unique<NewTabPageAd>();
|
||||
new_tab_page_ad_->AddObserver(this);
|
||||
}
|
||||
|
||||
~BatAdsNewTabPageAdTest() override = default;
|
||||
void TearDown() override {
|
||||
new_tab_page_ad_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void OnNewTabPageAdServed(const NewTabPageAdInfo& ad) override {
|
||||
ad_ = ad;
|
||||
|
||||
Vendored
+13
-3
@@ -32,12 +32,22 @@ constexpr char kPlacementId[] = "d2ef9bb0-a0dc-472c-bc49-62105bb6da68";
|
||||
class BatAdsNotificationAdTest : public NotificationAdObserver,
|
||||
public UnitTestBase {
|
||||
protected:
|
||||
BatAdsNotificationAdTest()
|
||||
: notification_ad_(std::make_unique<NotificationAd>()) {
|
||||
BatAdsNotificationAdTest() = default;
|
||||
|
||||
~BatAdsNotificationAdTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
UnitTestBase::SetUp();
|
||||
|
||||
notification_ad_ = std::make_unique<NotificationAd>();
|
||||
notification_ad_->AddObserver(this);
|
||||
}
|
||||
|
||||
~BatAdsNotificationAdTest() override = default;
|
||||
void TearDown() override {
|
||||
notification_ad_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void OnNotificationAdServed(const NotificationAdInfo& ad) override {
|
||||
ad_ = ad;
|
||||
|
||||
+13
-3
@@ -39,12 +39,22 @@ constexpr char kInvalidCreativeInstanceId[] = "";
|
||||
class BatAdsPromotedContentAdTest : public PromotedContentAdObserver,
|
||||
public UnitTestBase {
|
||||
protected:
|
||||
BatAdsPromotedContentAdTest()
|
||||
: promoted_content_ad_(std::make_unique<PromotedContentAd>()) {
|
||||
BatAdsPromotedContentAdTest() = default;
|
||||
|
||||
~BatAdsPromotedContentAdTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
UnitTestBase::SetUp();
|
||||
|
||||
promoted_content_ad_ = std::make_unique<PromotedContentAd>();
|
||||
promoted_content_ad_->AddObserver(this);
|
||||
}
|
||||
|
||||
~BatAdsPromotedContentAdTest() override = default;
|
||||
void TearDown() override {
|
||||
promoted_content_ad_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void OnPromotedContentAdServed(const PromotedContentAdInfo& ad) override {
|
||||
ad_ = ad;
|
||||
|
||||
Vendored
+13
-3
@@ -106,12 +106,22 @@ void ExpectConversionCountEquals(const size_t expected_count) {
|
||||
class BatAdsSearchResultAdTest : public SearchResultAdObserver,
|
||||
public UnitTestBase {
|
||||
protected:
|
||||
BatAdsSearchResultAdTest()
|
||||
: search_result_ad_(std::make_unique<SearchResultAd>()) {
|
||||
BatAdsSearchResultAdTest() = default;
|
||||
|
||||
~BatAdsSearchResultAdTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
UnitTestBase::SetUp();
|
||||
|
||||
search_result_ad_ = std::make_unique<SearchResultAd>();
|
||||
search_result_ad_->AddObserver(this);
|
||||
}
|
||||
|
||||
~BatAdsSearchResultAdTest() override = default;
|
||||
void TearDown() override {
|
||||
search_result_ad_->RemoveObserver(this);
|
||||
|
||||
UnitTestBase::TearDown();
|
||||
}
|
||||
|
||||
void FireEvent(const mojom::SearchResultAdPtr& ad_mojom,
|
||||
const mojom::SearchResultAdEventType event_type) {
|
||||
|
||||
Reference in New Issue
Block a user