Skip to content

Commit

Permalink
PageInfo: Enable PageInfoV2 by default
Browse files Browse the repository at this point in the history
Enable the redesigned PageInfo ui for Chrome and Weblayer.

Bug: 1077766
Change-Id: I9fe77f48cc3d8750451e0f2a70fd8be19b86efaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2719884
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Mugdha Lakhani <nator@chromium.org>
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#858524}
  • Loading branch information
xchrdw authored and Chromium LUCI CQ committed Mar 1, 2021
1 parent 3122af8 commit e10195b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 18 deletions.
7 changes: 6 additions & 1 deletion chrome/browser/ui/page_info/page_info_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/infobars/core/infobar.h"
#include "components/page_info/features.h"
#include "components/page_info/page_info_ui.h"
#include "components/safe_browsing/buildflags.h"
#include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h"
Expand Down Expand Up @@ -645,6 +646,10 @@ TEST_F(PageInfoTest, HTTPSConnection) {
#endif

TEST_F(PageInfoTest, InsecureContent) {
#if defined(OS_ANDROID)
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(page_info::kPageInfoV2);
#endif
struct TestCase {
security_state::SecurityLevel security_level;
net::CertStatus cert_status;
Expand Down Expand Up @@ -938,7 +943,7 @@ TEST_F(PageInfoTest, HTTPSSHA1) {
EXPECT_EQ(PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM,
page_info()->site_identity_status());
#if defined(OS_ANDROID)
EXPECT_EQ(IDR_PAGEINFO_WARNING_MINOR,
EXPECT_EQ(IDR_PAGEINFO_BAD_V2,
PageInfoUI::GetIdentityIconID(page_info()->site_identity_status()));
#endif
}
Expand Down
3 changes: 1 addition & 2 deletions components/page_info/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ const base::Feature kPageInfoDiscoverability{"PageInfoDiscoverability",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kPageInfoHistory{"PageInfoHistory",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kPageInfoV2{"PageInfoV2",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kPageInfoV2{"PageInfoV2", base::FEATURE_ENABLED_BY_DEFAULT};
#endif

} // namespace page_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
package org.chromium.weblayer.test;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withText;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import androidx.test.espresso.ViewInteraction;
import androidx.test.filters.SmallTest;

import org.hamcrest.Matcher;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -30,10 +34,23 @@
*/
@RunWith(WebLayerJUnit4ClassRunner.class)
public class PageInfoTest {
private static final String CONNECTION_IS_NOT_SECURE_TEXT = "Connection is not secure";

@Rule
public InstrumentationActivityTestRule mActivityTestRule =
new InstrumentationActivityTestRule();

private ViewInteraction onViewWaiting(Matcher<View> matcher) {
CriteriaHelper.pollInstrumentationThread(() -> {
try {
onView(matcher).check(matches(isDisplayed()));
} catch (Error e) {
throw new CriteriaNotSatisfiedException(e.toString());
}
});
return onView(matcher);
}

@Test
@SmallTest
public void testPageInfoLaunches() {
Expand All @@ -51,14 +68,7 @@ public void testPageInfoLaunches() {
StrictModeContext ignored = StrictModeContext.allowDiskReads();
EventUtils.simulateTouchCenterOfView(activity.findViewById(buttonId));
});
CriteriaHelper.pollInstrumentationThread(() -> {
try {
onView(withText("Your connection to this site is not secure"))
.check(matches(isDisplayed()));
} catch (Error e) {
throw new CriteriaNotSatisfiedException(e.toString());
}
});
onViewWaiting(withText(CONNECTION_IS_NOT_SECURE_TEXT));
}

@Test
Expand All @@ -73,13 +83,38 @@ public void testSingleTappableContainer() {
StrictModeContext ignored = StrictModeContext.allowDiskReads();
EventUtils.simulateTouchCenterOfView(activity.getUrlBarView());
});
CriteriaHelper.pollInstrumentationThread(() -> {
try {
onView(withText("Your connection to this site is not secure"))
.check(matches(isDisplayed()));
} catch (Error e) {
throw new CriteriaNotSatisfiedException(e.toString());
}
onViewWaiting(withText(CONNECTION_IS_NOT_SECURE_TEXT));
}

@Test
@SmallTest
public void testPageInfoConnectionSubPage() {
Bundle extras = new Bundle();
extras.putBoolean(InstrumentationActivity.EXTRA_URLBAR_TEXT_CLICKABLE, true);
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl(
mActivityTestRule.getTestDataURL("simple_page.html"), extras);

TestThreadUtils.runOnUiThreadBlocking(() -> {
StrictModeContext ignored = StrictModeContext.allowDiskReads();
EventUtils.simulateTouchCenterOfView(activity.getUrlBarView());
});
onViewWaiting(withText(CONNECTION_IS_NOT_SECURE_TEXT)).perform(click());
onViewWaiting(withText("The identity of this website has not been verified."));
}

@Test
@SmallTest
public void testPageInfoCookiesSubPage() {
Bundle extras = new Bundle();
extras.putBoolean(InstrumentationActivity.EXTRA_URLBAR_TEXT_CLICKABLE, true);
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl(
mActivityTestRule.getTestDataURL("simple_page.html"), extras);

TestThreadUtils.runOnUiThreadBlocking(() -> {
StrictModeContext ignored = StrictModeContext.allowDiskReads();
EventUtils.simulateTouchCenterOfView(activity.getUrlBarView());
});
onViewWaiting(withText("Cookies")).perform(click());
onViewWaiting(withText("0 cookies in use"));
}
}
2 changes: 2 additions & 0 deletions weblayer/grit_strings_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ IDS_PAGE_INFO_MALWARE_DETAILS
IDS_PAGE_INFO_MALWARE_SUMMARY
IDS_PAGE_INFO_MIXED_CONTENT_DETAILS
IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY
IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY_SHORT
IDS_PAGE_INFO_NOT_SECURE_DETAILS
IDS_PAGE_INFO_NOT_SECURE_SUMMARY
IDS_PAGE_INFO_NOT_SECURE_SUMMARY_SHORT
IDS_PAGE_INFO_PERMISSION_ADS_SUBTITLE
IDS_PAGE_INFO_PERMISSION_ALLOWED_BY_EXTENSION
IDS_PAGE_INFO_PERMISSION_ALLOWED_BY_POLICY
Expand Down

0 comments on commit e10195b

Please sign in to comment.