Chromium Code Reviews| Index: tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html |
| diff --git a/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html b/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html |
| index e84faf5746808341a58f5c6175a8ebe4fbae14b7..52009e6044c94cdd87f7d49b514a57626a68941b 100644 |
| --- a/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html |
| +++ b/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html |
| @@ -11,48 +11,68 @@ found in the LICENSE file. |
| <script> |
| 'use strict'; |
| +function makeController() { |
| + const controller = |
| + new tr.ui.e.about_tracing.InspectorTracingControllerClient(); |
| + controller.conn_ = new (function() { |
| + this.req = function(method, params) { |
| + const msg = JSON.stringify({ |
| + id: 1, |
| + method, |
| + params |
| + }); |
| + return new (function() { |
| + this.msg = msg; |
| + this.then = function(m1, m2) { |
| + return this; |
| + }; |
| + })(); |
| + }; |
| + this.setNotificationListener = function(method, listener) { |
| + }; |
| + })(); |
| + return controller; |
| +} |
| + |
| tr.b.unittest.testSuite(function() { |
| test('beginRecording_sendCategoriesAndOptions', function() { |
| - const controller = |
| - new tr.ui.e.about_tracing.InspectorTracingControllerClient(); |
| - controller.conn_ = new (function() { |
| - this.req = function(method, params) { |
| - const msg = JSON.stringify({ |
| - id: 1, |
| - method, |
| - params |
| - }); |
| - return new (function() { |
| - this.msg = msg; |
| - this.then = function(m1, m2) { |
| - return this; |
| - }; |
| - })(); |
| - }; |
| - this.setNotificationListener = function(method, listener) { |
| - }; |
| - })(); |
| + const controller = makeController(); |
| const recordingOptions = { |
| - categoryFilter: JSON.stringify(['a', 'b', 'c']), |
| + includedCategories: ['a', 'b', 'c'], |
| + excludedCategories: ['e'], |
| useSystemTracing: false, |
| - tracingRecordMode: 'test-mode', |
| + tracingRecordMode: 'recordUntilFull', |
| useSampling: true |
| }; |
| const result = JSON.parse(controller.beginRecording(recordingOptions).msg); |
| + assert.deepEqual( |
| + result.params.traceConfig.includedCategories, ['a', 'b', 'c']); |
| + assert.deepEqual( |
| + result.params.traceConfig.excludedCategories, ['e']); |
| assert.strictEqual( |
| - result.params.categories, JSON.stringify(['a', 'b', 'c'])); |
| - const options = result.params.options.split(','); |
| - let tracingRecordTestMode = false; |
| - let sampleFlag = false; |
| - for (const s in options) { |
| - if (options[s] === 'test-mode') tracingRecordTestMode = true; |
| - else if (options[s] === 'enable-sampling') sampleFlag = true; |
| - else assert.strictEqual(options[s], ''); |
| - } |
| - assert.isTrue(tracingRecordTestMode); |
| - assert.isTrue(sampleFlag); |
| + result.params.traceConfig.recordMode, 'recordUntilFull'); |
| + assert.isFalse( |
| + result.params.traceConfig.enableSystrace); |
| + assert.isTrue( |
| + result.params.traceConfig.memoryDumpConfig.triggers.length === 0); |
| + }); |
| + |
| + test('beginRecording_sendCategoriesAndOptionsWithMemoryInfra', function() { |
| + const controller = makeController(); |
| + |
| + const recordingOptions = { |
| + includedCategories: ['c', 'disabled-by-default-memory-infra', 'a'], |
| + excludedCategories: ['e'], |
| + useSystemTracing: false, |
| + tracingRecordMode: 'test-mode', |
| + useSampling: true |
| + }; |
| + |
| + const result = JSON.parse(controller.beginRecording(recordingOptions).msg); |
| + assert.isTrue( |
| + result.params.traceConfig.memoryDumpConfig.triggers.length === 1); |
|
fmeawad
2017/06/21 17:22:18
nit: Should we also add a check for the default du
erikchen
2017/06/21 22:56:50
Done.
|
| }); |
| test('oldFormat', function() { |