Exemplo n.º 1
0
        /// <summary>
        /// Starts tracing.
        /// </summary>
        /// <returns>Start task</returns>
        /// <param name="options">Tracing options</param>
        public async Task StartAsync(TracingOptions options)
        {
            if (_recording)
            {
                throw new InvalidOperationException("Cannot start recording trace while already recording trace.");
            }

            if (string.IsNullOrEmpty(options.Path))
            {
                throw new ArgumentException("Must specify a path to write trace file to.");
            }


            var categories = options.Categories ?? _defaultCategories;

            if (options.Screenshots)
            {
                categories.Add("disabled-by-default-devtools.screenshot");
            }

            _path      = options.Path;
            _recording = true;

            await _client.SendAsync("Tracing.start", new
            {
                transferMode = "ReturnAsStream",
                categories   = string.Join(", ", categories)
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts tracing.
        /// </summary>
        /// <returns>Start task</returns>
        /// <param name="options">Tracing options</param>
        public Task StartAsync(TracingOptions options)
        {
            if (_recording)
            {
                throw new InvalidOperationException("Cannot start recording trace while already recording trace.");
            }

            var categories = options.Categories ?? _defaultCategories;

            if (options.Screenshots)
            {
                categories.Add("disabled-by-default-devtools.screenshot");
            }

            _path      = options.Path;
            _recording = true;

            return(_client.SendAsync("Tracing.start", new TracingStartRequest
            {
                TransferMode = "ReturnAsStream",
                Categories = string.Join(", ", categories)
            }));
        }