| OLD | NEW |
| 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 testInitialFocus() { | 6 function testInitialFocus() { |
| 7 var url = 'data:text/html,<!doctype html>' + | 7 var url = 'data:text/html,<!doctype html>' + |
| 8 encodeURI('<input autofocus title=abc>'); | 8 encodeURI('<input autofocus title=abc>'); |
| 9 chrome.automation.getDesktop(function(rootNode) { | 9 chrome.automation.getDesktop(function(rootNode) { |
| 10 chrome.tabs.create({url: url}); | 10 chrome.tabs.create({url: url}); |
| 11 | 11 |
| 12 rootNode.addEventListener('loadComplete', function(event) { | 12 rootNode.addEventListener('focus', function(event) { |
| 13 if (event.target.url == url) { | 13 if (event.target.root.url == url) { |
| 14 chrome.automation.getFocus(function(focus) { | 14 chrome.automation.getFocus(function(focus) { |
| 15 assertEq('textField', focus.role); | 15 assertEq('textField', focus.role); |
| 16 assertEq('abc', focus.name); | 16 assertEq('abc', focus.name); |
| 17 chrome.test.succeed(); | 17 chrome.test.succeed(); |
| 18 }); | 18 }); |
| 19 } | 19 } |
| 20 }, false); | 20 }, false); |
| 21 }); | 21 }); |
| 22 }, | 22 }, |
| 23 ]; | 23 ]; |
| 24 | 24 |
| 25 chrome.test.runTests(allTests); | 25 chrome.test.runTests(allTests); |
| OLD | NEW |