-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #641 from WonderCsabo/travisAndroid
Use Travis Android support
- Loading branch information
Showing
10 changed files
with
137 additions
and
148 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
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
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
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
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
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
33 changes: 0 additions & 33 deletions
33
...orseflash-instrumentation/src/main/java/com/simpligility/android/morseflash/AllTests.java
This file was deleted.
Oops, something went wrong.
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
47 changes: 47 additions & 0 deletions
47
...mentation/src/main/java/com/simpligility/android/morseflash/ScreenUnlockerTestRunner.java
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,47 @@ | ||
package com.simpligility.android.morseflash; | ||
|
||
import android.app.KeyguardManager; | ||
import android.content.Context; | ||
import android.os.PowerManager; | ||
import android.support.test.runner.AndroidJUnitRunner; | ||
|
||
import static android.content.Context.KEYGUARD_SERVICE; | ||
import static android.content.Context.POWER_SERVICE; | ||
import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP; | ||
import static android.os.PowerManager.FULL_WAKE_LOCK; | ||
import static android.os.PowerManager.ON_AFTER_RELEASE; | ||
|
||
/** | ||
* Instrumentation which unlocks the screen before running any test. | ||
* This needs the following permissions in the <b>application</b> manifest: | ||
* | ||
* <pre> | ||
* <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> | ||
* <uses-permission android:name="android.permission.WAKE_LOCK"/> | ||
* </pre> | ||
* | ||
* Adapted from https://github.com/JakeWharton/u2020/blob/master/src/androidTestInternal/java/com/jakewharton/u2020/U2020TestRunner.java. | ||
*/ | ||
public final class ScreenUnlockerTestRunner extends AndroidJUnitRunner { | ||
|
||
@Override | ||
public void onStart() { | ||
runOnMainSync(new Runnable() { | ||
@SuppressWarnings("deprecation") | ||
// We don't care about deprecation here. | ||
public void run() { | ||
Context app = getTargetContext().getApplicationContext(); | ||
|
||
String name = ScreenUnlockerTestRunner.class.getSimpleName(); | ||
// Unlock the device so that the tests can input keystrokes. | ||
KeyguardManager keyguard = (KeyguardManager) app.getSystemService(KEYGUARD_SERVICE); | ||
keyguard.newKeyguardLock(name).disableKeyguard(); | ||
// Wake up the screen. | ||
PowerManager power = (PowerManager) app.getSystemService(POWER_SERVICE); | ||
power.newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, name).acquire(); | ||
} | ||
}); | ||
|
||
super.onStart(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.