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

Side by Side Diff: LayoutTests/http/tests/notifications/notification-data-property.html

Issue 1321643002: Fix notifications tests' use of assert_object_equals (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-data-reflection.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Notifications: The Notification object exposes the expected data prop erty.</title> 4 <title>Notifications: The Notification object exposes the expected data prop erty.</title>
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 // Tests that the Notification object exposes the data property per the 10 // Tests that the Notification object exposes the data property per the
11 // semantics defined by the specification. When the test is being ran 11 // semantics defined by the specification. When the test is being ran
12 // manually, grant Notification permission first. 12 // manually, grant Notification permission first.
13 13
14 function assertNotificationDataReflects(value) { 14 function assertNotificationDataReflects(value) {
15 var notification = new Notification('Title', { data: value }); 15 var notification = new Notification('Title', { data: value });
16 16
17 if (Array.isArray(value)) 17 if (typeof value === 'object')
18 assert_object_equals(notification.data, value); 18 assert_object_equals(notification.data, value);
19 else if (typeof value === 'object')
20 assert_array_equals(notification.data, value);
21 else 19 else
22 assert_equals(notification.data, value); 20 assert_equals(notification.data, value);
23 } 21 }
24 22
25 test(function () { 23 test(function () {
26 // Set notification's data of several type to a structured clone of opti ons's data. 24 // Set notification's data of several type to a structured clone of opti ons's data.
27 assertNotificationDataReflects(true); // Check Boolean type 25 assertNotificationDataReflects(true); // Check Boolean type
28 assertNotificationDataReflects(1024); // Check Number type 26 assertNotificationDataReflects(1024); // Check Number type
29 assertNotificationDataReflects(Number.NaN); // Check Number.NaN type 27 assertNotificationDataReflects(Number.NaN); // Check Number.NaN type
30 assertNotificationDataReflects('any data'); // Check String type 28 assertNotificationDataReflects('any data'); // Check String type
31 29
32 var cars = new Array('Saab', 'Volvo', 'BMW'); 30 var cars = new Array('Saab', 'Volvo', 'BMW');
33 assertNotificationDataReflects(cars); // Check Array type 31 assertNotificationDataReflects(cars); // Check Array type
34 32
35 var obj = { first: 'first', second: 'second'}; 33 var obj = { first: 'first', second: 'second'};
36 assertNotificationDataReflects(obj); // Check Object 34 assertNotificationDataReflects(obj); // Check Object
37 35
38 // Verifying the exception throwing behavior of the method. 36 // Verifying the exception throwing behavior of the method.
39 assert_throws('DataCloneError', function() { 37 assert_throws('DataCloneError', function() {
40 var notification = new Notification('Title', { data: function() { re turn 1; } }); 38 var notification = new Notification('Title', { data: function() { re turn 1; } });
41 }, 'Set function in data'); 39 }, 'Set function in data');
42 40
43 }, 'Checks the data of several type property exposed on the Notification obj ect.'); 41 }, 'Checks the data of several type property exposed on the Notification obj ect.');
44 </script> 42 </script>
45 </body> 43 </body>
46 </html> 44 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-data-reflection.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698