Added PSL tests

pull/207/head
M66B 3 years ago
parent ef8d3638eb
commit a8c37e45b9

@ -113,6 +113,9 @@ public class ApplicationEx extends Application
" process=" + android.os.Process.myPid()); " process=" + android.os.Process.myPid());
Log.logMemory(this, "App"); Log.logMemory(this, "App");
if (BuildConfig.DEBUG)
UriHelper.test(this);
CoalMine.install(this); CoalMine.install(this);
registerActivityLifecycleCallbacks(lifecycleCallbacks); registerActivityLifecycleCallbacks(lifecycleCallbacks);

@ -366,4 +366,19 @@ public class UriHelper {
return (!uri.isOpaque() && return (!uri.isOpaque() &&
("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))); ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())));
} }
static void test(Context context) {
String[] hosts = new String[]{
"child.parent.example.com", "parent.example.com", "example.com", "com",
"child.parent.co.uk", "parent.co.uk", "co.uk", "uk",
"child.parent.aaa.ck", "parent.aaa.ck", "aaa.ck", "ck",
"child.parent.www.ck", "parent.www.ck", "www.ck", "ck"
};
for (String host : hosts)
Log.i("PSL " + host + ":" +
" tld=" + getTld(context, host) +
" root=" + getRootDomain(context, host) +
" parent=" + getParentDomain(context, host));
}
} }

Loading…
Cancel
Save