1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var assertEq = chrome.test.assertEq;
6 var assertTrue = chrome.test.assertTrue;
7 var fail = chrome.test.fail;
8 var succeed = chrome.test.succeed;
10 function checkIsDefined(prop) {
11 if (!chrome.identity) {
12 fail('chrome.identity is not defined');
15 if (!chrome.identity[prop]) {
16 fail('chrome.identity.' + prop + ' is not undefined');
22 var id = 'mnkdjmfihjjihdfnnoiojdccnnfkajpd';
23 var host = 'https://' + id + '.chromiumapp.org';
25 chrome.test.runTests([
27 function testGenerateRedirectURLWithPath() {
28 if (!checkIsDefined('getRedirectURL'))
31 var url = chrome.identity.getRedirectURL('slashless/path');
32 assertEq(host + '/slashless/path', url);
34 var url = chrome.identity.getRedirectURL('/slash/path');
35 assertEq(host + '/slash/path', url);
40 function testGenerateRedirectURLNoPath() {
41 if (!checkIsDefined('getRedirectURL'))
44 var url = chrome.identity.getRedirectURL();
45 assertEq(host + '/', url);
50 function testGenerateRedirectURLemptyPath() {
51 if (!checkIsDefined('getRedirectURL'))
54 var url = chrome.identity.getRedirectURL('');
55 assertEq(host + '/', url);