forked from mirrors/gecko-dev
		
	MozReview-Commit-ID: KjIquC2PKKI --HG-- rename : testing/web-platform/tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits.html => testing/web-platform/tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits.https.html rename : testing/web-platform/tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys.html => testing/web-platform/tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys.https.html rename : testing/web-platform/tests/WebCryptoAPI/derive_bits_keys/test_hkdf.html => testing/web-platform/tests/WebCryptoAPI/derive_bits_keys/test_hkdf.https.html rename : testing/web-platform/tests/WebCryptoAPI/digest/test_digest.html => testing/web-platform/tests/WebCryptoAPI/digest/test_digest.https.html rename : testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_aes_cbc.html => testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_aes_cbc.https.html rename : testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_aes_ctr.html => testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_aes_ctr.https.html rename : testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm.html => testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm.https.html rename : testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep.html => testing/web-platform/tests/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-cbc.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-cbc.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-ctr.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-ctr.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CBC.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CBC.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CTR.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CTR.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-GCM.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-GCM.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-KW.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-KW.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDH.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDH.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDSA.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDSA.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_HMAC.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_HMAC.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-OAEP.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-PSS.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-PSS.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CBC.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CBC.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CTR.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CTR.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-GCM.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-GCM.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-KW.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-KW.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDH.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDH.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDSA.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDSA.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_HMAC.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_HMAC.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-PSS.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-PSS.https.html rename : testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html => testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.https.html rename : testing/web-platform/tests/WebCryptoAPI/import_export/test_ec_importKey.html => testing/web-platform/tests/WebCryptoAPI/import_export/test_ec_importKey.https.html rename : testing/web-platform/tests/WebCryptoAPI/import_export/test_rsa_importKey.html => testing/web-platform/tests/WebCryptoAPI/import_export/test_rsa_importKey.https.html rename : testing/web-platform/tests/WebCryptoAPI/import_export/test_symmetric_importKey.html => testing/web-platform/tests/WebCryptoAPI/import_export/test_symmetric_importKey.https.html rename : testing/web-platform/tests/WebCryptoAPI/sign_verify/test_ecdsa.html => testing/web-platform/tests/WebCryptoAPI/sign_verify/test_ecdsa.https.html rename : testing/web-platform/tests/WebCryptoAPI/sign_verify/test_hmac.html => testing/web-platform/tests/WebCryptoAPI/sign_verify/test_hmac.https.html rename : testing/web-platform/tests/WebCryptoAPI/sign_verify/test_rsa_pkcs.html => testing/web-platform/tests/WebCryptoAPI/sign_verify/test_rsa_pkcs.https.html rename : testing/web-platform/tests/WebCryptoAPI/sign_verify/test_rsa_pss.html => testing/web-platform/tests/WebCryptoAPI/sign_verify/test_rsa_pss.https.html rename : testing/web-platform/tests/WebCryptoAPI/wrapKey_unwrapKey/test_wrapKey_unwrapKey.html => testing/web-platform/tests/WebCryptoAPI/wrapKey_unwrapKey/test_wrapKey_unwrapKey.https.html rename : testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-_blank.html => testing/web-platform/tests/html/browsers/windows/browsing-context-names/choose-_blank-001.html rename : testing/web-platform/tests/html/browsers/windows/browsing-context-names/resources/parent-iframe-3.html => testing/web-platform/tests/html/browsers/windows/browsing-context-names/resources/choose-_parent-003-iframe.html rename : testing/web-platform/tests/html/browsers/windows/browsing-context-names/resources/parent-iframe-2.html => testing/web-platform/tests/html/browsers/windows/browsing-context-names/resources/open-in-_parent.html rename : testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.https.html => testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html rename : testing/web-platform/tests/tools/LICENSE => testing/web-platform/tests/tools/wptrunner/LICENSE rename : testing/web-platform/tests/auxclick/auxclick_event-manual.html => testing/web-platform/tests/uievents/auxclick/auxclick_event-manual.html rename : testing/web-platform/tests/webrtc/rtcpeerconnection/rtcconfiguration-icecandidatepoolsize.html => testing/web-platform/tests/webrtc/RTCConfiguration-iceCandidatePoolSize.html rename : testing/web-platform/tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor.html => testing/web-platform/tests/webrtc/RTCPeerConnection-constructor.html rename : testing/web-platform/tests/webrtc/rtcpeerconnection/iceGatheringState.html => testing/web-platform/tests/webrtc/RTCPeerConnection-iceGatheringState.html rename : testing/web-platform/tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html => testing/web-platform/tests/webrtc/RTCPeerConnection-idl.html
		
			
				
	
	
		
			103 lines
		
	
	
	
		
			4.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
	
		
			4.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
"use strict";
 | 
						|
 | 
						|
function testCollapse(range, point, method) {
 | 
						|
    selection.removeAllRanges();
 | 
						|
    var addedRange;
 | 
						|
    if (range) {
 | 
						|
        addedRange = range.cloneRange();
 | 
						|
        selection.addRange(addedRange);
 | 
						|
    }
 | 
						|
 | 
						|
    if (point[0].nodeType == Node.DOCUMENT_TYPE_NODE) {
 | 
						|
        assert_throws("INVALID_NODE_TYPE_ERR", function() {
 | 
						|
            selection[method](point[0], point[1]);
 | 
						|
        }, "Must throw INVALID_NODE_TYPE_ERR when " + method + "()ing if the node is a DocumentType");
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    if (point[1] < 0 || point[1] > getNodeLength(point[0])) {
 | 
						|
        assert_throws("INDEX_SIZE_ERR", function() {
 | 
						|
            selection[method](point[0], point[1]);
 | 
						|
        }, "Must throw INDEX_SIZE_ERR when " + method + "()ing if the offset is negative or greater than the node's length");
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    if (!document.contains(point[0])) {
 | 
						|
        assertSelectionNoChange(function() {
 | 
						|
            selection[method](point[0], point[1]);
 | 
						|
        });
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    selection[method](point[0], point[1]);
 | 
						|
 | 
						|
    assert_equals(selection.rangeCount, 1,
 | 
						|
        "selection.rangeCount must equal 1 after " + method + "()");
 | 
						|
    assert_equals(selection.focusNode, point[0],
 | 
						|
        "focusNode must equal the node we " + method + "()d to");
 | 
						|
    assert_equals(selection.focusOffset, point[1],
 | 
						|
        "focusOffset must equal the offset we " + method + "()d to");
 | 
						|
    assert_equals(selection.focusNode, selection.anchorNode,
 | 
						|
        "focusNode and anchorNode must be equal after " + method + "()");
 | 
						|
    assert_equals(selection.focusOffset, selection.anchorOffset,
 | 
						|
        "focusOffset and anchorOffset must be equal after " + method + "()");
 | 
						|
    if (range) {
 | 
						|
        assert_equals(addedRange.startContainer, range.startContainer,
 | 
						|
            method + "() must not change the startContainer of a preexisting Range");
 | 
						|
        assert_equals(addedRange.endContainer, range.endContainer,
 | 
						|
            method + "() must not change the endContainer of a preexisting Range");
 | 
						|
        assert_equals(addedRange.startOffset, range.startOffset,
 | 
						|
            method + "() must not change the startOffset of a preexisting Range");
 | 
						|
        assert_equals(addedRange.endOffset, range.endOffset,
 | 
						|
            method + "() must not change the endOffset of a preexisting Range");
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
// Also test a selection with no ranges
 | 
						|
testRanges.unshift("[]");
 | 
						|
 | 
						|
// Don't want to eval() each point a bazillion times
 | 
						|
var testPointsCached = [];
 | 
						|
for (var i = 0; i < testPoints.length; i++) {
 | 
						|
    testPointsCached.push(eval(testPoints[i]));
 | 
						|
}
 | 
						|
 | 
						|
// Run a subset of all of collapse tests.
 | 
						|
// Huge number of tests in a single file causes problems. Each of
 | 
						|
// collapse-NN.html runs a part of them.
 | 
						|
//
 | 
						|
// startIndex - Start index in testRanges array
 | 
						|
// optionalEndIndex - End index in testRanges array + 1. If this argument is
 | 
						|
//     omitted, testRanges.length is applied.
 | 
						|
function testCollapseSubSet(startIndex, optionalEndIndex) {
 | 
						|
    var endIndex = optionalEndIndex === undefined ? testRanges.length : optionalEndIndex;
 | 
						|
    if (startIndex < 0 || startIndex >= testRanges.length)
 | 
						|
        throw "Sanity check: Specified index is invalid.";
 | 
						|
    if (endIndex < 0 || endIndex > testRanges.length)
 | 
						|
        throw "Sanity check: Specified index is invalid.";
 | 
						|
 | 
						|
    var tests = [];
 | 
						|
    for (var i = startIndex; i < endIndex; i++) {
 | 
						|
        var endpoints = eval(testRanges[i]);
 | 
						|
        var range;
 | 
						|
        test(function() {
 | 
						|
            if (endpoints.length) {
 | 
						|
                range = ownerDocument(endpoints[0]).createRange();
 | 
						|
                range.setStart(endpoints[0], endpoints[1]);
 | 
						|
                range.setEnd(endpoints[2], endpoints[3]);
 | 
						|
            } else {
 | 
						|
                // Empty selection
 | 
						|
                range = null;
 | 
						|
            }
 | 
						|
        }, "Set up range " + i + " " + testRanges[i]);
 | 
						|
        for (var j = 0; j < testPoints.length; j++) {
 | 
						|
            tests.push(["collapse() on " + testRanges[i] + " to " + testPoints[j],
 | 
						|
                        range, testPointsCached[j], "collapse"]);
 | 
						|
            tests.push(["setPosition() on " + testRanges[i] + " to " + testPoints[j],
 | 
						|
                        range, testPointsCached[j], "setPosition"]);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    generate_tests(testCollapse, tests);
 | 
						|
}
 | 
						|
 |