| Index: chrome/browser/resources/tracing/timeline_model_test.html
|
| diff --git a/chrome/browser/resources/tracing/timeline_model_test.html b/chrome/browser/resources/tracing/timeline_model_test.html
|
| deleted file mode 100644
|
| index eed12906ff4412357acdfac27c8dcf5662e7dff2..0000000000000000000000000000000000000000
|
| --- a/chrome/browser/resources/tracing/timeline_model_test.html
|
| +++ /dev/null
|
| @@ -1,256 +0,0 @@
|
| -<!DOCTYPE html>
|
| -<html>
|
| -<!--
|
| -Copyright (c) 2012 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.
|
| --->
|
| -<head>
|
| -<title>TimelineModel tests</title>
|
| -<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="test_utils.js"></script>
|
| -<script src="timeline_model.js"></script>
|
| -<script>
|
| - goog.require('goog.testing.jsunit');
|
| -</script>
|
| -
|
| -</head>
|
| -<body>
|
| -<script>
|
| -'use strict';
|
| -var TimelineCpu = tracing.TimelineCpu;
|
| -var TimelineSlice = tracing.TimelineSlice;
|
| -var TimelineThreadSlice = tracing.TimelineThreadSlice;
|
| -var TimelineProcess = tracing.TimelineProcess;
|
| -var TimelineThread = tracing.TimelineThread;
|
| -var TimelineModel = tracing.TimelineModel;
|
| -var TimelineFilter = tracing.TimelineFilter;
|
| -var TimelineAsyncSlice = tracing.TimelineAsyncSlice;
|
| -var TimelineAsyncSliceGroup = tracing.TimelineAsyncSliceGroup;
|
| -var newAsyncSlice = test_utils.newAsyncSlice;
|
| -
|
| -function testThreadBounds_Empty() {
|
| - var t = new TimelineThread(new TimelineProcess(7), 1);
|
| - t.updateBounds();
|
| - assertEquals(undefined, t.minTimestamp);
|
| - assertEquals(undefined, t.maxTimestamp);
|
| -}
|
| -
|
| -function testThreadBounds_SubRow() {
|
| - var t = new TimelineThread(new TimelineProcess(7), 1);
|
| - t.subRows[0].push(new TimelineThreadSlice('a', 0, 1, {}, 3));
|
| - t.updateBounds();
|
| - assertEquals(1, t.minTimestamp);
|
| - assertEquals(4, t.maxTimestamp);
|
| -}
|
| -
|
| -function testThreadBounds_AsyncSliceGroup() {
|
| - var t = new TimelineThread(new TimelineProcess(7), 1);
|
| - t.subRows[0].push(new TimelineThreadSlice('a', 0, 1, {}, 3));
|
| - t.asyncSlices.push(newAsyncSlice(0.1, 5, t, t));
|
| - t.updateBounds();
|
| - assertEquals(0.1, t.minTimestamp);
|
| - assertEquals(5.1, t.maxTimestamp);
|
| -}
|
| -
|
| -function testModelBounds_EmptyModel() {
|
| - var m = new TimelineModel();
|
| - m.updateBounds();
|
| - assertEquals(undefined, m.minTimestamp);
|
| - assertEquals(undefined, m.maxTimestamp);
|
| -}
|
| -
|
| -function testModelBounds_OneEmptyThread() {
|
| - var m = new TimelineModel();
|
| - var t = m.getOrCreateProcess(1).getOrCreateThread(1);
|
| - m.updateBounds();
|
| - assertEquals(undefined, m.minTimestamp);
|
| - assertEquals(undefined, m.maxTimestamp);
|
| -}
|
| -
|
| -function testModelBounds_OneThread() {
|
| - var m = new TimelineModel();
|
| - var t = m.getOrCreateProcess(1).getOrCreateThread(1);
|
| - t.subRows[0].push(new TimelineThreadSlice('a', 0, 1, {}, 3));
|
| - m.updateBounds();
|
| - assertEquals(1, m.minTimestamp);
|
| - assertEquals(4, m.maxTimestamp);
|
| -}
|
| -
|
| -function testModelBounds_OneThreadAndOneEmptyThread() {
|
| - var m = new TimelineModel();
|
| - var t1 = m.getOrCreateProcess(1).getOrCreateThread(1);
|
| - t1.subRows[0].push(new TimelineThreadSlice('a', 0, 1, {}, 3));
|
| - var t2 = m.getOrCreateProcess(1).getOrCreateThread(1);
|
| - m.updateBounds();
|
| - assertEquals(1, m.minTimestamp);
|
| - assertEquals(4, m.maxTimestamp);
|
| -}
|
| -
|
| -function testCpuBounds_Empty() {
|
| - var cpu = new TimelineCpu(undefined, 1);
|
| - cpu.updateBounds();
|
| - assertEquals(undefined, cpu.minTimestamp);
|
| - assertEquals(undefined, cpu.maxTimestamp);
|
| -}
|
| -
|
| -function testCpuBounds_OneSlice() {
|
| - var cpu = new TimelineCpu(undefined, 1);
|
| - cpu.slices.push(new TimelineSlice('a', 0, 1, {}, 3));
|
| - cpu.updateBounds();
|
| - assertEquals(1, cpu.minTimestamp);
|
| - assertEquals(4, cpu.maxTimestamp);
|
| -}
|
| -
|
| -function testModelBounds_OneCpu() {
|
| - var m = new TimelineModel();
|
| - var cpu = m.getOrCreateCpu(1);
|
| - cpu.slices.push(new TimelineSlice('a', 0, 1, {}, 3));
|
| - m.updateBounds();
|
| - assertEquals(1, m.minTimestamp);
|
| - assertEquals(4, m.maxTimestamp);
|
| -}
|
| -
|
| -
|
| -function testModelBounds_OneCpuOneThread() {
|
| - var m = new TimelineModel();
|
| - var cpu = m.getOrCreateCpu(1);
|
| - cpu.slices.push(new TimelineSlice('a', 0, 1, {}, 3));
|
| -
|
| - var t = m.getOrCreateProcess(1).getOrCreateThread(1);
|
| - t.subRows[0].push(new TimelineThreadSlice('a', 0, 1, {}, 4));
|
| -
|
| - m.updateBounds();
|
| - assertEquals(1, m.minTimestamp);
|
| - assertEquals(5, m.maxTimestamp);
|
| -}
|
| -
|
| -function testPTIDFromPidAndTid() {
|
| - assertEquals('1:2', TimelineThread.getPTIDFromPidAndTid(1, 2));
|
| -}
|
| -
|
| -function testAsyncSliceGroupBounds_Empty() {
|
| - var g = new TimelineAsyncSliceGroup(name);
|
| - g.updateBounds();
|
| - assertEquals(undefined, g.minTimestamp);
|
| - assertEquals(undefined, g.maxTimestamp);
|
| -}
|
| -
|
| -function testAsyncSliceGroupBounds_Basic() {
|
| - var p1 = new TimelineProcess(1);
|
| - var t1 = new TimelineThread(p1, 1);
|
| - var g = new TimelineAsyncSliceGroup('a');
|
| - g.push(newAsyncSlice(0, 1, t1, t1));
|
| - g.push(newAsyncSlice(1, 1.5, t1, t1));
|
| - assertEquals(2, g.length);
|
| - g.updateBounds();
|
| - assertEquals(0, g.minTimestamp);
|
| - assertEquals(2.5, g.maxTimestamp);
|
| -}
|
| -
|
| -function testAsyncSliceGroup_rebuildSubRows_twoNonOverlappingSlices() {
|
| - var p1 = new TimelineProcess(1);
|
| - var t1 = new TimelineThread(p1, 1);
|
| - var g = new TimelineAsyncSliceGroup('a');
|
| - g.slices.push(newAsyncSlice(0, 1, t1, t1));
|
| - g.slices.push(newAsyncSlice(1, 1, t1, t1));
|
| -
|
| - assertEquals(1, g.subRows.length);
|
| - assertEquals(2, g.subRows[0].length);
|
| - assertEquals(g.slices[0].subSlices[0], g.subRows[0][0]);
|
| - assertEquals(g.slices[1].subSlices[0], g.subRows[0][1]);
|
| -}
|
| -
|
| -function testAsyncSliceGroup_rebuildSubRows_twoOverlappingSlices() {
|
| - var p1 = new TimelineProcess(1);
|
| - var t1 = new TimelineThread(p1, 1);
|
| - var g = new TimelineAsyncSliceGroup('a');
|
| - g.slices.push(newAsyncSlice(0, 1, t1, t1));
|
| - g.slices.push(newAsyncSlice(0, 1.5, t1, t1));
|
| - g.updateBounds();
|
| -
|
| - assertEquals(2, g.subRows.length);
|
| - assertEquals(1, g.subRows[0].length);
|
| - assertEquals(g.slices[0], g.subRows[0][0]);
|
| - assertEquals(1, g.subRows[1].length);
|
| - assertEquals(g.slices[1], g.subRows[1][0]);
|
| -}
|
| -
|
| -function testAsyncSliceGroup_rebuildSubRows_threePartlyOverlappingSlices() {
|
| - var p1 = new TimelineProcess(1);
|
| - var t1 = new TimelineThread(p1, 1);
|
| - var g = new TimelineAsyncSliceGroup('a');
|
| - g.slices.push(newAsyncSlice(0, 1, t1, t1));
|
| - g.slices.push(newAsyncSlice(0, 1.5, t1, t1));
|
| - g.slices.push(newAsyncSlice(1, 1.5, t1, t1));
|
| - g.updateBounds();
|
| -
|
| - assertEquals(2, g.subRows.length);
|
| - assertEquals(2, g.subRows[0].length);
|
| - assertEquals(g.slices[0].subSlices[0], g.subRows[0][0]);
|
| - assertEquals(g.slices[2].subSlices[0], g.subRows[0][1]);
|
| - assertEquals(1, g.subRows[1].length);
|
| - assertEquals(g.slices[1].subSlices[0], g.subRows[1][0]);
|
| -}
|
| -
|
| -function testAsyncSliceGroup_rebuildSubRows_twoOverlappingSlices() {
|
| - var p1 = new TimelineProcess(1);
|
| - var t1 = new TimelineThread(p1, 1);
|
| - var g = new TimelineAsyncSliceGroup('a');
|
| - g.slices.push(newAsyncSlice(0, 1, t1, t1));
|
| - g.slices.push(newAsyncSlice(0, 1.5, t1, t1));
|
| - g.slices.push(newAsyncSlice(2, 1, t1, t1));
|
| - g.updateBounds();
|
| -
|
| - assertEquals(2, g.subRows.length);
|
| - assertEquals(2, g.subRows[0].length);
|
| - assertEquals(g.slices[0].subSlices[0], g.subRows[0][0]);
|
| - assertEquals(g.slices[2].subSlices[0], g.subRows[0][1]);
|
| - assertEquals(1, g.subRows[1].length);
|
| - assertEquals(g.slices[1].subSlices[0], g.subRows[1][0]);
|
| -}
|
| -
|
| -function testAsyncSliceGroup_computeSubGroups_twoThreadSpecificSlices() {
|
| - var p1 = new TimelineProcess(1);
|
| - var t1 = new TimelineThread(p1, 1);
|
| - var t2 = new TimelineThread(p1, 2);
|
| - var g = new TimelineAsyncSliceGroup('a');
|
| - g.slices.push(newAsyncSlice(0, 1, t1, t1));
|
| - g.slices.push(newAsyncSlice(0, 1, t2, t2));
|
| -
|
| - var subGroups = g.computeSubGroups();
|
| - assertEquals(2, subGroups.length);
|
| -
|
| - assertEquals(g.name, subGroups[0].name);
|
| - assertEquals(1, subGroups[0].slices.length);
|
| - assertEquals(g.slices[0], subGroups[0].slices[0]);
|
| -
|
| - assertEquals(g.name, subGroups[1].name);
|
| - assertEquals(1, subGroups[1].slices.length);
|
| - assertEquals(g.slices[1], subGroups[1].slices[0]);
|
| -}
|
| -
|
| -function testModelCanImportEmpty() {
|
| - var m;
|
| - m = new TimelineModel([]);
|
| - m = new TimelineModel('');
|
| -}
|
| -
|
| -function testTimelineFilter() {
|
| - var s0 = new TimelineSlice('a', 0, 1, {}, 3);
|
| - assertFalse(new TimelineFilter('').matchSlice(s0));
|
| -
|
| - assertTrue(new TimelineFilter('a').matchSlice(s0));
|
| - assertFalse(new TimelineFilter('x').matchSlice(s0));
|
| -
|
| - var s1 = new TimelineSlice('ba', 0, 1, {}, 3);
|
| - assertTrue(new TimelineFilter('a').matchSlice(s1));
|
| - assertTrue(new TimelineFilter('ba').matchSlice(s1));
|
| - assertFalse(new TimelineFilter('x').matchSlice(s1));
|
| -}
|
| -
|
| -</script>
|
| -</body>
|
| -</html>
|
|
|