Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/sessions/sessions.js |
| diff --git a/chrome/test/data/extensions/api_test/sessions/sessions.js b/chrome/test/data/extensions/api_test/sessions/sessions.js |
| index 431edbec72fb11ed0a052bebb3a721a68cc1e13f..5de034fe434cb7ab69a8a5211459aba6fb14bee2 100644 |
| --- a/chrome/test/data/extensions/api_test/sessions/sessions.js |
| +++ b/chrome/test/data/extensions/api_test/sessions/sessions.js |
| @@ -59,6 +59,18 @@ function checkEntries(expectedEntries, actualEntries) { |
| }); |
| } |
| +function checkOnChangedEvent(expectedCallbackCount) { |
| + var callbackCount = 0; |
| + var doneListening = chrome.test.listenForever( |
| + chrome.sessions.onChanged, |
| + function() { |
| + callbackCount++; |
| + if (callbackCount == expectedCallbackCount) |
| + doneListening(); |
| + } |
| + ); |
| +} |
|
not at google - send to devlin
2014/03/21 10:52:59
this doesn't actually make any assertions. yes it
wjywbs
2014/03/21 19:45:33
I haven't found a good way yet. I looked at the ot
|
| + |
| chrome.test.runTests([ |
| // After setupWindows |
| // |
| @@ -108,6 +120,8 @@ chrome.test.runTests([ |
| function retrieveClosedTabs() { |
| // Check that the recently closed list contains what we expect |
| // after removing tabs. |
| + checkOnChangedEvent(2); |
| + |
| callForEach( |
| chrome.tabs.remove, |
| firstWindowTabIds.slice(0, 2).reverse(), |
| @@ -134,6 +148,8 @@ chrome.test.runTests([ |
| function retrieveClosedWindows() { |
| // Check that the recently closed list contains what we expect |
| // after removing windows. |
| + checkOnChangedEvent(2); |
| + |
| callForEach( |
| chrome.windows.remove, |
| windowIds.slice(1, 3).reverse(), |
| @@ -197,6 +213,8 @@ chrome.test.runTests([ |
| }, |
| function restoreClosedTabs() { |
| + checkOnChangedEvent(2); |
| + |
| chrome.windows.get(windowIds[0], {"populate": true}, |
| callbackPass(function(win) { |
| var tabCountBeforeRestore = win.tabs.length; |
| @@ -219,6 +237,8 @@ chrome.test.runTests([ |
| }, |
| function restoreTabInClosedWindow() { |
| + checkOnChangedEvent(1); |
| + |
| chrome.windows.getAll({"populate": true}, callbackPass(function(win) { |
| var windowCountBeforeRestore = win.length; |
| chrome.sessions.restore(recentlyClosedSecondWindowTabIds[0], |
| @@ -237,6 +257,8 @@ chrome.test.runTests([ |
| }, |
| function restoreClosedWindows() { |
| + checkOnChangedEvent(1); |
| + |
| chrome.windows.getAll({"populate": true}, callbackPass(function(win) { |
| var windowCountBeforeRestore = win.length; |
| chrome.sessions.restore(recentlyClosedWindowIds[0], |
| @@ -285,6 +307,8 @@ chrome.test.runTests([ |
| }, |
| function restoreMostRecentEntry() { |
| + checkOnChangedEvent(1); |
| + |
| chrome.windows.getAll({"populate": true}, callbackPass(function(win) { |
| var windowCountBeforeRestore = win.length; |
| chrome.sessions.restore(callbackPass(function(win_session) { |