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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/autoDiscardable.js

Issue 2205523002: AutoDiscardable property support on Chrome Extensions Tabs API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var testTab;
6 chrome.test.runTests([
7
8 function setupWindow() {
9 var testTabId;
10
11 createWindow(["about:blank", "chrome://newtab/"], {},
12 pass(function(winId, tabIds) {
13 testTabId = tabIds[1];
14 }));
15
16 waitForAllTabs(pass(function() {
17 queryForTab(testTabId, {}, pass(function(tab) {
18 testTab = tab;
19 }));
20 }));
21 },
22
23 function setNonAutoDiscardable() {
24 // Initially the tab is auto-discardable.
25 assertTrue(testTab.autoDiscardable);
26
27 var onUpdatedCompleted = chrome.test.listenForever(
28 chrome.tabs.onUpdated,
29 function(tabId, changeInfo, tab) {
30 if ('autoDiscardable' in changeInfo) {
31 // Make sure it's the right tab.
32 assertEq(testTab.id, tab.id);
33
34 // Make sure the auto-discardable state changed correctly.
35 assertFalse(changeInfo.autoDiscardable);
36 assertFalse(tab.autoDiscardable);
37
38 onUpdatedCompleted();
39 }
40 });
41
42 chrome.tabs.update(testTab.id, { autoDiscardable: false },
43 pass(function (tab) {
44 assertFalse(tab.autoDiscardable);
45 testTab = tab;
46 }));
47 },
48
49 function resetAutoDiscardable() {
chrisha 2016/08/02 14:40:06 Another +2 indent here as well?
Anderson Silva 2016/08/02 15:02:43 Done.
50 // Tab was set to non auto-discardable.
51 assertFalse(testTab.autoDiscardable);
52
53 var onUpdatedCompleted = chrome.test.listenForever(
54 chrome.tabs.onUpdated,
55 function(tabId, changeInfo, tab) {
56 if ('autoDiscardable' in changeInfo) {
57 // Make sure it's the right tab.
58 assertEq(testTab.id, tab.id);
59
60 // Make sure the auto-discardable state changed correctly.
61 assertTrue(changeInfo.autoDiscardable);
62 assertTrue(tab.autoDiscardable);
63
64 onUpdatedCompleted();
65 }
66 });
67
68 chrome.tabs.update(testTab.id, { autoDiscardable: true },
69 pass(function (tab) {
70 assertTrue(tab.autoDiscardable);
71 }));
72 }
73 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698