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

Unified 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698