forked from facebook/facebook-sdk-for-unity
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6d611a5
Showing
319 changed files
with
20,364 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# files for the dex VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# generated files | ||
bin/ | ||
gen/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
local.gradle | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Intellij project files | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Gradle | ||
.gradle | ||
build | ||
|
||
# vim temp files | ||
*.swp | ||
|
||
# Arc generated | ||
.phutil_module_cache | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
|
||
# Unity3D Generated File On Crash Reports | ||
sysinfo.txt | ||
|
||
# Unity project version File | ||
ProjectVersion.txt | ||
|
||
# Export Folder For SDK Package | ||
/TempGenStaticObjects/ | ||
/out/ | ||
|
||
# MD unit test results | ||
test-results/ | ||
unit_test_results.txt | ||
|
||
# Ignore Plugin Folders which are build by build | ||
/Facebook.Unity/Assets/Plugins/Android/ | ||
/Facebook.Unity/Assets/Plugins/iOS/ | ||
|
||
# Ignore Current Facebook Settings | ||
FacebookSettings.asset* | ||
|
||
# Ignore androdi wrapper lib created by build scripts | ||
/facebook-android-wrapper/libs/ | ||
|
||
# MD Plugins | ||
*.StyleCop | ||
*.StyleCop.meta | ||
StyleCop.Cache | ||
StyleCop.Cache.meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Facebook welcomes contributions to our SDKs. | ||
|
||
All contributors must sign a CLA (contributor license agreement) here: | ||
|
||
https://developers.facebook.com/opensource/cla | ||
|
||
To contribute on behalf of your employer, sign the company CLA | ||
To contribute on behalf of yourself, sign the individual CLA | ||
|
||
All contributions: | ||
|
||
1/ MUST be be licensed using the Apache License, Version 2.0 | ||
2/ authors MAY retain copyright by adding their copyright notice to the appropriate flies | ||
|
||
More information on the Apache License can be found here: http://www.apache.org/foundation/license-faq.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
* copy, modify, and distribute this software in source code or binary form for use | ||
* in connection with the web services and APIs provided by Facebook. | ||
* | ||
* As with any software that integrates with the Facebook platform, your use of | ||
* this software is subject to the Facebook Developer Principles and Policies | ||
* [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
* included in all copies or substantial portions of the software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
namespace Facebook.Unity.Tests | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Facebook.Unity.Mobile.Android; | ||
using NUnit.Framework; | ||
|
||
internal class AndroidTest<T> where T : IResult | ||
{ | ||
private readonly MockAndroidJavaClass mock; | ||
private readonly CallbackManager callbackManager; | ||
|
||
public AndroidTest() | ||
{ | ||
this.mock = new MockAndroidJavaClass(); | ||
this.callbackManager = new CallbackManager(); | ||
this.AndroidFacebook = new AndroidFacebook(this.mock, this.callbackManager); | ||
} | ||
|
||
public delegate void ResultValidator(T result); | ||
|
||
public ResultValidator CallbackResultValidator { get; set; } | ||
|
||
public IDictionary<string, object> ExpectedResult { private get; set; } | ||
|
||
public AndroidFacebook AndroidFacebook { get; private set; } | ||
|
||
public void Run(Action<FacebookDelegate<T>> method, MockAndroidJavaClass.OnResult handler) | ||
{ | ||
string expectedResultStr = MiniJSON.Json.Serialize(this.ExpectedResult); | ||
this.mock.Callback = handler; | ||
this.mock.Result = expectedResultStr; | ||
bool callbackCalled = false; | ||
|
||
FacebookDelegate<T> callback = delegate(T result) | ||
{ | ||
if (this.CallbackResultValidator != null) | ||
{ | ||
this.CallbackResultValidator(result); | ||
} | ||
|
||
Assert.AreEqual(expectedResultStr, result.RawResult); | ||
callbackCalled = true; | ||
}; | ||
|
||
method(callback); | ||
Assert.IsTrue(callbackCalled); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
* copy, modify, and distribute this software in source code or binary form for use | ||
* in connection with the web services and APIs provided by Facebook. | ||
* | ||
* As with any software that integrates with the Facebook platform, your use of | ||
* this software is subject to the Facebook Developer Principles and Policies | ||
* [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
* included in all copies or substantial portions of the software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
namespace Facebook.Unity.Tests | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Facebook.Unity.Mobile.Android; | ||
using NUnit.Framework; | ||
using NUnit.Mocks; | ||
|
||
[TestFixture] | ||
public class AppInvite : FacebookTestClass | ||
{ | ||
[Test] | ||
public void TestSimpleAppInvite() | ||
{ | ||
var test = new AndroidTest<IAppInviteResult>(); | ||
var result = new Dictionary<string, object>(); | ||
result[Constants.CallbackIdKey] = "1"; | ||
test.ExpectedResult = result; | ||
test.Run( | ||
(callback) => test.AndroidFacebook.AppInvite(null, null, callback), | ||
test.AndroidFacebook.OnAppInviteComplete); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
* copy, modify, and distribute this software in source code or binary form for use | ||
* in connection with the web services and APIs provided by Facebook. | ||
* | ||
* As with any software that integrates with the Facebook platform, your use of | ||
* this software is subject to the Facebook Developer Principles and Policies | ||
* [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
* included in all copies or substantial portions of the software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
namespace Facebook.Unity.Tests | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
|
||
public class AppLinks : FacebookTestClass | ||
{ | ||
[Test] | ||
public void TestAndroidEmptyDefferedAppLink() | ||
{ | ||
var test = new AndroidTest<IAppLinkResult>(); | ||
var result = new Dictionary<string, object>(); | ||
result[Constants.CallbackIdKey] = "1"; | ||
result["did_complete"] = true; | ||
test.ExpectedResult = result; | ||
|
||
test.Run( | ||
(callback) => test.AndroidFacebook.FetchDeferredAppLink(callback), | ||
test.AndroidFacebook.OnFetchDeferredAppLinkComplete); | ||
} | ||
|
||
[Test] | ||
public void TestAndroidDeferredAppLink() | ||
{ | ||
var test = new AndroidTest<IAppLinkResult>(); | ||
var result = new Dictionary<string, object>(); | ||
result[Constants.CallbackIdKey] = "1"; | ||
result[Constants.RefKey] = "test ref"; | ||
result[Constants.TargetUrlKey] = "test target url"; | ||
result[Constants.ExtrasKey] = new Dictionary<string, object>() | ||
{ | ||
{ | ||
"com.facebook.platform.APPLINK_NATIVE_CLASS", string.Empty | ||
}, | ||
{ | ||
"target_url", result[Constants.TargetUrlKey] | ||
} | ||
}; | ||
|
||
test.ExpectedResult = result; | ||
|
||
test.CallbackResultValidator = appLinkResult => | ||
{ | ||
Assert.IsNotNull(appLinkResult.Extras); | ||
Assert.IsNotNull(appLinkResult.Ref); | ||
Assert.IsNotNull(appLinkResult.TargetUrl); | ||
Assert.IsNull(appLinkResult.Url); | ||
}; | ||
|
||
test.Run( | ||
(callback) => test.AndroidFacebook.FetchDeferredAppLink(callback), | ||
test.AndroidFacebook.OnFetchDeferredAppLinkComplete); | ||
} | ||
|
||
[Test] | ||
public void TestAndroidSimpleDeepLink() | ||
{ | ||
var test = new AndroidTest<IAppLinkResult>(); | ||
var result = new Dictionary<string, object>(); | ||
result[Constants.CallbackIdKey] = "1"; | ||
result[Constants.UrlKey] = "test url"; | ||
result[Constants.RefKey] = "test ref"; | ||
result[Constants.TargetUrlKey] = "test target url"; | ||
result[Constants.ExtrasKey] = new Dictionary<string, object>() | ||
{ | ||
{ | ||
"extras", new Dictionary<string, object>() | ||
}, | ||
{ | ||
"version", "1.0" | ||
} | ||
}; | ||
|
||
test.ExpectedResult = result; | ||
|
||
test.CallbackResultValidator = appLinkResult => | ||
{ | ||
Assert.AreEqual(result[Constants.UrlKey], appLinkResult.Url); | ||
Assert.AreEqual(result[Constants.RefKey], appLinkResult.Ref); | ||
Assert.AreEqual(result[Constants.TargetUrlKey], appLinkResult.TargetUrl); | ||
Assert.AreEqual( | ||
MiniJSON.Json.Serialize(result[Constants.ExtrasKey]), | ||
MiniJSON.Json.Serialize(appLinkResult.Extras)); | ||
}; | ||
|
||
test.Run( | ||
(callback) => test.AndroidFacebook.GetAppLink(callback), | ||
test.AndroidFacebook.OnGetAppLinkComplete); | ||
} | ||
|
||
[Test] | ||
public void TestAndroidAppLink() | ||
{ | ||
var test = new AndroidTest<IAppLinkResult>(); | ||
var result = new Dictionary<string, object>(); | ||
result[Constants.CallbackIdKey] = "1"; | ||
result[Constants.UrlKey] = "test url"; | ||
|
||
test.ExpectedResult = result; | ||
|
||
test.CallbackResultValidator = appLinkResult => | ||
{ | ||
Assert.AreEqual(result[Constants.UrlKey], appLinkResult.Url); | ||
Assert.IsNull(appLinkResult.Ref); | ||
Assert.IsNull(appLinkResult.TargetUrl); | ||
Assert.IsNull(appLinkResult.Extras); | ||
}; | ||
|
||
test.Run( | ||
(callback) => test.AndroidFacebook.GetAppLink(callback), | ||
test.AndroidFacebook.OnGetAppLinkComplete); | ||
} | ||
} | ||
} |
Oops, something went wrong.