Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 function listener() { | |
| 6 } | |
| 7 | |
| 8 // 0. After start, add and remove onChanged listener. | |
| 9 // 1. Create incognito window. | |
| 10 // 2. Remove the initial findow. | |
|
Finnur
2016/01/27 17:23:55
nit: window
| |
| 11 // 3. Create new window. | |
| 12 // 4. Remove incognito window. | |
| 13 // 5. Register listener and check it works. | |
| 14 chrome.test.runTests([ | |
| 15 function onChangedTest() { | |
| 16 chrome.sessions.onChanged.addListener(listener); | |
| 17 chrome.sessions.onChanged.removeListener(listener); | |
| 18 chrome.windows.getCurrent(function(win) { | |
| 19 first_win = win; | |
| 20 chrome.windows.create({incognito:true}, function(win) { | |
| 21 incognito_win = win; | |
| 22 chrome.windows.remove(first_win.id, function() { | |
| 23 chrome.windows.create({url:chrome.extension.getURL("../a.html")}, | |
| 24 function(win) { | |
| 25 new_win = win; | |
| 26 chrome.windows.remove(incognito_win.id, function() { | |
| 27 callbackCount = 0; | |
| 28 chrome.test.listenForever(chrome.sessions.onChanged, function() { | |
| 29 callbackCount++; | |
| 30 }); | |
| 31 chrome.tabs.remove(new_win.tabs[0].id, function() { | |
| 32 chrome.test.assertTrue(callbackCount > 0); | |
| 33 chrome.test.succeed(); | |
| 34 }); | |
| 35 }); | |
| 36 }); | |
| 37 }); | |
| 38 }); | |
| 39 }); | |
| 40 } | |
| 41 ]); | |
| OLD | NEW |