- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / webnavigation / test_requestOpenTab.js
1 // Copyright (c) 2012 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 onload = function() {
6   var getURL = chrome.extension.getURL;
7   chrome.tabs.create({"url": "about:blank"}, function(tab) {
8     var tabId = tab.id;
9
10     chrome.test.runTests([
11       // Opens a tab and waits for the user to middle-click on a link in it.
12       function requestOpenTab() {
13         expect([
14           { label: "a-onBeforeNavigate",
15             event: "onBeforeNavigate",
16             details: { frameId: 0,
17                        parentFrameId: -1,
18                        processId: 0,
19                        tabId: 0,
20                        timeStamp: 0,
21                        url: getURL('requestOpenTab/a.html') }},
22           { label: "a-onCommitted",
23             event: "onCommitted",
24             details: { frameId: 0,
25                        processId: 0,
26                        tabId: 0,
27                        timeStamp: 0,
28                        transitionQualifiers: [],
29                        transitionType: "typed",
30                        url: getURL('requestOpenTab/a.html') }},
31           { label: "a-onDOMContentLoaded",
32             event: "onDOMContentLoaded",
33             details: { frameId: 0,
34                        processId: 0,
35                        tabId: 0,
36                        timeStamp: 0,
37                        url: getURL('requestOpenTab/a.html') }},
38           { label: "a-onCompleted",
39             event: "onCompleted",
40             details: { frameId: 0,
41                        processId: 0,
42                        tabId: 0,
43                        timeStamp: 0,
44                        url: getURL('requestOpenTab/a.html') }},
45           { label: "b-onCreatedNavigationTarget",
46             event: "onCreatedNavigationTarget",
47             details: { sourceFrameId: 0,
48                        sourceProcessId: 0,
49                        sourceTabId: 0,
50                        tabId: 1,
51                        timeStamp: 0,
52                        url: getURL('requestOpenTab/b.html') }},
53           { label: "b-onBeforeNavigate",
54             event: "onBeforeNavigate",
55             details: { frameId: 0,
56                        parentFrameId: -1,
57                        processId: 0,
58                        tabId: 1,
59                        timeStamp: 0,
60                        url: getURL('requestOpenTab/b.html') }},
61           { label: "b-onCommitted",
62             event: "onCommitted",
63             details: { frameId: 0,
64                        processId: 0,
65                        tabId: 1,
66                        timeStamp: 0,
67                        transitionQualifiers: [],
68                        transitionType: "link",
69                        url: getURL('requestOpenTab/b.html') }},
70           { label: "b-onDOMContentLoaded",
71             event: "onDOMContentLoaded",
72             details: { frameId: 0,
73                        processId: 0,
74                        tabId: 1,
75                        timeStamp: 0,
76                        url: getURL('requestOpenTab/b.html') }},
77           { label: "b-onCompleted",
78             event: "onCompleted",
79             details: { frameId: 0,
80                        processId: 0,
81                        tabId: 1,
82                        timeStamp: 0,
83                        url: getURL('requestOpenTab/b.html') }}],
84           [ navigationOrder("a-"),
85             navigationOrder("b-"),
86             [ "a-onDOMContentLoaded",
87               "b-onCreatedNavigationTarget",
88               "b-onBeforeNavigate" ]]);
89
90         // Notify the api test that we're waiting for the user.
91         chrome.test.notifyPass();
92       },
93     ]);
94   });
95 };