| Index: chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.js
|
| diff --git a/chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.js b/chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..24325c6c590c7d5dfb54c36f74b99077b13e2078
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.js
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +function listener() {
|
| +}
|
| +
|
| +// 0. After start, add and remove onChanged listener.
|
| +// 1. Create incognito window.
|
| +// 2. Remove the initial window.
|
| +// 3. Create new window.
|
| +// 4. Remove incognito window.
|
| +// 5. Register listener and check it works.
|
| +chrome.test.runTests([
|
| + function onChangedTest() {
|
| + chrome.sessions.onChanged.addListener(listener);
|
| + chrome.sessions.onChanged.removeListener(listener);
|
| + chrome.windows.getCurrent(function(win) {
|
| + first_win = win;
|
| + chrome.windows.create({incognito:true}, function(win) {
|
| + incognito_win = win;
|
| + chrome.windows.remove(first_win.id, function() {
|
| + chrome.windows.create({url:chrome.extension.getURL("../a.html")},
|
| + function(win) {
|
| + new_win = win;
|
| + chrome.windows.remove(incognito_win.id, function() {
|
| + callbackCount = 0;
|
| + chrome.test.listenForever(chrome.sessions.onChanged, function() {
|
| + callbackCount++;
|
| + });
|
| + chrome.tabs.remove(new_win.tabs[0].id, function() {
|
| + chrome.test.assertTrue(callbackCount > 0);
|
| + chrome.test.succeed();
|
| + });
|
| + });
|
| + });
|
| + });
|
| + });
|
| + });
|
| + }
|
| +]);
|
|
|