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

Unified Diff: chrome/test/data/extensions/api_test/automation/tests/webview/location_in_webview.js

Issue 2762373002: Fix computation of Automation API location offsets in WebViews. (Closed)
Patch Set: Only run new test on chromeos because of required perms Created 3 years, 9 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/webview/location_in_webview.js
diff --git a/chrome/test/data/extensions/api_test/automation/tests/webview/location_in_webview.js b/chrome/test/data/extensions/api_test/automation/tests/webview/location_in_webview.js
new file mode 100644
index 0000000000000000000000000000000000000000..833ff43968ce30fcfaff03fd5f9670a6ad866966
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/automation/tests/webview/location_in_webview.js
@@ -0,0 +1,45 @@
+// 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 assertTrue = chrome.test.assertTrue;
+
+var EventType = chrome.automation.EventType;
+
+var allTests = [
+ function testLocationInWebView() {
+ rootNode.addEventListener(EventType.LOAD_COMPLETE, function() {
+ var outerButton = rootNode.find({ attributes: { name: 'Outer' } });
+ var innerButton = rootNode.find({ attributes: { name: 'Inner' } });
+ if (outerButton && innerButton) {
+ var outerRect = outerButton.location;
+ var innerRect = innerButton.location;
+
+ // The outer button should be at (50, 150). Allow one pixel off
+ // for rounding errors.
+ assertTrue(Math.abs(outerRect.left - 50) <= 1);
+ assertTrue(Math.abs(outerRect.top - 150) <= 1);
+
+ // The inner button should be exactly 100 x 200 pixels offset from
+ // the outer button.
+ assertTrue(Math.abs(innerRect.left - outerRect.left - 100) <= 1);
+ assertTrue(Math.abs(innerRect.top - outerRect.top - 200) <= 1);
+ chrome.test.succeed();
+ }
+ }, false);
+
+ chrome.app.window.create('webview_frame.html', {
+ 'innerBounds': {
+ 'left': 50,
+ 'top': 150,
+ 'width': 400,
+ 'height': 400
+ }
+ });
+ }
+];
+
+chrome.automation.getDesktop(function(rootNodeArg) {
+ window.rootNode = rootNodeArg;
+ chrome.test.runTests(allTests);
+});

Powered by Google App Engine
This is Rietveld 408576698