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..a88eb29acbcd766f520618373e32dc71617c3b50 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/automation/tests/webview/location_in_webview.js |
@@ -0,0 +1,44 @@ |
+// 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 assertEq = chrome.test.assertEq; |
+ |
+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). |
+ assertEq(50, outerRect.left); |
+ assertEq(150, outerRect.top); |
+ |
+ // The inner button should be exactly 100 x 200 pixels offset from |
+ // the outer button. |
+ assertEq(100, innerRect.left - outerRect.left); |
+ assertEq(200, innerRect.top - outerRect.top); |
+ 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); |
+}); |