< Summary

Class:DCL.AssetTextureWebLoader
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Texture/Providers/AssetTextureWebLoader.cs
Covered lines:7
Uncovered lines:0
Coverable lines:7
Total lines:30
Line coverage:100% (7 of 7)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetTextureAsync()0%770100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Texture/Providers/AssetTextureWebLoader.cs

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using System;
 3using System.Threading;
 4using UnityEngine;
 5using UnityEngine.Networking;
 6
 7namespace DCL
 8{
 9    /// <summary>
 10    /// Downloads Texture by Web URL
 11    /// </summary>
 12    public class AssetTextureWebLoader : ITextureAssetProvider
 13    {
 14        public async UniTask<Texture2D> GetTextureAsync(string url, CancellationToken cancellationToken = default)
 15        {
 13116            using var asyncOp = Environment.i.platform.webRequest.GetTexture(url, disposeOnCompleted: false);
 17
 39318            await asyncOp.WithCancellation(cancellationToken);
 19
 12020            if (!asyncOp.isSucceeded)
 21            {
 5122                var webRequestError = asyncOp.webRequest.error;
 5123                throw new Exception($"Texture promise failed: {webRequestError}");
 24            }
 25
 6926            return DownloadHandlerTexture.GetContent(asyncOp.webRequest);
 6927        }
 28
 29    }
 30}

Methods/Properties

GetTextureAsync()