Skip to content

Commit

Permalink
Fix lint issues in tab_ui
Browse files Browse the repository at this point in the history
* 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/+/2315926
Reviewed-by: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Yue Zhang <yuezhanggg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791974}
  • Loading branch information
Yue Zhang authored and Commit Bot committed Jul 27, 2020
1 parent 5aa7577 commit 89f4148
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 129 deletions.
121 changes: 0 additions & 121 deletions build/android/lint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,6 @@
column="17"/>
</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
id="CutPasteId"
message="The id `R.id.bottom_container` has already been looked up in this method; possible cut &amp; paste error?"
Expand Down Expand Up @@ -3536,17 +3525,6 @@
column="36"/>
</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
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
Expand Down Expand Up @@ -4009,17 +3987,6 @@
column="79"/>
</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
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
Expand Down Expand Up @@ -5197,17 +5164,6 @@
column="23"/>
</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
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
Expand Down Expand Up @@ -5747,83 +5703,6 @@
column="50"/>
</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
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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.profiles.Profile;
import org.chromium.components.feature_engagement.FeatureConstants;
Expand Down Expand Up @@ -55,6 +57,7 @@ private void review() {
mIphController.showIph();
}

@SuppressLint("CheckResult")
private void dismiss() {
mTracker.shouldTriggerHelpUI(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE);
mTracker.dismissed(FeatureConstants.TAB_GROUPS_DRAG_AND_DROP_FEATURE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,6 @@ public void removeObserver(TabPersistentStoreObserver observer) {
* @param uniqueId The ID that uniquely identifies this state file.
* @return The name of the state file.
*/
@VisibleForTesting
public static String getStateFileName(String uniqueId) {
return SAVED_STATE_FILE_PREFIX + uniqueId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public List<String> getStateToBeMergedFileNames() {
* @param selectorIndex The index that represents which state file to pull and save state to.
* @return The name of the state file.
*/
@VisibleForTesting
public static String getStateFileName(int selectorIndex) {
return TabPersistentStore.getStateFileName(Integer.toString(selectorIndex));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ private static void recordUserStatusEnums(@UserStatus int userStatus) {
*
* @param featureStatus the target {@link FeatureStatus} to set.
*/
@VisibleForTesting
public static void setFeatureStatus(@FeatureStatus int featureStatus) {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
sharedPreferencesManager.writeInt(FEATURE_STATUS, featureStatus);
Expand Down Expand Up @@ -219,7 +218,6 @@ public static int getContinuousDismissCount() {
*
* @param count the updated count to save into SharedPreference.
*/
@VisibleForTesting
public static void setContinuousDismissCount(int count) {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
sharedPreferencesManager.writeInt(CONTINUOUS_DISMISS_COUNTER, count);
Expand All @@ -229,7 +227,6 @@ public static void setContinuousDismissCount(int count) {
* Get the boolean indicator that indicates whether this user has opt-outed the conditional tab
* strip feature from SharedPreference.
*/
@VisibleForTesting
public static boolean getOptOutIndicator() {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
return sharedPreferencesManager.readBoolean(OPT_OUT_INDICATOR, false);
Expand All @@ -241,7 +238,6 @@ public static boolean getOptOutIndicator() {
*
* @param isOptOut the boolean indicator to save into SharedPreference.
*/
@VisibleForTesting
public static void setOptOutIndicator(boolean isOptOut) {
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance();
sharedPreferencesManager.writeBoolean(OPT_OUT_INDICATOR, isOptOut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package org.chromium.content_public.browser;

import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

/**
* The NavigationController Java wrapper to allow communicating with the native
Expand Down Expand Up @@ -144,7 +143,6 @@ public interface NavigationController {
* @param index Index to retrieve the NavigationEntry for.
* @return Entry containing info about the navigation, null if the index is out of bounds.
*/
@VisibleForTesting
public NavigationEntry getEntryAtIndex(int index);

/**
Expand Down

0 comments on commit 89f4148

Please sign in to comment.