| Index: chrome/browser/resources/tracing/profiling_view_test.html
|
| diff --git a/chrome/browser/resources/tracing/profiling_view_test.html b/chrome/browser/resources/tracing/profiling_view_test.html
|
| index 3297c4e73e39ddd322864b115d5f807335aa8ad6..18121be2fd8422eaa136e2df26d4c81fc2904f84 100644
|
| --- a/chrome/browser/resources/tracing/profiling_view_test.html
|
| +++ b/chrome/browser/resources/tracing/profiling_view_test.html
|
| @@ -6,15 +6,29 @@ Use of this source code is governed by a BSD-style license that can be
|
| found in the LICENSE file.
|
| -->
|
| <head i18n-values="dir:textdirection;">
|
| -<title>Interactive Timeline Tests</title>
|
| +<title>ProfilingView tests</title>
|
| <link rel="stylesheet" href="profiling_view.css">
|
| +<link rel="stylesheet" href="timeline_view.css">
|
| +<link rel="stylesheet" href="overlay.css">
|
| +<link rel="stylesheet" href="timeline.css">
|
| <link rel="stylesheet" href="../shared/css/tabs.css">
|
| <script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
|
| <script src="../shared/js/cr.js"></script>
|
| <script src="../shared/js/cr/event_target.js"></script>
|
| <script src="../shared/js/cr/ui.js"></script>
|
| <script src="../shared/js/cr/ui/tabs.js"></script>
|
| +<script src="overlay.js"></script>
|
| +<script src="measuring_stick.js"></script>
|
| <script src="profiling_view.js"></script>
|
| +<script src="timeline_view.js"></script>
|
| +<script src="timeline_model.js"></script>
|
| +<script src="linux_perf_importer.js"></script>
|
| +<script src="trace_event_importer.js"></script>
|
| +<script src="timeline.js"></script>
|
| +<script src="timeline_track.js"></script>
|
| +<script src="sorted_array_utils.js"></script>
|
| +<script src="fast_rect_renderer.js"></script>
|
| +<script src="test_utils.js"></script>
|
| <script>
|
| goog.require('goog.testing.jsunit');
|
| </script>
|
| @@ -32,8 +46,8 @@ found in the LICENSE file.
|
| * Just enough of the TracingController to support the tests below.
|
| */
|
| function FakeTracingController() {
|
| -
|
| }
|
| +
|
| FakeTracingController.prototype = {
|
| __proto__: cr.EventTarget.prototype,
|
|
|
| @@ -50,74 +64,33 @@ found in the LICENSE file.
|
|
|
| get systemTraceEvents() {
|
| if (!this.wasBeginTracingCalled)
|
| - return undefined;
|
| + return [];
|
| if (!this.wasBeginTracingCalledWithSystemTracingEnabled)
|
| - return undefined;
|
| + return [];
|
| return FakeTracingController.systemTraceTestData;
|
| }
|
|
|
| };
|
| FakeTracingController.testData = [
|
| - "hello",
|
| - "world"
|
| + {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
|
| + {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'},
|
| + {name: 'b', args: {}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'B'},
|
| + {name: 'b', args: {}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'}
|
| ];
|
| FakeTracingController.systemTraceTestData = [
|
| - "the kernel",
|
| - "says it wants",
|
| - "its memory back"
|
| - ];
|
| -
|
| - /*
|
| - * Just enough of the TimelineModel to support the tests below.
|
| - */
|
| - function FakeTimelineModel() {
|
| -
|
| - }
|
| - FakeTimelineModel.prototype = {
|
| - __proto__: Object.prototype,
|
| -
|
| - importEvents: function(eventData,
|
| - opt_zeroAndBoost, opt_additionalEventData) {
|
| - assertEquals(eventData, FakeTracingController.testData);
|
| - if (cr.isChromeOS) {
|
| - assertEquals(1, opt_additionalEventData.length);
|
| - assertEquals(opt_additionalEventData[0], FakeTracingController.systemTraceTestData)
|
| - }
|
| - },
|
| -
|
| - something: function() {
|
| - },
|
| - };
|
| -
|
| - /*
|
| - * Just enough of the TimelineView to support the tests below.
|
| - */
|
| - var FakeTimelineView = cr.ui.define('div');
|
| -
|
| - FakeTimelineView.prototype = {
|
| - __proto__: HTMLDivElement.prototype,
|
| -
|
| - decorate: function() {
|
| - this.statusEl_ = document.createElement('span');
|
| - this.appendChild(this.statusEl_);
|
| - this.refresh_();
|
| - },
|
| -
|
| - refresh_: function() {
|
| - var status;
|
| - if (this.timelineModel)
|
| - status = "timelineModel";
|
| - else
|
| - status = "!timelineModel";
|
| - this.statusEl_.textContent = status;
|
| - },
|
| - };
|
| -
|
| - /* Monkeypatch timeline model and view so ProfilingView
|
| - * instantiates them instead.
|
| - */
|
| - tracing.TimelineModel = FakeTimelineModel;
|
| - tracing.TimelineView = FakeTimelineView;
|
| + 'systrace.sh-8170 [001] 15180.978813: sched_switch: ' +
|
| + 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
|
| + 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
|
| + 'next_prio=120',
|
| + ' kworker/1:0-7873 [001] 15180.978836: sched_switch: ' +
|
| + 'prev_comm=kworker/1:0 prev_pid=7873 prev_prio=120 ' +
|
| + 'prev_state=S ==> next_comm=debugd next_pid=4404 next_prio=120',
|
| + ' debugd-4404 [001] 15180.979010: sched_switch: prev_comm=debugd ' +
|
| + 'prev_pid=4404 prev_prio=120 prev_state=S ==> ' +
|
| + 'next_comm=dbus-daemon next_pid=510 next_prio=120',
|
| + 'systrace.sh-8182 [000] 15186.203900: tracing_mark_write: ' +
|
| + 'trace_event_clock_sync: parent_ts=0.0'
|
| + ].join('\n');
|
|
|
| /* This test just instantiates a ProflingView and adds it to the DOM
|
| * to help with non-unittest UI work.
|
| @@ -125,6 +98,7 @@ found in the LICENSE file.
|
| function testInstantiate() {
|
| var view = new tracing.ProfilingView();
|
| view.tracingController = new FakeTracingController();
|
| + view.focusElement = view;
|
| document.body.appendChild(view);
|
| }
|
|
|
| @@ -136,7 +110,7 @@ found in the LICENSE file.
|
| assertTrue(tracingController.wasBeginTracingCalled);
|
| assertEquals(cr.isChromeOS,
|
| tracingController.wasBeginTracingCalledWithSystemTracingEnabled);
|
| -
|
| +
|
| var e = new cr.Event('traceEnded');
|
| var didRefresh = false;
|
| e.events = tracingController.traceEvents;
|
|
|