| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script> | 2 <script> |
| 3 function expect(test, msg) { | 3 function expect(test, msg) { |
| 4 if (test) | 4 if (test) |
| 5 return true; | 5 return true; |
| 6 | 6 |
| 7 log.innerText = 'FAIL: expected ' + msg; | 7 log.innerText = 'FAIL: expected ' + msg; |
| 8 testRunner.notifyDone(); | 8 testRunner.notifyDone(); |
| 9 return false; | 9 return false; |
| 10 } | 10 } |
| 11 | 11 |
| 12 function testBackspaceNavigatesBack() { | 12 function testBackspaceNavigatesBack() { |
| 13 eventSender.keyDown('\u0008'); | 13 eventSender.keyDown('Backspace'); |
| 14 | 14 |
| 15 // We expected to navigate; set a timeout that causes the test | 15 // We expected to navigate; set a timeout that causes the test |
| 16 // to fail quickly if we didn't navigate. | 16 // to fail quickly if we didn't navigate. |
| 17 setTimeout(function() { | 17 setTimeout(function() { |
| 18 expect(false, 'navigation back'); | 18 expect(false, 'navigation back'); |
| 19 }, 500); | 19 }, 500); |
| 20 } | 20 } |
| 21 | 21 |
| 22 function doStep(step, location) { | 22 function doStep(step, location) { |
| 23 // This function is called on each page load. | 23 // This function is called on each page load. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 // Test unix behavior: that backspace does not go back. | 66 // Test unix behavior: that backspace does not go back. |
| 67 internals.settings.setEditingBehavior('unix'); | 67 internals.settings.setEditingBehavior('unix'); |
| 68 | 68 |
| 69 // We expect backspace to *not* navigate. | 69 // We expect backspace to *not* navigate. |
| 70 // Start a navigation to the success page; if backspace causes us to go
back, | 70 // Start a navigation to the success page; if backspace causes us to go
back, |
| 71 // it will cancel that navigation and navigate us elsewhere, causing the
test | 71 // it will cancel that navigation and navigate us elsewhere, causing the
test |
| 72 // to fail. | 72 // to fail. |
| 73 document.location = '?test-complete'; | 73 document.location = '?test-complete'; |
| 74 eventSender.keyDown('\u0008'); | 74 eventSender.keyDown('Backspace'); |
| 75 | 75 |
| 76 break; | 76 break; |
| 77 case 7: | 77 case 7: |
| 78 if (!expect(location == 'test-complete', 'navigation to test-complete')) | 78 if (!expect(location == 'test-complete', 'navigation to test-complete')) |
| 79 return; | 79 return; |
| 80 log.innerText += 'PASS: test complete'; | 80 log.innerText += 'PASS: test complete'; |
| 81 sessionStorage.removeItem('step'); | 81 sessionStorage.removeItem('step'); |
| 82 testRunner.notifyDone(); | 82 testRunner.notifyDone(); |
| 83 } | 83 } |
| 84 } | 84 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 setTimeout(function() { | 100 setTimeout(function() { |
| 101 doStep(sessionStorage.step++, location.search.substring(1)); | 101 doStep(sessionStorage.step++, location.search.substring(1)); |
| 102 }, 0) | 102 }, 0) |
| 103 } | 103 } |
| 104 </script> | 104 </script> |
| 105 <body>This test passes if it says PASS below. | 105 <body>This test passes if it says PASS below. |
| 106 <div id=log></div> | 106 <div id=log></div> |
| 107 </body> | 107 </body> |
| OLD | NEW |