diff options
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 163baa40f7..389f8ff4df 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=a94a8fe5ccb19ba614') === 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=a94a8fe5ccb19ba614') === 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'); @@ -2978,6 +2979,15 @@ function PiwikTest() { equal( tracker.hook.test._getCookie( cookieName ), expectedValue, 'getCookie(), setCookie()' ); }); + test("Tracker setSecureCookie(), isSecureCookie()", function() { + expect(1); + + var tracker = Piwik.getTracker(); + + tracker.hook.test._setSecureCookie(1); + equal( tracker.hook.test._isSecureCookie(), 1); + }); + test("Tracker getCookieName() contains website ID", function() { expect(4); |