Beispiel #1
0
        public IEnumerator TestDownloadRemoteAssetBundle(System.Action <string, AssetBundle> callback)
        {
            Debug.Log("Testing RemoteAssetBundleUtils.DownloadAssetBundle");
            AssetBundleInfo          info    = new AssetBundleInfo(TestConstants.TEST_BUNDLE_NAME, TestConstants.TEST_BUNDLE_PATH);
            FCMMessage               message = new FCMMessage("Test Upload", "This is a test", null);
            Task <RemoteAssetBundle> task    = RemoteAssetBundleUtils.UploadAssetBundle(TestConstants.TEST_SERVER_URL, info, message, null, TestConstants.JWT_TOKEN_NAME);

            while (!task.IsCompleted)
            {
                yield return(new WaitForFixedUpdate());
            }
            RemoteAssetBundle bundle = task.Result;

            Assert.AreEqual(bundle.toHash128().isValid, true);
            yield return(StartCoroutine(RemoteAssetBundleUtils.DownloadAssetBundleAsync(TestConstants.TEST_SERVER_URL, bundle, callback)));

            // Try to download again and check the cache
            yield return(StartCoroutine(RemoteAssetBundleUtils.DownloadAssetBundleAsync(TestConstants.TEST_SERVER_URL, bundle, TestDownloadCachedAsset)));

            // Now try to delete it
            Task <HttpStatusCode> t = RemoteAssetBundleUtils.DeleteAssetBundle(TestConstants.TEST_SERVER_URL, bundle);

            while (!t.IsCompleted)
            {
                yield return(new WaitForFixedUpdate());
            }
            HttpStatusCode status = t.Result;

            Assert.AreEqual(status, HttpStatusCode.OK);
            Debug.Log("Passed");
            finished = true;
        }
Beispiel #2
0
        public IEnumerator VerifyUpdateAssetBundle()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.VerifyAssetBundle");
            Task <RemoteAssetBundle> task = RemoteAssetBundleUtils.VerifyAssetBundle(TestConstants.TEST_SERVER_URL, bundle, true, TestConstants.JWT_TOKEN_NAME);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            bundle = task.Result;
            Assert.IsTrue(bundle.toHash128().isValid);
            Assert.IsTrue(bundle.verified);
        }
Beispiel #3
0
        public IEnumerator VerifyUploadAssetBundle()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.UploadAssetBundle");
            AssetBundleInfo          info    = new AssetBundleInfo(TestConstants.TEST_BUNDLE_NAME, TestConstants.TEST_BUNDLE_PATH);
            FCMMessage               message = new FCMMessage("Test Upload", "This is a test", null);
            Task <RemoteAssetBundle> task    = RemoteAssetBundleUtils.UploadAssetBundle(TestConstants.TEST_SERVER_URL, info, message, null, TestConstants.JWT_TOKEN_NAME);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            bundle = task.Result;
            Assert.IsTrue(bundle.toHash128().isValid);
            Assert.AreEqual(Application.productName, bundle.appName);
        }