diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-07-19 00:04:11 +0300 |
---|---|---|
committer | Stefan Giehl <stefan@piwik.org> | 2017-07-19 00:04:11 +0300 |
commit | 4576d92b5fc69e748d68c157e0e7bde90ff772e9 (patch) | |
tree | 61cd22d55863e1735fe7d28597c1913704132282 /tests | |
parent | 0e0003769107d4d48a1959b313627861fe38069f (diff) |
JS Tracker: new setCrossDomainLinkingTimeout function useful to set a higher timeout for links (#11828)
* JS Tracker: new setCrossDomainLinkingTimeout function useful to set a higher timeout for links
and increasing the default to 120 seconds
* Code review feedback
* Compiled Piwik.js
* fix one test
* Fix tests
* remove debugger;
Diffstat (limited to 'tests')
-rw-r--r-- | tests/javascript/index.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index a0ce0769ce..2205b26a0b 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2104,7 +2104,7 @@ function PiwikTest() { }); test("API methods", function() { - expect(87); + expect(88); equal( typeof Piwik.addPlugin, 'function', 'addPlugin' ); equal( typeof Piwik.addPlugin, 'function', 'addTracker' ); @@ -2152,6 +2152,7 @@ function PiwikTest() { equal( typeof tracker.enableCrossDomainLinking, 'function', 'enableCrossDomainLinking' ); equal( typeof tracker.disableCrossDomainLinking, 'function', 'disableCrossDomainLinking' ); equal( typeof tracker.isCrossDomainLinkingEnabled, 'function', 'isCrossDomainLinkingEnabled' ); + equal( typeof tracker.setCrossDomainLinkingTimeout, 'function', 'isCrossDomainLinkingEnabled' ); equal( typeof tracker.setIgnoreClasses, 'function', 'setIgnoreClasses' ); equal( typeof tracker.setRequestMethod, 'function', 'setRequestMethod' ); equal( typeof tracker.setRequestContentType, 'function', 'setRequestContentType' ); @@ -2808,8 +2809,8 @@ function PiwikTest() { var browserId = generateBrowserSpecificId(); strictEqual(true, isSameCrossDomainDevice(String(currentTimestamp) + browserId), "isSameCrossDomainDevice, should return true if browserId is the same and timestamp within 45 seconds" ); - strictEqual(true, isSameCrossDomainDevice(String(currentTimestamp - 42) + browserId), "isSameCrossDomainDevice, should return true if browserId is the same and timestamp within 45 seconds" ); - strictEqual(false, isSameCrossDomainDevice(String(currentTimestamp - 48) + browserId), "isSameCrossDomainDevice, should return false if browserId is the same but timestamp is 46+ seconds old" ); + strictEqual(true, isSameCrossDomainDevice(String(currentTimestamp - 100) + browserId), "isSameCrossDomainDevice, should return true if browserId is the same and timestamp within 45 seconds" ); + strictEqual(false, isSameCrossDomainDevice(String(currentTimestamp - 183) + browserId), "isSameCrossDomainDevice, should return false if browserId is the same but timestamp is 181+ seconds old" ); strictEqual(false, isSameCrossDomainDevice(String(currentTimestamp + 2) + browserId), "isSameCrossDomainDevice, should return false if browserId is the same but timestamp was only generated later" ); strictEqual(false, isSameCrossDomainDevice(String(currentTimestamp)), "isSameCrossDomainDevice, should return false if no device ID given" ); strictEqual(false, isSameCrossDomainDevice(browserId), "isSameCrossDomainDevice, should return false if no timestamp given" ); @@ -2853,8 +2854,8 @@ function PiwikTest() { strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp, 'foobar'), "getVisitorIdFromUrl, should return empty string if visitorId is given but browser ID is not valid" ); strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp, 'fooba'), "getVisitorIdFromUrl, should return empty string if pk_vid has not 32 character but 31" ); strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp, '!test,'), "getVisitorIdFromUrl, should return empty string if pk_vid has invalid characters" ); - strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp + 58, browserId), "getVisitorIdFromUrl, should return empty string if visitorId and browser ID is valid but timestamp is in future" ); - strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp - 58, browserId), "getVisitorIdFromUrl, should return empty string if visitorId and browser ID is valid but timestamp was too long ago" ); + strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp + 158, browserId), "getVisitorIdFromUrl, should return empty string if visitorId and browser ID is valid but timestamp is in future" ); + strictEqual('', makeVisitorIdFromUrl(true, currentTimestamp - 188, browserId), "getVisitorIdFromUrl, should return empty string if visitorId and browser ID is valid but timestamp was too long ago" ); strictEqual('900d0d1eb6714aa4', makeVisitorIdFromUrl(true, currentTimestamp - 20, browserId), "getVisitorIdFromUrl, should return the visitorId if browser ID is valid and timestamp is only 20 seconds old" ); function makeReplaceHrefForCrossDomainLink(url) { @@ -2873,11 +2874,11 @@ function PiwikTest() { tracker.setUserId('test'); var replacedUrl = makeReplaceHrefForCrossDomainLink('http://www.example.com'); - ok(replacedUrl.indexOf('http://www.example.com?pk_vid=a94a8fe5ccb19ba615') === 0, 'replaceHrefForCrossDomainLink, should set parameters if a URL is given'); + ok(replacedUrl.indexOf('http://www.example.com?pk_vid=a94a8fe5ccb19ba61') === 0, 'replaceHrefForCrossDomainLink, should set parameters if a URL is given'); ok(replacedUrl.indexOf(browserId) > 20, 'replaceHrefForCrossDomainLink, should set browserId if a url is given'); replacedUrl = makeReplaceHrefForCrossDomainLink(makeUrlWithVisitorId(true, currentTimestamp, 'foobar')); - ok(replacedUrl.indexOf('http://www.example.com/?pk_vid=a94a8fe5ccb19ba615') === 0, 'replaceHrefForCrossDomainLink, should replace parameters if a URL is given'); + ok(replacedUrl.indexOf('http://www.example.com/?pk_vid=a94a8fe5ccb19ba61') === 0, 'replaceHrefForCrossDomainLink, should replace parameters if a URL is given'); ok(replacedUrl.indexOf(browserId) > 20, 'replaceHrefForCrossDomainLink, should replace browserId if a URL is given'); |