Index: chrome/test/data/extensions/platform_apps/extension_view/connect_api/main.js |
diff --git a/chrome/test/data/extensions/platform_apps/extension_view/connect_api/main.js b/chrome/test/data/extensions/platform_apps/extension_view/connect_api/main.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..709f4958fcb1ca48f55470b9651b462953f7037f |
--- /dev/null |
+++ b/chrome/test/data/extensions/platform_apps/extension_view/connect_api/main.js |
@@ -0,0 +1,49 @@ |
+// Copyright 2015 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 checkExtension = function(element, expectedValue) { |
+ chrome.test.assertEq(expectedValue, element.extension); |
+}; |
+ |
+var checkSrc = function(element, expectedValue) { |
+ chrome.test.assertEq(expectedValue, element.src); |
+}; |
+ |
+onload = function() { |
+ chrome.test.runTests([ |
+ function extensionView() { |
+ var firstExtensionId = 'firstExtensionId'; |
+ var secondExtensionId = 'secondExtensionId'; |
+ var firstSrc = 'data:text/html,<body>One</body>'; |
+ var secondSrc = 'data:text/html,<body>One</body>'; |
+ |
+ var extensionview = document.querySelector('extensionview'); |
+ // Call connect with an initial extension Id and src. |
+ extensionview.connect(firstExtensionId, firstSrc); |
+ checkExtension(extensionview, firstExtensionId); |
+ checkSrc(extensionview, firstSrc); |
+ |
+ // Call connect with the same extension Id and src. |
+ extensionview.connect(firstExtensionId, firstSrc); |
+ checkExtension(extensionview, firstExtensionId); |
+ checkSrc(extensionview, firstSrc); |
+ |
+ // Call connect with the same extension Id and different src. |
+ extensionview.connect(firstExtensionId, secondSrc); |
+ checkExtension(extensionview, firstExtensionId); |
+ checkSrc(extensionview, secondSrc); |
+ |
+ // Call connect with a new extension Id and src. |
+ extensionview.connect(secondExtensionId, firstSrc); |
+ checkExtension(extensionview, secondExtensionId); |
+ checkSrc(extensionview, firstSrc); |
+ |
+ // Call setAttribute with a different src. |
+ extensionview.setAttribute('src', secondSrc); |
+ checkExtension(extensionview, secondExtensionId); |
+ checkSrc(extensionview, secondSrc); |
+ chrome.test.succeed(); |
+ } |
+ ]); |
+}; |