Index: chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.js |
diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9e7f7a691b9087a7781c5a80db9b1d2493ec3c1d |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.js |
@@ -0,0 +1,31 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+var allTests = [ |
+ function testHitTestInDesktop() { |
+ var url = 'data:text/html,<!doctype html>' + |
+ encodeURI('<button>Click Me</button>'); |
+ chrome.automation.getDesktop(function(desktop) { |
+ chrome.tabs.create({url: url}); |
+ |
+ desktop.addEventListener('loadComplete', function(event) { |
+ if (event.target.url.indexOf('data:') >= 0) { |
+ var button = desktop.find({ attributes: { name: 'Click Me' } }); |
+ if (button) { |
+ button.addEventListener(EventType.ALERT, function() { |
+ chrome.test.succeed(); |
+ }, true); |
+ var cx = Math.floor( |
+ button.location.left + button.location.width / 2); |
+ var cy = Math.floor( |
+ button.location.top + button.location.height / 2); |
+ desktop.hitTest(cx, cy, EventType.ALERT); |
+ } |
+ } |
+ }, false); |
+ }); |
+ }, |
+]; |
+ |
+chrome.test.runTests(allTests); |