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); |
+}); |