Commit 908b870c authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

Add log for debugging testSmartSelection* tests

To verify if |blockSelectionClient| in SelectionPopupControllerImpl was
set to false when these tests were failing

Bug: 967811
Change-Id: Id11ac9df208c2f0c2d371cbd90e55fe4789b7e27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637435Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664812}
parent dc02b349
......@@ -364,7 +364,7 @@ public class SelectionPopupControllerImpl extends ActionModeCallbackHelper
if (hasSelection()) {
// Device is not provisioned, don't trigger SelectionClient logic at all.
boolean blockSelectionClient = !isDeviceProvisioned(mContext);
boolean blockSelectionClient = !isDeviceProvisioned();
// Disable SelectionClient logic if it's incognito.
blockSelectionClient |= isIncognito();
......@@ -1567,10 +1567,11 @@ public class SelectionPopupControllerImpl extends ActionModeCallbackHelper
return client == null ? null : client.getCustomTextClassifier();
}
private static boolean isDeviceProvisioned(Context context) {
if (context == null || context.getContentResolver() == null) return true;
@VisibleForTesting
public boolean isDeviceProvisioned() {
if (mContext == null || mContext.getContentResolver() == null) return true;
return Settings.Global.getInt(
context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0)
mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0)
!= 0;
}
......
......@@ -20,6 +20,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.Log;
import org.chromium.base.task.PostTask;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.DisabledTest;
......@@ -45,6 +46,8 @@ import java.util.concurrent.Callable;
*/
@RunWith(ContentJUnit4ClassRunner.class)
public class ContentTextSelectionTest {
private static final String TAG = "ContentTextSelTest";
@Rule
public ContentShellActivityTestRule mActivityTestRule = new ContentShellActivityTestRule();
private static final String DATA_URL = UrlUtils.encodeHtmlDataUri(
......@@ -375,6 +378,9 @@ public class ContentTextSelectionTest {
mSelectionPopupController.setSelectionClient(client);
// TODO(crbug.com/967811): Remove logs once we confirmed the assumpution.
Log.d(TAG, "isIncognito = " + mWebContents.isIncognito());
Log.d(TAG, "isDeviceProvisioned = " + mSelectionPopupController.isDeviceProvisioned());
DOMUtils.longPressNode(mWebContents, "smart_selection");
waitForSelectActionBarVisible(true);
......@@ -402,6 +408,9 @@ public class ContentTextSelectionTest {
mSelectionPopupController.setSelectionClient(client);
// TODO(crbug.com/967811): Remove logs once we confirmed the assumpution.
Log.d(TAG, "isIncognito = " + mWebContents.isIncognito());
Log.d(TAG, "isDeviceProvisioned = " + mSelectionPopupController.isDeviceProvisioned());
DOMUtils.longPressNode(mWebContents, "smart_selection");
waitForSelectActionBarVisible(true);
......
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