Changeset 65348 in webkit


Ignore:
Timestamp:
Aug 13, 2010 7:16:42 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-13 Mihai Parparita <mihaip@chromium.org>

Reviewed by Dimitri Glazkov.

Form state restore tests fail on GTK build with r65340
https://bugs.webkit.org/show_bug.cgi?id=43998

Move form submits (and rest of test) to run during onload, to make sure
that the submit generates a history entry.

  • fast/forms/state-restore-to-non-autocomplete-form.html:
  • fast/forms/state-restore-to-non-edited-controls.html:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65340 r65348  
     12010-08-13  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Form state restore tests fail on GTK build with r65340
     6        https://bugs.webkit.org/show_bug.cgi?id=43998
     7
     8        Move form submits (and rest of test) to run during onload, to make sure
     9        that the submit generates a history entry.
     10
     11        * fast/forms/state-restore-to-non-autocomplete-form.html:
     12        * fast/forms/state-restore-to-non-edited-controls.html:
     13
    1142010-08-13  Mihai Parparita  <mihaip@chromium.org>
    215
  • trunk/LayoutTests/fast/forms/state-restore-to-non-autocomplete-form.html

    r65340 r65348  
    55<script src="../../fast/js/resources/js-test-pre.js"></script>
    66</head>
    7 <body>
     7<body onload="runTest()">
    88<p>Test to NOT restore form state to a form with autocomplete=off.</p>
    99<div id="console"></div>
     
    2525<script>
    2626
    27 var parent = document.getElementById('parent');
    28 var state = document.getElementById('emptyOnFirstVisit');
    29 if (!state.value) {
    30     // First visit.
    31     if (window.layoutTestController)
    32         layoutTestController.waitUntilDone();
    33     state.value = 'visited';
    34 
    35     document.getElementById('input1').value = 'value1';
    36     document.getElementById('textarea1').value = 'nice';
    37     document.getElementById('select1').value = 'Windows';
    38     document.getElementById('input2').value = 'value2';
    39     document.getElementById('textarea2').value = 'good';
    40     document.getElementById('select2').value = 'BSD';
    41     // Submit form in a timeout to make sure that we create a new back/forward list item.           
    42     setTimeout(function() {document.getElementById('form2').submit();}, 0);
    43 } else {
    44     // Second visit.
    45     debug('Controls in the first form should have their default values:');
    46     shouldBe('document.getElementById("input1").value', '""');
    47     shouldBe('document.getElementById("textarea1").value', '""');
    48     shouldBe('document.getElementById("select1").value', '"Mac"');
    49     debug('Controls in the second form should have edited values:');
    50     shouldBe('document.getElementById("input2").value', '"value2"');
    51     shouldBe('document.getElementById("textarea2").value', '"good"');
    52     shouldBe('document.getElementById("select2").value', '"BSD"');
    53     if (window.layoutTestController)
    54         layoutTestController.notifyDone();
    55 }
     27function runTest()
     28{
     29    var parent = document.getElementById('parent');
     30    var state = document.getElementById('emptyOnFirstVisit');
     31    if (!state.value) {
     32        // First visit.
     33        if (window.layoutTestController)
     34            layoutTestController.waitUntilDone();
     35        state.value = 'visited';
     36   
     37        document.getElementById('input1').value = 'value1';
     38        document.getElementById('textarea1').value = 'nice';
     39        document.getElementById('select1').value = 'Windows';
     40        document.getElementById('input2').value = 'value2';
     41        document.getElementById('textarea2').value = 'good';
     42        document.getElementById('select2').value = 'BSD';
     43        // Submit form in a timeout to make sure that we create a new back/forward list item.           
     44        setTimeout(function() {document.getElementById('form2').submit();}, 0);
     45    } else {
     46        // Second visit.
     47        debug('Controls in the first form should have their default values:');
     48        shouldBe('document.getElementById("input1").value', '""');
     49        shouldBe('document.getElementById("textarea1").value', '""');
     50        shouldBe('document.getElementById("select1").value', '"Mac"');
     51        debug('Controls in the second form should have edited values:');
     52        shouldBe('document.getElementById("input2").value', '"value2"');
     53        shouldBe('document.getElementById("textarea2").value', '"good"');
     54        shouldBe('document.getElementById("select2").value', '"BSD"');
     55        if (window.layoutTestController)
     56            layoutTestController.notifyDone();
     57    }
     58 }
    5659</script>
    5760</body>
  • trunk/LayoutTests/fast/forms/state-restore-to-non-edited-controls.html

    r65340 r65348  
    55<script src="../../fast/js/resources/js-test-pre.js"></script>
    66</head>
    7 <body>
     7<body onload="runTest()">
    88<p>Test to NOT save state for non-edited controls</p>
    99<div id="console"></div>
     
    2828}
    2929
    30 var parent = document.getElementById('parent');
    31 var state = document.getElementById('emptyOnFirstVisit');
    32 if (!state.value) {
    33     // First visit.
    34     if (window.layoutTestController)
    35         layoutTestController.waitUntilDone();
    36     state.value = 'visited';
    37     makeForm(parent, '1', '1', '1', '1', '1', '1', '1', '1');
    38 
    39     document.getElementById('text1').value = 'edit';
    40     // Submit form in a timeout to make sure that we create a new back/forward list item.           
    41     setTimeout(function() {document.getElementById('form1').submit();}, 0);
    42 } else {
    43     // Second visit.
    44     makeForm(parent, '2', '2', '2', '2', '2', '2', '2', '2');
    45 
    46     shouldBe('document.getElementById("button").value', '"2"');
    47     shouldBe('document.getElementById("hidden").value', '"2"');
    48     shouldBe('document.getElementById("image").value', '"2"');
    49     shouldBe('document.getElementById("reset").value', '"2"');
    50     shouldBe('document.getElementById("submit1").value', '"2"');
    51     shouldBe('document.getElementById("text1").value', '"edit"');
    52     shouldBe('document.getElementById("text2").value', '"2"');
    53     shouldBe('document.getElementById("textarea").value', '"2"');
    54 
    55     parent.innerHTML = '';
    56     if (window.layoutTestController)
    57         layoutTestController.notifyDone();
     30function runTest()
     31{
     32    var parent = document.getElementById('parent');
     33    var state = document.getElementById('emptyOnFirstVisit');
     34    if (!state.value) {
     35        // First visit.
     36        if (window.layoutTestController)
     37            layoutTestController.waitUntilDone();
     38        state.value = 'visited';
     39        makeForm(parent, '1', '1', '1', '1', '1', '1', '1', '1');
     40   
     41        document.getElementById('text1').value = 'edit';
     42        // Submit form in a timeout to make sure that we create a new back/forward list item.           
     43        setTimeout(function() {document.getElementById('form1').submit();}, 0);
     44    } else {
     45        // Second visit.
     46        makeForm(parent, '2', '2', '2', '2', '2', '2', '2', '2');
     47   
     48        shouldBe('document.getElementById("button").value', '"2"');
     49        shouldBe('document.getElementById("hidden").value', '"2"');
     50        shouldBe('document.getElementById("image").value', '"2"');
     51        shouldBe('document.getElementById("reset").value', '"2"');
     52        shouldBe('document.getElementById("submit1").value', '"2"');
     53        shouldBe('document.getElementById("text1").value', '"edit"');
     54        shouldBe('document.getElementById("text2").value', '"2"');
     55        shouldBe('document.getElementById("textarea").value', '"2"');
     56   
     57        parent.innerHTML = '';
     58        if (window.layoutTestController)
     59            layoutTestController.notifyDone();
     60    }
    5861}
    5962</script>
Note: See TracChangeset for help on using the changeset viewer.