Skip to content

Commit

Permalink
Merge pull request #11379 from /issues/19860
Browse files Browse the repository at this point in the history
Add new tab page ad serving support to the ads library
  • Loading branch information
tmancey authored Dec 10, 2021
2 parents 8c480f5 + 7807c57 commit 580ef81
Show file tree
Hide file tree
Showing 99 changed files with 2,710 additions and 1,294 deletions.
9 changes: 7 additions & 2 deletions components/brave_ads/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ source_set("brave_ads_unit_tests") {
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_serving/ad_targeting/models/behavioral/purchase_intent/purchase_intent_model_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_serving/ad_targeting/models/contextual/text_classification/text_classification_model_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_serving/inline_content_ads/inline_content_ad_serving_test.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_serving/new_tab_page_ads/new_tab_page_ad_serving_test.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_targeting/ad_targeting_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_targeting/ad_targeting_user_model_builder_unittest_util.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/ad_targeting/ad_targeting_user_model_builder_unittest_util.h",
Expand All @@ -66,6 +67,8 @@ source_set("brave_ads_unit_tests") {
"//brave/vendor/bat-native-ads/src/bat/ads/internal/bundle/creative_ad_unittest_util.h",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/bundle/creative_inline_content_ad_unittest_util.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/bundle/creative_inline_content_ad_unittest_util.h",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/bundle/creative_new_tab_page_ad_unittest_util.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/bundle/creative_new_tab_page_ad_unittest_util.h",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/calendar_leap_year_util_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/calendar_util_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/catalog/catalog_unittest.cc",
Expand All @@ -87,6 +90,7 @@ source_set("brave_ads_unit_tests") {
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_ads_database_table_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_inline_content_ads_database_table_test.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_inline_content_ads_database_table_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_new_tab_page_ad_wallpapers_database_table_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_new_tab_page_ads_database_table_test.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_new_tab_page_ads_database_table_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/database/tables/creative_promoted_content_ads_database_table_test.cc",
Expand All @@ -103,13 +107,16 @@ source_set("brave_ads_unit_tests") {
"//brave/vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/eligible_ads_predictor_util_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/inline_content_ads/eligible_inline_content_ads_v1_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/inline_content_ads/eligible_inline_content_ads_v2_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_v1_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_v2_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/eligible_ads/sample_ads_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/ad_rewards/ad_rewards_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/ad_serving/ad_serving_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/anti_targeting/anti_targeting_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/bandits/epsilon_greedy_bandit_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/conversions/conversions_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/inline_content_ads/inline_content_ads_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/new_tab_page_ads/new_tab_page_ads_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/purchase_intent/purchase_intent_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/text_classification/text_classification_features_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/features/user_activity/user_activity_features_unittest.cc",
Expand All @@ -121,12 +128,10 @@ source_set("brave_ads_unit_tests") {
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/dismissed_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/marked_as_inappropriate_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/marked_to_no_longer_receive_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/new_tab_page_ad_uuid_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/per_day_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/per_hour_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/per_month_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/per_week_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/promoted_content_ad_uuid_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/split_test_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/subdivision_targeting_frequency_cap_unittest.cc",
"//brave/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/exclusion_rules/total_max_frequency_cap_unittest.cc",
Expand Down
36 changes: 30 additions & 6 deletions vendor/bat-native-ads/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ source_set("headers") {
"include/bat/ads/export.h",
"include/bat/ads/inline_content_ad_info.h",
"include/bat/ads/new_tab_page_ad_info.h",
"include/bat/ads/new_tab_page_ad_wallpaper_focal_point_info.h",
"include/bat/ads/new_tab_page_ad_wallpaper_info.h",
"include/bat/ads/new_tab_page_ad_wallpaper_info_aliases.h",
"include/bat/ads/page_transition_types.h",
"include/bat/ads/pref_names.h",
"include/bat/ads/promoted_content_ad_info.h",
Expand Down Expand Up @@ -236,6 +239,9 @@ source_set("ads") {
"src/bat/ads/internal/ad_serving/inline_content_ads/inline_content_ad_serving.cc",
"src/bat/ads/internal/ad_serving/inline_content_ads/inline_content_ad_serving.h",
"src/bat/ads/internal/ad_serving/inline_content_ads/inline_content_ad_serving_observer.h",
"src/bat/ads/internal/ad_serving/new_tab_page_ads/new_tab_page_ad_serving.cc",
"src/bat/ads/internal/ad_serving/new_tab_page_ads/new_tab_page_ad_serving.h",
"src/bat/ads/internal/ad_serving/new_tab_page_ads/new_tab_page_ad_serving_observer.h",
"src/bat/ads/internal/ad_targeting/ad_targeting.cc",
"src/bat/ads/internal/ad_targeting/ad_targeting.h",
"src/bat/ads/internal/ad_targeting/ad_targeting_constants.h",
Expand Down Expand Up @@ -311,8 +317,6 @@ source_set("ads") {
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad.h",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_builder.cc",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_builder.h",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_exclusion_rules.cc",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_exclusion_rules.h",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_observer.h",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_permission_rules.cc",
"src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad_permission_rules.h",
Expand Down Expand Up @@ -363,6 +367,11 @@ source_set("ads") {
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_info.cc",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_info.h",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_info_aliases.h",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_wallpaper_focal_point_info.cc",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_wallpaper_focal_point_info.h",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_wallpaper_info.cc",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_wallpaper_info.h",
"src/bat/ads/internal/bundle/creative_new_tab_page_ad_wallpaper_info_aliases.h",
"src/bat/ads/internal/bundle/creative_promoted_content_ad_info.cc",
"src/bat/ads/internal/bundle/creative_promoted_content_ad_info.h",
"src/bat/ads/internal/bundle/creative_promoted_content_ad_info_aliases.h",
Expand Down Expand Up @@ -407,6 +416,11 @@ source_set("ads") {
"src/bat/ads/internal/catalog/catalog_inline_content_ad_payload_info.h",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_payload_info.cc",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_payload_info.h",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_wallpaper_focal_point_info.cc",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_wallpaper_focal_point_info.h",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_wallpaper_info.cc",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_wallpaper_info.h",
"src/bat/ads/internal/catalog/catalog_new_tab_page_ad_wallpaper_info_aliases.h",
"src/bat/ads/internal/catalog/catalog_os_info.cc",
"src/bat/ads/internal/catalog/catalog_os_info.h",
"src/bat/ads/internal/catalog/catalog_os_info_aliases.h",
Expand Down Expand Up @@ -489,6 +503,8 @@ source_set("ads") {
"src/bat/ads/internal/database/tables/creative_inline_content_ads_database_table.cc",
"src/bat/ads/internal/database/tables/creative_inline_content_ads_database_table.h",
"src/bat/ads/internal/database/tables/creative_inline_content_ads_database_table_aliases.h",
"src/bat/ads/internal/database/tables/creative_new_tab_page_ad_wallpapers_database_table.cc",
"src/bat/ads/internal/database/tables/creative_new_tab_page_ad_wallpapers_database_table.h",
"src/bat/ads/internal/database/tables/creative_new_tab_page_ads_database_table.cc",
"src/bat/ads/internal/database/tables/creative_new_tab_page_ads_database_table.h",
"src/bat/ads/internal/database/tables/creative_new_tab_page_ads_database_table_aliases.h",
Expand Down Expand Up @@ -532,6 +548,14 @@ source_set("ads") {
"src/bat/ads/internal/eligible_ads/inline_content_ads/eligible_inline_content_ads_v1.h",
"src/bat/ads/internal/eligible_ads/inline_content_ads/eligible_inline_content_ads_v2.cc",
"src/bat/ads/internal/eligible_ads/inline_content_ads/eligible_inline_content_ads_v2.h",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_base.cc",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_base.h",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_factory.cc",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_factory.h",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_v1.cc",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_v1.h",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_v2.cc",
"src/bat/ads/internal/eligible_ads/new_tab_page_ads/eligible_new_tab_page_ads_v2.h",
"src/bat/ads/internal/eligible_ads/round_robin_ads.h",
"src/bat/ads/internal/eligible_ads/round_robin_advertisers.h",
"src/bat/ads/internal/eligible_ads/sample_ads.h",
Expand All @@ -553,6 +577,8 @@ source_set("ads") {
"src/bat/ads/internal/features/features_util.h",
"src/bat/ads/internal/features/inline_content_ads/inline_content_ads_features.cc",
"src/bat/ads/internal/features/inline_content_ads/inline_content_ads_features.h",
"src/bat/ads/internal/features/new_tab_page_ads/new_tab_page_ads_features.cc",
"src/bat/ads/internal/features/new_tab_page_ads/new_tab_page_ads_features.h",
"src/bat/ads/internal/features/purchase_intent/purchase_intent_features.cc",
"src/bat/ads/internal/features/purchase_intent/purchase_intent_features.h",
"src/bat/ads/internal/features/text_classification/text_classification_features.cc",
Expand All @@ -577,8 +603,6 @@ source_set("ads") {
"src/bat/ads/internal/frequency_capping/exclusion_rules/marked_as_inappropriate_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/marked_to_no_longer_receive_frequency_cap.cc",
"src/bat/ads/internal/frequency_capping/exclusion_rules/marked_to_no_longer_receive_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/new_tab_page_ad_uuid_frequency_cap.cc",
"src/bat/ads/internal/frequency_capping/exclusion_rules/new_tab_page_ad_uuid_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/per_day_frequency_cap.cc",
"src/bat/ads/internal/frequency_capping/exclusion_rules/per_day_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/per_hour_frequency_cap.cc",
Expand All @@ -587,8 +611,6 @@ source_set("ads") {
"src/bat/ads/internal/frequency_capping/exclusion_rules/per_month_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/per_week_frequency_cap.cc",
"src/bat/ads/internal/frequency_capping/exclusion_rules/per_week_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/promoted_content_ad_uuid_frequency_cap.cc",
"src/bat/ads/internal/frequency_capping/exclusion_rules/promoted_content_ad_uuid_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/split_test_frequency_cap.cc",
"src/bat/ads/internal/frequency_capping/exclusion_rules/split_test_frequency_cap.h",
"src/bat/ads/internal/frequency_capping/exclusion_rules/subdivision_targeting_frequency_cap.cc",
Expand Down Expand Up @@ -888,6 +910,8 @@ source_set("ads") {
"src/bat/ads/internal/user_activity/user_activity_util.cc",
"src/bat/ads/internal/user_activity/user_activity_util.h",
"src/bat/ads/new_tab_page_ad_info.cc",
"src/bat/ads/new_tab_page_ad_wallpaper_focal_point_info.cc",
"src/bat/ads/new_tab_page_ad_wallpaper_info.cc",
"src/bat/ads/pref_names.cc",
"src/bat/ads/promoted_content_ad_info.cc",
"src/bat/ads/statement_info.cc",
Expand Down
Binary file modified vendor/bat-native-ads/data/test/database_issue_17199.sqlite
Binary file not shown.
Binary file modified vendor/bat-native-ads/data/test/database_issue_17231.sqlite
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions vendor/bat-native-ads/include/bat/ads/ads.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class ADS_EXPORT Ads {
const std::string& uuid,
const mojom::AdNotificationEventType event_type) = 0;

// Should be called to get an eligible new tab page ad
virtual void GetNewTabPageAd(GetNewTabPageAdCallback callback) = 0;

// Should be called when a user views or clicks a new tab page ad
virtual void OnNewTabPageAdEvent(
const std::string& uuid,
Expand Down
4 changes: 4 additions & 0 deletions vendor/bat-native-ads/include/bat/ads/ads_aliases.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
namespace ads {

struct InlineContentAdInfo;
struct NewTabPageAdInfo;
struct StatementInfo;

using InitializeCallback = std::function<void(const bool)>;
using ShutdownCallback = std::function<void(const bool)>;

using RemoveAllHistoryCallback = std::function<void(const bool)>;

using GetNewTabPageAdCallback =
std::function<void(const bool, const NewTabPageAdInfo&)>;

using GetInlineContentAdCallback = std::function<
void(const bool, const std::string&, const InlineContentAdInfo&)>;

Expand Down
3 changes: 3 additions & 0 deletions vendor/bat-native-ads/include/bat/ads/new_tab_page_ad_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "bat/ads/ad_info.h"
#include "bat/ads/export.h"
#include "bat/ads/new_tab_page_ad_wallpaper_info_aliases.h"

namespace ads {

Expand All @@ -24,7 +25,9 @@ struct ADS_EXPORT NewTabPageAdInfo final : AdInfo {
bool FromJson(const std::string& json);

std::string company_name;
std::string image_url;
std::string alt;
NewTabPageAdWallpaperList wallpapers;
};

} // namespace ads
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* 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_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_FOCAL_POINT_INFO_H_
#define BRAVE_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_FOCAL_POINT_INFO_H_

#include "bat/ads/export.h"

namespace ads {

struct ADS_EXPORT NewTabPageAdWallpaperFocalPointInfo final {
NewTabPageAdWallpaperFocalPointInfo();
NewTabPageAdWallpaperFocalPointInfo(
const NewTabPageAdWallpaperFocalPointInfo& info);
~NewTabPageAdWallpaperFocalPointInfo();

int x;
int y;
};

} // namespace ads

#endif // BRAVE_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_FOCAL_POINT_INFO_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* 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_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_INFO_H_
#define BRAVE_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_INFO_H_

#include <string>

#include "bat/ads/export.h"
#include "bat/ads/new_tab_page_ad_wallpaper_focal_point_info.h"

namespace ads {

struct ADS_EXPORT NewTabPageAdWallpaperInfo final {
NewTabPageAdWallpaperInfo();
NewTabPageAdWallpaperInfo(const NewTabPageAdWallpaperInfo& info);
~NewTabPageAdWallpaperInfo();

std::string image_url;
NewTabPageAdWallpaperFocalPointInfo focal_point;
};

} // namespace ads

#endif // BRAVE_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_INFO_H_
Original file line number Diff line number Diff line change
@@ -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_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_INFO_ALIASES_H_
#define BRAVE_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_INFO_ALIASES_H_

#include <vector>

#include "bat/ads/new_tab_page_ad_wallpaper_info.h"

namespace ads {

using NewTabPageAdWallpaperList = std::vector<NewTabPageAdWallpaperInfo>;

} // namespace ads

#endif // BRAVE_VENDOR_BAT_NATIVE_ADS_INCLUDE_BAT_ADS_NEW_TAB_PAGE_AD_WALLPAPER_INFO_ALIASES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ struct InlineContentAdInfo;

class InlineContentAdServingObserver : public base::CheckedObserver {
public:
// Invoked when an ad notification is served
// Invoked when an inline content ad is served
virtual void OnDidServeInlineContentAd(const InlineContentAdInfo& ad) {}

// Invoked when an ad notification fails to serve
// Invoked when an inline content ad fails to serve
virtual void OnFailedToServeInlineContentAd() {}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,15 @@ TEST_F(BatAdsInlineContentAdServingTest, ServeAd) {
Save(creative_ads);

// Act
const InlineContentAdInfo expected_ad = BuildInlineContentAd(creative_ad);

ad_serving_->MaybeServeAd(
"200x100",
[&expected_ad](const bool success, const std::string& dimensions,
[&creative_ad](const bool success, const std::string& dimensions,
const InlineContentAdInfo& ad) {
ASSERT_TRUE(success);

InlineContentAdInfo expected_ad = BuildInlineContentAd(creative_ad);
expected_ad.uuid = ad.uuid;

EXPECT_EQ(expected_ad, ad);
});

Expand Down
Loading

0 comments on commit 580ef81

Please sign in to comment.