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

Side by Side Diff: tracing/tracing/base/range_test.html

Issue 1300433003: Add range toJSON and fromDict (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 5 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « tracing/tracing/base/range.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/range.html"> 8 <link rel="import" href="/tracing/base/range.html">
9 9
10 <script> 10 <script>
(...skipping 18 matching lines...) Expand all
29 29
30 test('addNonEmptyRange', function() { 30 test('addNonEmptyRange', function() {
31 var r1 = new Range(); 31 var r1 = new Range();
32 r1.addValue(1); 32 r1.addValue(1);
33 r1.addValue(2); 33 r1.addValue(2);
34 34
35 var r = new Range(); 35 var r = new Range();
36 r.addRange(r1); 36 r.addRange(r1);
37 assert.equal(1, r.min); 37 assert.equal(1, r.min);
38 assert.equal(2, r.max); 38 assert.equal(2, r.max);
39
40 var r2 = Range.fromDict(r.toJSON());
41 assert.equal(r2.isEmpty, r.isEmpty);
42 assert.equal(r2.max, r.max);
43 assert.equal(r2.min, r.min);
39 }); 44 });
40 45
41 test('addEmptyRange', function() { 46 test('addEmptyRange', function() {
42 var r1 = new Range(); 47 var r1 = new Range();
43 48
44 var r = new Range(); 49 var r = new Range();
45 r.addRange(r1); 50 r.addRange(r1);
46 assert.isTrue(r.isEmpty); 51 assert.isTrue(r.isEmpty);
47 assert.isUndefined(r.min); 52 assert.isUndefined(r.min);
48 assert.isUndefined(r.max); 53 assert.isUndefined(r.max);
54
55 var r2 = Range.fromDict(r.toJSON());
56 assert.equal(r2.isEmpty, r.isEmpty);
57 assert.isUndefined(r2.max);
58 assert.isUndefined(r2.min);
49 }); 59 });
50 60
51 test('addRangeToRange', function() { 61 test('addRangeToRange', function() {
52 var r1 = new Range(); 62 var r1 = new Range();
53 r1.addValue(1); 63 r1.addValue(1);
54 r1.addValue(2); 64 r1.addValue(2);
55 65
56 var r = new Range(); 66 var r = new Range();
57 r.addValue(3); 67 r.addValue(3);
58 r.addRange(r1); 68 r.addRange(r1);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 297
288 test('findIntersection_emptyRange', function() { 298 test('findIntersection_emptyRange', function() {
289 var r1 = Range.fromExplicitRange(0, 2); 299 var r1 = Range.fromExplicitRange(0, 2);
290 var r2 = new Range(); 300 var r2 = new Range();
291 301
292 assert.isTrue(r1.findIntersection(r2).isEmpty); 302 assert.isTrue(r1.findIntersection(r2).isEmpty);
293 assert.isTrue(r2.findIntersection(r1).isEmpty); 303 assert.isTrue(r2.findIntersection(r1).isEmpty);
294 }); 304 });
295 }); 305 });
296 </script> 306 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/range.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698