Commit b1c4584d authored by Kristi Park's avatar Kristi Park Committed by Commit Bot

[SelfShare] Rename IsContentRequirementsMet to AreContentRequirementsMet

For grammatical correctness

Change-Id: I2d5faa4acc6b1855c21c25cb23d9afacf243f8f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829295Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarRamya Nagarajan <ramyan@chromium.org>
Commit-Queue: Kristi Park <kristipark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701263}
parent efa8a336
......@@ -2039,7 +2039,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
case IDC_CONTENT_LINK_SEND_TAB_TO_SELF:
case IDC_CONTENT_LINK_SEND_TAB_TO_SELF_SINGLE_TARGET:
return send_tab_to_self::IsContentRequirementsMet(
return send_tab_to_self::AreContentRequirementsMet(
params_.link_url, GetBrowser()->profile());
case IDC_CHECK_SPELLING_WHILE_TYPING:
......
......@@ -44,7 +44,7 @@ bool HasValidTargetDevice(Profile* profile) {
service->GetSendTabToSelfModel()->HasValidTargetDevice();
}
bool IsContentRequirementsMet(const GURL& url, Profile* profile) {
bool AreContentRequirementsMet(const GURL& url, Profile* profile) {
bool is_http_or_https = url.SchemeIsHTTPOrHTTPS();
bool is_native_page = url.SchemeIs(content::kChromeUIScheme);
bool is_incognito_mode = profile->IsIncognitoProfile();
......@@ -59,7 +59,7 @@ bool ShouldOfferFeature(content::WebContents* web_contents) {
// If sending is enabled, then so is receiving.
return IsSendingEnabled() && IsUserSyncTypeActive(profile) &&
HasValidTargetDevice(profile) &&
IsContentRequirementsMet(web_contents->GetURL(), profile);
AreContentRequirementsMet(web_contents->GetURL(), profile);
}
bool ShouldOfferFeatureForLink(content::WebContents* web_contents,
......@@ -73,8 +73,8 @@ bool ShouldOfferFeatureForLink(content::WebContents* web_contents,
// Send tab to self should not be offered for tel links, click to call
// feature will be handling tel links.
!link_url.SchemeIs(url::kTelScheme) &&
(IsContentRequirementsMet(web_contents->GetURL(), profile) ||
IsContentRequirementsMet(link_url, profile));
(AreContentRequirementsMet(web_contents->GetURL(), profile) ||
AreContentRequirementsMet(link_url, profile));
}
bool ShouldOfferOmniboxIcon(content::WebContents* web_contents) {
......
......@@ -28,7 +28,7 @@ bool HasValidTargetDevice(Profile* profile);
// User is viewing an HTTP or HTTPS page.
// User is not on a native page.
// User is not in Incongnito mode.
bool IsContentRequirementsMet(const GURL& gurl, Profile* profile);
bool AreContentRequirementsMet(const GURL& gurl, Profile* profile);
// Returns true if the feature should be offered in menus.
bool ShouldOfferFeature(content::WebContents* web_contents);
......
......@@ -96,21 +96,21 @@ TEST_F(SendTabToSelfUtilTest, HasValidTargetDevice) {
}
TEST_F(SendTabToSelfUtilTest, ContentRequirementsMet) {
EXPECT_TRUE(IsContentRequirementsMet(url_, profile()));
EXPECT_TRUE(AreContentRequirementsMet(url_, profile()));
}
TEST_F(SendTabToSelfUtilTest, NotHTTPOrHTTPS) {
url_ = GURL("192.168.0.0");
EXPECT_FALSE(IsContentRequirementsMet(url_, profile()));
EXPECT_FALSE(AreContentRequirementsMet(url_, profile()));
}
TEST_F(SendTabToSelfUtilTest, NativePage) {
url_ = GURL("chrome://flags");
EXPECT_FALSE(IsContentRequirementsMet(url_, profile()));
EXPECT_FALSE(AreContentRequirementsMet(url_, profile()));
}
TEST_F(SendTabToSelfUtilTest, IncognitoMode) {
EXPECT_FALSE(IsContentRequirementsMet(url_, incognito_profile_));
EXPECT_FALSE(AreContentRequirementsMet(url_, incognito_profile_));
}
TEST_F(SendTabToSelfUtilTest, ShouldNotOfferFeatureForTelephoneLink) {
......
......@@ -32,7 +32,7 @@ bool HasValidTargetDevice(ios::ChromeBrowserState* browser_state);
// User is viewing an HTTP or HTTPS page.
// User is not on a native page.
// User is not in Incongnito mode.
bool IsContentRequirementsMet(const GURL& gurl,
bool AreContentRequirementsMet(const GURL& gurl,
ios::ChromeBrowserState* browser_state);
// Returns true if all conditions are true and shows the option onto the menu.
......
......@@ -55,7 +55,7 @@ bool HasValidTargetDevice(ios::ChromeBrowserState* browser_state) {
service->GetSendTabToSelfModel()->HasValidTargetDevice();
}
bool IsContentRequirementsMet(const GURL& url,
bool AreContentRequirementsMet(const GURL& url,
ios::ChromeBrowserState* browser_state) {
bool is_http_or_https = url.SchemeIsHTTPOrHTTPS();
bool is_native_page = url.SchemeIs(kChromeUIScheme);
......@@ -68,7 +68,7 @@ bool ShouldOfferFeature(ios::ChromeBrowserState* browser_state,
// If sending is enabled, then so is receiving.
return IsSendingEnabled() && IsUserSyncTypeActive(browser_state) &&
HasValidTargetDevice(browser_state) &&
IsContentRequirementsMet(url, browser_state);
AreContentRequirementsMet(url, browser_state);
}
void CreateNewEntry(ios::ChromeBrowserState* browser_state,
......
......@@ -96,22 +96,23 @@ TEST_F(SendTabToSelfUtilTest, AreFlagsDisabled) {
TEST_F(SendTabToSelfUtilTest, NotHTTPOrHTTPS) {
GURL url = GURL("192.168.0.0");
EXPECT_FALSE(IsContentRequirementsMet(url, browser_state()));
EXPECT_FALSE(AreContentRequirementsMet(url, browser_state()));
}
TEST_F(SendTabToSelfUtilTest, WebUIPage) {
GURL url = GURL("chrome://flags");
EXPECT_FALSE(IsContentRequirementsMet(url, browser_state()));
EXPECT_FALSE(AreContentRequirementsMet(url, browser_state()));
}
TEST_F(SendTabToSelfUtilTest, IncognitoMode) {
GURL url = GURL("https://www.google.com");
EXPECT_FALSE(IsContentRequirementsMet(url, OffTheRecordChromeBrowserState()));
EXPECT_FALSE(
AreContentRequirementsMet(url, OffTheRecordChromeBrowserState()));
}
TEST_F(SendTabToSelfUtilTest, ValidUrl) {
GURL url = GURL("https://www.google.com");
EXPECT_TRUE(IsContentRequirementsMet(url, browser_state()));
EXPECT_TRUE(AreContentRequirementsMet(url, browser_state()));
}
// TODO(crbug.com/961897) Add test for CreateNewEntry.
......
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