Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1470)

Unified Diff: chrome/browser/resources/tracing/timeline_test.html

Issue 8513009: Add TRACE_COUNTER support to about:tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/tracing/timeline_test.html
diff --git a/chrome/browser/resources/tracing/timeline_test.html b/chrome/browser/resources/tracing/timeline_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..6a8cc204d58f84e391bfa9abb2d6b6f65aa91915
--- /dev/null
+++ b/chrome/browser/resources/tracing/timeline_test.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Copyright (c) 2010 The Chromium Authors. All rights reserved.
James Hawkins 2011/11/16 17:41:38 2011.
nduca 2011/11/16 19:03:56 Done.
+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>
+<style>
James Hawkins 2011/11/16 17:41:38 Move to a CSS file.
nduca 2011/11/16 19:03:56 Killed this entirely. It was just convenience stuf
+* {
+ box-sizing: border-box;
+ -webkit-user-select: none;
+}
+
+.timeline-container {
+ border: 1px solid red;
+}
+
+</style>
+<link rel="stylesheet" href="timeline.css">
+<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/util.js"></script>
+<script src="timeline_model.js"></script>
+<script src="sorted_array_utils.js"></script>
+<script src="measuring_stick.js"></script>
+<script src="timeline.js"></script>
+<script src="timeline_track.js"></script>
+<script src="fast_rect_renderer.js"></script>
+</head>
+<body>
+ <script>
+ function get(url, cb) {
James Hawkins 2011/11/16 17:41:38 Move to a JS file.
nduca 2011/11/16 19:03:56 Done.
+ var req = new XMLHttpRequest();
+ req.open('GET', url, true);
+ req.onreadystatechange = function(aEvt) {
+ if (req.readyState == 4) {
+ window.setTimeout(function() {
+ if (req.status == 200) {
+ var resp = JSON.parse(req.responseText);
+ if (resp.traceEvents)
+ cb(resp.traceEvents);
+ else
+ cb(resp);
+ } else {
+ console.log('Failed to load ' + url);
+ }
+ }, 0);
+ }
+ }
+ req.send(null);
+ }
+ </script>
+
+ <div class="timeline-test" src="./tests/trivial_trace.json" create-detached=1>
+ </div>
+
+ <div class="timeline-test" src="./tests/trivial_trace.json">
+ </div>
+
+ <div class="timeline-test" src="./tests/simple_trace.json">
+ </div>
+
+ <div class="timeline-test" src="./tests/nonnested_trace.json">
+ </div>
+
+ <div class="timeline-test" src="./tests/tall_trace.json">
+ </div>
+
+ <div class="timeline-test" src="./tests/big_trace.json">
+ </div>
+
+ <div class="timeline-test" src="./tests/huge_trace.json">
+ </div>
+
+ <script>
+ function load(parentEl) {
James Hawkins 2011/11/16 17:41:38 Move to a JS file.
nduca 2011/11/16 19:03:56 This code is specific to this test group. I was co
+ var src = parentEl.getAttribute('src');
+ if (document.location.hash && document.location.hash.substring(1) != src) {
+ parentEl.hidden = true;
+ return;
+ }
+ parentEl.hidden = false;
+ parentEl.textContent = '';
+ var titleEl = document.createElement('h3');
+ var linkEl = document.createElement('a');
+ linkEl.textContent = src;
+ linkEl.href = '#' + src;
+ titleEl.appendChild(linkEl);
+
+ var containerEl = document.createElement('div');
+ containerEl.tabIndex = 0;
+ containerEl.className = 'timeline-container';
+
+ var timelineEl = document.createElement('div');
+ cr.ui.decorate(timelineEl, tracing.Timeline);
+ timelineEl.focusElement = containerEl;
+
+ parentEl.appendChild(titleEl);
+ parentEl.appendChild(containerEl);
+
+ // Creating attached vs detached stress tests the canvas- and viewport-
+ // setup code.
+ var create_detached = parentEl.getAttribute('create-attached') == 1;
+ if (create_detached) {
+ containerEl.appendChild(timelineEl);
+ get(src, function(events) {
+ var model = new tracing.TimelineModel(events);
+ timelineEl.model = model;
+ });
+ } else {
+ get(src, function(events) {
+ var model = new tracing.TimelineModel(events);
+ timelineEl.model = model;
+ containerEl.appendChild(timelineEl);
+ });
+ }
+ }
+ function onLoad() {
+ Array.prototype.forEach.call(document.querySelectorAll('.timeline-test'),
+ load);
+ }
+
+ document.addEventListener('DOMContentLoaded', onLoad);
+ window.addEventListener('hashchange', onLoad);
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698