- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / tabs / basics / relative_urls.js
1 // Copyright (c) 2011 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.
4
5 var firstWindowId;
6 var relativePageLoaded;
7
8 chrome.test.runTests([
9   function setupRelativeUrlTests() {
10     createWindow(["about:blank"], {}, pass(function(winId, tabIds) {
11       firstWindowId = winId;
12     }));
13   },
14
15   function relativeUrlTestsTabsCreate() {
16     // Will be called from relative.html
17     relativePageLoaded = chrome.test.callbackAdded();
18     var createCompleted = chrome.test.callbackAdded();
19
20     chrome.tabs.create({windowId: firstWindowId, url: 'relative.html'},
21       function(tab){
22         testTabId = tab.id;
23         createCompleted();
24       }
25     );
26   },
27
28   function relativeUrlTestsTabsUpdate() {
29     // Will be called from relative.html
30     relativePageLoaded = chrome.test.callbackAdded();
31
32     chrome.tabs.update(testTabId, {url: pageUrl("a")}, function(tab) {
33       chrome.test.assertEq(pageUrl("a"), tab.url);
34       chrome.tabs.update(tab.id, {url: "relative.html"}, function(tab) {
35       });
36     });
37   },
38
39   function relativeUrlTestsWindowCreate() {
40     // Will be called from relative.html
41     relativePageLoaded = chrome.test.callbackAdded();
42
43     chrome.windows.create({url: "relative.html"});
44   }
45
46 ]);