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

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

Issue 2205563002: Fix newTabPageShareProces() in chrome.processes API browsertests (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
« no previous file with comments | « no previous file | 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Wait for all loads to complete. 100 // Wait for all loads to complete.
101 var completedCount = 0; 101 var completedCount = 0;
102 var onUpdatedCompleted = chrome.test.listenForever( 102 var onUpdatedCompleted = chrome.test.listenForever(
103 chrome.tabs.onUpdated, 103 chrome.tabs.onUpdated,
104 function(changedTabId, changeInfo, changedTab) { 104 function(changedTabId, changeInfo, changedTab) {
105 if (changedTab.status == "complete") { 105 if (changedTab.status == "complete") {
106 completedCount++; 106 completedCount++;
107 107
108 // Once the NTP finishes loading, create another one. This ensures 108 // Once the NTP finishes loading, create another one. This ensures
109 // both NTPs end up in the same process. 109 // both NTPs end up in the same process.
110 if (changedTabId == tabs[3].id) { 110 if (changedTabId == tabs[3].id)
111 createTab(4, "chrome://newtab/"); 111 createTab(4, "chrome://newtab/");
112 }
113 } 112 }
114 113
115 // Once all tabs are done loading, continue with the next test. 114 // Once all tabs are done loading, continue with the next test.
116 if (completedCount == 4) { 115 if (completedCount == 5)
117 onUpdatedCompleted(); 116 onUpdatedCompleted();
118 }
119 } 117 }
120 ); 118 );
121 119
122 }, 120 },
123 121
124 function extensionPageInOwnProcess() { 122 function extensionPageInOwnProcess() {
125 getProcessId(tabs[0].id, pass(function(pid0) { 123 getProcessId(tabs[0].id, pass(function(pid0) {
126 getProcessId(tabs[1].id, pass(function(pid1) { 124 getProcessId(tabs[1].id, pass(function(pid1) {
127 // about:blank and extension page should not share a process 125 // about:blank and extension page should not share a process
128 assertTrue(pid0 != pid1); 126 assertTrue(pid0 != pid1);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 160
163 function newTabPageInOwnProcess() { 161 function newTabPageInOwnProcess() {
164 getProcessId(tabs[0].id, pass(function(pid0) { 162 getProcessId(tabs[0].id, pass(function(pid0) {
165 getProcessId(tabs[3].id, pass(function(pid3) { 163 getProcessId(tabs[3].id, pass(function(pid3) {
166 // NTP should not share a process with current tabs 164 // NTP should not share a process with current tabs
167 assertTrue(pid0 != pid3); 165 assertTrue(pid0 != pid3);
168 })); 166 }));
169 })); 167 }));
170 }, 168 },
171 169
172 // DISABLED: crbug.com/594318
173 // Fails in --site-per-process
174 /*
175 function newTabPagesShareProcess() { 170 function newTabPagesShareProcess() {
176 getProcessId(tabs[3].id, pass(function(pid3) { 171 getProcessId(tabs[3].id, pass(function(pid3) {
177 getProcessId(tabs[4].id, pass(function(pid4) { 172 getProcessId(tabs[4].id, pass(function(pid4) {
178 // Multiple NTPs should share a process 173 // Multiple NTPs should share a process
179 assertEq(pid3, pid4); 174 assertEq(pid3, pid4);
180 })); 175 }));
181 })); 176 }));
182 }, 177 },
183 */
184 178
185 function idsInUpdateEvent() { 179 function idsInUpdateEvent() {
186 listenOnce(chrome.processes.onUpdated, function(processes) { 180 listenOnce(chrome.processes.onUpdated, function(processes) {
187 // onUpdated should return a valid dictionary of processes, 181 // onUpdated should return a valid dictionary of processes,
188 // indexed by process ID. 182 // indexed by process ID.
189 var pids = Object.keys(processes); 183 var pids = Object.keys(processes);
190 // There should be at least 5 processes: 1 browser, 1 extension, and 3 184 // There should be at least 5 processes: 1 browser, 1 extension, and 3
191 // renderers (for the 5 tabs). 185 // renderers (for the 5 tabs).
192 assertTrue(pids.length >= 5, "Unexpected size of pids"); 186 assertTrue(pids.length >= 5, "Unexpected size of pids");
193 187
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 }); 331 });
338 }); 332 });
339 chrome.tabs.create({"url": "chrome://hang" }, function(tab) { 333 chrome.tabs.create({"url": "chrome://hang" }, function(tab) {
340 getProcessId(tab.id, function(pid0) { 334 getProcessId(tab.id, function(pid0) {
341 hangingTabProcess = pid0; 335 hangingTabProcess = pid0;
342 }); 336 });
343 chrome.tabs.update(tab.id, { "url": "chrome://flags" }); 337 chrome.tabs.update(tab.id, { "url": "chrome://flags" });
344 }); 338 });
345 } 339 }
346 ]); 340 ]);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698