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

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

Issue 2831853002: Re-land: Finish implementation of automation API hit testing for the desktop (Closed)
Patch Set: Fix to trigger final test callback only once 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
« no previous file with comments | « chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..924579c7f6fe82fa2be5c85531ab0c3513b370bf
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.js
@@ -0,0 +1,35 @@
+// 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>');
+ var didHitTest = false;
+ chrome.automation.getDesktop(function(desktop) {
+ chrome.tabs.create({url: url});
+
+ desktop.addEventListener('loadComplete', function(event) {
+ if (didHitTest)
+ return;
+ if (event.target.url.indexOf('data:') >= 0) {
+ var button = desktop.find({ attributes: { name: 'Click Me' } });
+ if (button) {
+ didHitTest = true;
+ 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);
« no previous file with comments | « chrome/test/data/extensions/api_test/automation/tests/desktop/hit_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698