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

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/close_tab.js

Issue 1308813008: Fix crash when accessing automation node from stale AX tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put setTimeout in else to be more clear Created 5 years, 3 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/renderer/resources/extensions/automation/automation_node.js ('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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 var allTests = [ 5 var allTests = [
6 function testCloseTab() { 6 function testCloseTab() {
7 getUrlFromConfig('index.html', function(url) { 7 getUrlFromConfig('index.html', function(url) {
8 chrome.tabs.create({'url': url}, function(tab) { 8 chrome.tabs.create({'url': url}, function(tab) {
9 chrome.automation.getTree(function(rootNode) { 9 chrome.automation.getTree(function(rootNode) {
10 rootNode.addEventListener(EventType.destroyed, function() { 10 rootNode.addEventListener(EventType.destroyed, function() {
11 // Should get a 'destroyed' event when the tab is closed. 11 // Poll until the root node doesn't have a role anymore
David Tseng 2015/08/28 22:51:25 Do we get an event (as to avoid busy waiting?).
dmazzoni 2015/08/28 23:02:35 We get the event immediately before it's destroyed
12 // TODO(aboxhall): assert actual cleanup has occurred once 12 // indicating that it really did get cleaned up.
13 // crbug.com/387954 makes it possible. 13 function checkSuccess() {
14 chrome.test.succeed(); 14 if (rootNode.role === undefined)
15 chrome.test.succeed();
16 else
17 window.setTimeout(checkSuccess, 10);
18 }
19 checkSuccess();
15 }); 20 });
16 chrome.tabs.remove(tab.id); 21 chrome.tabs.remove(tab.id);
17 }); 22 });
18 }); 23 });
19 }); 24 });
20 } 25 }
21 ] 26 ]
22 chrome.test.runTests(allTests); 27 chrome.test.runTests(allTests);
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/automation/automation_node.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698