Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html

Issue 1095093002: Add layouttest for notification properties of persistent notification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html
diff --git a/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html
similarity index 58%
copy from LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
copy to LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html
index 6f2f52f40927a851e64966042d1798a96f02f8ce..e7f0fc6813ae7352cc28cd681b4fd6a16ea686a6 100644
--- a/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
+++ b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>Notifications: ServiceWorkerRegistration.showNotification() fails on too much data.</title>
+ <title>Notifications: Verifying the exception throwing behavior, when data set invalid value such as method.</title>
Peter Beverloo 2015/04/21 12:26:36 micro nit: as *a* method.
Sanghyun Park 2015/04/21 13:38:34 Done.
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../serviceworker/resources/test-helpers.js"></script>
@@ -9,9 +9,8 @@
</head>
<body>
<script>
- // Tests that the showNotification() function rejects the promise when the
- // developer-provided data exceeds a megabyte. This is an implementation-
- // defined limit to prevent abuse.
+ // Tests that the showNotification() function rejects the returned promise with a
+ // DataCloneError when data set invalid data such as method.
async_test(function(test) {
var scope = 'resources/scope/' + location.pathname,
@@ -25,17 +24,17 @@
// (1) Display a Web Notification from the document.
assert_inherits(workerInfo.registration, 'showNotification', 'showNotification() must be exposed.');
- return workerInfo.registration.showNotification(scope, {
- body: 'Hello, world!',
- icon: '/icon.png',
- data: new Array(1024 * 1024 * 2).join('.'), // 2 million dots
+ workerInfo.registration.showNotification(scope, {
+ data: function() { return 1; }
+ }).then(function() {
Peter Beverloo 2015/04/21 12:26:36 then(unreached_fulfillment(test))
Sanghyun Park 2015/04/21 13:38:34 Done.
+ assert_unreached('showNotification() is expected to reject.');
+ }).catch(function(error) {
+ assert_equals(error.name, 'DataCloneError');
+ test.done();
});
- }).then(unreached_fulfillment(test))
- .catch(function() {
- test.done();
- });
+ }).catch(unreached_rejection(test));
- }, 'ServiceWorkerRegistration.showNotification() fails on too much data.');
+ }, 'showNotification() must reject If data is invalid value.');
Peter Beverloo 2015/04/21 12:26:36 micro nit: s/If/if/
Sanghyun Park 2015/04/21 13:38:34 Done.
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698