Commit 89f4148d authored by Yue Zhang's avatar Yue Zhang Committed by Commit Bot

Fix lint issues in tab_ui

* Suppress a lint warning that is expected.
* For methods whose visibility is relaxed not only for the reason of
  testing, remove the @VisibleForTesting annotation.

Bug: 1108022
Change-Id: I3f8004e3b27cfbbc82a8061c19e57e1662a0691a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315926Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Yue Zhang <yuezhanggg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791974}
parent 5aa75779
...@@ -199,17 +199,6 @@ ...@@ -199,17 +199,6 @@
column="17"/> column="17"/>
</issue> </issue>
<issue
id="CheckResult"
message="The result of `shouldTriggerHelpUI` is not used"
errorLine1=" mTracker.shouldTriggerHelpUI(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/IphMessageService.java"
line="59"
column="9"/>
</issue>
<issue <issue
id="CutPasteId" id="CutPasteId"
message="The id `R.id.bottom_container` has already been looked up in this method; possible cut &amp; paste error?" message="The id `R.id.bottom_container` has already been looked up in this method; possible cut &amp; paste error?"
...@@ -3536,17 +3525,6 @@ ...@@ -3536,17 +3525,6 @@
column="36"/> column="36"/>
</issue> </issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" return TabPersistentStore.getStateFileName(Integer.toString(mTaskId));"
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicy.java"
line="105"
column="35"/>
</issue>
<issue <issue
id="VisibleForTests" id="VisibleForTests"
message="This method should only be accessed from tests or within private scope" message="This method should only be accessed from tests or within private scope"
...@@ -4009,17 +3987,6 @@ ...@@ -4009,17 +3987,6 @@
column="79"/> column="79"/>
</issue> </issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" NavigationEntry entry = controller.getEntryAtIndex(index);"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPage.java"
line="401"
column="44"/>
</issue>
<issue <issue
id="VisibleForTests" id="VisibleForTests"
message="This method should only be accessed from tests or within private scope" message="This method should only be accessed from tests or within private scope"
...@@ -5197,17 +5164,6 @@ ...@@ -5197,17 +5164,6 @@
column="23"/> column="23"/>
</issue> </issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" TabbedModeTabPersistencePolicy.getStateFileName(0));"
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/pseudotab/PseudoTab.java"
line="303"
column="48"/>
</issue>
<issue <issue
id="VisibleForTests" id="VisibleForTests"
message="This method should only be accessed from tests or within private scope" message="This method should only be accessed from tests or within private scope"
...@@ -5747,83 +5703,6 @@ ...@@ -5747,83 +5703,6 @@
column="50"/> column="50"/>
</issue> </issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" tab.getWebContents().getNavigationController().getEntryAtIndex("
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContext.java"
line="121"
column="68"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" ConditionalTabStripUtils.setFeatureStatus(FeatureStatus.FORBIDDEN);"
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java"
line="368"
column="42"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" ConditionalTabStripUtils.setFeatureStatus(FeatureStatus.ACTIVATED);"
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java"
line="519"
column="38"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" ConditionalTabStripUtils.setOptOutIndicator(true);"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java"
line="537"
column="46"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" ConditionalTabStripUtils.setContinuousDismissCount("
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java"
line="540"
column="42"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" ConditionalTabStripUtils.setFeatureStatus(FeatureStatus.ACTIVATED);"
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java"
line="561"
column="34"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
errorLine1=" &amp;&amp; !ConditionalTabStripUtils.getOptOutIndicator();"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiFeatureUtilities.java"
line="138"
column="46"/>
</issue>
<issue <issue
id="VisibleForTests" id="VisibleForTests"
message="This method should only be accessed from tests or within private scope" message="This method should only be accessed from tests or within private scope"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.tasks.tab_management; package org.chromium.chrome.browser.tasks.tab_management;
import android.annotation.SuppressLint;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.components.feature_engagement.FeatureConstants; import org.chromium.components.feature_engagement.FeatureConstants;
...@@ -55,6 +57,7 @@ public class IphMessageService extends MessageService { ...@@ -55,6 +57,7 @@ public class IphMessageService extends MessageService {
mIphController.showIph(); mIphController.showIph();
} }
@SuppressLint("CheckResult")
private void dismiss() { private void dismiss() {
mTracker.shouldTriggerHelpUI(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE); mTracker.shouldTriggerHelpUI(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE);
mTracker.dismissed(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE); mTracker.dismissed(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE);
......
...@@ -1432,7 +1432,6 @@ public class TabPersistentStore extends TabPersister { ...@@ -1432,7 +1432,6 @@ public class TabPersistentStore extends TabPersister {
* @param uniqueId The ID that uniquely identifies this state file. * @param uniqueId The ID that uniquely identifies this state file.
* @return The name of the state file. * @return The name of the state file.
*/ */
@VisibleForTesting
public static String getStateFileName(String uniqueId) { public static String getStateFileName(String uniqueId) {
return SAVED_STATE_FILE_PREFIX + uniqueId; return SAVED_STATE_FILE_PREFIX + uniqueId;
} }
......
...@@ -111,7 +111,6 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy { ...@@ -111,7 +111,6 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
* @param selectorIndex The index that represents which state file to pull and save state to. * @param selectorIndex The index that represents which state file to pull and save state to.
* @return The name of the state file. * @return The name of the state file.
*/ */
@VisibleForTesting
public static String getStateFileName(int selectorIndex) { public static String getStateFileName(int selectorIndex) {
return TabPersistentStore.getStateFileName(Integer.toString(selectorIndex)); return TabPersistentStore.getStateFileName(Integer.toString(selectorIndex));
} }
......
...@@ -171,7 +171,6 @@ public class ConditionalTabStripUtils { ...@@ -171,7 +171,6 @@ public class ConditionalTabStripUtils {
* *
* @param featureStatus the target {@link FeatureStatus} to set. * @param featureStatus the target {@link FeatureStatus} to set.
*/ */
@VisibleForTesting
public static void setFeatureStatus(@FeatureStatus int featureStatus) { public static void setFeatureStatus(@FeatureStatus int featureStatus) {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
sharedPreferencesManager.writeInt(FEATURE_STATUS, featureStatus); sharedPreferencesManager.writeInt(FEATURE_STATUS, featureStatus);
...@@ -219,7 +218,6 @@ public class ConditionalTabStripUtils { ...@@ -219,7 +218,6 @@ public class ConditionalTabStripUtils {
* *
* @param count the updated count to save into SharedPreference. * @param count the updated count to save into SharedPreference.
*/ */
@VisibleForTesting
public static void setContinuousDismissCount(int count) { public static void setContinuousDismissCount(int count) {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
sharedPreferencesManager.writeInt(CONTINUOUS_DISMISS_COUNTER, count); sharedPreferencesManager.writeInt(CONTINUOUS_DISMISS_COUNTER, count);
...@@ -229,7 +227,6 @@ public class ConditionalTabStripUtils { ...@@ -229,7 +227,6 @@ public class ConditionalTabStripUtils {
* Get the boolean indicator that indicates whether this user has opt-outed the conditional tab * Get the boolean indicator that indicates whether this user has opt-outed the conditional tab
* strip feature from SharedPreference. * strip feature from SharedPreference.
*/ */
@VisibleForTesting
public static boolean getOptOutIndicator() { public static boolean getOptOutIndicator() {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
return sharedPreferencesManager.readBoolean(OPT_OUT_INDICATOR, false); return sharedPreferencesManager.readBoolean(OPT_OUT_INDICATOR, false);
...@@ -241,7 +238,6 @@ public class ConditionalTabStripUtils { ...@@ -241,7 +238,6 @@ public class ConditionalTabStripUtils {
* *
* @param isOptOut the boolean indicator to save into SharedPreference. * @param isOptOut the boolean indicator to save into SharedPreference.
*/ */
@VisibleForTesting
public static void setOptOutIndicator(boolean isOptOut) { public static void setOptOutIndicator(boolean isOptOut) {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
sharedPreferencesManager.writeBoolean(OPT_OUT_INDICATOR, isOptOut); sharedPreferencesManager.writeBoolean(OPT_OUT_INDICATOR, isOptOut);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.content_public.browser; package org.chromium.content_public.browser;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
/** /**
* The NavigationController Java wrapper to allow communicating with the native * The NavigationController Java wrapper to allow communicating with the native
...@@ -144,7 +143,6 @@ public interface NavigationController { ...@@ -144,7 +143,6 @@ public interface NavigationController {
* @param index Index to retrieve the NavigationEntry for. * @param index Index to retrieve the NavigationEntry for.
* @return Entry containing info about the navigation, null if the index is out of bounds. * @return Entry containing info about the navigation, null if the index is out of bounds.
*/ */
@VisibleForTesting
public NavigationEntry getEntryAtIndex(int index); public NavigationEntry getEntryAtIndex(int index);
/** /**
......
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