forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
181 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Lorem Ipsum</title> | ||
<link rel="canonical" href="amps.html" > | ||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script> | ||
<style amp-custom> | ||
body { | ||
font-family: 'Georgia', Serif; | ||
} | ||
h1 { | ||
padding: 10px; | ||
} | ||
p { | ||
padding: 15px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>Lorem Ipsum</h1> | ||
<amp-img | ||
src="img/sea@1x.jpg" | ||
srcset="img/sea@1x.jpg 1x, img/sea@2x.jpg 2x" | ||
alt="Fusce pretium tempor justo, vitae consequat dolor maximus eget." | ||
placeholder | ||
width="360" height="216" layout="responsive" | ||
role='img'> | ||
</amp-img> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
Curabitur ullamcorper turpis vel commodo scelerisque. Phasellus | ||
luctus nunc ut elit cursus, et imperdiet diam vehicula. | ||
Duis et nisi sed urna blandit bibendum et sit amet erat. | ||
</p> | ||
|
||
<amp-analytics> | ||
<script type="application/json"> | ||
{ | ||
"requests": { | ||
"user-error": "http://localhost:9876/amp4test/request-bank/deposit/user-error-report-Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_12_6)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.115%20Safari%2F537.36" | ||
}, | ||
"triggers": { | ||
"user-error": { | ||
"on": "user-error", | ||
"request": "user-error" | ||
} | ||
} | ||
} | ||
</script> | ||
</amp-analytics> | ||
|
||
<amp-pixel src="https://foo.com/tracker/foo" | ||
layout="nodisplay" | ||
referrerpolicy="referrer-fail"></amp-pixel> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/** | ||
* Copyright 2017 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { | ||
withdrawRequest, | ||
//composeDocWithExtension, | ||
depositRequestUrl, | ||
} from '../../testing/test-helper'; | ||
|
||
import {createFixtureIframe} from '../../testing/iframe.js'; | ||
|
||
|
||
describe('user-error-reporting', function() { | ||
//this.timeout(15000); | ||
|
||
// describes.integration('amp-pixel integration test', { | ||
// body: `<amp-analytics> | ||
// { | ||
// "requests": { | ||
// "user-error": "${depositRequestUrl('user-error-repor')}" | ||
// }, | ||
// | ||
// "triggers": { | ||
// "user-error": { | ||
// "on": "user-error", | ||
// "request": "user-error" | ||
// } | ||
// }, | ||
// | ||
// "transport": { | ||
// "beacon": "false", | ||
// "xhrpost": "false", | ||
// "image": "true" | ||
// } | ||
// } | ||
// </amp-analytics> | ||
// <amp-pixel src="${depositRequestUrl('has-referrer')}">`, | ||
// }, env => { | ||
// it('should keep referrer if no referrerpolicy specified', () => { | ||
// return withdrawRequest(env.win, 'has-referrer').then(request => { | ||
// expect(request.headers.referer).to.be.ok; | ||
// }); | ||
// }); | ||
// }); | ||
|
||
|
||
// describes.integration('user-error-reporting integration test', { | ||
// extensions: 'amp-analytics', | ||
// body: | ||
// `<amp-analytics><script type="application/json"> | ||
// { | ||
// "requests": { | ||
// "user-error": "${depositRequestUrl('user-error-report')}" | ||
// }, | ||
// "triggers": { | ||
// "user-error": { | ||
// "on": "user-error", | ||
// "request": "user-error" | ||
// } | ||
// } | ||
// } | ||
// </script></amp-analytics> | ||
// | ||
// <amp-pixel src="https://foo.com/tracker/foo" | ||
// layout="nodisplay" | ||
// referrerpolicy="referrer-fail"></amp-pixel>`, | ||
// }, env => { | ||
// it('should ping correct host', () => { | ||
// return withdrawRequest(env.win, 'user-error-report').then(request => { | ||
// expect(request).to.be.ok; | ||
// }); | ||
// }); | ||
// }); | ||
|
||
describe('User-Error', function() { | ||
let fixture; | ||
|
||
beforeEach(() => { | ||
return createFixtureIframe( | ||
'test/fixtures/analytics-error-reporting.html', 500) | ||
.then(f => { | ||
fixture = f; | ||
}); | ||
}); | ||
|
||
it('should ping correct host', () => { | ||
return withdrawRequest(fixture.win, 'user-error-report').then(request => { | ||
expect(request).to.be.ok; | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,3 +122,6 @@ export function withdrawRequest(win, id) { | |
credentials: 'omit', | ||
}).then(res => res.json()); | ||
} | ||
|
||
|
||
|