Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove QualityEnforcer #422

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public class TwaLauncherTest {
private static final Uri URL = Uri.parse("https://www.test.com/default_url/");

private Context mContext = InstrumentationRegistry.getContext();
private static final CustomTabsCallback mCustomTabsCallback = new QualityEnforcer();

@Rule
public final EnableComponentsTestRule mEnableComponents = new EnableComponentsTestRule(
Expand Down Expand Up @@ -120,7 +119,7 @@ public void transfersTwaBuilderParams() {
int expected = color | 0xff000000;

TrustedWebActivityIntentBuilder builder = makeBuilder().setToolbarColor(color);
Runnable launchRunnable = () -> mTwaLauncher.launch(builder, mCustomTabsCallback,
Runnable launchRunnable = () -> mTwaLauncher.launch(builder, null,
null, null);
Intent intent = getBrowserActivityWhenLaunched(launchRunnable).getIntent();

Expand Down Expand Up @@ -158,7 +157,7 @@ public void customTabFallbackUsesStatusBarColor() {
int expected = color | 0xff000000;

TrustedWebActivityIntentBuilder builder = makeBuilder().setToolbarColor(color);
Runnable launchRunnable = () -> launcher.launch(builder, mCustomTabsCallback,
Runnable launchRunnable = () -> launcher.launch(builder, null,
null, null);
Intent intent = getBrowserActivityWhenLaunched(launchRunnable).getIntent();

Expand Down Expand Up @@ -206,7 +205,7 @@ public void createsDifferentSessions_IfDifferentIdsSpecified() {
@Test
public void completionCallbackCalled() {
Runnable callback = mock(Runnable.class);
Runnable launchRunnable = () -> mTwaLauncher.launch(makeBuilder(), mCustomTabsCallback,
Runnable launchRunnable = () -> mTwaLauncher.launch(makeBuilder(), null,
null, callback);
getBrowserActivityWhenLaunched(launchRunnable);
verify(callback).run();
Expand All @@ -218,7 +217,7 @@ public void completionCallbackCalled_WhenFallingBackToCct() {
TwaLauncher twaLauncher = new TwaLauncher(mActivity);

Runnable callback = mock(Runnable.class);
Runnable launchRunnable = () -> twaLauncher.launch(makeBuilder(), mCustomTabsCallback,
Runnable launchRunnable = () -> twaLauncher.launch(makeBuilder(), null,
null, callback);
getBrowserActivityWhenLaunched(launchRunnable);
verify(callback).run();
Expand All @@ -229,7 +228,7 @@ public void completionCallbackCalled_WhenFallingBackToCct() {
public void notifiesSplashScreenStrategyOfLaunchInitiation() {
SplashScreenStrategy strategy = mock(SplashScreenStrategy.class);
TrustedWebActivityIntentBuilder builder = makeBuilder();
mTwaLauncher.launch(builder, mCustomTabsCallback, strategy, null);
mTwaLauncher.launch(builder, null, strategy, null);
verify(strategy).onTwaLaunchInitiated(
eq(InstrumentationRegistry.getContext().getPackageName()),
eq(builder));
Expand All @@ -242,7 +241,7 @@ public void doesntLaunch_UntilSplashScreenStrategyFinishesConfiguring() {
// Using spy to verify intent is never built to avoid testing directly that activity is
// not launched.
TrustedWebActivityIntentBuilder builder = spy(makeBuilder());
mTwaLauncher.launch(builder, mCustomTabsCallback, strategy, null);
mTwaLauncher.launch(builder, null, strategy, null);
verify(builder, never()).build(any());
}

Expand All @@ -254,7 +253,7 @@ public void launches_WhenSplashScreenStrategyFinishesConfiguring() {
return null;
}).when(strategy).configureTwaBuilder(any(), any(), any());

Runnable launchRunnable = () -> mTwaLauncher.launch(makeBuilder(), mCustomTabsCallback,
Runnable launchRunnable = () -> mTwaLauncher.launch(makeBuilder(), null,
strategy, null);
assertNotNull(getBrowserActivityWhenLaunched(launchRunnable));
}
Expand All @@ -271,7 +270,7 @@ public void cancelsLaunch_IfSplashScreenStrategyFinishes_AfterDestroy() throws E
}).when(strategy).configureTwaBuilder(any(), any(), any());

TrustedWebActivityIntentBuilder builder = spy(makeBuilder());
mTwaLauncher.launch(builder, mCustomTabsCallback, strategy, null);
mTwaLauncher.launch(builder, null, strategy, null);
assertTrue(latch.await(3, TimeUnit.SECONDS));
verify(builder, never()).build(any());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected void launchTwa() {
}

protected CustomTabsCallback getCustomTabsCallback() {
return new QualityEnforcer();
return null;
}

protected TwaLauncher createTwaLauncher() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public TwaLauncher(Context context, @Nullable String providerPackage, int sessio
* @param url Url to open.
*/
public void launch(Uri url) {
launch(new TrustedWebActivityIntentBuilder(url), new QualityEnforcer(), null, null, null);
launch(new TrustedWebActivityIntentBuilder(url), null, null, null, null);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
import android.widget.Toast;

import com.google.androidbrowserhelper.demo.R;
import com.google.androidbrowserhelper.trusted.QualityEnforcer;
import com.google.androidbrowserhelper.trusted.TwaLauncher;
import com.google.androidbrowserhelper.trusted.TwaProviderPicker;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import androidx.browser.customtabs.CustomTabsCallback;
import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsServiceConnection;
import androidx.browser.customtabs.CustomTabsSession;
Expand All @@ -45,7 +43,6 @@ public class LaunchTwaActivity extends Activity {
private final TrustedWebActivityIntentBuilder builder = new TrustedWebActivityIntentBuilder(
LAUNCH_URI);

private CustomTabsCallback mCustomTabsCallback = new QualityEnforcer();
/**
* A bag to put all TwaLauncher in so we can dispose all at once.
*/
Expand Down Expand Up @@ -109,7 +106,7 @@ public void launchWithCustomColors(View view) {


TwaLauncher launcher = new TwaLauncher(this);
launcher.launch(builder, mCustomTabsCallback, null, null);
launcher.launch(builder, null, null, null);
launchers.add(launcher);
}

Expand All @@ -129,7 +126,7 @@ public void launcherWithMultipleOrigins(View view) {


TwaLauncher launcher = new TwaLauncher(this);
launcher.launch(builder, mCustomTabsCallback, null , null);
launcher.launch(builder, null, null , null);
launchers.add(launcher);
}

Expand Down
Loading