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

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.js

Issue 2813083003: Finish implementation of automation API hit testing for the desktop. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2017 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 testHitTestInDesktop() {
7 var url = 'data:text/html,<!doctype html>' +
8 encodeURI('<button>Click Me</button>');
9 chrome.automation.getDesktop(function(desktop) {
10 chrome.tabs.create({url: url});
11
12 desktop.addEventListener('loadComplete', function(event) {
13 if (event.target.url.indexOf('data:') >= 0) {
14 var button = desktop.find({ attributes: { name: 'Click Me' } });
15 if (button) {
16 button.addEventListener(EventType.ALERT, function() {
17 chrome.test.succeed();
18 }, true);
19 var cx = Math.floor(
20 button.location.left + button.location.width / 2);
21 var cy = Math.floor(
22 button.location.top + button.location.height / 2);
23 desktop.hitTest(cx, cy, EventType.ALERT);
24 }
25 }
26 }, false);
27 });
28 },
29 ];
30
31 chrome.test.runTests(allTests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698