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

Side by Side 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, 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 assertTrue = chrome.test.assertTrue;
6
7 var EventType = chrome.automation.EventType;
8
9 var allTests = [
10 function testLocationInWebView() {
11 rootNode.addEventListener(EventType.LOAD_COMPLETE, function() {
12 var outerButton = rootNode.find({ attributes: { name: 'Outer' } });
13 var innerButton = rootNode.find({ attributes: { name: 'Inner' } });
14 if (outerButton && innerButton) {
15 var outerRect = outerButton.location;
16 var innerRect = innerButton.location;
17
18 // The outer button should be at (50, 150). Allow one pixel off
19 // for rounding errors.
20 assertTrue(Math.abs(outerRect.left - 50) <= 1);
21 assertTrue(Math.abs(outerRect.top - 150) <= 1);
22
23 // The inner button should be exactly 100 x 200 pixels offset from
24 // the outer button.
25 assertTrue(Math.abs(innerRect.left - outerRect.left - 100) <= 1);
26 assertTrue(Math.abs(innerRect.top - outerRect.top - 200) <= 1);
27 chrome.test.succeed();
28 }
29 }, false);
30
31 chrome.app.window.create('webview_frame.html', {
32 'innerBounds': {
33 'left': 50,
34 'top': 150,
35 'width': 400,
36 'height': 400
37 }
38 });
39 }
40 ];
41
42 chrome.automation.getDesktop(function(rootNodeArg) {
43 window.rootNode = rootNodeArg;
44 chrome.test.runTests(allTests);
45 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698