2
* Copyright (C) 2012 Google Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* 2. Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
13
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
* THE POSSIBILITY OF SUCH DAMAGE.
30
var kDummyPerfGraphData = {
31
"dummy_perf_test_1": [
33
"builder": "Mac10.6 Perf",
34
"url": "http://dummyurl1"
37
"dummy_perf_test_2": [
39
"builder": "Mac10.6 Perf",
40
"url": "http://dummyurl2"
43
"builder": "Linux Perf",
44
"url": "http://dummyurl3"
49
asyncTest("View", 7, function() {
50
var oldPerfBuilders = builders.perfBuilders;
51
builders.perfBuilders = function(callback) {
52
setTimeout(function() { callback(kDummyPerfGraphData) }, 0);
55
var view = new ui.perf.View();
57
setTimeout(function() {
58
equal(view.outerHTML, '<div id="perf-view">' +
59
'<ol class="notifications">' +
60
'<li style="opacity: 0; ">' +
61
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
64
'<div class="title-bar">' +
65
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
66
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
67
'<select><option value="http://dummyurl1">Mac10.6 Perf</option></select>' +
68
'<a class="pop-out" target="_blank" href="http://dummyurl1">Pop out</a>' +
70
'<iframe src="http://dummyurl1"></iframe>' +
75
equal(view.outerHTML, '<div id="perf-view">' +
76
'<ol class="notifications">' +
77
'<li style="opacity: 0; ">' +
78
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
81
'<div class="title-bar">' +
82
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
83
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
84
'<a class="pop-out" target="_blank" href="http://dummyurl2">Pop out</a>' +
85
'<select><option value="http://dummyurl2">Mac10.6 Perf</option><option value="http://dummyurl3">Linux Perf</option></select>' +
87
'<iframe src="http://dummyurl2"></iframe>' +
92
equal(view.outerHTML, '<div id="perf-view">' +
93
'<ol class="notifications">' +
94
'<li style="opacity: 0; ">' +
95
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
98
'<div class="title-bar">' +
99
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
100
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
101
'<a class="pop-out" target="_blank" href="http://dummyurl3">Pop out</a>' +
102
'<select><option value="http://dummyurl2">Mac10.6 Perf</option><option value="http://dummyurl3">Linux Perf</option></select>' +
104
'<iframe src="http://dummyurl3"></iframe>' +
109
equal(view.outerHTML, '<div id="perf-view">' +
110
'<ol class="notifications">' +
111
'<li style="opacity: 0; ">' +
112
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
115
'<div class="title-bar">' +
116
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
117
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
118
'<a class="pop-out" target="_blank" href="http://dummyurl3">Pop out</a>' +
119
'<select><option value="http://dummyurl2">Mac10.6 Perf</option><option value="http://dummyurl3">Linux Perf</option></select>' +
121
'<iframe src="http://dummyurl3"></iframe>' +
124
view._previousGraph();
126
equal(view.outerHTML, '<div id="perf-view">' +
127
'<ol class="notifications">' +
128
'<li style="opacity: 0; ">' +
129
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
132
'<div class="title-bar">' +
133
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
134
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
135
'<a class="pop-out" target="_blank" href="http://dummyurl2">Pop out</a>' +
136
'<select><option value="http://dummyurl2">Mac10.6 Perf</option><option value="http://dummyurl3">Linux Perf</option></select>' +
138
'<iframe src="http://dummyurl2"></iframe>' +
141
view._previousGraph();
143
equal(view.outerHTML, '<div id="perf-view">' +
144
'<ol class="notifications">' +
145
'<li style="opacity: 0; ">' +
146
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
149
'<div class="title-bar">' +
150
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
151
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
152
'<a class="pop-out" target="_blank" href="http://dummyurl1">Pop out</a>' +
153
'<select><option value="http://dummyurl1">Mac10.6 Perf</option></select>' +
155
'<iframe src="http://dummyurl1"></iframe>' +
158
view._previousGraph();
160
equal(view.outerHTML, '<div id="perf-view">' +
161
'<ol class="notifications">' +
162
'<li style="opacity: 0; ">' +
163
'<div class="how"></div><div class="what">Loading list of perf dashboards...</div>' +
166
'<div class="title-bar">' +
167
'<select><option>dummy_perf_test_1</option><option>dummy_perf_test_2</option></select>' +
168
'<ul class="actions"><li><button class="action previous">\u25C0</button></li><li><button class="action next">\u25B6</button></li></ul>' +
169
'<a class="pop-out" target="_blank" href="http://dummyurl1">Pop out</a>' +
170
'<select><option value="http://dummyurl1">Mac10.6 Perf</option></select>' +
172
'<iframe src="http://dummyurl1"></iframe>' +
175
builders.perfBuilders = oldPerfBuilders;