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

Unified Diff: chrome/test/data/extensions/platform_apps/extension_view/connect_api/main.js

Issue 913393003: Restrict extensionview to chrome-extension:// (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/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();
+ }
+ ]);
+};

Powered by Google App Engine
This is Rietveld 408576698