Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var pages = [pageUrl('a'), pageUrl('b'), pageUrl('c')]; | 5 var pages = [pageUrl('a'), pageUrl('b'), pageUrl('c')]; |
| 6 var firstWindowTabIds = []; | 6 var firstWindowTabIds = []; |
| 7 var recentlyClosedSecondWindowTabIds = []; | 7 var recentlyClosedSecondWindowTabIds = []; |
| 8 var recentlyClosedTabIds = []; | 8 var recentlyClosedTabIds = []; |
| 9 var recentlyClosedWindowIds = []; | 9 var recentlyClosedWindowIds = []; |
| 10 var windowIds = []; | 10 var windowIds = []; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 assertEq(callArgs.length + 1, win.length); | 101 assertEq(callArgs.length + 1, win.length); |
| 102 }) | 102 }) |
| 103 ); | 103 ); |
| 104 } | 104 } |
| 105 ); | 105 ); |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 function retrieveClosedTabs() { | 108 function retrieveClosedTabs() { |
| 109 // Check that the recently closed list contains what we expect | 109 // Check that the recently closed list contains what we expect |
| 110 // after removing tabs. | 110 // after removing tabs. |
| 111 var expectedCallbackCount = 2, callbackCount = 0; | |
|
not at google - send to devlin
2014/03/17 14:21:18
what does this actually test?
wjywbs
2014/03/17 19:27:24
Lines 63-79 of this file describe that this retrie
| |
| 112 var doneListening = chrome.test.listenForever( | |
| 113 chrome.sessions.onRecentlyClosed, | |
| 114 function() { | |
| 115 callbackCount++; | |
| 116 if (callbackCount == expectedCallbackCount) | |
| 117 doneListening(); | |
| 118 } | |
| 119 ); | |
| 120 | |
| 111 callForEach( | 121 callForEach( |
| 112 chrome.tabs.remove, | 122 chrome.tabs.remove, |
| 113 firstWindowTabIds.slice(0, 2).reverse(), | 123 firstWindowTabIds.slice(0, 2).reverse(), |
| 114 function each() { | 124 function each() { |
| 115 }, | 125 }, |
| 116 function done() { | 126 function done() { |
| 117 chrome.sessions.getRecentlyClosed( | 127 chrome.sessions.getRecentlyClosed( |
| 118 {maxResults: 2}, | 128 {maxResults: 2}, |
| 119 callbackPass(function(entries) { | 129 callbackPass(function(entries) { |
| 120 var expectedEntries = [ | 130 var expectedEntries = [ |
| 121 { tab: { url: pages[0] } }, | 131 { tab: { url: pages[0] } }, |
| 122 { tab: { url: pages[1] } } | 132 { tab: { url: pages[1] } } |
| 123 ]; | 133 ]; |
| 124 checkEntries(expectedEntries, entries); | 134 checkEntries(expectedEntries, entries); |
| 125 entries.forEach(function(entry) { | 135 entries.forEach(function(entry) { |
| 126 recentlyClosedTabIds.push(entry.tab.sessionId); | 136 recentlyClosedTabIds.push(entry.tab.sessionId); |
| 127 }); | 137 }); |
| 128 }) | 138 }) |
| 129 ); | 139 ); |
| 130 } | 140 } |
| 131 ); | 141 ); |
| 132 }, | 142 }, |
| 133 | 143 |
| 134 function retrieveClosedWindows() { | 144 function retrieveClosedWindows() { |
| 135 // Check that the recently closed list contains what we expect | 145 // Check that the recently closed list contains what we expect |
| 136 // after removing windows. | 146 // after removing windows. |
| 147 var expectedCallbackCount = 2, callbackCount = 0; | |
| 148 var doneListening = chrome.test.listenForever( | |
| 149 chrome.sessions.onRecentlyClosed, | |
| 150 function() { | |
| 151 callbackCount++; | |
| 152 if (callbackCount == expectedCallbackCount) | |
| 153 doneListening(); | |
| 154 } | |
| 155 ); | |
| 156 | |
| 137 callForEach( | 157 callForEach( |
| 138 chrome.windows.remove, | 158 chrome.windows.remove, |
| 139 windowIds.slice(1, 3).reverse(), | 159 windowIds.slice(1, 3).reverse(), |
| 140 function each() { | 160 function each() { |
| 141 }, | 161 }, |
| 142 function done() { | 162 function done() { |
| 143 chrome.sessions.getRecentlyClosed( | 163 chrome.sessions.getRecentlyClosed( |
| 144 {maxResults: 2}, | 164 {maxResults: 2}, |
| 145 callbackPass(function(entries) { | 165 callbackPass(function(entries) { |
| 146 var expectedEntries = [ | 166 var expectedEntries = [ |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 chrome.windows.getAll({"populate": true}, | 326 chrome.windows.getAll({"populate": true}, |
| 307 callbackPass(function(win) { | 327 callbackPass(function(win) { |
| 308 assertEq(windowCountBeforeRestore, win.length); | 328 assertEq(windowCountBeforeRestore, win.length); |
| 309 }) | 329 }) |
| 310 ); | 330 ); |
| 311 }) | 331 }) |
| 312 ); | 332 ); |
| 313 })); | 333 })); |
| 314 } | 334 } |
| 315 ]); | 335 ]); |
| OLD | NEW |