OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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. | |
4 | |
5 chrome.test.runTests([ | |
6 function testOnUpdated() { | |
7 var expectedEventData = [{ status: 'loading' }, { status: 'complete' }]; | |
8 var capturedEventData = []; | |
9 | |
10 function onUpdateListener(tabId, info, tab) { | |
11 capturedEventData.push(info); | |
12 if (capturedEventData.length < expectedEventData.length) { | |
13 return; | |
14 } | |
not at google - send to devlin
2013/01/09 22:30:15
nit: single-line ifs omit {}
mvrable
2013/01/09 23:03:14
Done.
| |
15 chrome.tabs.onUpdated.removeListener(onUpdateListener); | |
16 chrome.test.assertEq(expectedEventData, capturedEventData); | |
17 chrome.test.succeed(); | |
18 } | |
19 | |
20 chrome.tabs.onUpdated.addListener(onUpdateListener); | |
21 chrome.tabs.create({ url: 'chrome://newtab/' }); | |
not at google - send to devlin
2013/01/09 22:30:15
mm, you should also test changing the URL or title
mvrable
2013/01/09 23:03:14
Done.
| |
22 }, | |
23 | |
24 function testQuery() { | |
25 chrome.tabs.create({ url: 'chrome://newtab/' }); | |
26 chrome.tabs.query({active: true}, chrome.test.callbackPass(function(tabs) { | |
27 chrome.test.assertEq(1, tabs.length); | |
28 chrome.test.assertEq(undefined, tabs[0].url); | |
not at google - send to devlin
2013/01/09 22:30:15
you could add the other sensitive properties here
mvrable
2013/01/09 23:03:14
Done (implemented as a separate check function so
| |
29 })); | |
30 }, | |
31 | |
32 ]); | |
OLD | NEW |