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

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

Issue 2142413003: Adding Discarded property support for onUpdate function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@API_Discarded
Patch Set: todo 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
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/basics/discarded.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
Devlin 2016/07/29 21:23:40 indent parameters more, function body less: create
Anderson Silva 2016/07/29 22:12:24 Done.
13 testTabId = tabIds[1];
14 }));
15
16 waitForAllTabs(pass(function () {
Devlin 2016/07/29 21:23:40 no space between function and (
Anderson Silva 2016/07/29 22:12:24 Done.
17 queryForTab(testTabId, {}, pass(function (tab) {
18 testTab = tab;
19 }));
20 }));
21 },
22
23 function discard() {
24 // Initially tab isn't discarded.
25 assertFalse(testTab.discarded);
26
27 var onUpdatedCompleted = chrome.test.listenForever(
28 chrome.tabs.onUpdated,
29 function (tabId, changeInfo, tab) {
Devlin 2016/07/29 21:23:40 indent these two more, outdent the function body t
Anderson Silva 2016/07/29 22:12:24 Done.
30 if ('discarded' in changeInfo) {
31 // Make sure it's the right tab.
32 assertEq(testTab.index, tab.index);
33 assertEq(testTab.windowId, tab.windowId);
34
35 // Make sure the discarded state changed correctly.
36 assertTrue(changeInfo.discarded);
37 assertTrue(tab.discarded);
38
39 onUpdatedCompleted();
40 }
41 }
42 );
Devlin 2016/07/29 21:23:40 nit: put the paren and the closing function brace
Anderson Silva 2016/07/29 22:12:24 Done.
43
44 // TODO(georgesak): Remove tab update when http://crbug.com/632839 is
45 // resolved.
46 // Discard and update testTab (the id changes after a tab is discarded).
47 chrome.tabs.discard(testTab.id, pass(function (tab) {
48 assertTrue(tab.discarded);
49 testTab = tab;
50 }));
51 },
52
53 function reload() {
54 // Tab is already discarded.
55 assertTrue(testTab.discarded);
56
57 var onUpdatedCompleted = chrome.test.listenForever(
58 chrome.tabs.onUpdated,
Devlin 2016/07/29 21:23:40 see indentation advice for line 27
Anderson Silva 2016/07/29 22:12:24 Done.
59 function (tabId, changeInfo, tab) {
60 if ('discarded' in changeInfo) {
61 // Make sure it's the right tab.
62 assertEq(testTab.index, tab.index);
63 assertEq(testTab.windowId, tab.windowId);
64
65 // Make sure the discarded state changed correctly.
66 assertFalse(changeInfo.discarded);
67 assertFalse(tab.discarded);
68
69 onUpdatedCompleted();
70 }
71 }
72 );
73
74 chrome.tabs.reload(testTab.id);
75 }
76 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/basics/discarded.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698