Commit b0f24cde authored by rsesek@chromium.org's avatar rsesek@chromium.org

SheriffOMatic: Add ct-popout-iframe and switch test output iframes to use it.

BUG=413067
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/559843006

git-svn-id: svn://svn.chromium.org/blink/trunk@181902 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 655be0e8
<!--
Copyright 2014 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.
-->
<polymer-element name="ct-popout-iframe" attributes="src" noscript>
<template>
<style>
.link {
/* <ct-test-output> sets line-height 0, so reset it here. */
line-height: initial;
padding: 3px;
}
iframe {
border: none;
width: 100%;
height: 400px;
}
</style>
<iframe src="{{src}}"></iframe>
<div class="link"><a href="{{src}}" target="_blank">pop out to a new tab</a></div>
</template>
</polymer-element>
...@@ -7,6 +7,7 @@ found in the LICENSE file. ...@@ -7,6 +7,7 @@ found in the LICENSE file.
<link rel="import" href="../bower_components/core-menu/core-menu.html"> <link rel="import" href="../bower_components/core-menu/core-menu.html">
<link rel="import" href="ct-results-by-builder.html"> <link rel="import" href="ct-results-by-builder.html">
<link rel="import" href="ct-embedded-flakiness-dashboard.html"> <link rel="import" href="ct-embedded-flakiness-dashboard.html">
<link rel="import" href="ct-popout-iframe.html">
<polymer-element name="ct-results-panel" attributes="failures tree"> <polymer-element name="ct-results-panel" attributes="failures tree">
<template> <template>
...@@ -55,7 +56,7 @@ found in the LICENSE file. ...@@ -55,7 +56,7 @@ found in the LICENSE file.
<div class="message">No results to display.</div> <div class="message">No results to display.</div>
</template> </template>
<template if="{{ failures.url }}"> <template if="{{ failures.url }}">
<iframe src='{{ failures.url }}'></iframe> <ct-popout-iframe src="{{ failures.url }}"></ct-popout-iframe>
</template> </template>
<template if="{{ failures.length }}"> <template if="{{ failures.length }}">
<core-menu selected="{{ selected }}"> <core-menu selected="{{ selected }}">
......
...@@ -4,18 +4,15 @@ Use of this source code is governed by a BSD-style license that can be ...@@ -4,18 +4,15 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. found in the LICENSE file.
--> -->
<polymer-element name="ct-test-output" attributes="type url"> <link rel="import" href="ct-popout-iframe.html">
<polymer-element name="ct-test-output" attributes="type url">
<template> <template>
<style> <style>
.result { .result {
border: 1px solid gray; border: 1px solid gray;
line-height: 0; line-height: 0;
} }
iframe {
border: none;
width: 100%;
height: 400px;
}
img { img {
width: 100%; width: 100%;
} }
...@@ -27,7 +24,7 @@ found in the LICENSE file. ...@@ -27,7 +24,7 @@ found in the LICENSE file.
<img src="{{url}}"> <img src="{{url}}">
</template> </template>
<template if="{{type == _kTextType}}"> <template if="{{type == _kTextType}}">
<iframe src="{{url}}"></iframe> <ct-popout-iframe src="{{url}}"></ct-popout-iframe>
</template> </template>
<template if="{{type == _kAudioType}}"> <template if="{{type == _kAudioType}}">
<audio controls src="{{url}}"></audio> <audio controls src="{{url}}"></audio>
......
<!--
Copyright 2014 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.
-->
<link rel="import" href="../ct-popout-iframe.html">
<script>
(function() {
var assert = chai.assert;
describe('ct-popout-iframe', function() {
it('has iframe and link', function() {
var elem = document.createElement('ct-popout-iframe');
var iframes = elem.shadowRoot.querySelectorAll('iframe');
assert.lengthOf(iframes, 1);
var links = elem.shadowRoot.querySelectorAll('a');
assert.lengthOf(links, 1);
var thisHref = location.href;
assert.equal(iframes[0].src, thisHref);
assert.equal(links[0].href, thisHref);
var url = 'http://example.com/results.txt';
elem.src = url;
describe('src', function() {
it('set to a URL', function() {
assert.equal(iframes[0].src, url);
assert.equal(links[0].href, url);
});
});
});
});
})();
</script>
...@@ -50,7 +50,7 @@ describe('ct-test-output', function() { ...@@ -50,7 +50,7 @@ describe('ct-test-output', function() {
assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0); assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0);
assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0); assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0);
var iframes = output.shadowRoot.querySelectorAll('iframe'); var iframes = output.shadowRoot.querySelectorAll('ct-popout-iframe');
assert.lengthOf(iframes, 1); assert.lengthOf(iframes, 1);
assert.equal(iframes[0].src, url); assert.equal(iframes[0].src, url);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment