| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Service Worker: clients.openWindow() tests (using testRunner)</title> | 2 <title>Service Worker: clients.openWindow() tests (using testRunner)</title> |
| 3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../resources/test-helpers.js"></script> | 5 <script src="../resources/test-helpers.js"></script> |
| 6 <script> | 6 <script> |
| 7 // This test is using testRunner to grant itself the notification permission and | 7 // This test is using testRunner to grant itself the notification permission and |
| 8 // to simulate a click on a notification. A couple of changes would allow it to | 8 // to simulate a click on a notification. A couple of changes would allow it to |
| 9 // be run as a manual test by other browser vendors. | 9 // be run as a manual test by other browser vendors. |
| 10 if (window.testRunner) | 10 if (window.testRunner) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 'openWindow() can open about:crash', | 44 'openWindow() can open about:crash', |
| 45 'openWindow() result: null', | 45 'openWindow() result: null', |
| 46 'openWindow() can not open an invalid url', | 46 'openWindow() can not open an invalid url', |
| 47 'openWindow() error is: TypeError', | 47 'openWindow() error is: TypeError', |
| 48 'openWindow() can not open view-source scheme', | 48 'openWindow() can not open view-source scheme', |
| 49 'openWindow() error is: TypeError', | 49 'openWindow() error is: TypeError', |
| 50 'openWindow() can not open file scheme', | 50 'openWindow() can not open file scheme', |
| 51 'openWindow() error is: TypeError', | 51 'openWindow() error is: TypeError', |
| 52 ]; | 52 ]; |
| 53 | 53 |
| 54 // LayoutTests on Mac do not open focused windows. | |
| 55 var isMac = navigator.platform.indexOf('Mac') == 0; | |
| 56 if (isMac) | |
| 57 expected[10] = ' focused: false'; | |
| 58 | |
| 59 function onMessage(e) { | 54 function onMessage(e) { |
| 60 var message = e.data; | 55 var message = e.data; |
| 61 | 56 |
| 62 if (typeof(message) === 'object') { | 57 if (typeof(message) === 'object') { |
| 63 if (message.type !== 'click') | 58 if (message.type !== 'click') |
| 64 return; | 59 return; |
| 65 if (window.testRunner) | 60 if (window.testRunner) |
| 66 testRunner.simulateWebNotificationClick(message.title, -1 /* action_in
dex */); | 61 testRunner.simulateWebNotificationClick(message.title, -1 /* action_in
dex */); |
| 67 return; | 62 return; |
| 68 } | 63 } |
| 69 | 64 |
| 70 if (message === 'quit') { | 65 if (message === 'quit') { |
| 71 assert_array_equals(result, expected, | 66 assert_array_equals(result, expected, |
| 72 'Worker should post back expected messages.'); | 67 'Worker should post back expected messages.'); |
| 73 service_worker_unregister_and_done(t, scope); | 68 service_worker_unregister_and_done(t, scope); |
| 74 } else { | 69 } else { |
| 75 result.push(message); | 70 result.push(message); |
| 76 } | 71 } |
| 77 } | 72 } |
| 78 }); | 73 }); |
| 79 </script> | 74 </script> |
| OLD | NEW |