public IEnumerator Setup()
    {
        var loginDone = false;

        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);
        Autoya.Auth_SetOnAuthenticated(
            () =>
        {
            loginDone = true;
        }
            );

        yield return(WaitUntil(
                         () =>
        {
            return loginDone;
        },
                         () => { throw new TimeoutException("timeout."); }
                         ));

        // delete all.
        Autoya.Persist_DeleteByDomain(AutoyaFilePersistTestsFileDomain);
    }
Exemple #2
0
    [MSetup] public void Setup()
    {
        Autoya.ResetAllForceSetting();

        DeleteAllData(AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);

        var    authorized   = false;
        Action onMainThread = () => {
            var dataPath = Application.persistentDataPath;
            Autoya.TestEntryPoint(dataPath);

            Autoya.Auth_SetOnAuthenticated(
                () => {
                authorized = true;
            }
                );
        };

        RunOnMainThread(onMainThread);

        WaitUntil(
            () => {
            return(authorized);
        },
            5,
            "timeout in setup."
            );

        Assert(Autoya.Auth_IsAuthenticated(), "not logged in.");

        Autoya.forceMaintenance = true;
    }
Exemple #3
0
    [MSetup] public void Setup()
    {
        if (!IsTestRunningInPlayingMode())
        {
            SkipCurrentTest("Purchase feature should run on MainThread.");
            return;
        }
        ;

        var    authorized   = false;
        Action onMainThread = () => {
            var dataPath = Application.persistentDataPath;

            var fwPath = Path.Combine(dataPath, AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);
            DeleteAllData(fwPath);

            Autoya.TestEntryPoint(dataPath);

            Autoya.Auth_SetOnAuthenticated(
                () => {
                authorized = true;
            }
                );
        };

        RunOnMainThread(onMainThread);

        WaitUntil(
            () => {
            return(authorized && Autoya.Purchase_IsReady());
        },
            5,
            "failed to auth or failed to ready purchase."
            );
    }
Exemple #4
0
    public IEnumerator Setup()
    {
        Autoya.ResetAllForceSetting();

        DeleteAllData(AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);

        var authorized = false;

        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);

        Autoya.Auth_SetOnAuthenticated(
            () =>
        {
            authorized = true;
        }
            );

        yield return(WaitUntil(
                         () =>
        {
            return authorized;
        },
                         () => { throw new TimeoutException("timeout in setup."); }
                         ));

        True(Autoya.Auth_IsAuthenticated(), "not logged in.");

        Autoya.forceMaintenance = true;
    }
Exemple #5
0
    public IEnumerator StoredAssetBundleListIsEmptyOnBoot()
    {
        // 事前に保存済みのデータを消す、これでほかのテストの影響を受けない初期化されたデータだけができる。
        Autoya.Persist_DeleteByDomain(AppSettings.APP_STORED_RUNTIME_MANIFEST_DOMAIN);
        Autoya.Persist_DeleteByDomain(AssetBundlesSettings.ASSETBUNDLES_LIST_STORED_DOMAIN);

        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);
        {
            var loginDone = false;
            Autoya.Auth_SetOnAuthenticated(
                () =>
            {
                loginDone = true;
            }
                );

            yield return(WaitUntil(
                             () =>
            {
                return loginDone;
            },
                             () => { throw new TimeoutException("timeout."); }
                             ));
        }

        Assert.True(!Autoya.AssetBundle_IsAssetBundleFeatureReady(), "ready.");
    }
    [MSetup] public void Setup()
    {
        var    authenticated = false;
        Action onMainThread  = () => {
            var dataPath = Application.persistentDataPath;

            var fwPath = Path.Combine(dataPath, AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);
            DeleteAllData(fwPath);

            Autoya.TestEntryPoint(dataPath);

            Autoya.Auth_SetOnAuthenticated(
                () => {
                authenticated = true;
            }
                );
        };

        RunOnMainThread(onMainThread);

        WaitUntil(
            () => {
            return(authenticated);
        },
            5,
            "failed to auth."
            );

        Assert(Autoya.Auth_IsAuthenticated(), "not logged in.");
    }
    public IEnumerator Setup()
    {
        var dataPath = Application.persistentDataPath;
        var fwPath   = Path.Combine(dataPath, AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);

        DeleteAllData(fwPath);

        Autoya.TestEntryPoint(dataPath);

        var authenticated = false;

        Autoya.Auth_SetOnAuthenticated(
            () =>
        {
            authenticated = true;
        }
            );

        yield return(WaitUntil(
                         () => authenticated,
                         () => { throw new TimeoutException("failed to auth."); }
                         ));

        True(Autoya.Auth_IsAuthenticated(), "not logged in.");
    }
Exemple #8
0
    private IEnumerator WaitPurchaseFeatureOfAutoya(Action done)
    {
        Autoya.TestEntryPoint(Application.persistentDataPath);

        while (!Autoya.Purchase_IsReady())
        {
            yield return(null);
        }
        done();
    }
    public IEnumerator EndPointUpdateRetry()
    {
        // 必ず失敗するURLを実行
        EndPointSelectorSettings.ENDPOINT_INFO_URL = "https://127.0.0.1/" + Guid.NewGuid().ToString("N");

        // Autoyaの起動と、起動直後にEndPointの更新、
        // Retryするかどうかのポイントをリトライが完了したかどうかの確認ポイントとして、一度実行されたら更新が発生するようにセットする
        // こうすることで、リトライの直後にURLが書き換わり、認証まで終わるのを待てばEpの更新が完了する。
        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);

        Autoya.Debug_OnEndPointInstanceRequired(
            () =>
        {
            return(new AutoyaFramework.EndPointSelect.IEndPoint[] { new main(), new sub() });
        }
            );

        var done = false;

        Autoya.Debug_SetShouldRetryEndPointGetRequest(
            () =>
        {
            done = true;
            return(true);
        }
            );

        while (!done)
        {
            yield return(null);
        }

        // change to valid url.
        EndPointSelectorSettings.ENDPOINT_INFO_URL = "https://raw.githubusercontent.com/sassembla/Autoya/master/Assets/AutoyaTests/RuntimeData/EndPoints/mainAndSub.json";
        while (!Autoya.Auth_IsAuthenticated())
        {
            yield return(null);
        }

        // epUpdate succeeded and updated.
        var mainEp = Autoya.EndPoint_GetEndPoint <main>();

        Assert.True(mainEp.key0 == "val0", "not match. mainEp.key0:" + mainEp.key0);
        Assert.True(mainEp.key1 == "default_val1", "not match. mainEp.key1:" + mainEp.key1);

        var subEp = Autoya.EndPoint_GetEndPoint <sub>();

        Assert.True(subEp.key0 == "default_val0", "not match. subEp.key0:" + subEp.key0);
    }
    public IEnumerator Setup()
    {
        Autoya.ResetAllForceSetting();

        var dataPath = Application.persistentDataPath;
        var fwPath   = Path.Combine(dataPath, AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);

        DeleteAllData(fwPath);

        Autoya.TestEntryPoint(dataPath);

        while (!Autoya.Auth_IsAuthenticated())
        {
            yield return(false);
        }

        var authenticated = false;

        Autoya.Auth_SetOnAuthenticated(
            () =>
        {
            authenticated = true;
        }
            );
        Autoya.Auth_SetOnBootAuthFailed(
            (code, reason) =>
        {
            Debug.LogError("code:" + code + " reason:" + reason);
        }
            );

        yield return(WaitUntil(
                         () => authenticated,
                         () => { throw new TimeoutException("failed to auth."); }
                         ));

        True(Autoya.Auth_IsAuthenticated(), "not logged in.");
    }
Exemple #11
0
    public IEnumerator Setup()
    {
        Autoya.forceMaintenance        = false;
        Autoya.forceFailAuthentication = false;
        Autoya.forceFailHttp           = false;

        var dataPath = Application.persistentDataPath;

        var fwPath = Path.Combine(dataPath, AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN);

        DeleteAllData(fwPath);

        Autoya.TestEntryPoint(dataPath);

        yield return(WaitUntil(
                         () =>
        {
            return Autoya.Purchase_IsReady();
        },
                         () => { throw new TimeoutException("failed to auth or failed to ready purchase."); },
                         10
                         ));
    }
    [MSetup] public void Setup()
    {
        var loginDone = false;

        RunOnMainThread(
            () => {
            var dataPath = Application.persistentDataPath;
            Autoya.TestEntryPoint(dataPath);
            Autoya.Auth_SetOnAuthenticated(
                () => {
                loginDone = true;
            }
                );
        }
            );

        WaitUntil(
            () => {
            return(loginDone);
        },
            3
            );
        Autoya.Persist_DeleteByDomain(AutoyaFilePersistTestsFileDomain);
    }
Exemple #13
0
    public IEnumerator StoredAssetBundleListIsEnoughOnBoot()
    {
        // 事前に保存済みのデータを消す、これでほかのテストの影響を受けない初期化されたデータだけができる。
        Autoya.Persist_DeleteByDomain(AppSettings.APP_STORED_RUNTIME_MANIFEST_DOMAIN);
        Autoya.Persist_DeleteByDomain(AssetBundlesSettings.ASSETBUNDLES_LIST_STORED_DOMAIN);

        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);
        {
            var loginDone = false;
            Autoya.Auth_SetOnAuthenticated(
                () =>
            {
                loginDone = true;
            }
                );

            yield return(WaitUntil(
                             () =>
            {
                return loginDone;
            },
                             () => { throw new TimeoutException("timeout."); }
                             ));
        }

        var abReady = false;

        Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
            results =>
        {
            abReady = true;
        },
            (code, reason, status) =>
        {
            Debug.LogError("failed to download ABList, code:" + code + " reason:" + reason);
        }
            );
        while (!abReady)
        {
            yield return(null);
        }

        // reboot autoya.
        Autoya.TestEntryPoint(dataPath);

        {
            var loginDone = false;
            Autoya.Auth_SetOnAuthenticated(
                () =>
            {
                loginDone = true;
            }
                );

            yield return(WaitUntil(
                             () =>
            {
                return loginDone;
            },
                             () => { throw new TimeoutException("timeout."); }
                             ));
        }

        Assert.True(Autoya.AssetBundle_IsAssetBundleFeatureReady(), "not ready.");
    }
Exemple #14
0
    public IEnumerator RemoveUnnecessaryStoredAssetBundleListOnBoot()
    {
        // 事前に保存済みのデータを消す、これでほかのテストの影響を受けない初期化されたデータだけができる。
        Autoya.Persist_DeleteByDomain(AppSettings.APP_STORED_RUNTIME_MANIFEST_DOMAIN);
        Autoya.Persist_DeleteByDomain(AssetBundlesSettings.ASSETBUNDLES_LIST_STORED_DOMAIN);

        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);
        {
            var loginDone = false;
            Autoya.Auth_SetOnAuthenticated(
                () =>
            {
                loginDone = true;
            }
                );

            yield return(WaitUntil(
                             () =>
            {
                return loginDone;
            },
                             () => { throw new TimeoutException("timeout."); }
                             ));
        }
        var abReady = false;

        Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
            results =>
        {
            abReady = true;
        },
            (code, reason, status) =>
        {
            Debug.LogError("failed to download ABList, code:" + code + " reason:" + reason);
        }
            );
        while (!abReady)
        {
            yield return(null);
        }

        var defaultGeneratedABListIdentities = Autoya.AssetBundle_AssetBundleLists().Select(list => list.identity).ToArray();

        // このあとまたAutoyaを起動するので、ABListがあるdomainに存在するファイルに、独自の「アプリのアプデでいらなくなった」という状態のリストを追加する。
        var dummyListIdentity = "dummy_reomved";
        var removedABListStr  = "{\"identity\":\"" + dummyListIdentity + "\",\"target\":\"iOS\",\"version\":\"1.0.0\",\"assetBundles\":[{\"bundleName\":\"sample\",\"assetNames\":[\"Assets/AutoyaTests/RuntimeData/AssetBundles/SubResources/sample.txt\"],\"dependsBundleNames\":[],\"crc\":1672014196,\"hash\":\"720461ec2bb1aecd2ce41903f3a7d205\",\"size\":754}]}";

        Autoya.Persist_Update(AssetBundlesSettings.ASSETBUNDLES_LIST_STORED_DOMAIN, "dummyList.json", removedABListStr);

        Autoya.TestEntryPoint(dataPath);

        {
            var loginDone = false;
            Autoya.Auth_SetOnAuthenticated(
                () =>
            {
                loginDone = true;
            }
                );

            yield return(WaitUntil(
                             () =>
            {
                return loginDone;
            },
                             () => { throw new TimeoutException("timeout."); }
                             ));
        }

        abReady = false;

        Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
            results =>
        {
            abReady = true;
        },
            (code, reason, status) =>
        {
            Debug.LogError("failed to download ABList, code:" + code + " reason:" + reason);
        }
            );

        while (!abReady)
        {
            yield return(null);
        }

        // dummy abList should be deleted.
        var lists            = Autoya.AssetBundle_AssetBundleLists();
        var storedIdentities = lists.Select(list => list.identity).ToArray();

        Assert.True(!storedIdentities.Contains(dummyListIdentity), "contained.");

        // all identites are matched.
        foreach (var defaultGeneratedABListIdentitiy in defaultGeneratedABListIdentities)
        {
            Assert.True(storedIdentities.Contains(defaultGeneratedABListIdentitiy), "not contained.");
        }

        foreach (var storedIdentity in storedIdentities)
        {
            Assert.True(defaultGeneratedABListIdentities.Contains(storedIdentity), "not contained.");
        }
    }