public override AssetRequest <TAsset> LoadAsync <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry, AssetLoadedHandler <TAsset> handler = null) { string key = entry.Key; TextAsset textAsset = Resources.Load <TextAsset>(key); return(new IndexedAssetRequest <TAsset>(entry.Key, (TAsset)(object)textAsset)); }
protected override IEnumerator runTest() { string payload = string.Format("{0}embeddedasseta.txt?dl=bundle:mock-create-bundle&b=embedded_asset_test&x=.txt", "assets/rootassets/"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); BundleManager bundleManager = new BundleManager(null); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new BundleDevice(deviceManager, bundleManager)); AssetRequest <TextAsset> request = deviceManager.LoadAsync <TextAsset>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); } else if (bundleManager.IsMounted(entry.BundleKey)) { IntegrationTest.Fail("Bundle will not be mounted untill after the AssetBundle is created internally."); } else { yield return(request); IntegrationTest.Assert(bundleManager.IsMounted(entry.BundleKey)); IntegrationTest.Assert(request.Asset != null); bundleManager.UnmountBundle(entry.BundleKey, unloadAllLoadedObjects: false); } bundleManager.UnmountAllBundles(); }
public override TAsset LoadImmediate <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry) { string key = entry.Key; TextAsset textAsset = Resources.Load <TextAsset>(key); return((TAsset)(object)textAsset); }
protected override IEnumerator runTest() { string payload = "test/test_cube?dl=www-bundle&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); GcsAccessTokenService gcsAccessTokenService = new GcsAccessTokenService(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountName"), new GcsP12AssetFileLoader(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountFile"))); CPipeManifestService cpipeManifestService = new CPipeManifestService("https://storage.googleapis.com/ad37ed76-3a24-91ba-def6-2ff16973c49d.disney.io/", "__mapping_cpremix_dev.json", gcsAccessTokenService); deviceManager.Mount(new WwwBundleDevice(deviceManager, gcsAccessTokenService, cpipeManifestService)); AssetRequest <AssetBundle> request = deviceManager.LoadAsync <AssetBundle>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(request == null); IntegrationTestEx.FailIf(request.Finished); IntegrationTestEx.FailIf(request.Cancelled); yield return(request); IntegrationTest.Assert(request.Finished); IntegrationTest.Assert(!request.Cancelled); IntegrationTest.Assert(request.Asset != null); IntegrationTest.Assert(request.Asset.GetAllAssetNames().Length == 1); string[] assetNames = request.Asset.GetAllAssetNames(); IntegrationTest.Assert(assetNames.Contains("assets/bundleassets/test/test_cube.prefab")); request.Asset.Unload(unloadAllLoadedObjects: false); }
protected override IEnumerator runTest() { string payload = string.Format("{0}?dl=bytes:mock-text-asset", "Configuration/embedded_content_manifest"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager manager = new DeviceManager(); manager.Mount(new MockTextAssetDevice(manager)); manager.Mount(new BytesDevice(manager)); AssetRequest <byte[]> request = manager.LoadAsync <byte[]>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); yield break; } yield return(request); IntegrationTestEx.FailIf(!request.Finished); IntegrationTestEx.FailIf(request.Cancelled); IntegrationTestEx.FailIf(request.Asset == null); IntegrationTestEx.FailIf(request.Asset == null); if (request.Asset != null) { string key = entry.Key; byte[] bytes = Resources.Load <TextAsset>(key).bytes; IntegrationTestEx.FailIf(!request.Asset.SequenceEqual(bytes)); } IntegrationTest.Pass(); }
protected override IEnumerator runTest() { string payload = string.Format("{0}?dl=json:mock-json-res&x=txt", "Configuration/embedded_content_manifest"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager manager = new DeviceManager(); manager.Mount(new MockJsonResourceDevice(manager)); manager.Mount(new JsonDevice(manager)); AssetRequest <ContentManifest> request = manager.LoadAsync <ContentManifest>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); } else { yield return(request); IntegrationTestEx.FailIf(!request.Finished); IntegrationTestEx.FailIf(request.Cancelled); IntegrationTestEx.FailIf(request.Asset == null); if (request.Asset == null) { } } IntegrationTest.Pass(); }
protected override IEnumerator runTest() { string payload = $"embeddedasseta?dl=bundle:mock-create-bundle&b=embedded_asset_test&x=.txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); BundleManager bundleManager = new BundleManager(null); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new BundleDevice(deviceManager, bundleManager)); AssetRequest <TextAsset> requestA = deviceManager.LoadAsync <TextAsset>(entry.DeviceList, ref entry); AssetRequest <TextAsset> requestB = deviceManager.LoadAsync <TextAsset>(entry.DeviceList, ref entry); if (requestA == null || requestB == null) { IntegrationTest.Fail("requestA == null"); } else { yield return(requestA); yield return(requestB); IntegrationTestEx.FailIf(requestA.Asset == null); IntegrationTestEx.FailIf(requestB.Asset == null); IntegrationTest.Pass(); } bundleManager.UnmountAllBundles(); }
protected override IEnumerator runTest() { string testPath = Path.Combine(Directory.GetCurrentDirectory(), "Assets/Generated/Resources/Configuration/embedded_content_manifest.txt"); string payload = $"{testPath}?dl=file-bytes&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager manager = new DeviceManager(); manager.Mount(new FileBytesDevice(manager)); AssetRequest <byte[]> request = manager.LoadAsync <byte[]>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); } else { yield return(request); IntegrationTestEx.FailIf(!request.Finished); IntegrationTestEx.FailIf(request.Cancelled); IntegrationTestEx.FailIf(request.Asset == null); IntegrationTestEx.FailIf(request.Asset == null); string path = "Configuration/embedded_content_manifest.json"; IntegrationTestEx.FailIf(!Enumerable.SequenceEqual(second: Resources.Load <TextAsset>(path).bytes, first: request.Asset)); } IntegrationTest.Pass(); }
public override AssetRequest <TAsset> LoadAsync <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry, AssetLoadedHandler <TAsset> handler = null) { Resources.Load <TextAsset>(entry.Key); ResourceRequest unityRequest = Resources.LoadAsync <TextAsset>(entry.Key); AssetRequestWrapper <TAsset> request = new AssetRequestWrapper <TAsset>(null); AsyncAssetRequest <TAsset> asyncAssetRequest = new AsyncAssetRequest <TAsset>(entry.Key, request); CoroutineRunner.StartPersistent(waitForTextAssetToLoad(entry.Key, unityRequest, asyncAssetRequest), this, "test"); return(asyncAssetRequest); }
protected override IEnumerator runTest() { string payload = "small_text?dl=asset:res&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); TextAsset textAsset = ResourceLoader <TextAsset> .Load(ref entry); IntegrationTest.Assert(textAsset != null); IntegrationTest.Assert(textAsset.text.StartsWith("hello world")); yield break; }
private bool checkAssetsAreIndentical(ContentManifest mergedManifest) { Dictionary <string, ContentManifest.AssetEntry> .Enumerator enumerator = mergedManifest.AssetEntryMap.GetEnumerator(); while (enumerator.MoveNext()) { ContentManifest.AssetEntry value = enumerator.Current.Value; ContentManifest.AssetEntry assetEntry = mockResultingManifest.AssetEntryMap[enumerator.Current.Key]; if (assetEntry != value) { return(false); } } return(true); }
protected override IEnumerator runTest() { string payload = "small_text?dl=res&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); ResourceDevice device = new ResourceDevice(deviceManager); deviceManager.Mount(device); TextAsset textAsset = deviceManager.LoadImmediate <TextAsset>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(textAsset == null); IntegrationTestEx.FailIf(textAsset.GetType() != typeof(TextAsset)); IntegrationTestEx.FailIf(!textAsset.text.StartsWith("hello world")); IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string payload = "invalid?dl=asset:res&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); try { AsycnResourceLoader <TextAsset> .Load(ref entry); IntegrationTest.Fail("Expected exception"); } catch (ArgumentException) { IntegrationTest.Pass(); } yield break; }
protected override IEnumerator runTest() { string arg = Path.Combine(Directory.GetCurrentDirectory(), "Assets/Generated/Resources/Configuration/embedded_content_manifest.txt"); string payload = $"{arg}?dl=file-bytes&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new FileBytesDevice(deviceManager)); byte[] array = deviceManager.LoadImmediate <byte[]>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(array == null); string path = "Configuration/embedded_content_manifest.json"; byte[] bytes = Resources.Load <TextAsset>(path).bytes; IntegrationTestEx.FailIf(!array.SequenceEqual(bytes)); IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string payload = string.Format("{0}?dl=json:mock-json-res&x=txt", "Configuration/embedded_content_manifest"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new MockJsonResourceDevice(deviceManager)); deviceManager.Mount(new JsonDevice(deviceManager)); ContentManifest contentManifest = deviceManager.LoadImmediate <ContentManifest>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(contentManifest == null); if (contentManifest != null) { } IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string arg = PathUtil.Combine(Directory.GetCurrentDirectory(), "Assets/External/UnityShared/KelownaCommon/Core/Tests/Integration/ContentSystem/Resources/embedded_asset_test.unity3d.txt"); string payload = string.Format("{0}embeddedasseta.txt?dl=bundle:create-bundle:file-bytes&b={1}&x=txt", "assets/rootassets/", arg); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); BundleManager bundleManager = new BundleManager(null); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new BundleDevice(deviceManager, bundleManager)); deviceManager.Mount(new FileBytesDevice(deviceManager)); TextAsset textAsset = deviceManager.LoadImmediate <TextAsset>(entry.DeviceList, ref entry); IntegrationTest.Assert(textAsset != null); IntegrationTest.Assert(textAsset.text.StartsWith("embeddedasseta")); bundleManager.UnmountAllBundles(); yield break; }
protected override IEnumerator runTest() { string payload = string.Format("{0}?dl=bytes:mock-text-asset", "Configuration/embedded_content_manifest"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new MockTextAssetDevice(deviceManager)); deviceManager.Mount(new BytesDevice(deviceManager)); byte[] array = deviceManager.LoadImmediate <byte[]>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(array == null); IntegrationTestEx.FailIf(array == null); string key = entry.Key; byte[] bytes = Resources.Load <TextAsset>(key).bytes; IntegrationTestEx.FailIf(!array.SequenceEqual(bytes)); IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string arg = Path.Combine(Directory.GetCurrentDirectory(), "Assets/Generated/Resources/Configuration/embedded_content_manifest.txt"); string payload = $"{arg}?dl=file-string&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new FileStringDevice(deviceManager)); string text = deviceManager.LoadImmediate <string>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(string.IsNullOrEmpty(text)); string path = "Configuration/embedded_content_manifest.json"; string text2 = Resources.Load <TextAsset>(path).text; IntegrationTestEx.FailIf(!text.SequenceEqual(text2)); IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string payload = string.Format("{0}embeddedasseta.txt?dl=bundle:mock-create-bundle&b=embedded_asset_test&x=.txt", "assets/rootassets/"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); BundleManager bundleManager = new BundleManager(null); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new BundleDevice(deviceManager, bundleManager)); TextAsset textAsset = deviceManager.LoadImmediate <TextAsset>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(textAsset == null, "asset was null"); if (textAsset != null) { IntegrationTestEx.FailIf(!textAsset.text.StartsWith("embeddedasset")); } bundleManager.UnmountAllBundles(); IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string payload = string.Format("{0}?dl=str:mock-text-asset&x=txt", "Configuration/embedded_content_manifest"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new MockTextAssetDevice(deviceManager)); deviceManager.Mount(new StringDevice(deviceManager)); string text = deviceManager.LoadImmediate <string>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(text == null); IntegrationTestEx.FailIf(text == null); string key = entry.Key; string text2 = Resources.Load <TextAsset>(key).text; IntegrationTestEx.FailIf(text != text2); IntegrationTest.Pass(); yield break; }
protected override IEnumerator runTest() { string payload = "small_text?dl=asset:res&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); bool finished = false; AsycnResourceLoader <TextAsset> .Load(ref entry, delegate(string s, TextAsset a) { IntegrationTest.Assert(s != null); IntegrationTest.Assert(a != null); IntegrationTest.Assert(a.text.StartsWith("hello world")); finished = true; }); while (!finished) { yield return(null); } }
protected override IEnumerator runTest() { string payload = string.Format("{0}embeddedasseta.txt?dl=bundle:mock-create-bundle&b=embedded_asset_test&x=.txt", "assets/rootassets/"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); BundleManager bundleManager = new BundleManager(null); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new BundleDevice(deviceManager, bundleManager)); AssetRequest <TextAsset> request = deviceManager.LoadAsync <TextAsset>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); } else { if (request.Finished) { IntegrationTest.Fail("Asset did not load async"); } else if (request.Cancelled) { IntegrationTest.Fail("request should not be cancelled"); } yield return(request); IntegrationTestEx.FailIf(!request.Finished); IntegrationTestEx.FailIf(request.Cancelled); IntegrationTestEx.FailIf(request.Asset == null); if (request.Asset != null) { IntegrationTestEx.FailIf(!request.Asset.text.StartsWith("embeddedasset")); } IntegrationTest.Pass(); } bundleManager.UnmountAllBundles(); }
protected override IEnumerator runTest() { string payload = "small_text?dl=res&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager manager = new DeviceManager(); ResourceDevice device = new ResourceDevice(manager); manager.Mount(device); AssetRequest <TextAsset> request = manager.LoadAsync <TextAsset>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); yield break; } if (request.Finished) { IntegrationTest.Fail("Asset did not load async"); } else if (request.Cancelled) { IntegrationTest.Fail("request should not be cancelled"); } yield return(request); IntegrationTestEx.FailIf(!request.Finished); IntegrationTestEx.FailIf(request.Cancelled); IntegrationTestEx.FailIf(request.Asset == null); IntegrationTestEx.FailIf(request.Asset.GetType() != typeof(TextAsset)); if (request.Asset != null) { IntegrationTestEx.FailIf(!request.Asset.text.StartsWith("hello world")); } IntegrationTest.Pass(); }
public override AssetRequest <TAsset> LoadAsync <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry, AssetLoadedHandler <TAsset> handler = null) { return(AsycnResourceLoader <TAsset> .Load(ref entry, handler)); }
public abstract TAsset LoadImmediate <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry) where TAsset : class;
public abstract AssetRequest <TAsset> LoadAsync <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry, AssetLoadedHandler <TAsset> handler = null) where TAsset : class;
public override TAsset LoadImmediate <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry) { return(ResourceLoader <TAsset> .Load(ref entry)); }