| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 3 Copyright 2017 The Chromium Authors. All rights reserved. | |
| 4 Use of this source code is governed by a BSD-style license that can be | |
| 5 found in the LICENSE file. | |
| 6 --> | |
| 7 | |
| 8 <link rel="import" href="/tracing/core/test_utils.html"> | |
| 9 <link rel="import" href="/tracing/value/diagnostics/device_info.html"> | |
| 10 <link rel="import" href="/tracing/value/diagnostics/generic_set.html"> | |
| 11 <link rel="import" href="/tracing/value/diagnostics/merged_device_info.html"> | |
| 12 | |
| 13 <script> | |
| 14 'use strict'; | |
| 15 | |
| 16 tr.b.unittest.testSuite(function() { | |
| 17 test('merge', function() { | |
| 18 const deviceA = new tr.v.d.DeviceInfo({ | |
| 19 chromeVersion: '1.2.3.4', | |
| 20 osName: 'GNU/Linux', | |
| 21 osVersion: '1.2', | |
| 22 }); | |
| 23 | |
| 24 const deviceB = new tr.v.d.DeviceInfo({ | |
| 25 chromeVersion: '2.3.4.5', | |
| 26 osName: 'GNU/Linux', | |
| 27 osVersion: '2.3', | |
| 28 }); | |
| 29 | |
| 30 assert.isFalse(deviceA.canAddDiagnostic(new tr.v.d.GenericSet())); | |
| 31 assert.isFalse(deviceA.canAddDiagnostic(deviceB)); | |
| 32 assert.isFalse(deviceB.canAddDiagnostic(deviceA)); | |
| 33 | |
| 34 const merged = new tr.v.d.MergedDeviceInfo(); | |
| 35 | |
| 36 assert.isFalse(merged.canAddDiagnostic(new tr.v.d.GenericSet())); | |
| 37 assert.isTrue(merged.canAddDiagnostic(deviceA)); | |
| 38 assert.isTrue(merged.canAddDiagnostic(deviceB)); | |
| 39 | |
| 40 merged.addDiagnostic(deviceA); | |
| 41 merged.addDiagnostic(deviceB); | |
| 42 | |
| 43 const clone = tr.v.d.Diagnostic.fromDict(merged.asDict()); | |
| 44 | |
| 45 assert.deepEqual(Array.from(clone.chromeVersions), ['1.2.3.4', '2.3.4.5']); | |
| 46 assert.strictEqual(tr.b.getOnlyElement(clone.osNames), 'GNU/Linux'); | |
| 47 assert.deepEqual(Array.from(clone.osVersions), ['1.2', '2.3']); | |
| 48 }); | |
| 49 }); | |
| 50 </script> | |
| OLD | NEW |