OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 checkExtension = function(element, expectedValue) { |
| 6 chrome.test.assertEq(expectedValue, element.extension); |
| 7 }; |
| 8 |
| 9 var checkSrc = function(element, expectedValue) { |
| 10 chrome.test.assertEq(expectedValue, element.src); |
| 11 }; |
| 12 |
| 13 onload = function() { |
| 14 chrome.test.runTests([ |
| 15 function extensionView() { |
| 16 var firstExtensionId = 'firstExtensionId'; |
| 17 var secondExtensionId = 'secondExtensionId'; |
| 18 var firstSrc = 'data:text/html,<body>One</body>'; |
| 19 var secondSrc = 'data:text/html,<body>One</body>'; |
| 20 |
| 21 var extensionview = document.querySelector('extensionview'); |
| 22 // Call connect with an initial extension Id and src. |
| 23 extensionview.connect(firstExtensionId, firstSrc); |
| 24 checkExtension(extensionview, firstExtensionId); |
| 25 checkSrc(extensionview, firstSrc); |
| 26 |
| 27 // Call connect with the same extension Id and src. |
| 28 extensionview.connect(firstExtensionId, firstSrc); |
| 29 checkExtension(extensionview, firstExtensionId); |
| 30 checkSrc(extensionview, firstSrc); |
| 31 |
| 32 // Call connect with the same extension Id and different src. |
| 33 extensionview.connect(firstExtensionId, secondSrc); |
| 34 checkExtension(extensionview, firstExtensionId); |
| 35 checkSrc(extensionview, secondSrc); |
| 36 |
| 37 // Call connect with a new extension Id and src. |
| 38 extensionview.connect(secondExtensionId, firstSrc); |
| 39 checkExtension(extensionview, secondExtensionId); |
| 40 checkSrc(extensionview, firstSrc); |
| 41 |
| 42 // Call setAttribute with a different src. |
| 43 extensionview.setAttribute('src', secondSrc); |
| 44 checkExtension(extensionview, secondExtensionId); |
| 45 checkSrc(extensionview, secondSrc); |
| 46 chrome.test.succeed(); |
| 47 } |
| 48 ]); |
| 49 }; |
OLD | NEW |