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

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: 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
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..6722c7711309ab9be808c51e36435dfb12f093bf
--- /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 findow.
Finnur 2016/01/27 17:23:55 nit: 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();
+ });
+ });
+ });
+ });
+ });
+ });
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698