Commit c2c919db authored by Michael van Ouwerkerk's avatar Michael van Ouwerkerk Committed by Commit Bot

Tweak URL format and remove period in DisclosureNotification text.

Screenshot before: https://screenshot.googleplex.com/BARaxjkyDLmdPR5.png
Screenshot after: https://screenshot.googleplex.com/92GvmjRmJsErz2q.png

Bug: 1091563
Change-Id: Icfaccb7888cafe18a22c8897737bef458e20f3d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412341
Commit-Queue: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807842}
parent e266f4c1
...@@ -34,6 +34,7 @@ import org.chromium.components.browser_ui.notifications.NotificationManagerProxy ...@@ -34,6 +34,7 @@ import org.chromium.components.browser_ui.notifications.NotificationManagerProxy
import org.chromium.components.browser_ui.notifications.NotificationMetadata; import org.chromium.components.browser_ui.notifications.NotificationMetadata;
import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.NotificationWrapper;
import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.browser_ui.notifications.PendingIntentProvider;
import org.chromium.components.url_formatter.UrlFormatter;
import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyKey;
import org.chromium.ui.modelutil.PropertyObservable; import org.chromium.ui.modelutil.PropertyObservable;
...@@ -106,7 +107,9 @@ public class DisclosureNotification ...@@ -106,7 +107,9 @@ public class DisclosureNotification
NotificationMetadata metadata = new NotificationMetadata(umaType, scope, notificationId); NotificationMetadata metadata = new NotificationMetadata(umaType, scope, notificationId);
String title = mResources.getString(R.string.twa_running_in_chrome); String title = mResources.getString(R.string.twa_running_in_chrome);
String text = mResources.getString(R.string.twa_running_in_chrome_v2, scope); String scopeForDisplay =
UrlFormatter.formatUrlForDisplayOmitSchemeOmitTrivialSubdomains(scope);
String text = mResources.getString(R.string.twa_running_in_chrome_v2, scopeForDisplay);
// We're using setStyle, which can't be handled by compat mode. // We're using setStyle, which can't be handled by compat mode.
boolean preferCompat = false; boolean preferCompat = false;
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
package org.chromium.chrome.browser.browserservices.ui.view.trustedwebactivity; package org.chromium.chrome.browser.browserservices.ui.view.trustedwebactivity;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel.DISCLOSURE_EVENTS_CALLBACK; import static org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel.DISCLOSURE_EVENTS_CALLBACK;
import static org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel.DISCLOSURE_FIRST_TIME; import static org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel.DISCLOSURE_FIRST_TIME;
...@@ -21,6 +23,7 @@ import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDe ...@@ -21,6 +23,7 @@ import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDe
import android.content.Context; import android.content.Context;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
...@@ -30,10 +33,13 @@ import org.robolectric.RuntimeEnvironment; ...@@ -30,10 +33,13 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config; import org.robolectric.annotation.Config;
import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.BaseRobolectricTestRunner;
import org.chromium.base.test.util.JniMocker;
import org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel; import org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel;
import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy;
import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.NotificationWrapper;
import org.chromium.components.url_formatter.UrlFormatter;
import org.chromium.components.url_formatter.UrlFormatterJni;
/** /**
* Tests for {@link DisclosureNotification}. * Tests for {@link DisclosureNotification}.
...@@ -44,6 +50,10 @@ public class DisclosureNotificationTest { ...@@ -44,6 +50,10 @@ public class DisclosureNotificationTest {
private static final String SCOPE = "https://www.example.com"; private static final String SCOPE = "https://www.example.com";
private static final String PACKAGE = "com.example.twa"; private static final String PACKAGE = "com.example.twa";
@Rule
public JniMocker mJniMocker = new JniMocker();
@Mock
private UrlFormatter.Natives mUrlFormatterJniMock;
@Mock @Mock
public ActivityLifecycleDispatcher mLifecycleDispatcher; public ActivityLifecycleDispatcher mLifecycleDispatcher;
@Mock @Mock
...@@ -66,6 +76,10 @@ public class DisclosureNotificationTest { ...@@ -66,6 +76,10 @@ public class DisclosureNotificationTest {
Context context = RuntimeEnvironment.application; Context context = RuntimeEnvironment.application;
mNotification = new DisclosureNotification(context, context.getResources(), mNotification = new DisclosureNotification(context, context.getResources(),
mNotificationManager, mModel, mLifecycleDispatcher); mNotificationManager, mModel, mLifecycleDispatcher);
mJniMocker.mock(UrlFormatterJni.TEST_HOOKS, mUrlFormatterJniMock);
when(mUrlFormatterJniMock.formatUrlForDisplayOmitSchemeOmitTrivialSubdomains(anyString()))
.then(inv -> "formatted " + inv.getArgument(0));
} }
@Test @Test
......
...@@ -3273,7 +3273,7 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p ...@@ -3273,7 +3273,7 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
Running in Chrome Running in Chrome
</message> </message>
<message name="IDS_TWA_RUNNING_IN_CHROME_V2" desc="Updated message on a snackbar indicating that the current Activity may use Chrome data (the rest of the app may not be)."> <message name="IDS_TWA_RUNNING_IN_CHROME_V2" desc="Updated message on a snackbar indicating that the current Activity may use Chrome data (the rest of the app may not be).">
You'll see your <ph name="SITE_NAME">%1$s<ex>www.youtube.com</ex></ph> sign-in status, browsing data, and site data in Chrome. You'll see your <ph name="SITE_NAME">%1$s<ex>www.youtube.com</ex></ph> sign-in status, browsing data, and site data in Chrome
</message> </message>
<message name="IDS_GOT_IT" desc="Button for the user to accept a disclosure/message"> <message name="IDS_GOT_IT" desc="Button for the user to accept a disclosure/message">
Got it Got it
......
7934e5b7a2b7441d96b73ae5b96c13a6a93bd7f1 f86b29fff42b05757e275b55cd89cd814066b1ae
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment