Changeset 60667 in webkit


Ignore:
Timestamp:
Jun 4, 2010 2:32:19 AM (14 years ago)
Author:
steveblock@google.com
Message:

2010-06-04 Steve Block <steveblock@google.com>

Reviewed by Jeremy Orlow.

Geolocation LayoutTests should make more careful use of LayoutTestController
https://bugs.webkit.org/show_bug.cgi?id=39994

Guards calls to LayoutTestController methods with 'if (window.layoutTestController)'
and adds test output to make it clear if the test can not pass without LayoutTestController.
Also removes superfluous calls to LayoutTestController.waitUntilDone(), which are now made
by js-test-post.js.

  • fast/dom/Geolocation/callback-exception-expected.txt:
  • fast/dom/Geolocation/script-tests/callback-exception.js:
  • fast/dom/Geolocation/script-tests/error.js:
  • fast/dom/Geolocation/script-tests/maximum-age.js:
  • fast/dom/Geolocation/script-tests/notimer-after-unload.js:
  • fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js:
  • fast/dom/Geolocation/script-tests/permission-denied-already-error.js:
  • fast/dom/Geolocation/script-tests/permission-denied-already-success.js:
  • fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js:
  • fast/dom/Geolocation/script-tests/permission-denied.js:
  • fast/dom/Geolocation/script-tests/position-string.js:
  • fast/dom/Geolocation/script-tests/reentrant-error.js:
  • fast/dom/Geolocation/script-tests/reentrant-success.js:
  • fast/dom/Geolocation/script-tests/success.js:
  • fast/dom/Geolocation/script-tests/timeout-clear-watch.js:
  • fast/dom/Geolocation/script-tests/timeout-zero.js:
  • fast/dom/Geolocation/script-tests/timeout.js:
  • fast/dom/Geolocation/script-tests/watch.js:
Location:
trunk/LayoutTests
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r60664 r60667  
     12010-06-04  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Geolocation LayoutTests should make more careful use of LayoutTestController
     6        https://bugs.webkit.org/show_bug.cgi?id=39994
     7
     8        Guards calls to LayoutTestController methods with 'if (window.layoutTestController)'
     9        and adds test output to make it clear if the test can not pass without LayoutTestController.
     10        Also removes superfluous calls to LayoutTestController.waitUntilDone(), which are now made
     11        by js-test-post.js.
     12
     13        * fast/dom/Geolocation/callback-exception-expected.txt:
     14        * fast/dom/Geolocation/script-tests/callback-exception.js:
     15        * fast/dom/Geolocation/script-tests/error.js:
     16        * fast/dom/Geolocation/script-tests/maximum-age.js:
     17        * fast/dom/Geolocation/script-tests/notimer-after-unload.js:
     18        * fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js:
     19        * fast/dom/Geolocation/script-tests/permission-denied-already-error.js:
     20        * fast/dom/Geolocation/script-tests/permission-denied-already-success.js:
     21        * fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js:
     22        * fast/dom/Geolocation/script-tests/permission-denied.js:
     23        * fast/dom/Geolocation/script-tests/position-string.js:
     24        * fast/dom/Geolocation/script-tests/reentrant-error.js:
     25        * fast/dom/Geolocation/script-tests/reentrant-success.js:
     26        * fast/dom/Geolocation/script-tests/success.js:
     27        * fast/dom/Geolocation/script-tests/timeout-clear-watch.js:
     28        * fast/dom/Geolocation/script-tests/timeout-zero.js:
     29        * fast/dom/Geolocation/script-tests/timeout.js:
     30        * fast/dom/Geolocation/script-tests/watch.js:
     31
    1322010-06-04  Qi Zhang  <qi.2.zhang@nokia.com>
    233
  • trunk/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt

    r59926 r60667  
    1 CONSOLE MESSAGE: line 22: Error: Exception in success callback
     1CONSOLE MESSAGE: line 25: Error: Exception in success callback
    22Tests that when an exception is thrown in the success callback, the error callback is not invoked. Note that this test throws an exception which is not caught.
    33
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js

    r59926 r60667  
    55var mockAccuracy = 100;
    66
    7 window.layoutTestController.setGeolocationPermission(true);
    8 window.layoutTestController.setMockGeolocationPosition(mockLatitude,
    9                                                        mockLongitude,
    10                                                        mockAccuracy);
     7if (window.layoutTestController) {
     8    layoutTestController.setGeolocationPermission(true);
     9    layoutTestController.setMockGeolocationPosition(mockLatitude,
     10                                                    mockLongitude,
     11                                                    mockAccuracy);
     12} else
     13    debug('This test can not be run without the LayoutTestController');
    1114
    1215var position;
    1316navigator.geolocation.getCurrentPosition(function(p) {
    14     position = p
     17    position = p;
    1518    shouldBe('position.coords.latitude', 'mockLatitude');
    1619    shouldBe('position.coords.longitude', 'mockLongitude');
     
    2629});
    2730
    28 window.layoutTestController.waitUntilDone();
    29 
    3031window.jsTestIsAsync = true;
    3132window.successfullyParsed = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/error.js

    r60488 r60667  
    44var mockMessage = "debug";
    55
    6 window.layoutTestController.setGeolocationPermission(true);
    7 window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     6if (window.layoutTestController) {
     7    layoutTestController.setGeolocationPermission(true);
     8    layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     9} else
     10    debug('This test can not be run without the LayoutTestController');
    811
    912var error;
     
    1215    finishJSTest();
    1316}, function(e) {
    14     error = e
     17    error = e;
    1518    shouldBe('error.code', 'mockCode');
    1619    shouldBe('error.message', 'mockMessage');
     
    2124    finishJSTest();
    2225});
    23 window.layoutTestController.waitUntilDone();
    2426
    2527window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js

    r60488 r60667  
    2626}
    2727
    28 window.layoutTestController.setGeolocationPermission(true);
    29 window.layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
     28if (window.layoutTestController) {
     29    layoutTestController.setGeolocationPermission(true);
     30    layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
     31} else
     32    debug('This test can not be run without the LayoutTestController');
    3033
    3134// Initialize the cached Position
     
    4043function testZeroMaximumAge() {
    4144    // Update the position provided by the mock service.
    42     window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
     45    if (window.layoutTestController)
     46        layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
    4347    // The default maximumAge is zero, so we expect the updated position from the service.
    4448    navigator.geolocation.getCurrentPosition(function(p) {
     
    5357function testNonZeroMaximumAge() {
    5458    // Update the mock service to report an error.
    55     window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     59    if (window.layoutTestController)
     60        layoutTestController.setMockGeolocationError(mockCode, mockMessage);
    5661    // The maximumAge is non-zero, so we expect the cached position, not the error from the service.
    5762    navigator.geolocation.getCurrentPosition(function(p) {
     
    7580}
    7681
    77 window.layoutTestController.waitUntilDone();
    78 
    7982window.jsTestIsAsync = true;
    8083window.successfullyParsed = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js

    r59926 r60667  
    1818window.jsTestIsAsync = true;
    1919window.successfullyParsed = true;
    20 
    21 if (window.layoutTestController) layoutTestController.waitUntilDone();
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js

    r59926 r60667  
    22
    33// Prime the Geolocation instance by denying permission.
    4 window.layoutTestController.setGeolocationPermission(false);
    5 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     4if (window.layoutTestController) {
     5    layoutTestController.setGeolocationPermission(false);
     6    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     7} else
     8    debug('This test can not be run without the LayoutTestController');
    69
    710var error;
     
    1013    finishJSTest();
    1114}, function(e) {
    12     error = e
     15    error = e;
    1316    shouldBe('error.code', 'error.PERMISSION_DENIED');
    1417    shouldBe('error.message', '"User denied Geolocation"');
     
    2427        finishJSTest();
    2528    }, function(e) {
    26         error = e
     29        error = e;
    2730        shouldBe('error.code', 'error.PERMISSION_DENIED');
    2831        shouldBe('error.message', '"User denied Geolocation"');
     
    3235}
    3336
    34 window.layoutTestController.waitUntilDone();
    35 
    3637window.jsTestIsAsync = true;
    3738window.successfullyParsed = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js

    r59926 r60667  
    22
    33// Prime the Geolocation instance by denying permission.
    4 window.layoutTestController.setGeolocationPermission(false);
    5 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     4if (window.layoutTestController) {
     5    layoutTestController.setGeolocationPermission(false);
     6    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     7} else
     8    debug('This test can not be run without the LayoutTestController');
    69
    710var error;
     
    1013    finishJSTest();
    1114}, function(e) {
    12     error = e
     15    error = e;
    1316    shouldBe('error.code', 'error.PERMISSION_DENIED');
    1417    shouldBe('error.message', '"User denied Geolocation"');
     
    2023{
    2124    // Make another request, with permission already denied.
    22     window.layoutTestController.setMockGeolocationError(0, 'test');
     25    if (window.layoutTestController)
     26        layoutTestController.setMockGeolocationError(0, 'test');
    2327
    2428    navigator.geolocation.getCurrentPosition(function(p) {
     
    2630        finishJSTest();
    2731    }, function(e) {
    28         error = e
     32        error = e;
    2933        shouldBe('error.code', 'error.PERMISSION_DENIED');
    3034        shouldBe('error.message', '"User denied Geolocation"');
     
    3236    });
    3337}
    34 window.layoutTestController.waitUntilDone();
    3538
    3639window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js

    r59926 r60667  
    22
    33// Prime the Geolocation instance by denying permission.
    4 window.layoutTestController.setGeolocationPermission(false);
    5 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     4if (window.layoutTestController) {
     5    layoutTestController.setGeolocationPermission(false);
     6    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     7} else
     8    debug('This test can not be run without the LayoutTestController');
    69
    710var error;
     
    1013    finishJSTest();
    1114}, function(e) {
    12     error = e
     15    error = e;
    1316    shouldBe('error.code', 'error.PERMISSION_DENIED');
    1417    shouldBe('error.message', '"User denied Geolocation"');
     
    2427        finishJSTest();
    2528    }, function(e) {
    26         error = e
     29        error = e;
    2730        shouldBe('error.code', 'error.PERMISSION_DENIED');
    2831        shouldBe('error.message', '"User denied Geolocation"');
     
    3033    });
    3134}
    32 window.layoutTestController.waitUntilDone();
    3335
    3436window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js

    r59926 r60667  
    33// Configure the mock Geolocation service to report a position to cause permission
    44// to be requested, then deny it.
    5 window.layoutTestController.setGeolocationPermission(false);
    6 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
     5if (window.layoutTestController) {
     6    layoutTestController.setGeolocationPermission(false);
     7    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
     8} else
     9    debug('This test can not be run without the LayoutTestController');
    710
    811var error;
     
    1821    errorCallbackInvoked = true;
    1922
    20     error = e
     23    error = e;
    2124    shouldBe('error.code', 'error.PERMISSION_DENIED');
    2225    shouldBe('error.message', '"User denied Geolocation"');
     
    2427    // Update the mock Geolocation service to report a new position, then
    2528    // yield to allow a chance for the success callback to be invoked.
    26     window.layoutTestController.setMockGeolocationPosition(55.478, -0.166, 100);
     29    if (window.layoutTestController)
     30        layoutTestController.setMockGeolocationPosition(55.478, -0.166, 100);
    2731    window.setTimeout(finishJSTest, 0);
    2832});
    2933
    30 window.layoutTestController.waitUntilDone();
    3134
    3235window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js

    r59926 r60667  
    11description("Tests Geolocation when permission is denied, using the mock service.");
    22
    3 window.layoutTestController.setGeolocationPermission(false);
    4 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
     3if (window.layoutTestController) {
     4    layoutTestController.setGeolocationPermission(false);
     5    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
     6} else
     7    debug('This test can not be run without the LayoutTestController');
    58
    69var error;
     
    912    finishJSTest();
    1013}, function(e) {
    11     error = e
     14    error = e;
    1215    shouldBe('error.code', 'error.PERMISSION_DENIED');
    1316    shouldBe('error.message', '"User denied Geolocation"');
    1417    finishJSTest();
    1518});
    16 window.layoutTestController.waitUntilDone();
    1719
    1820window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js

    r59926 r60667  
    55var mockAccuracy = 100.0;
    66
    7 window.layoutTestController.setGeolocationPermission(true);
    8 window.layoutTestController.setMockGeolocationPosition(mockLatitude,
    9                                                        mockLongitude,
    10                                                        mockAccuracy);
     7if (window.layoutTestController) {
     8    layoutTestController.setGeolocationPermission(true);
     9    layoutTestController.setMockGeolocationPosition(mockLatitude,
     10                                                    mockLongitude,
     11                                                    mockAccuracy);
     12} else
     13    debug('This test can not be run without the LayoutTestController');
    1114
    1215var position;
    1316navigator.geolocation.getCurrentPosition(function(p) {
    1417    // shouldBe can't use local variables yet.
    15     position = p
     18    position = p;
    1619    shouldBe('position.coords.latitude', 'mockLatitude');
    1720    shouldBe('position.coords.longitude', 'mockLongitude');
     
    2427    finishJSTest();
    2528});
    26 window.layoutTestController.waitUntilDone();
    2729
    2830window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js

    r60488 r60667  
    44var mockMessage = 'test';
    55
    6 window.layoutTestController.setGeolocationPermission(true);
    7 window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     6if (window.layoutTestController) {
     7    layoutTestController.setGeolocationPermission(true);
     8    layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     9} else
     10    debug('This test can not be run without the LayoutTestController');
    811
    912var error;
     
    3033    mockMessage += ' repeat';
    3134
    32     window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     35    if (window.layoutTestController)
     36        layoutTestController.setMockGeolocationError(mockCode, mockMessage);
    3337
    3438    navigator.geolocation.getCurrentPosition(function(p) {
     
    4246    });
    4347}
    44 window.layoutTestController.waitUntilDone();
    4548
    4649window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js

    r59926 r60667  
    55var mockAccuracy = 100.0;
    66
    7 window.layoutTestController.setGeolocationPermission(true);
    8 window.layoutTestController.setMockGeolocationPosition(mockLatitude,
    9                                                        mockLongitude,
    10                                                        mockAccuracy);
     7if (window.layoutTestController) {
     8    layoutTestController.setGeolocationPermission(true);
     9    layoutTestController.setMockGeolocationPosition(mockLatitude,
     10                                                    mockLongitude,
     11                                                    mockAccuracy);
     12} else
     13    debug('This test can not be run without the LayoutTestController');
    1114
    1215var position;
     
    3134
    3235function continueTest() {
    33     window.layoutTestController.setMockGeolocationPosition(++mockLatitude,
    34                                                            ++mockLongitude,
    35                                                            ++mockAccuracy);
     36    if (window.layoutTestController)
     37        layoutTestController.setMockGeolocationPosition(++mockLatitude,
     38                                                        ++mockLongitude,
     39                                                        ++mockAccuracy);
    3640
    3741    navigator.geolocation.getCurrentPosition(function(p) {
     
    4650    });
    4751}
    48 window.layoutTestController.waitUntilDone();
    4952
    5053window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/success.js

    r59926 r60667  
    55var mockAccuracy = 100;
    66
    7 window.layoutTestController.setGeolocationPermission(true);
    8 window.layoutTestController.setMockGeolocationPosition(mockLatitude,
    9                                                        mockLongitude,
    10                                                        mockAccuracy);
     7if (window.layoutTestController) {
     8    layoutTestController.setGeolocationPermission(true);
     9    layoutTestController.setMockGeolocationPosition(mockLatitude,
     10                                                    mockLongitude,
     11                                                    mockAccuracy);
     12} else
     13    debug('This test can not be run without the LayoutTestController');
    1114
    1215var position;
    1316navigator.geolocation.getCurrentPosition(function(p) {
    14     position = p
     17    position = p;
    1518    shouldBe('position.coords.latitude', 'mockLatitude');
    1619    shouldBe('position.coords.longitude', 'mockLongitude');
     
    2124    finishJSTest();
    2225});
    23 window.layoutTestController.waitUntilDone();
    2426
    2527window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js

    r59926 r60667  
    11description("Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.");
    22
    3 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
     3if (window.layoutTestController)
     4    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
    45
    56var error;
     
    89    finishJSTest();
    910}, function(e) {
    10     error = e
     11    error = e;
    1112    shouldBe('error.code', 'error.TIMEOUT');
    1213    shouldBe('error.message', '"Timeout expired"');
     
    1718});
    1819
    19 window.layoutTestController.waitUntilDone();
    2020
    2121window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js

    r59926 r60667  
    11description("Tests that when timeout is zero (and maximumAge is too), the error callback is called immediately with code TIMEOUT.");
    22
    3 layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
     3if (window.layoutTestController)
     4    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
    45
    56var error;
     
    89    finishJSTest();
    910}, function(e) {
    10     error = e
     11    error = e;
    1112    shouldBe('error.code', 'error.TIMEOUT');
    1213    shouldBe('error.message', '"Timeout expired"');
     
    1516    timeout: 0
    1617});
    17 window.layoutTestController.waitUntilDone();
    1818
    1919window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js

    r59926 r60667  
    55var mockAccuracy = 100.0;
    66
    7 window.layoutTestController.setGeolocationPermission(true);
    8 window.layoutTestController.setMockGeolocationPosition(mockLatitude,
    9                                                        mockLongitude,
    10                                                        mockAccuracy);
     7if (window.layoutTestController) {
     8    layoutTestController.setGeolocationPermission(true);
     9    layoutTestController.setMockGeolocationPosition(mockLatitude,
     10                                                    mockLongitude,
     11                                                    mockAccuracy);
     12} else
     13    debug('This test can not be run without the LayoutTestController');
    1114
    1215var position;
     
    2326    timeout: 1000
    2427});
    25 window.layoutTestController.waitUntilDone();
    2628
    2729window.jsTestIsAsync = true;
  • trunk/LayoutTests/fast/dom/Geolocation/script-tests/watch.js

    r60488 r60667  
    2626}
    2727
    28 window.layoutTestController.setGeolocationPermission(true);
    29 window.layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
     28if (window.layoutTestController) {
     29    layoutTestController.setGeolocationPermission(true);
     30    layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
     31} else
     32    debug('This test can not be run without the LayoutTestController');
    3033
    3134var state = 0;
     
    3437        case 0:
    3538            checkPosition(p);
    36             window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
     39            if (window.layoutTestController)
     40                layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
    3741            break;
    3842        case 1:
    3943            checkPosition(p);
    40             window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
     44            if (window.layoutTestController)
     45                layoutTestController.setMockGeolocationError(mockCode, mockMessage);
    4146            break;
    4247        case 3:
     
    5257        case 2:
    5358            checkError(e);
    54             window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
     59            if (window.layoutTestController)
     60                layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
    5561            break;
    5662        default:
     
    5965    }
    6066});
    61 window.layoutTestController.waitUntilDone();
    6267
    6368window.jsTestIsAsync = true;
Note: See TracChangeset for help on using the changeset viewer.