Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 allTests = [ | |
| 6 function testFocusInIframes() { | |
| 7 chrome.test.getConfig(function(config) { | |
| 8 var url = 'http://a.com:' + config.testServer.port + '/iframe_outer.html'; | |
| 9 chrome.tabs.create({url: url}); | |
| 10 | |
| 11 chrome.automation.getDesktop(function(rootNode) { | |
| 12 // Succeed when the button inside the iframe gets focus. | |
| 13 rootNode.addEventListener('focus', function(event) { | |
| 14 if (event.target.name == 'Inner') | |
| 15 chrome.test.succeed(); | |
| 16 }); | |
| 17 | |
| 18 // Wait for the inner frame to load, then find the button inside it | |
| 19 // and focus it. | |
| 20 rootNode.addEventListener('loadComplete', function(event) { | |
| 21 if (event.target.url.indexOf('iframe_inner.html') >= 0) { | |
| 22 chrome.automation.getFocus(function(focus) { | |
| 23 // Assert that the outer frame has focus. | |
| 24 assertTrue(focus.url.indexOf('iframe_outer') >= 0); | |
| 25 | |
| 26 // Find the inner button and focus it. | |
| 27 var innerButton = focus.find({ attributes: { name: 'Inner' } }); | |
| 28 innerButton.focus(); | |
| 29 }); | |
| 30 } | |
| 31 }); | |
| 32 }); | |
| 33 }); | |
| 34 }, | |
| 35 ]; | |
|
David Tseng
2016/03/04 16:50:20
Could you also add a test for tree walking (out an
dmazzoni
2016/03/07 23:12:39
Done now. I had to make a change to AutomationPred
| |
| 36 | |
| 37 chrome.test.runTests(allTests); | |
| OLD | NEW |