Skip to content

Commit

Permalink
[amp-ad] Add validator rules for always-serve-npa & block-rtc (#3…
Browse files Browse the repository at this point in the history
…2066)

* Validator rules + test

* update validator tests
  • Loading branch information
Micajuine Ho committed Jan 22, 2021
1 parent e5a682e commit 363f962
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions extensions/amp-ad/validator-amp-ad.protoascii
Expand Up @@ -65,6 +65,8 @@ tags: { # <amp-ad>
attrs: { name: "template" }
attrs: { name: "type" mandatory: true }
attrs: { name: "sticky" value: "" }
attrs: { name: "always-serve-npa" }
attrs: { name: "block-rtc" }
attr_lists: "extended-amp-global"
spec_url: "https://amp.dev/documentation/components/amp-ad/"
amp_layout: {
Expand Down Expand Up @@ -146,6 +148,8 @@ tags: { # <amp-ad data-multi-size>
}
disallowed_value_regex: "__amp_source_origin"
}
attrs: { name: "always-serve-npa" }
attrs: { name: "block-rtc" }
attrs: { name: "type" mandatory: true }
attr_lists: "extended-amp-global"
spec_url: "https://amp.dev/documentation/components/amp-ad/"
Expand Down Expand Up @@ -223,6 +227,8 @@ tags: { # <amp-embed>
disallowed_value_regex: "__amp_source_origin"
}
attrs: { name: "type" mandatory: true }
attrs: { name: "always-serve-npa" }
attrs: { name: "block-rtc" }
attr_lists: "extended-amp-global"
spec_url: "https://amp.dev/documentation/components/amp-ad/"
amp_layout: {
Expand Down Expand Up @@ -258,6 +264,8 @@ tags: { # <amp-embed data-multi-size>
}
attrs: { name: "json" }
attrs: { name: "rtc-config" }
attrs: { name: "always-serve-npa" }
attrs: { name: "block-rtc" }
attrs: {
name: "src"
value_url: {
Expand Down
15 changes: 15 additions & 0 deletions validator/testdata/feature_tests/ads.html
Expand Up @@ -650,6 +650,21 @@ <h2>Doubleclick with RTC config</h2>
rtc-config="{foo: bar}">
</amp-ad>

<h2>Doubleclick with block-rtc attribute</h2>
<amp-ad width="320" height="50"
type="doubleclick"
data-slot="/4119129/mobile_ad_banner"
block-rtc="gdpr"
rtc-config="{foo: bar}">
</amp-ad>

<h2>Doubleclick with always-serve-npa attribute</h2>
<amp-ad width="320" height="50"
type="doubleclick"
data-slot="/4119129/mobile_ad_banner"
always-serve-npa="gdpr">
</amp-ad>

<h2>Doubleclick with JSON based parameters</h2>
<amp-ad width="320" height="50"
type="doubleclick"
Expand Down
15 changes: 15 additions & 0 deletions validator/testdata/feature_tests/ads.out
Expand Up @@ -651,6 +651,21 @@ PASS
| rtc-config="{foo: bar}">
| </amp-ad>
|
| <h2>Doubleclick with block-rtc attribute</h2>
| <amp-ad width="320" height="50"
| type="doubleclick"
| data-slot="/4119129/mobile_ad_banner"
| block-rtc="gdpr"
| rtc-config="{foo: bar}">
| </amp-ad>
|
| <h2>Doubleclick with always-serve-npa attribute</h2>
| <amp-ad width="320" height="50"
| type="doubleclick"
| data-slot="/4119129/mobile_ad_banner"
| always-serve-npa="gdpr">
| </amp-ad>
|
| <h2>Doubleclick with JSON based parameters</h2>
| <amp-ad width="320" height="50"
| type="doubleclick"
Expand Down

0 comments on commit 363f962

Please sign in to comment.