Skip to content

Commit

Permalink
[ads] Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tmancey committed Nov 29, 2023
1 parent e485c35 commit c2637bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion components/brave_ads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Users earn tokens by viewing privacy-first Brave Ads. Ads presented are based on the user's interests, as inferred from the user's browsing behavior. No personal data or browsing history should ever leave the browser.

For more details, refer to [glossary of terms](../../../brave/components/brave_ads/GLOSSARY.md).
For more details, refer to [glossary of terms](GLOSSARY.md).

Brave Ads is a [layered component](https://sites.google.com/a/chromium.org/dev/developers/design-documents/layered-components-design). It has the following structure:

Expand Down
2 changes: 2 additions & 0 deletions components/brave_ads/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

Platform independent implementation of the world's first global ad platform built on privacy, see [Brave Ads](https://brave.com/brave-ads-launch/).

For more details, refer to [glossary of terms](../GLOSSARY.md).

Please add to it!
39 changes: 21 additions & 18 deletions components/brave_ads/core/internal/common/unittest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ Override `SetUp` and call `SetUp` with `is_integration_test` set to `true` to te

Use the `GetAds` convenience function to access `AdsImpl`. i.e.

GetAds().TriggerNotificationAdEvent(/*placement_id*
"7ee858e8-6306-4317-88c3-9e7d58afad26", ConfirmationType::kClicked);
GetAds().TriggerNotificationAdEvent(
/*placement_id=*/"7ee858e8-6306-4317-88c3-9e7d58afad26",
ConfirmationType::kClicked);

## Mocking Command-Line Switches

Expand Down Expand Up @@ -76,7 +77,7 @@ Mocked responses for URL requests can be defined inline or read from a text file
net::HTTP_OK, "/response.json"
}
}
}
};

MockUrlResponses(ads_client_mock_, url_responses);

Expand All @@ -88,31 +89,33 @@ Inline or text file responses can contain `<time:period>` tags for mocking times
net::HTTP_OK, "An example response with a timestamp <time:+7 days> in the not too distant future"
}
}
}
};

MockUrlResponses(ads_client_mock_, url_responses);

`distant_past` is equivalent to `base::Time() + base::Microseconds(1)` and `distant_future` is defined as `Tuesday, 19 January 2038 03:14:07` in UTC.

You can add one or more responses per request, which will be returned in the given order, then will wrap back to the first response after mocking the last, i.e.

const URLResponseMap url_responses = {
"/foo/bar", {
{
net::HTTP_INTERNAL_SERVER_ERROR, "Program say to kill, to disassemble, to make dead"
},
{
net::HTTP_CREATED, "To me there's no creativity without boundaries"
const URLResponseMap url_responses2 = {
{
"/foo/bar", {
{
net::HTTP_INTERNAL_SERVER_ERROR, "Program say to kill, to disassemble, to make dead"
},
{
net::HTTP_CREATED, "To me there's no creativity without boundaries"
}
}
}
},
{
"/baz", {
{
net::HTTP_IM_A_TEAPOT, "Keep Calm & Drink Tea! L. Masinter, 1 April 1998"
},
{
"/baz", {
{
net::HTTP_IM_A_TEAPOT, "Keep Calm & Drink Tea! L. Masinter, 1 April 1998"
}
}
}
}
};

MockUrlResponses(ads_client_mock_, url_responses);

Expand Down

0 comments on commit c2637bd

Please sign in to comment.