-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix broken PaseVerifier codepath and add test
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
.../CHIPTool/app/src/androidTest/java/com/google/chip/chiptool/CHIPDeviceControllerTest.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,42 @@ | ||
package com.google.chip.chiptool; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import androidx.test.platform.app.InstrumentationRegistry; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import chip.devicecontroller.ChipDeviceController; | ||
import chip.devicecontroller.PaseVerifierParams; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class CHIPDeviceControllerTest { | ||
@Test | ||
public void PaseVerifierTest() { | ||
long deviceId = 123L; | ||
long setupPincode = 808080L; | ||
long iterations = 1000L; | ||
byte[] randomSalt = "hEvzbU:%h)?aB,h7+9fn[Lf[BhYB!=TA".getBytes(); | ||
|
||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
ChipDeviceController chipDeviceController = | ||
ChipClient.INSTANCE.getDeviceController(appContext); | ||
|
||
PaseVerifierParams params = | ||
chipDeviceController.computePaseVerifier(deviceId, setupPincode, iterations, randomSalt); | ||
|
||
assertNotNull(params); | ||
assertEquals(params.getSetupPincode(), setupPincode); | ||
assertNotNull(params.getPakeVerifier()); | ||
} | ||
} |
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