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

Unified Diff: chrome/test/data/extensions/api_test/tabs/basics/discarded.js

Issue 2205523002: AutoDiscardable property support on Chrome Extensions Tabs API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits Created 4 years, 4 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/common/extensions/api/tabs.json ('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/tabs/basics/discarded.js
diff --git a/chrome/test/data/extensions/api_test/tabs/basics/discarded.js b/chrome/test/data/extensions/api_test/tabs/basics/discarded.js
index 7d212a82c37aeeb40bcb08dc2ed444ea3d519d20..f2fe5b23565d4bfa02154c9b5ebec67ffaf31e4e 100644
--- a/chrome/test/data/extensions/api_test/tabs/basics/discarded.js
+++ b/chrome/test/data/extensions/api_test/tabs/basics/discarded.js
@@ -20,6 +20,7 @@ chrome.test.runTests([
}));
},
+ // Tests chrome.tabs.onUpdated for Discarded property.
function discard() {
// Initially tab isn't discarded.
assertFalse(testTab.discarded);
@@ -70,5 +71,57 @@ chrome.test.runTests([
});
chrome.tabs.reload(testTab.id);
+ },
+
+ // Tests chrome.tabs.onUpdated for autoDiscardable property.
+ function setNonAutoDiscardable() {
+ // Initially the tab is auto-discardable.
+ assertTrue(testTab.autoDiscardable);
+
+ var onUpdatedCompleted = chrome.test.listenForever(
+ chrome.tabs.onUpdated,
+ function(tabId, changeInfo, tab) {
+ if ('autoDiscardable' in changeInfo) {
+ // Make sure it's the right tab.
+ assertEq(testTab.id, tab.id);
+
+ // Make sure the auto-discardable state changed correctly.
+ assertFalse(changeInfo.autoDiscardable);
+ assertFalse(tab.autoDiscardable);
+
+ onUpdatedCompleted();
+ }
+ });
+
+ chrome.tabs.update(testTab.id, { autoDiscardable: false },
+ pass(function(tab) {
+ assertFalse(tab.autoDiscardable);
+ testTab = tab;
+ }));
+ },
+
+ function resetAutoDiscardable() {
+ // Tab was set to non auto-discardable.
+ assertFalse(testTab.autoDiscardable);
+
+ var onUpdatedCompleted = chrome.test.listenForever(
+ chrome.tabs.onUpdated,
+ function(tabId, changeInfo, tab) {
+ if ('autoDiscardable' in changeInfo) {
+ // Make sure it's the right tab.
+ assertEq(testTab.id, tab.id);
+
+ // Make sure the auto-discardable state changed correctly.
+ assertTrue(changeInfo.autoDiscardable);
+ assertTrue(tab.autoDiscardable);
+
+ onUpdatedCompleted();
+ }
+ });
+
+ chrome.tabs.update(testTab.id, { autoDiscardable: true },
+ pass(function (tab) {
+ assertTrue(tab.autoDiscardable);
+ }));
}
]);
« no previous file with comments | « chrome/common/extensions/api/tabs.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698