Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.js

Issue 1642583002: Fix bug with invalid chrome.sessions.onChanged listener. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+ });
+ });
+ });
+ });
+ });
+ });
+ }
+]);
« no previous file with comments | « chrome/test/data/extensions/api_test/sessions/onchanged/onchanged.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698