Esempio n. 1
0
    public IEnumerator ReceiveFirstList()
    {
        var done = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json",
            status =>
        {
            done = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        yield return(WaitUntil(
                         () => done,
                         () => { throw new TimeoutException("faild to get assetBundleList."); }
                         ));

        // リスト1.0.0が保持されている。
        True(Autoya.Debug_AssetBundle_FeatureState() == Autoya.AssetBundlesFeatureState.Ready);
        True(Autoya.AssetBundle_AssetBundleLists()[0].version == "1.0.0");
    }
Esempio n. 2
0
    public IEnumerator GetAssetBundleListFromDebugMethod()
    {
        var listIdentity = "main_assets";
        var fileName     = "main_assets.json";
        var version      = "1.0.0";

        var done = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
            status =>
        {
            done = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        yield return(WaitUntil(
                         () => done,
                         () => { throw new TimeoutException("faild to get assetBundleList."); }
                         ));
    }
Esempio n. 3
0
    public IEnumerator GetAssetBundleListFailThenTryAgain()
    {
        // fail once.
        {
            var listIdentity     = "fake_main_assets";
            var notExistFileName = "fake_main_assets.json";
            var version          = "1.0.0";
            var done             = false;
            Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
                abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + notExistFileName,
                status =>
            {
                Fail("should not be succeeded.");
            },
                (err, reason, autoyaStatus) =>
            {
                True(err == Autoya.ListDownloadError.FailedToDownload, "err does not match.");
                done = true;
            }
                );

            yield return(WaitUntil(
                             () => done,
                             () => { throw new TimeoutException("faild to fail getting assetBundleList."); }
                             ));
        }

        // try again with valid fileName.
        {
            var listIdentity = "main_assets";
            var fileName     = "main_assets.json";
            var version      = "1.0.0";

            var done = false;
            Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
                abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
                status =>
            {
                done = true;
            },
                (code, reason, autoyaStatus) =>
            {
                // do nothing.
                Fail("reason:" + reason);
            }
                );

            yield return(WaitUntil(
                             () => done,
                             () => { throw new TimeoutException("faild to get assetBundleList."); }
                             ));
        }
    }
Esempio n. 4
0
    public IEnumerator DownloadSameBundleListAtOnce()
    {
        var listIdentity = "main_assets";
        var fileName     = "main_assets.json";
        var version      = "1.0.0";

        var done1 = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
            status =>
        {
            done1 = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        var done2 = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
            status =>
        {
            done2 = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        yield return(WaitUntil(
                         () => done1 && done2,
                         () =>
        {
            throw new TimeoutException("failed to download multiple list in time.");
        },
                         5
                         ));
    }
Esempio n. 5
0
    public IEnumerator DownloadMultipleBundleListAtOnce()
    {
        var done1 = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListDlPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json",
            status =>
        {
            done1 = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );


        var done2 = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListDlPath + "sub_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/sub_assets.json",
            status =>
        {
            done2 = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        yield return(WaitUntil(
                         () => done1 && done2,
                         () =>
        {
            throw new TimeoutException("failed to download multiple list in time.");
        },
                         5
                         ));
    }
Esempio n. 6
0
    public IEnumerator ReceiveUpdatedListThenIgnoreAndIgnoredListIsCached()
    {
        var done = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json",
            status =>
        {
            done = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        yield return(WaitUntil(
                         () => done,
                         () => { throw new TimeoutException("faild to get assetBundleList."); }
                         ));

        // リスト1.0.0が保持されている。
        // 通信のレスポンスヘッダーに特定の値が含まれていることで、listの更新リクエストを送り出す機構を着火する。


        // 新しいリストの取得判断の関数をセット(レスポンスを捕まえられるはず)
        Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
            (basePath, identity, newVersion) =>
        {
            True(newVersion == "1.0.1");
            return(RequestYes(basePath, identity, newVersion));
        }
            );

        // リストの更新判断の関数をセット、ここでは更新を無視する。
        // 無視されたリストはpostponedなリストとしてメモリ上に保持される。これによって無駄な取得リクエストを省く。
        var listWillBeIgnored = false;

        Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
            condition =>
        {
            listWillBeIgnored = true;
            return(false);
        }
            );


        Autoya.Http_Get(
            "https://httpbin.org/response-headers?" + resversionDesc + "=main_assets:1.0.1",
            (conId, data) =>
        {
            // pass.
        },
            (conId, code, reason, status) =>
        {
            Fail();
        }
            );

        yield return(WaitUntil(
                         () => listWillBeIgnored,
                         () => { throw new TimeoutException("too late."); }
                         ));

        // list is not updated yet.
        True(Autoya.AssetBundle_AssetBundleLists()[0].version == "1.0.0");

        True(Autoya.Debug_AssetBundle_FeatureState() == Autoya.AssetBundlesFeatureState.Ready);

        // set to the new list to be updated.
        var listWillBeUpdated = false;

        Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
            condition =>
        {
            listWillBeUpdated = true;
            return(true);
        }
            );

        // get list again.
        Autoya.Http_Get(
            "https://httpbin.org/response-headers?" + resversionDesc + "=main_assets:1.0.1",
            (conId, data) =>
        {
            // pass.
        },
            (conId, code, reason, status) =>
        {
            Fail();
        }
            );

        yield return(WaitUntil(
                         () => listWillBeUpdated,
                         () => { throw new TimeoutException("too late."); }
                         ));

        True(Autoya.AssetBundle_AssetBundleLists()[0].version == "1.0.1");
    }
Esempio n. 7
0
    public IEnumerator ReceiveListUpdated()
    {
        var done = false;

        Autoya.Debug_AssetBundle_DownloadAssetBundleListFromUrl(
            abListPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json",
            status =>
        {
            done = true;
        },
            (code, reason, autoyaStatus) =>
        {
            // do nothing.
            Fail("code:" + code + " reason:" + reason);
        }
            );


        yield return(WaitUntil(
                         () => done,
                         () => { throw new TimeoutException("faild to get assetBundleList."); }
                         ));

        // リスト1.0.0が保持されている。
        // 通信のレスポンスヘッダーに特定の値が含まれていることで、listの更新リクエストを送り出す機構を着火する。

        // 新しいリストの取得判断の関数をセット(レスポンスを捕まえられるはず)
        var listWillBeDownloaded = false;

        Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
            (basePath, identity, newVersion) =>
        {
            listWillBeDownloaded = true;
            True(newVersion == "1.0.1");
            return(RequestYes(basePath, identity, newVersion));
        }
            );

        // リストの更新判断の関数をセット
        var listWillBeUpdated = false;

        Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
            condition =>
        {
            listWillBeUpdated = true;
            return(true);
        }
            );

        // この通信でresponseHeaderを指定してリストの更新機能を着火する。
        Autoya.Http_Get(
            "https://httpbin.org/response-headers?" + resversionDesc + "=main_assets:1.0.1",
            (conId, data) =>
        {
            // pass.
        },
            (conId, code, reason, status) =>
        {
            Fail();
        }
            );



        yield return(WaitUntil(
                         () => listWillBeDownloaded,
                         () => { throw new TimeoutException("too late."); }
                         ));

        yield return(WaitUntil(
                         () => listWillBeUpdated,
                         () => { throw new TimeoutException("too late."); }
                         ));
    }