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

Side by Side Diff: chrome/test/data/extensions/api_test/processes/api/test.js

Issue 165153003: Add process title and nacl debug port fields to the processes api. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new bug Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Processes API test for Chrome. 5 // Processes API test for Chrome.
6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Processes 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Processes
7 7
8 var pass = chrome.test.callbackPass; 8 var pass = chrome.test.callbackPass;
9 var fail = chrome.test.callbackFail; 9 var fail = chrome.test.callbackFail;
10 var assertEq = chrome.test.assertEq; 10 var assertEq = chrome.test.assertEq;
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 var getProcessId = chrome.processes.getProcessIdForTab; 24 var getProcessId = chrome.processes.getProcessIdForTab;
25 25
26 function pageUrl(letter) { 26 function pageUrl(letter) {
27 return chrome.extension.getURL(letter + ".html"); 27 return chrome.extension.getURL(letter + ".html");
28 } 28 }
29 29
30 function dumpProcess(process) { 30 function dumpProcess(process) {
31 console.log("id " + process.id); 31 console.log("id " + process.id);
32 console.log("title " + process.title);
32 console.log("osProcId " + process.osProcessId); 33 console.log("osProcId " + process.osProcessId);
33 console.log("type " + process.type); 34 console.log("type " + process.type);
34 console.log("profile " + process.profile); 35 console.log("profile " + process.profile);
35 console.log("tabs " + process.tabs); 36 console.log("tabs " + process.tabs);
36 console.log("cpu " + process.cpu); 37 console.log("cpu " + process.cpu);
37 console.log("privMem " + process.privateMemory); 38 console.log("privMem " + process.privateMemory);
38 console.log("network " + process.network); 39 console.log("network " + process.network);
39 console.log("jsMemAlloc " + process.jsMemoryAllocated); 40 console.log("jsMemAlloc " + process.jsMemoryAllocated);
40 console.log("jsMemUsed " + process.jsMemoryUsed); 41 console.log("jsMemUsed " + process.jsMemoryUsed);
41 console.log("sqliteMem " + process.sqliteMemory); 42 console.log("sqliteMem " + process.sqliteMemory);
42 console.log("fps " + process.fps); 43 console.log("fps " + process.fps);
44 console.log("naclDebugPort " + process.naclDebugPort);
miket_OOO 2014/02/21 21:19:56 Just a thought: will there be more NaCl stuff in t
bradn 2014/02/21 22:08:06 I don't foresee anything offhand. The most likely
43 if ("imageCache" in process) { 45 if ("imageCache" in process) {
44 console.log("imageCache.size " + process.imageCache.size); 46 console.log("imageCache.size " + process.imageCache.size);
45 console.log("imageCache.liveSize " + process.imageCache.liveSize); 47 console.log("imageCache.liveSize " + process.imageCache.liveSize);
46 } 48 }
47 if ("scriptCache" in process) { 49 if ("scriptCache" in process) {
48 console.log("scriptCache.size " + process.scriptCache.size); 50 console.log("scriptCache.size " + process.scriptCache.size);
49 console.log("scriptCache.liveSize " + process.scriptCache.liveSize); 51 console.log("scriptCache.liveSize " + process.scriptCache.liveSize);
50 } 52 }
51 if ("cssCache" in process) { 53 if ("cssCache" in process) {
52 console.log("cssCache.size " + process.cssCache.size); 54 console.log("cssCache.size " + process.cssCache.size);
53 console.log("cssCache .liveSize " + process.cssCache.liveSize); 55 console.log("cssCache .liveSize " + process.cssCache.liveSize);
54 } 56 }
55 } 57 }
56 58
57 function validateProcessProperties(process, updating, memory_included) { 59 function validateProcessProperties(process, updating, memory_included) {
58 // Always present. 60 // Always present.
59 assertTrue("id" in process); 61 assertTrue("id" in process);
62 assertTrue("title" in process);
63 assertTrue("naclDebugPort" in process);
60 assertTrue("osProcessId" in process); 64 assertTrue("osProcessId" in process);
61 assertTrue("type" in process); 65 assertTrue("type" in process);
62 assertTrue("profile" in process); 66 assertTrue("profile" in process);
63 assertTrue("tabs" in process); 67 assertTrue("tabs" in process);
64 68
65 // Present if onUpdate(WithMemory) listener is registered. 69 // Present if onUpdate(WithMemory) listener is registered.
66 assertEq(("cpu" in process), updating); 70 assertEq(("cpu" in process), updating);
67 assertEq(("network" in process), updating); 71 assertEq(("network" in process), updating);
68 assertEq(("fps" in process), updating); 72 assertEq(("fps" in process), updating);
69 73
70 // Present if memory details are requested. 74 // Present if memory details are requested.
71 assertEq(("privateMemory" in process), memory_included); 75 assertEq(("privateMemory" in process), memory_included);
72 76
73 // sqliteMemory is only reported for the browser process 77 // sqliteMemory is only reported for the browser process
74 if (process.type == "browser") { 78 if (process.type == "browser") {
75 assertEq(("sqliteMemory" in process), updating); 79 assertEq(("sqliteMemory" in process), updating);
76 } else { 80 } else if (process.type == "renderer") {
77 // The rest are not present in the browser process 81 // The rest are not present in the browser process
78 assertEq(("jsMemoryAllocated" in process), updating); 82 assertEq(("jsMemoryAllocated" in process), updating);
79 assertEq(("jsMemoryUsed" in process), updating); 83 assertEq(("jsMemoryUsed" in process), updating);
80 assertEq(("imageCache" in process), updating); 84 assertEq(("imageCache" in process), updating);
81 assertEq(("scriptCache" in process), updating); 85 assertEq(("scriptCache" in process), updating);
82 assertEq(("cssCache" in process), updating); 86 assertEq(("cssCache" in process), updating);
83 } 87 }
84 } 88 }
85 89
86 chrome.test.runTests([ 90 chrome.test.runTests([
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 }, 261 },
258 262
259 function testOnCreated() { 263 function testOnCreated() {
260 listenOnce(chrome.processes.onCreated, function(process) { 264 listenOnce(chrome.processes.onCreated, function(process) {
261 assertTrue("id" in process, "process doesn't have id property"); 265 assertTrue("id" in process, "process doesn't have id property");
262 assertTrue(process.id > 0, "id is not positive " + process.id); 266 assertTrue(process.id > 0, "id is not positive " + process.id);
263 }); 267 });
264 createTab(5, "chrome://newtab/"); 268 createTab(5, "chrome://newtab/");
265 }, 269 },
266 270
271 // DISABLED: crbug.com/345411
272 // Hangs consistently.
273 /*
267 function testOnExited() { 274 function testOnExited() {
268 listenOnce(chrome.processes.onExited, 275 listenOnce(chrome.processes.onExited,
269 function(processId, type, code) { 276 function(processId, type, code) {
270 assertTrue(type >= 0 && type < 5); 277 assertTrue(type >= 0 && type < 5);
271 }); 278 });
272 chrome.tabs.create({"url": "http://google.com/"}, pass(function(tab) { 279 chrome.tabs.create({"url": "http://google.com/"}, pass(function(tab) {
273 chrome.tabs.remove(tab.id); 280 chrome.tabs.remove(tab.id);
274 })); 281 }));
275 }, 282 },
283 */
276 284
277 function testGetProcessInfoList() { 285 function testGetProcessInfoList() {
278 getProcessId(tabs[0].id, pass(function(pidTab0) { 286 getProcessId(tabs[0].id, pass(function(pidTab0) {
279 getProcessId(tabs[1].id, pass(function(pidTab1) { 287 getProcessId(tabs[1].id, pass(function(pidTab1) {
280 chrome.processes.getProcessInfo([pidTab0, pidTab1], false, 288 chrome.processes.getProcessInfo([pidTab0, pidTab1], false,
281 pass(function(processes) { 289 pass(function(processes) {
282 assertTrue(Object.keys(processes).length == 2); 290 assertTrue(Object.keys(processes).length == 2);
283 })); 291 }));
284 })); 292 }));
285 })); 293 }));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 }); 329 });
322 }); 330 });
323 chrome.tabs.create({"url": "chrome://hang" }, function(tab) { 331 chrome.tabs.create({"url": "chrome://hang" }, function(tab) {
324 getProcessId(tab.id, function(pid0) { 332 getProcessId(tab.id, function(pid0) {
325 hangingTabProcess = pid0; 333 hangingTabProcess = pid0;
326 }); 334 });
327 chrome.tabs.update(tab.id, { "url": "chrome://flags" }); 335 chrome.tabs.update(tab.id, { "url": "chrome://flags" });
328 }); 336 });
329 } 337 }
330 ]); 338 ]);
OLDNEW
« chrome/common/extensions/api/processes.json ('K') | « chrome/common/extensions/api/processes.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698