| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 function runTests() { | 5 function runTests() { |
| 6 var getURL = chrome.extension.getURL; | 6 var getURL = chrome.extension.getURL; |
| 7 chrome.tabs.create({"url": "about:blank"}, function(tab) { | 7 chrome.tabs.create({"url": "about:blank"}, function(tab) { |
| 8 var tabId = tab.id; | 8 var tabId = tab.id; |
| 9 | 9 |
| 10 chrome.test.runTests([ | 10 chrome.test.runTests([ |
| 11 // First navigates to a.html which redirects to to b.html which uses | 11 // First navigates to a.html which redirects to to b.html which uses |
| 12 // history.back() to navigate back to a.html | 12 // history.back() to navigate back to a.html |
| 13 function forwardBack() { | 13 function forwardBack() { |
| 14 expect([ | 14 expect([ |
| 15 [ "onBeforeNavigate", | 15 { label: "a-onBeforeNavigate", |
| 16 { frameId: 0, | 16 event: "onBeforeNavigate", |
| 17 tabId: 0, | 17 details: { frameId: 0, |
| 18 timeStamp: 0, | 18 tabId: 0, |
| 19 url: getURL('forwardBack/a.html') }], | 19 timeStamp: 0, |
| 20 [ "onCommitted", | 20 url: getURL('forwardBack/a.html') }}, |
| 21 { frameId: 0, | 21 { label: "a-onCommitted", |
| 22 tabId: 0, | 22 event: "onCommitted", |
| 23 timeStamp: 0, | 23 details: { frameId: 0, |
| 24 transitionQualifiers: [], | 24 tabId: 0, |
| 25 transitionType: "link", | 25 timeStamp: 0, |
| 26 url: getURL('forwardBack/a.html') }], | 26 transitionQualifiers: [], |
| 27 [ "onDOMContentLoaded", | 27 transitionType: "link", |
| 28 { frameId: 0, | 28 url: getURL('forwardBack/a.html') }}, |
| 29 tabId: 0, | 29 { label: "a-onDOMContentLoaded", |
| 30 timeStamp: 0, | 30 event: "onDOMContentLoaded", |
| 31 url: getURL('forwardBack/a.html') }], | 31 details: { frameId: 0, |
| 32 [ "onCompleted", | 32 tabId: 0, |
| 33 { frameId: 0, | 33 timeStamp: 0, |
| 34 tabId: 0, | 34 url: getURL('forwardBack/a.html') }}, |
| 35 timeStamp: 0, | 35 { label: "a-onCompleted", |
| 36 url: getURL('forwardBack/a.html') }], | 36 event: "onCompleted", |
| 37 [ "onBeforeNavigate", | 37 details: { frameId: 0, |
| 38 { frameId: 0, | 38 tabId: 0, |
| 39 tabId: 0, | 39 timeStamp: 0, |
| 40 timeStamp: 0, | 40 url: getURL('forwardBack/a.html') }}, |
| 41 url: getURL('forwardBack/b.html') }], | 41 { label: "b-onBeforeNavigate", |
| 42 [ "onCommitted", | 42 event: "onBeforeNavigate", |
| 43 { frameId: 0, | 43 details: { frameId: 0, |
| 44 tabId: 0, | 44 tabId: 0, |
| 45 timeStamp: 0, | 45 timeStamp: 0, |
| 46 transitionQualifiers: ["client_redirect"], | 46 url: getURL('forwardBack/b.html') }}, |
| 47 transitionType: "link", | 47 { label: "b-onCommitted", |
| 48 url: getURL('forwardBack/b.html') }], | 48 event: "onCommitted", |
| 49 [ "onDOMContentLoaded", | 49 details: { frameId: 0, |
| 50 { frameId: 0, | 50 tabId: 0, |
| 51 tabId: 0, | 51 timeStamp: 0, |
| 52 timeStamp: 0, | 52 transitionQualifiers: ["client_redirect"], |
| 53 url: getURL('forwardBack/b.html') }], | 53 transitionType: "link", |
| 54 [ "onCompleted", | 54 url: getURL('forwardBack/b.html') }}, |
| 55 { frameId: 0, | 55 { label: "b-onDOMContentLoaded", |
| 56 tabId: 0, | 56 event: "onDOMContentLoaded", |
| 57 timeStamp: 0, | 57 details: { frameId: 0, |
| 58 url: getURL('forwardBack/b.html') }], | 58 tabId: 0, |
| 59 [ "onBeforeNavigate", | 59 timeStamp: 0, |
| 60 { frameId: 0, | 60 url: getURL('forwardBack/b.html') }}, |
| 61 tabId: 0, | 61 { label: "b-onCompleted", |
| 62 timeStamp: 0, | 62 event: "onCompleted", |
| 63 url: getURL('forwardBack/a.html') }], | 63 details: { frameId: 0, |
| 64 [ "onCommitted", | 64 tabId: 0, |
| 65 { frameId: 0, | 65 timeStamp: 0, |
| 66 tabId: 0, | 66 url: getURL('forwardBack/b.html') }}, |
| 67 timeStamp: 0, | 67 { label: "c-onBeforeNavigate", |
| 68 transitionQualifiers: ["forward_back"], | 68 event: "onBeforeNavigate", |
| 69 transitionType: "link", | 69 details: { frameId: 0, |
| 70 url: getURL('forwardBack/a.html') }], | 70 tabId: 0, |
| 71 [ "onDOMContentLoaded", | 71 timeStamp: 0, |
| 72 { frameId: 0, | 72 url: getURL('forwardBack/a.html') }}, |
| 73 tabId: 0, | 73 { label: "c-onCommitted", |
| 74 timeStamp: 0, | 74 event: "onCommitted", |
| 75 url: getURL('forwardBack/a.html') }], | 75 details: { frameId: 0, |
| 76 [ "onCompleted", | 76 tabId: 0, |
| 77 { frameId: 0, | 77 timeStamp: 0, |
| 78 tabId: 0, | 78 transitionQualifiers: ["forward_back"], |
| 79 timeStamp: 0, | 79 transitionType: "link", |
| 80 url: getURL('forwardBack/a.html') }]]); | 80 url: getURL('forwardBack/a.html') }}, |
| 81 { label: "c-onDOMContentLoaded", |
| 82 event: "onDOMContentLoaded", |
| 83 details: { frameId: 0, |
| 84 tabId: 0, |
| 85 timeStamp: 0, |
| 86 url: getURL('forwardBack/a.html') }}, |
| 87 { label: "c-onCompleted", |
| 88 event: "onCompleted", |
| 89 details: { frameId: 0, |
| 90 tabId: 0, |
| 91 timeStamp: 0, |
| 92 url: getURL('forwardBack/a.html') }}], |
| 93 [ navigationOrder("a-"), navigationOrder("b-"), navigationOrder("c-"), |
| 94 isLoadedBy("b-", "a-"), isLoadedBy("c-", "b-")]); |
| 81 chrome.tabs.update(tabId, { url: getURL('forwardBack/a.html') }); | 95 chrome.tabs.update(tabId, { url: getURL('forwardBack/a.html') }); |
| 82 }, | 96 }, |
| 83 ]); | 97 ]); |
| 84 }); | 98 }); |
| 85 } | 99 } |
| OLD | NEW |