Merge "skip the country code test when the country code is not support" into main
This commit is contained in:
commit
749898bb1e
3 changed files with 13 additions and 0 deletions
|
|
@ -40,6 +40,8 @@ import static com.google.common.io.BaseEncoding.base16;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assertWithMessage;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
@ -213,6 +215,8 @@ public class ThreadIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void otDaemonRestart_latestCountryCodeIsSetToOtDaemon() throws Exception {
|
||||
assumeTrue(mOtCtl.isCountryCodeSupported());
|
||||
|
||||
runThreadCommand("force-country-code enabled CN");
|
||||
|
||||
runShellCommand("stop ot-daemon");
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.thread.utils.FullThreadDevice;
|
||||
|
|
@ -139,6 +140,8 @@ public class ThreadNetworkShellCommandTest {
|
|||
|
||||
@Test
|
||||
public void forceCountryCode_setCN_getCountryCodeReturnsCN() {
|
||||
assumeTrue(mOtCtl.isCountryCodeSupported());
|
||||
|
||||
runThreadCommand("force-country-code enabled CN");
|
||||
|
||||
final String result = runThreadCommand("get-country-code");
|
||||
|
|
|
|||
|
|
@ -156,6 +156,12 @@ public final class OtDaemonController {
|
|||
return executeCommandAndParse("extpanid").get(0);
|
||||
}
|
||||
|
||||
public boolean isCountryCodeSupported() {
|
||||
final String result = executeCommand("region");
|
||||
|
||||
return !result.equals("Error 12: NotImplemented\r\n");
|
||||
}
|
||||
|
||||
public String executeCommand(String cmd) {
|
||||
return SystemUtil.runShellCommand(OT_CTL + " " + cmd);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue