mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge b2g-inbound to mozilla-central
This commit is contained in:
commit
2b75afa842
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
|
32
b2g/config/emulator-kk/config.json
Normal file
32
b2g/config/emulator-kk/config.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"config_version": 2,
|
||||
"tooltool_manifest": "releng-emulator-kk.tt",
|
||||
"mock_target": "mozilla-centos6-x86_64",
|
||||
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"],
|
||||
"mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
|
||||
"build_targets": ["droid", "package-emulator", "package-tests"],
|
||||
"upload_files": [
|
||||
"{workdir}/out/target/product/generic/*.tar.bz2",
|
||||
"{workdir}/out/target/product/generic/tests/*.zip",
|
||||
"{workdir}/out/emulator.tar.gz",
|
||||
"{objdir}/dist/b2g-*.crashreporter-symbols.zip",
|
||||
"{workdir}/sources.xml"
|
||||
],
|
||||
"public_upload_files": [
|
||||
"{workdir}/out/target/product/generic/*.tar.bz2",
|
||||
"{workdir}/out/target/product/generic/tests/*.zip",
|
||||
"{objdir}/dist/b2g-*.crashreporter-symbols.zip",
|
||||
"{workdir}/sources.xml"
|
||||
],
|
||||
"upload_platform": "emulator-kk",
|
||||
"gecko_l10n_root": "https://hg.mozilla.org/l10n-central",
|
||||
"gaia": {
|
||||
"l10n": {
|
||||
"vcs": "hgtool",
|
||||
"root": "https://hg.mozilla.org/gaia-l10n"
|
||||
}
|
||||
},
|
||||
"b2g_manifest": "emulator-kk.xml",
|
||||
"b2g_manifest_branch": "master",
|
||||
"b2g_manifest_intree": true
|
||||
}
|
2
b2g/config/emulator-kk/releng-emulator-kk.tt
Normal file
2
b2g/config/emulator-kk/releng-emulator-kk.tt
Normal file
@ -0,0 +1,2 @@
|
||||
[
|
||||
]
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"branch": "",
|
||||
"revision": ""
|
||||
},
|
||||
"revision": "61e8a88f301aea77f22abdde19a85f0af27ab7f4",
|
||||
"revision": "03dfc866c15f5322d13a542b722eeb1accb1c429",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4bb8b32d8f1a3a64bfac8f2da7878dc63e613ca5"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -43,9 +43,15 @@ BluetoothHidManager::Observe(nsISupports* aSubject,
|
||||
}
|
||||
|
||||
BluetoothHidManager::BluetoothHidManager()
|
||||
: mConnected(false)
|
||||
, mController(nullptr)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothHidManager::Reset()
|
||||
{
|
||||
mConnected = false;
|
||||
mController = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -10,9 +10,10 @@
|
||||
#include "BluetoothA2dpManager.h"
|
||||
#include "BluetoothHfpManager.h"
|
||||
#include "BluetoothHidManager.h"
|
||||
|
||||
#include "BluetoothUtils.h"
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -23,6 +24,29 @@ USING_BLUETOOTH_NAMESPACE
|
||||
BT_LOGR("[%s] " msg, name.get(), ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
#define CONNECTION_TIMEOUT_MS 15000
|
||||
|
||||
class CheckProfileStatusCallback : public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
CheckProfileStatusCallback(BluetoothProfileController* aController)
|
||||
: mController(aController)
|
||||
{
|
||||
MOZ_ASSERT(aController);
|
||||
}
|
||||
|
||||
virtual ~CheckProfileStatusCallback()
|
||||
{
|
||||
mController = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<BluetoothProfileController> mController;
|
||||
};
|
||||
|
||||
BluetoothProfileController::BluetoothProfileController(
|
||||
bool aConnect,
|
||||
const nsAString& aDeviceAddress,
|
||||
@ -34,6 +58,7 @@ BluetoothProfileController::BluetoothProfileController(
|
||||
, mDeviceAddress(aDeviceAddress)
|
||||
, mRunnable(aRunnable)
|
||||
, mCallback(aCallback)
|
||||
, mCurrentProfileFinished(false)
|
||||
, mSuccess(false)
|
||||
, mProfilesIndex(-1)
|
||||
{
|
||||
@ -41,6 +66,10 @@ BluetoothProfileController::BluetoothProfileController(
|
||||
MOZ_ASSERT(aRunnable);
|
||||
MOZ_ASSERT(aCallback);
|
||||
|
||||
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
MOZ_ASSERT(mTimer);
|
||||
|
||||
mCheckProfileStatusCallback = new CheckProfileStatusCallback(this);
|
||||
mProfiles.Clear();
|
||||
|
||||
/**
|
||||
@ -63,6 +92,10 @@ BluetoothProfileController::~BluetoothProfileController()
|
||||
mProfiles.Clear();
|
||||
mRunnable = nullptr;
|
||||
mCallback = nullptr;
|
||||
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -164,17 +197,36 @@ BluetoothProfileController::SetupProfiles(bool aAssignServiceClass)
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(CheckProfileStatusCallback, nsITimerCallback)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CheckProfileStatusCallback::Notify(nsITimer* aTimer)
|
||||
{
|
||||
MOZ_ASSERT(mController);
|
||||
// Continue on the next profile since we haven't got the callback after
|
||||
// timeout.
|
||||
mController->GiveupAndContinue();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothProfileController::Start()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(mProfilesIndex == -1);
|
||||
MOZ_ASSERT(mTimer);
|
||||
NS_ENSURE_TRUE_VOID(mProfiles.Length() > 0);
|
||||
|
||||
++mProfilesIndex;
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "");
|
||||
|
||||
if (mTimer) {
|
||||
mTimer->InitWithCallback(mCheckProfileStatusCallback, CONNECTION_TIMEOUT_MS,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
if (mConnect) {
|
||||
mProfiles[mProfilesIndex]->Connect(mDeviceAddress, this);
|
||||
} else {
|
||||
@ -188,10 +240,18 @@ BluetoothProfileController::Next()
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(mProfilesIndex < (int)mProfiles.Length());
|
||||
MOZ_ASSERT(mTimer);
|
||||
|
||||
mCurrentProfileFinished = false;
|
||||
if (++mProfilesIndex < (int)mProfiles.Length()) {
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "");
|
||||
|
||||
if (mTimer) {
|
||||
mTimer->InitWithCallback(mCheckProfileStatusCallback,
|
||||
CONNECTION_TIMEOUT_MS,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
if (mConnect) {
|
||||
mProfiles[mProfilesIndex]->Connect(mDeviceAddress, this);
|
||||
} else {
|
||||
@ -217,9 +277,16 @@ void
|
||||
BluetoothProfileController::OnConnect(const nsAString& aErrorStr)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mTimer);
|
||||
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "<%s>",
|
||||
NS_ConvertUTF16toUTF8(aErrorStr).get());
|
||||
|
||||
mCurrentProfileFinished = true;
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
}
|
||||
|
||||
if (!aErrorStr.IsEmpty()) {
|
||||
BT_WARNING(NS_ConvertUTF16toUTF8(aErrorStr).get());
|
||||
} else {
|
||||
@ -233,9 +300,16 @@ void
|
||||
BluetoothProfileController::OnDisconnect(const nsAString& aErrorStr)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mTimer);
|
||||
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "<%s>",
|
||||
NS_ConvertUTF16toUTF8(aErrorStr).get());
|
||||
|
||||
mCurrentProfileFinished = true;
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
}
|
||||
|
||||
if (!aErrorStr.IsEmpty()) {
|
||||
BT_WARNING(NS_ConvertUTF16toUTF8(aErrorStr).get());
|
||||
} else {
|
||||
@ -244,3 +318,14 @@ BluetoothProfileController::OnDisconnect(const nsAString& aErrorStr)
|
||||
|
||||
Next();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothProfileController::GiveupAndContinue()
|
||||
{
|
||||
MOZ_ASSERT(!mCurrentProfileFinished);
|
||||
MOZ_ASSERT(mProfilesIndex < (int)mProfiles.Length());
|
||||
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], ERR_OPERATION_TIMEOUT);
|
||||
mProfiles[mProfilesIndex]->Reset();
|
||||
Next();
|
||||
}
|
||||
|
@ -8,8 +8,9 @@
|
||||
#define mozilla_dom_bluetooth_bluetoothprofilecontroller_h__
|
||||
|
||||
#include "BluetoothUuid.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -102,6 +103,11 @@ public:
|
||||
*/
|
||||
void OnDisconnect(const nsAString& aErrorStr);
|
||||
|
||||
/**
|
||||
* It is invoked after a profile has reached timeout, reset mProfiles.
|
||||
*/
|
||||
void GiveupAndContinue();
|
||||
|
||||
private:
|
||||
// Setup data member mProfiles
|
||||
void SetupProfiles(bool aAssignServiceClass);
|
||||
@ -121,6 +127,7 @@ private:
|
||||
nsRefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
BluetoothProfileControllerCallback mCallback;
|
||||
|
||||
bool mCurrentProfileFinished;
|
||||
bool mSuccess;
|
||||
int8_t mProfilesIndex;
|
||||
nsTArray<BluetoothProfileManagerBase*> mProfiles;
|
||||
@ -130,6 +137,9 @@ private:
|
||||
uint32_t cod;
|
||||
BluetoothServiceClass service;
|
||||
} mTarget;
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsITimerCallback> mCheckProfileStatusCallback;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define ERR_REACHED_CONNECTION_LIMIT "ReachedConnectionLimitError"
|
||||
#define ERR_SERVICE_CHANNEL_NOT_FOUND "DeviceChannelRetrievalError"
|
||||
#define ERR_UNKNOWN_PROFILE "UnknownProfileError"
|
||||
#define ERR_OPERATION_TIMEOUT "OperationTimeout"
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "nsIObserver.h"
|
||||
@ -65,7 +66,12 @@ public:
|
||||
virtual void OnDisconnect(const nsAString& aErrorStr) = 0;
|
||||
|
||||
/**
|
||||
* Returns string of profile name
|
||||
* Clean up profile resources and set mController as null.
|
||||
*/
|
||||
virtual void Reset() = 0;
|
||||
|
||||
/**
|
||||
* Returns string of profile name.
|
||||
*/
|
||||
virtual void GetName(nsACString& aName) = 0;
|
||||
};
|
||||
@ -85,6 +91,7 @@ public:
|
||||
virtual void Disconnect(BluetoothProfileController* aController) MOZ_OVERRIDE; \
|
||||
virtual void OnConnect(const nsAString& aErrorStr) MOZ_OVERRIDE; \
|
||||
virtual void OnDisconnect(const nsAString& AErrorStr) MOZ_OVERRIDE; \
|
||||
virtual void Reset() MOZ_OVERRIDE;
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
@ -475,6 +475,8 @@ BluetoothService::StartStopBluetooth(bool aStart, bool aIsStartup)
|
||||
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
|
||||
if (profile->IsConnected()) {
|
||||
profile->Disconnect(nullptr);
|
||||
} else {
|
||||
profile->Reset();
|
||||
}
|
||||
|
||||
profile = BluetoothOppManager::Get();
|
||||
@ -487,13 +489,18 @@ BluetoothService::StartStopBluetooth(bool aStart, bool aIsStartup)
|
||||
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
|
||||
if (profile->IsConnected()) {
|
||||
profile->Disconnect(nullptr);
|
||||
} else {
|
||||
profile->Reset();
|
||||
}
|
||||
|
||||
profile = BluetoothHidManager::Get();
|
||||
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
|
||||
if (profile->IsConnected()) {
|
||||
profile->Disconnect(nullptr);
|
||||
} else {
|
||||
profile->Reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!mBluetoothThread) {
|
||||
|
@ -197,6 +197,12 @@ BluetoothA2dpManager::Observe(nsISupports* aSubject,
|
||||
}
|
||||
|
||||
BluetoothA2dpManager::BluetoothA2dpManager()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothA2dpManager::Reset()
|
||||
{
|
||||
ResetA2dp();
|
||||
ResetAvrcp();
|
||||
@ -592,6 +598,9 @@ BluetoothA2dpManager::Connect(const nsAString& aDeviceAddress,
|
||||
void
|
||||
BluetoothA2dpManager::Disconnect(BluetoothProfileController* aController)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mController);
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
if (aController) {
|
||||
@ -608,7 +617,6 @@ BluetoothA2dpManager::Disconnect(BluetoothProfileController* aController)
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(!mController);
|
||||
|
||||
mController = aController;
|
||||
|
||||
@ -648,6 +656,7 @@ BluetoothA2dpManager::OnDisconnect(const nsAString& aErrorStr)
|
||||
|
||||
nsRefPtr<BluetoothProfileController> controller = mController.forget();
|
||||
controller->OnDisconnect(aErrorStr);
|
||||
Reset();
|
||||
}
|
||||
|
||||
/* HandleSinkPropertyChanged update sink state in A2dp
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
uint64_t GetTotalMediaNumber();
|
||||
void GetTitle(nsAString& aTitle);
|
||||
void GetArtist(nsAString& aArtist);
|
||||
|
||||
private:
|
||||
class SinkPropertyChangedHandler;
|
||||
BluetoothA2dpManager();
|
||||
|
@ -1553,3 +1553,9 @@ BluetoothOppManager::OnDisconnect(const nsAString& aErrorStr)
|
||||
{
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::Reset()
|
||||
{
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
|
@ -1246,6 +1246,7 @@ void
|
||||
BluetoothHfpManager::Disconnect(BluetoothProfileController* aController)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mController);
|
||||
|
||||
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
|
||||
|
||||
@ -1254,7 +1255,6 @@ BluetoothHfpManager::Disconnect(BluetoothProfileController* aController)
|
||||
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
|
||||
sBluetoothHfpInterface->disconnect(&deviceBdAddress));
|
||||
|
||||
MOZ_ASSERT(!mController);
|
||||
mController = aController;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,6 @@ private:
|
||||
bool Init();
|
||||
bool InitHfpInterface();
|
||||
void DeinitHfpInterface();
|
||||
void Reset();
|
||||
|
||||
void HandleShutdown();
|
||||
void HandleVolumeChanged(const nsAString& aData);
|
||||
|
@ -45,6 +45,12 @@ BluetoothA2dpManager::Observe(nsISupports* aSubject,
|
||||
}
|
||||
|
||||
BluetoothA2dpManager::BluetoothA2dpManager()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothA2dpManager::Reset()
|
||||
{
|
||||
ResetA2dp();
|
||||
ResetAvrcp();
|
||||
@ -230,6 +236,7 @@ BluetoothA2dpManager::OnDisconnect(const nsAString& aErrorStr)
|
||||
|
||||
nsRefPtr<BluetoothProfileController> controller = mController.forget();
|
||||
controller->OnDisconnect(aErrorStr);
|
||||
Reset();
|
||||
}
|
||||
|
||||
/* HandleSinkPropertyChanged update sink state in A2dp
|
||||
|
@ -342,7 +342,7 @@ Call::IsActive()
|
||||
/**
|
||||
* BluetoothHfpManager
|
||||
*/
|
||||
BluetoothHfpManager::BluetoothHfpManager() : mController(nullptr)
|
||||
BluetoothHfpManager::BluetoothHfpManager()
|
||||
{
|
||||
#ifdef MOZ_B2G_RIL
|
||||
mPhoneType = PhoneType::NONE;
|
||||
@ -384,15 +384,7 @@ BluetoothHfpManager::Reset()
|
||||
mCCWA = false;
|
||||
mCLIP = false;
|
||||
mDialingRequestProcessed = true;
|
||||
#endif
|
||||
mCMEE = false;
|
||||
mCMER = false;
|
||||
mConnectScoRequest = false;
|
||||
mSlcConnected = false;
|
||||
mIsHsp = false;
|
||||
mReceiveVgsFlag = false;
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// We disable BSIR by default as it requires OEM implement BT SCO + SPEAKER
|
||||
// output audio path in audio driver. OEM can enable BSIR by setting
|
||||
// mBSIR=true here.
|
||||
@ -402,6 +394,13 @@ BluetoothHfpManager::Reset()
|
||||
|
||||
ResetCallArray();
|
||||
#endif
|
||||
mCMEE = false;
|
||||
mCMER = false;
|
||||
mConnectScoRequest = false;
|
||||
mSlcConnected = false;
|
||||
mIsHsp = false;
|
||||
mReceiveVgsFlag = false;
|
||||
mController = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1936,3 +1935,4 @@ BluetoothHfpManager::OnDisconnect(const nsAString& aErrorStr)
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(BluetoothHfpManager, nsIObserver)
|
||||
|
||||
|
@ -153,7 +153,6 @@ private:
|
||||
|
||||
bool Init();
|
||||
void Notify(const hal::BatteryInformation& aBatteryInfo);
|
||||
void Reset();
|
||||
#ifdef MOZ_B2G_RIL
|
||||
void ResetCallArray();
|
||||
uint32_t FindFirstCall(uint16_t aState);
|
||||
|
@ -1609,3 +1609,9 @@ BluetoothOppManager::OnDisconnect(const nsAString& aErrorStr)
|
||||
{
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::Reset()
|
||||
{
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
|
@ -9,12 +9,13 @@ let Promise =
|
||||
|
||||
let bluetoothManager;
|
||||
|
||||
/* Get mozSettings value specified by @aKey.
|
||||
/**
|
||||
* Get mozSettings value specified by @aKey.
|
||||
*
|
||||
* Resolve if that mozSettings value is retrieved successfully, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Forfill params:
|
||||
* Fulfill params:
|
||||
* The corresponding mozSettings value of the key.
|
||||
* Reject params: (none)
|
||||
*
|
||||
@ -39,11 +40,12 @@ function getSettings(aKey) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Set mozSettings values.
|
||||
/**
|
||||
* Set mozSettings values.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Forfill params: (none)
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aSettings
|
||||
@ -67,12 +69,13 @@ function setSettings(aSettings) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Get mozSettings value of 'bluetooth.enabled'.
|
||||
/**
|
||||
* Get mozSettings value of 'bluetooth.enabled'.
|
||||
*
|
||||
* Resolve if that mozSettings value is retrieved successfully, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Forfill params:
|
||||
* Fulfill params:
|
||||
* A boolean value.
|
||||
* Reject params: (none)
|
||||
*
|
||||
@ -82,11 +85,12 @@ function getBluetoothEnabled() {
|
||||
return getSettings("bluetooth.enabled");
|
||||
}
|
||||
|
||||
/* Set mozSettings value of 'bluetooth.enabled'.
|
||||
/**
|
||||
* Set mozSettings value of 'bluetooth.enabled'.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Forfill params: (none)
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aEnabled
|
||||
@ -100,10 +104,11 @@ function setBluetoothEnabled(aEnabled) {
|
||||
return setSettings(obj);
|
||||
}
|
||||
|
||||
/* Push required permissions and test if |navigator.mozBluetooth| exists.
|
||||
/**
|
||||
* Push required permissions and test if |navigator.mozBluetooth| exists.
|
||||
* Resolve if it does, reject otherwise.
|
||||
*
|
||||
* Forfill params:
|
||||
* Fulfill params:
|
||||
* bluetoothManager -- an reference to navigator.mozBluetooth.
|
||||
* Reject params: (none)
|
||||
*
|
||||
@ -151,11 +156,12 @@ function ensureBluetoothManager(aPermissions) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Wait for one named BluetoothManager event.
|
||||
/**
|
||||
* Wait for one named BluetoothManager event.
|
||||
*
|
||||
* Resolve if that named event occurs. Never reject.
|
||||
*
|
||||
* Forfill params: the DOMEvent passed.
|
||||
* Fulfill params: the DOMEvent passed.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
@ -172,12 +178,13 @@ function waitForManagerEvent(aEventName) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Convenient function for setBluetoothEnabled and waitForManagerEvent
|
||||
/**
|
||||
* Convenient function for setBluetoothEnabled and waitForManagerEvent
|
||||
* combined.
|
||||
*
|
||||
* Resolve if that named event occurs. Reject if we can't set settings.
|
||||
*
|
||||
* Forfill params: the DOMEvent passed.
|
||||
* Fulfill params: the DOMEvent passed.
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @return A deferred promise.
|
||||
@ -198,11 +205,12 @@ function setBluetoothEnabledAndWait(aEnabled) {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/* Get default adapter.
|
||||
/**
|
||||
* Get default adapter.
|
||||
*
|
||||
* Resolve if that default adapter is got, reject otherwise.
|
||||
*
|
||||
* Forfill params: a BluetoothAdapter instance.
|
||||
* Fulfill params: a BluetoothAdapter instance.
|
||||
* Reject params: a DOMError, or null if if there is no adapter ready yet.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
@ -237,7 +245,8 @@ function getDefaultAdapter() {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Flush permission settings and call |finish()|.
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
|
146
dom/events/test/marionette/head.js
Normal file
146
dom/events/test/marionette/head.js
Normal file
@ -0,0 +1,146 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
|
||||
|
||||
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
|
||||
|
||||
let _pendingEmulatorCmdCount = 0;
|
||||
|
||||
/**
|
||||
* Send emulator command with safe guard.
|
||||
*
|
||||
* We should only call |finish()| after all emulator command transactions
|
||||
* end, so here comes with the pending counter. Resolve when the emulator
|
||||
* gives positive response, and reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function runEmulatorCmdSafe(aCommand) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
++_pendingEmulatorCmdCount;
|
||||
runEmulatorCmd(aCommand, function(aResult) {
|
||||
--_pendingEmulatorCmdCount;
|
||||
|
||||
ok(true, "Emulator response: " + JSON.stringify(aResult));
|
||||
if (Array.isArray(aResult) &&
|
||||
aResult[aResult.length - 1] === "OK") {
|
||||
deferred.resolve(aResult);
|
||||
} else {
|
||||
deferred.reject(aResult);
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get emulator sensor values of a named sensor.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator sensor values.
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aSensorName
|
||||
* A string name of the sensor. Availables are: "acceleration"
|
||||
* "magnetic-field", "orientation", "temperature", "proximity".
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function getEmulatorSensorValues(aSensorName) {
|
||||
return runEmulatorCmdSafe("sensor get " + aSensorName)
|
||||
.then(function(aResult) {
|
||||
// aResult = ["orientation = 0:0:0", "OK"]
|
||||
return aResult[0].split(" ")[2].split(":").map(function(aElement) {
|
||||
return parseInt(aElement, 10);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient alias function for getting orientation sensor values.
|
||||
*/
|
||||
function getEmulatorOrientationValues() {
|
||||
return getEmulatorSensorValues("orientation");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set emulator orientation sensor values.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aAzimuth
|
||||
* @param aPitch
|
||||
* @param aRoll
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setEmulatorOrientationValues(aAzimuth, aPitch, aRoll) {
|
||||
let cmd = "sensor set orientation " + aAzimuth + ":" + aPitch + ":" + aRoll;
|
||||
return runEmulatorCmdSafe(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a named window event.
|
||||
*
|
||||
* Resolve if that named event occurs. Never reject.
|
||||
*
|
||||
* Forfill params: the DOMEvent passed.
|
||||
*
|
||||
* @param aEventName
|
||||
* A string event name.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function waitForWindowEvent(aEventName) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
window.addEventListener(aEventName, function onevent(aEvent) {
|
||||
window.removeEventListener(aEventName, onevent);
|
||||
|
||||
ok(true, "Window event '" + aEventName + "' got.");
|
||||
deferred.resolve(aEvent);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
return _pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic test routine helper.
|
||||
*
|
||||
* This helper does nothing but clean-ups.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestBase(aTestCaseMain) {
|
||||
Promise.resolve()
|
||||
.then(aTestCaseMain)
|
||||
.then(cleanUp, function() {
|
||||
ok(false, 'promise rejects during test.');
|
||||
cleanUp();
|
||||
});
|
||||
}
|
6
dom/events/test/marionette/manifest.ini
Normal file
6
dom/events/test/marionette/manifest.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
b2g = true
|
||||
browser = false
|
||||
qemu = true
|
||||
|
||||
[test_sensor_orientation.js]
|
53
dom/events/test/marionette/test_sensor_orientation.js
Normal file
53
dom/events/test/marionette/test_sensor_orientation.js
Normal file
@ -0,0 +1,53 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 120000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
function doTest(aAzimuth, aPitch, aRoll) {
|
||||
log("Testing [azimuth, pitch, roll] = " + Array.slice(arguments));
|
||||
|
||||
return setEmulatorOrientationValues(aAzimuth, aPitch, aRoll)
|
||||
.then(() => waitForWindowEvent("deviceorientation"))
|
||||
.then(function(aEvent) {
|
||||
is(aEvent.alpha, aAzimuth, "azimuth");
|
||||
is(aEvent.beta, aPitch, "pitch");
|
||||
is(aEvent.gamma, aRoll, "roll");
|
||||
});
|
||||
}
|
||||
|
||||
function testAllPermutations() {
|
||||
const angles = [-180, -90, 0, 90, 180];
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < angles.length; i++) {
|
||||
for (let j = 0; j < angles.length; j++) {
|
||||
for (let k = 0; k < angles.length; k++) {
|
||||
promise =
|
||||
promise.then(doTest.bind(null, angles[i], angles[j], angles[k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
||||
startTestBase(function() {
|
||||
let origValues;
|
||||
|
||||
return Promise.resolve()
|
||||
|
||||
// Retrieve original status.
|
||||
.then(() => getEmulatorOrientationValues())
|
||||
.then(function(aValues) {
|
||||
origValues = aValues;
|
||||
is(typeof origValues, "object", "typeof origValues");
|
||||
is(origValues.length, 3, "origValues.length");
|
||||
})
|
||||
|
||||
// Test original status
|
||||
.then(() => doTest.apply(null, origValues))
|
||||
|
||||
.then(testAllPermutations)
|
||||
|
||||
// Restore original status.
|
||||
.then(() => setEmulatorOrientationValues.apply(null, origValues));
|
||||
});
|
399
dom/mobileconnection/tests/marionette/head.js
Normal file
399
dom/mobileconnection/tests/marionette/head.js
Normal file
@ -0,0 +1,399 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
|
||||
|
||||
const SETTINGS_KEY_DATA_ENABLED = "ril.data.enabled";
|
||||
const SETTINGS_KEY_DATA_ROAMING_ENABLED = "ril.data.roaming_enabled";
|
||||
const SETTINGS_KEY_DATA_APN_SETTINGS = "ril.data.apnSettings";
|
||||
|
||||
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
|
||||
|
||||
let _pendingEmulatorCmdCount = 0;
|
||||
|
||||
/**
|
||||
* Send emulator command with safe guard.
|
||||
*
|
||||
* We should only call |finish()| after all emulator command transactions
|
||||
* end, so here comes with the pending counter. Resolve when the emulator
|
||||
* gives positive response, and reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @param aCommand
|
||||
* A string command to be passed to emulator through its telnet console.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function runEmulatorCmdSafe(aCommand) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
++_pendingEmulatorCmdCount;
|
||||
runEmulatorCmd(aCommand, function(aResult) {
|
||||
--_pendingEmulatorCmdCount;
|
||||
|
||||
ok(true, "Emulator response: " + JSON.stringify(aResult));
|
||||
if (Array.isArray(aResult) && aResult[0] === "OK") {
|
||||
deferred.resolve(aResult);
|
||||
} else {
|
||||
deferred.reject(aResult);
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mozSettings value specified by @aKey.
|
||||
*
|
||||
* Resolve if that mozSettings value is retrieved successfully, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* The corresponding mozSettings value of the key.
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aKey
|
||||
* A string.
|
||||
* @param aAllowError [optional]
|
||||
* A boolean value. If set to true, an error response won't be treated
|
||||
* as test failure. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function getSettings(aKey, aAllowError) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let request = navigator.mozSettings.createLock().get(aKey);
|
||||
request.addEventListener("success", function(aEvent) {
|
||||
ok(true, "getSettings(" + aKey + ") - success");
|
||||
deferred.resolve(aEvent.target.result[aKey]);
|
||||
});
|
||||
request.addEventListener("error", function() {
|
||||
ok(aAllowError, "getSettings(" + aKey + ") - error");
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mozSettings values.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aSettings
|
||||
* An object of format |{key1: value1, key2: value2, ...}|.
|
||||
* @param aAllowError [optional]
|
||||
* A boolean value. If set to true, an error response won't be treated
|
||||
* as test failure. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setSettings(aSettings, aAllowError) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let request = navigator.mozSettings.createLock().set(aSettings);
|
||||
request.addEventListener("success", function() {
|
||||
ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
|
||||
deferred.resolve();
|
||||
});
|
||||
request.addEventListener("error", function() {
|
||||
ok(aAllowError, "setSettings(" + JSON.stringify(aSettings) + ")");
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mozSettings value with only one key.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aKey
|
||||
* A string key.
|
||||
* @param aValue
|
||||
* An object value.
|
||||
* @param aAllowError [optional]
|
||||
* A boolean value. If set to true, an error response won't be treated
|
||||
* as test failure. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setSettings1(aKey, aValue, aAllowError) {
|
||||
let settings = {};
|
||||
settings[aKey] = aValue;
|
||||
return setSettings(settings, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_ENABLED.
|
||||
*/
|
||||
function getDataEnabled(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_ENABLED, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_ENABLED.
|
||||
*/
|
||||
function setDataEnabled(aEnabled, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_ENABLED, aEnabled, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_ROAMING_ENABLED.
|
||||
*/
|
||||
function getDataRoamingEnabled(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_ROAMING_ENABLED, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_ROAMING_ENABLED.
|
||||
*/
|
||||
function setDataRoamingEnabled(aEnabled, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_ROAMING_ENABLED, aEnabled, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_APN_SETTINGS.
|
||||
*/
|
||||
function getDataApnSettings(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_APN_SETTINGS, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_APN_SETTINGS.
|
||||
*/
|
||||
function setDataApnSettings(aApnSettings, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
|
||||
}
|
||||
|
||||
let mobileConnection;
|
||||
|
||||
/**
|
||||
* Push required permissions and test if
|
||||
* |navigator.mozMobileConnections[<aServiceId>]| exists. Resolve if it does,
|
||||
* reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* mobileConnection -- an reference to navigator.mozMobileMessage.
|
||||
*
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aAdditonalPermissions [optional]
|
||||
* An array of permission strings other than "mobileconnection" to be
|
||||
* pushed. Default: empty string.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: 0.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
aAdditionalPermissions = aAdditionalPermissions || [];
|
||||
aServiceId = aServiceId || 0;
|
||||
|
||||
if (aAdditionalPermissions.indexOf("mobileconnection") < 0) {
|
||||
aAdditionalPermissions.push("mobileconnection");
|
||||
}
|
||||
let permissions = [];
|
||||
for (let perm of aAdditionalPermissions) {
|
||||
permissions.push({ "type": perm, "allow": 1, "context": document });
|
||||
}
|
||||
|
||||
SpecialPowers.pushPermissions(permissions, function() {
|
||||
ok(true, "permissions pushed: " + JSON.stringify(permissions));
|
||||
|
||||
// Permission changes can't change existing Navigator.prototype
|
||||
// objects, so grab our objects from a new Navigator.
|
||||
let ifr = document.createElement("iframe");
|
||||
ifr.addEventListener("load", function load() {
|
||||
ifr.removeEventListener("load", load);
|
||||
|
||||
mobileConnection =
|
||||
ifr.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||
|
||||
if (mobileConnection) {
|
||||
log("navigator.mozMobileConnections[" + aServiceId + "] is instance of " +
|
||||
mobileConnection.constructor);
|
||||
} else {
|
||||
log("navigator.mozMobileConnections[" + aServiceId + "] is undefined");
|
||||
}
|
||||
|
||||
if (mobileConnection instanceof MozMobileConnection) {
|
||||
deferred.resolve(mobileConnection);
|
||||
} else {
|
||||
deferred.reject();
|
||||
}
|
||||
});
|
||||
|
||||
document.body.appendChild(ifr);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for one named MobileConnection event.
|
||||
*
|
||||
* Resolve if that named event occurs. Never reject.
|
||||
*
|
||||
* Fulfill params: the DOMEvent passed.
|
||||
*
|
||||
* @param aEventName
|
||||
* A string event name.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function waitForManagerEvent(aEventName) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
mobileConnection.addEventListener(aEventName, function onevent(aEvent) {
|
||||
mobileConnection.removeEventListener(aEventName, onevent);
|
||||
|
||||
ok(true, "MobileConnection event '" + aEventName + "' got.");
|
||||
deferred.resolve(aEvent);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data connection enabling state and wait for "datachange" event.
|
||||
*
|
||||
* Resolve if data connection state changed to the expected one. Never reject.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aEnabled
|
||||
* A boolean state.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setDataEnabledAndWait(aEnabled) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("datachange"));
|
||||
promises.push(setDataEnabled(aEnabled));
|
||||
Promise.all(promises).then(function keepWaiting() {
|
||||
// To ignore some transient states, we only resolve that deferred promise
|
||||
// when the |connected| state equals to the expected one and never rejects.
|
||||
let connected = mobileConnection.data.connected;
|
||||
if (connected == aEnabled) {
|
||||
deferred.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
return waitForManagerEvent("datachange").then(keepWaiting);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set voice/data roaming emulation and wait for state change.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aRoaming
|
||||
* A boolean state.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setEmulatorRoamingAndWait(aRoaming) {
|
||||
function doSetAndWait(aWhich, aRoaming) {
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent(aWhich + "change"));
|
||||
|
||||
let cmd = "gsm " + aWhich + " " + (aRoaming ? "roaming" : "home");
|
||||
promises.push(runEmulatorCmdSafe(cmd));
|
||||
return Promise.all(promises)
|
||||
.then(() => is(mobileConnection[aWhich].roaming, aRoaming,
|
||||
aWhich + ".roaming"));
|
||||
}
|
||||
|
||||
// Set voice registration state first and then data registration state.
|
||||
return doSetAndWait("voice", aRoaming)
|
||||
.then(() => doSetAndWait("data", aRoaming));
|
||||
}
|
||||
|
||||
let _networkManager;
|
||||
|
||||
/**
|
||||
* Get internal NetworkManager service.
|
||||
*/
|
||||
function getNetworkManager() {
|
||||
if (!_networkManager) {
|
||||
_networkManager = Cc["@mozilla.org/network/manager;1"]
|
||||
.getService(Ci.nsINetworkManager);
|
||||
ok(_networkManager, "NetworkManager");
|
||||
}
|
||||
|
||||
return _networkManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
return _pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic test routine helper for mobile connection tests.
|
||||
*
|
||||
* This helper does nothing but clean-ups.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestBase(aTestCaseMain) {
|
||||
Promise.resolve()
|
||||
.then(aTestCaseMain)
|
||||
.then(cleanUp, function() {
|
||||
ok(false, 'promise rejects during test.');
|
||||
cleanUp();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Common test routine helper for mobile connection tests.
|
||||
*
|
||||
* This function ensures global |mobileConnection| variable is available during
|
||||
* the process and performs clean-ups as well.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes one parameter -- mobileConnection.
|
||||
* @param aAdditonalPermissions [optional]
|
||||
* An array of permission strings other than "mobileconnection" to be
|
||||
* pushed. Default: empty string.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: 0.
|
||||
*/
|
||||
function startTestCommon(aTestCaseMain, aAdditionalPermissions, aServiceId) {
|
||||
startTestBase(function() {
|
||||
return ensureMobileConnection(aAdditionalPermissions, aServiceId)
|
||||
.then(aTestCaseMain);
|
||||
});
|
||||
}
|
@ -23,3 +23,5 @@ disabled = Bug 808783
|
||||
[test_mobile_last_known_network.js]
|
||||
[test_mobile_icc_change.js]
|
||||
[test_mobile_connections_array_uninitialized.js]
|
||||
[test_mobile_data_ipv6.js]
|
||||
disabled = Bug 978071
|
||||
|
112
dom/mobileconnection/tests/marionette/test_mobile_data_ipv6.js
Normal file
112
dom/mobileconnection/tests/marionette/test_mobile_data_ipv6.js
Normal file
@ -0,0 +1,112 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
/**
|
||||
* Test resulting IP address format with given APN settings.
|
||||
*
|
||||
* This test utility function performs following steps:
|
||||
*
|
||||
* 1) set "ril.data.apnSettings" to a given settings object,
|
||||
* 2) enable data connection and wait for a "datachange" event,
|
||||
* 3) check the IP address type of the active network interface,
|
||||
* 4) disable data connection.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aApnSettings
|
||||
* An APN settings value.
|
||||
* @param aIsIPv6
|
||||
* A boolean value indicating whether we're expecting an IPv6 address.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function doTest(aApnSettings, aIsIPv6) {
|
||||
return setDataApnSettings([])
|
||||
.then(() => setDataApnSettings(aApnSettings))
|
||||
.then(() => setDataEnabledAndWait(true))
|
||||
.then(function() {
|
||||
let nm = getNetworkManager();
|
||||
let active = nm.active;
|
||||
ok(active, "Active network interface");
|
||||
|
||||
log(" Interface: " + active.name);
|
||||
log(" Address: " + active.ip);
|
||||
if (aIsIPv6) {
|
||||
ok(active.ip.indexOf(":") > 0, "IPv6 address");
|
||||
} else {
|
||||
ok(active.ip.indexOf(":") < 0, "IPv4 address");
|
||||
}
|
||||
})
|
||||
.then(() => setDataEnabledAndWait(false));
|
||||
}
|
||||
|
||||
function doTestHome(aApnSettings, aProtocol) {
|
||||
log("Testing \"" + aProtocol + "\"@HOME... ");
|
||||
|
||||
// aApnSettings is a double-array of per PDP context settings. The first
|
||||
// index is a DSDS service ID, and the second one is the index of pre-defined
|
||||
// PDP context settings of a specified radio interface. We use 0 for both as
|
||||
// default here.
|
||||
aApnSettings[0][0].protocol = aProtocol;
|
||||
delete aApnSettings[0][0].roaming_protocol;
|
||||
|
||||
return doTest(aApnSettings, aProtocol === "IPV6");
|
||||
}
|
||||
|
||||
function doTestRoaming(aApnSettings, aRoaminProtocol) {
|
||||
log("Testing \"" + aRoaminProtocol + "\"@ROMAING... ");
|
||||
|
||||
// aApnSettings is a double-array of per PDP context settings. The first
|
||||
// index is a DSDS service ID, and the second one is the index of pre-defined
|
||||
// PDP context settings of a specified radio interface. We use 0 for both as
|
||||
// default here.
|
||||
delete aApnSettings[0][0].protocol;
|
||||
aApnSettings[0][0].roaming_protocol = aRoaminProtocol;
|
||||
|
||||
return doTest(aApnSettings, aRoaminProtocol === "IPV6");
|
||||
}
|
||||
|
||||
startTestCommon(function() {
|
||||
let origApnSettings;
|
||||
|
||||
return setDataRoamingEnabled(true)
|
||||
.then(getDataApnSettings)
|
||||
.then(function(aResult) {
|
||||
// If already set, then save original APN settings.
|
||||
origApnSettings = JSON.parse(JSON.stringify(aResult));
|
||||
return aResult;
|
||||
}, function() {
|
||||
// Return our own default value.
|
||||
return [[{ "carrier": "T-Mobile US",
|
||||
"apn": "epc.tmobile.com",
|
||||
"mmsc": "http://mms.msg.eng.t-mobile.com/mms/wapenc",
|
||||
"types": ["default", "supl", "mms"] }]];
|
||||
})
|
||||
|
||||
.then(function(aApnSettings) {
|
||||
return Promise.resolve()
|
||||
|
||||
.then(() => doTestHome(aApnSettings, "NoSuchProtocol"))
|
||||
.then(() => doTestHome(aApnSettings, "IP"))
|
||||
.then(() => doTestHome(aApnSettings, "IPV6"))
|
||||
|
||||
.then(() => setEmulatorRoamingAndWait(true))
|
||||
|
||||
.then(() => doTestRoaming(aApnSettings, "NoSuchProtocol"))
|
||||
.then(() => doTestRoaming(aApnSettings, "IP"))
|
||||
.then(() => doTestRoaming(aApnSettings, "IPV6"))
|
||||
|
||||
.then(() => setEmulatorRoamingAndWait(false));
|
||||
})
|
||||
|
||||
.then(() => setDataRoamingEnabled(false))
|
||||
.then(function() {
|
||||
if (origApnSettings) {
|
||||
return setDataApnSettings(origApnSettings);
|
||||
}
|
||||
});
|
||||
}, ["settings-read", "settings-write"]);
|
@ -5,7 +5,8 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
|
||||
|
||||
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
|
||||
|
||||
/* Push required permissions and test if |navigator.mozMobileMessage| exists.
|
||||
/**
|
||||
* Push required permissions and test if |navigator.mozMobileMessage| exists.
|
||||
* Resolve if it does, reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
@ -44,7 +45,8 @@ function ensureMobileMessage() {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Send a SMS message to a single receiver. Resolve if it succeeds, reject
|
||||
/**
|
||||
* Send a SMS message to a single receiver. Resolve if it succeeds, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
@ -72,7 +74,8 @@ function sendSmsWithSuccess(aReceiver, aText) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Send a MMS message with specified parameters. Resolve if it fails, reject
|
||||
/**
|
||||
* Send a MMS message with specified parameters. Resolve if it fails, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
@ -100,7 +103,8 @@ function sendMmsWithFailure(aMmsParameters) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Retrieve messages from database.
|
||||
/**
|
||||
* Retrieve messages from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* messages -- an array of {Sms,Mms}Message instances.
|
||||
@ -136,7 +140,8 @@ function getMessages(aFilter, aReverse) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Retrieve all messages from database.
|
||||
/**
|
||||
* Retrieve all messages from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* messages -- an array of {Sms,Mms}Message instances.
|
||||
@ -150,7 +155,8 @@ function getAllMessages() {
|
||||
return getMessages(null, false);
|
||||
}
|
||||
|
||||
/* Retrieve all threads from database.
|
||||
/**
|
||||
* Retrieve all threads from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* threads -- an array of MozMobileMessageThread instances.
|
||||
@ -179,7 +185,8 @@ function getAllThreads() {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Retrieve a single specified thread from database.
|
||||
/**
|
||||
* Retrieve a single specified thread from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* thread -- a MozMobileMessageThread instance.
|
||||
@ -204,7 +211,8 @@ function getThreadById(aThreadId) {
|
||||
});
|
||||
}
|
||||
|
||||
/* Delete messages specified from database.
|
||||
/**
|
||||
* Delete messages specified from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of boolean values indicating whether delesion was
|
||||
@ -234,7 +242,8 @@ function deleteMessagesById(aMessageIds) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Delete messages specified from database.
|
||||
/**
|
||||
* Delete messages specified from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of boolean values indicating whether delesion was
|
||||
@ -252,7 +261,8 @@ function deleteMessages(aMessages) {
|
||||
return deleteMessagesById(ids);
|
||||
}
|
||||
|
||||
/* Delete all messages from database.
|
||||
/**
|
||||
* Delete all messages from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* ids -- an array of numeric values identifying those deleted
|
||||
@ -269,7 +279,8 @@ function deleteAllMessages() {
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
|
||||
/* Send emulator command with safe guard.
|
||||
/**
|
||||
* Send emulator command with safe guard.
|
||||
*
|
||||
* We should only call |finish()| after all emulator command transactions
|
||||
* end, so here comes with the pending counter. Resolve when the emulator
|
||||
@ -301,7 +312,8 @@ function runEmulatorCmdSafe(aCommand) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Send simple text SMS to emulator.
|
||||
/**
|
||||
* Send simple text SMS to emulator.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
@ -316,7 +328,8 @@ function sendTextSmsToEmulator(aFrom, aText) {
|
||||
return runEmulatorCmdSafe(command);
|
||||
}
|
||||
|
||||
/* Send raw SMS TPDU to emulator.
|
||||
/**
|
||||
* Send raw SMS TPDU to emulator.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
@ -331,7 +344,8 @@ function sendRawSmsToEmulator(aPdu) {
|
||||
return runEmulatorCmdSafe(command);
|
||||
}
|
||||
|
||||
/* Name space for MobileMessageDB.jsm. Only initialized after first call to
|
||||
/**
|
||||
* Name space for MobileMessageDB.jsm. Only initialized after first call to
|
||||
* newMobileMessageDB.
|
||||
*/
|
||||
let MMDB;
|
||||
@ -348,7 +362,8 @@ function newMobileMessageDB() {
|
||||
return mmdb;
|
||||
}
|
||||
|
||||
/* Initialize a MobileMessageDB. Resolve if initialized with success, reject
|
||||
/**
|
||||
* Initialize a MobileMessageDB. Resolve if initialized with success, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params: a MobileMessageDB instance.
|
||||
@ -378,7 +393,8 @@ function initMobileMessageDB(aMmdb, aDbName, aDbVersion) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/* Close a MobileMessageDB.
|
||||
/**
|
||||
* Close a MobileMessageDB.
|
||||
*
|
||||
* @return The passed MobileMessageDB instance.
|
||||
*/
|
||||
@ -387,7 +403,8 @@ function closeMobileMessageDB(aMmdb) {
|
||||
return aMmdb;
|
||||
}
|
||||
|
||||
/* Create a new array of id attribute of input messages.
|
||||
/**
|
||||
* Create a new array of id attribute of input messages.
|
||||
*
|
||||
* @param aMessages an array of {Sms,Mms}Message instances.
|
||||
*
|
||||
@ -404,7 +421,8 @@ function messagesToIds(aMessages) {
|
||||
// A reference to a nsIUUIDGenerator service.
|
||||
let uuidGenerator;
|
||||
|
||||
/* Generate a new UUID.
|
||||
/**
|
||||
* Generate a new UUID.
|
||||
*
|
||||
* @return A UUID string.
|
||||
*/
|
||||
@ -418,7 +436,8 @@ function newUUID() {
|
||||
return uuidGenerator.generateUUID().toString();
|
||||
}
|
||||
|
||||
/* Flush permission settings and call |finish()|.
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
@ -433,6 +452,14 @@ function cleanUp() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic test routine helper for mobile message tests.
|
||||
*
|
||||
* This helper does nothing but clean-ups.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestBase(aTestCaseMain) {
|
||||
Promise.resolve()
|
||||
.then(aTestCaseMain)
|
||||
@ -442,6 +469,15 @@ function startTestBase(aTestCaseMain) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Common test routine helper for mobile message tests.
|
||||
*
|
||||
* This function ensures global |manager| variable is available during the
|
||||
* process and performs clean-ups as well.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestCommon(aTestCaseMain) {
|
||||
startTestBase(function() {
|
||||
return ensureMobileMessage()
|
||||
|
@ -4518,12 +4518,22 @@ RILNetworkInterface.prototype = {
|
||||
}
|
||||
authType = RIL.RIL_DATACALL_AUTH_TO_GECKO.indexOf(RIL.GECKO_DATACALL_AUTH_DEFAULT);
|
||||
}
|
||||
let pdptype = !radioInterface.rilContext.data.roaming
|
||||
? this.apnSetting.protocol
|
||||
: this.apnSetting.roaming_protocol;
|
||||
if (RIL.RIL_DATACALL_PDP_TYPES.indexOf(pdptype) < 0) {
|
||||
if (DEBUG) {
|
||||
this.debug("Invalid pdptype '" + pdptype + "', using '" +
|
||||
RIL.GECKO_DATACALL_PDP_TYPE_DEFAULT + "'");
|
||||
}
|
||||
pdptype = RIL.GECKO_DATACALL_PDP_TYPE_DEFAULT;
|
||||
}
|
||||
radioInterface.setupDataCall(radioTechnology,
|
||||
this.apnSetting.apn,
|
||||
this.apnSetting.user,
|
||||
this.apnSetting.password,
|
||||
authType,
|
||||
"IP");
|
||||
pdptype);
|
||||
this.connecting = true;
|
||||
},
|
||||
|
||||
|
@ -2361,6 +2361,15 @@ this.RIL_DATACALL_AUTH_TO_GECKO = [
|
||||
GECKO_DATACALL_AUTH_PAP_OR_CHAP // DATACALL_AUTH_PAP_OR_CHAP
|
||||
];
|
||||
|
||||
this.GECKO_DATACALL_PDP_TYPE_IP = "IP";
|
||||
this.GECKO_DATACALL_PDP_TYPE_IPV6 = "IPV6";
|
||||
this.GECKO_DATACALL_PDP_TYPE_DEFAULT = GECKO_DATACALL_PDP_TYPE_IP;
|
||||
this.RIL_DATACALL_PDP_TYPES = [
|
||||
GECKO_DATACALL_PDP_TYPE_IP,
|
||||
GECKO_DATACALL_PDP_TYPE_IPV6,
|
||||
// TODO: Bug 978711 - Support IPV4V6
|
||||
];
|
||||
|
||||
this.DATACALL_PROFILE_DEFAULT = 0;
|
||||
this.DATACALL_PROFILE_TETHERED = 1;
|
||||
this.DATACALL_PROFILE_OEM_BASE = 1000;
|
||||
|
@ -3962,8 +3962,9 @@ RilObject.prototype = {
|
||||
}
|
||||
currentDataCall.gw = updatedDataCall.gw;
|
||||
if (updatedDataCall.dns) {
|
||||
currentDataCall.dns[0] = updatedDataCall.dns[0];
|
||||
currentDataCall.dns[1] = updatedDataCall.dns[1];
|
||||
currentDataCall.dns = updatedDataCall.dns.slice();
|
||||
} else {
|
||||
currentDataCall.dns = [];
|
||||
}
|
||||
currentDataCall.rilMessageType = "datacallstatechange";
|
||||
this.sendChromeMessage(currentDataCall);
|
||||
|
@ -179,6 +179,7 @@ LayerManagerComposite::BeginTransactionWithDrawTarget(DrawTarget* aTarget)
|
||||
|
||||
mIsCompositorReady = true;
|
||||
mCompositor->SetTargetContext(aTarget);
|
||||
mTarget = aTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -243,6 +244,7 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
|
||||
}
|
||||
|
||||
mCompositor->SetTargetContext(nullptr);
|
||||
mTarget = nullptr;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
Log();
|
||||
@ -444,7 +446,7 @@ LayerManagerComposite::Render()
|
||||
/** Our more efficient but less powerful alter ego, if one is available. */
|
||||
nsRefPtr<Composer2D> composer2D = mCompositor->GetWidget()->GetComposer2D();
|
||||
|
||||
if (composer2D && composer2D->TryRender(mRoot, mWorldMatrix)) {
|
||||
if (!mTarget && composer2D && composer2D->TryRender(mRoot, mWorldMatrix)) {
|
||||
if (mFPS) {
|
||||
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
||||
if (gfxPrefs::LayersDrawFPS()) {
|
||||
|
@ -261,6 +261,11 @@ private:
|
||||
RefPtr<Compositor> mCompositor;
|
||||
nsAutoPtr<LayerProperties> mClonedLayerTreeProperties;
|
||||
|
||||
/**
|
||||
* Context target, nullptr when drawing directly to our swap chain.
|
||||
*/
|
||||
RefPtr<gfx::DrawTarget> mTarget;
|
||||
|
||||
gfx::Matrix mWorldMatrix;
|
||||
nsIntRegion mInvalidRegion;
|
||||
nsAutoPtr<FPSState> mFPS;
|
||||
|
@ -578,19 +578,19 @@ CompositorParent::ScheduleComposition()
|
||||
TimeDuration minFrameDelta = TimeDuration::FromMilliseconds(
|
||||
rate == 0 ? 0.0 : std::max(0.0, 1000.0 / rate));
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
mExpectedComposeTime = TimeStamp::Now() + minFrameDelta;
|
||||
#endif
|
||||
|
||||
mCurrentCompositeTask = NewRunnableMethod(this, &CompositorParent::Composite);
|
||||
|
||||
if (!initialComposition && delta < minFrameDelta) {
|
||||
TimeDuration delay = minFrameDelta - delta;
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
mExpectedComposeTime = TimeStamp::Now() + delay;
|
||||
mExpectedComposeStartTime = TimeStamp::Now() + delay;
|
||||
#endif
|
||||
ScheduleTask(mCurrentCompositeTask, delay.ToMilliseconds());
|
||||
} else {
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
mExpectedComposeStartTime = TimeStamp::Now();
|
||||
#endif
|
||||
ScheduleTask(mCurrentCompositeTask, 0);
|
||||
}
|
||||
}
|
||||
@ -608,6 +608,16 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget)
|
||||
PROFILER_LABEL("CompositorParent", "Composite");
|
||||
NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(),
|
||||
"Composite can only be called on the compositor thread");
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
TimeDuration scheduleDelta = TimeStamp::Now() - mExpectedComposeStartTime;
|
||||
if (scheduleDelta > TimeDuration::FromMilliseconds(2) ||
|
||||
scheduleDelta < TimeDuration::FromMilliseconds(-2)) {
|
||||
printf_stderr("Compositor: Compose starting off schedule by %4.1f ms\n",
|
||||
scheduleDelta.ToMilliseconds());
|
||||
}
|
||||
#endif
|
||||
|
||||
mCurrentCompositeTask = nullptr;
|
||||
|
||||
mLastCompose = TimeStamp::Now();
|
||||
@ -658,9 +668,15 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget)
|
||||
}
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
if (mExpectedComposeTime + TimeDuration::FromMilliseconds(15) < TimeStamp::Now()) {
|
||||
printf_stderr("Compositor: Composite took %i ms.\n",
|
||||
15 + (int)(TimeStamp::Now() - mExpectedComposeTime).ToMilliseconds());
|
||||
TimeDuration executionTime = TimeStamp::Now() - mLastCompose;
|
||||
TimeDuration frameBudget = TimeDuration::FromMilliseconds(15);
|
||||
int32_t frameRate = CalculateCompositionFrameRate();
|
||||
if (frameRate > 0) {
|
||||
frameBudget = TimeDuration::FromSeconds(1.0 / frameRate);
|
||||
}
|
||||
if (executionTime > frameBudget) {
|
||||
printf_stderr("Compositor: Composite execution took %4.1f ms\n",
|
||||
executionTime.ToMilliseconds());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -306,7 +306,7 @@ private:
|
||||
TimeStamp mTestTime;
|
||||
bool mIsTesting;
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
TimeStamp mExpectedComposeTime;
|
||||
TimeStamp mExpectedComposeStartTime;
|
||||
#endif
|
||||
|
||||
bool mPaused;
|
||||
|
@ -25,3 +25,4 @@ skip = false
|
||||
[include:../../../../../dom/icc/tests/marionette/manifest.ini]
|
||||
[include:../../../../../dom/system/tests/marionette/manifest.ini]
|
||||
[include:../../../../../dom/nfc/tests/marionette/manifest.ini]
|
||||
[include:../../../../../dom/events/test/marionette/manifest.ini]
|
||||
|
Loading…
Reference in New Issue
Block a user