diff --git a/DEPS b/DEPS index 23495a612..52ff49da 100644 --- a/DEPS +++ b/DEPS
@@ -167,11 +167,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '0846d68474fbc92ea33ca648b5c340e75fc578d4', + 'skia_revision': '04b9964167358e716a44f90cc70f738134128622', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '1370481f4b1fba0c2a764320b3e7c75785628e52', + 'v8_revision': 'd58f380d3b66719cb061452fe49421eca4da36a0', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -179,11 +179,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'ceac3320975b432fdde2ade2afc2a24af927aee0', + 'angle_revision': '087f1384f233792921d34c0ca5b5a90fac75b070', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'faa2a365b5c0e90a5e1156c01a3acb4246632316', + 'swiftshader_revision': 'a9dc7707d6106b329ed68a5175b3152db28cf6c8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -218,7 +218,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': 'c37a501458e2b5389ac977ed2523eed3e2d9bd61', + 'freetype_revision': '839a023619b593b742f62ffab8e7e4f9da8c1593', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling HarfBuzz # and whatever else without interference from each other. @@ -238,7 +238,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-node-modules # and whatever else without interference from each other. - 'devtools_node_modules_revision': '42d0028a8621347b04fa31462b33a32cd105d715', + 'devtools_node_modules_revision': '499e57bfea8a4f8e8373321f2c99632372553e56', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -862,7 +862,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'd9d7419a45d6766ae607250101548ad8a13681f5', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '9ee7f7856b07f247ff0abd5698a0b4d396c177f8', 'condition': 'checkout_linux', }, @@ -1269,7 +1269,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '1fab224fb263308aeb6e5af05d9c4f77fb31c6e9', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'cc55bdc0a75eea863c1a84ff83ad14e011e2bd18', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1459,7 +1459,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '7c4e67ff117d6c640e6dd17989afe2fb7da7eecb', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '45b176fc22892db55c0f5bd5dc876386ee5512d0', + Var('webrtc_git') + '/src.git' + '@' + '4aded80e0498dc1aa290c6f1be029aded0793388', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1521,7 +1521,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@01cd0891cf7a9b2bdc805f690dcd43fe79adef8d', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@699a19bcc20b66193a44d6a094c2288f54a397ea', 'condition': 'checkout_src_internal', }, @@ -1529,7 +1529,7 @@ 'packages': [ { 'package': 'chromium/third_party/android_deps/libs/com_google_android_play_core_verification', - 'version': '0z_scbnHbcGHs7fem6R48_Cfgf7n-46yI7DEXkpkZcwC', + 'version': '5WpfZCqhiL1qWTiBl_x3VTelXCJsv5r_SMuE-3H1CI0C', }, ], 'condition': 'checkout_android',
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java index 154361bf8..78b0732c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java
@@ -40,7 +40,7 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mAwContents = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient) .getAwContents(); @@ -50,7 +50,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java index 20d47897..824fa0c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
@@ -148,7 +148,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) { mWebServer.shutdown(); } @@ -258,8 +258,7 @@ } private void assertScrollInJs(final AwContents awContents, - final TestAwContentsClient contentsClient, final double xCss, final double yCss) - throws Exception { + final TestAwContentsClient contentsClient, final double xCss, final double yCss) { AwActivityTestRule.pollInstrumentationThread(() -> { String x = mActivityTestRule.executeJavaScriptAndWaitForResult( awContents, contentsClient, "window.scrollX"); @@ -273,8 +272,8 @@ }); } - private void assertScrolledToBottomInJs(final AwContents awContents, - final TestAwContentsClient contentsClient) throws Exception { + private void assertScrolledToBottomInJs( + final AwContents awContents, final TestAwContentsClient contentsClient) { final String isBottomScript = "window.scrollY == " + "(window.document.documentElement.scrollHeight - window.innerHeight)"; AwActivityTestRule.pollInstrumentationThread(() -> {
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java index 145670c..a2123100 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java
@@ -108,7 +108,7 @@ new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); private AwTestContainerView createCustomTestContainerViewOnMainSync( - final AwContentsClient awContentsClient, final int visibility) throws Exception { + final AwContentsClient awContentsClient, final int visibility) { final AtomicReference<AwTestContainerView> testContainerView = new AtomicReference<>(); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { @@ -129,13 +129,13 @@ return testContainerView.get(); } - private void assertZeroHeight(final AwTestContainerView testContainerView) throws Throwable { + private void assertZeroHeight(final AwTestContainerView testContainerView) { // Make sure the test isn't broken by the view having a non-zero height. InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> Assert.assertEquals(0, testContainerView.getHeight())); } - private int getRootLayoutWidthOnMainThread() throws Exception { + private int getRootLayoutWidthOnMainThread() { final AtomicReference<Integer> width = new AtomicReference<>(); InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> width.set(
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java index 8cf29a10..31b8900 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
@@ -44,7 +44,7 @@ private AwTestContainerView mTestContainerView; @Before - public void setUp() throws Exception { + public void setUp() { mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwActivityTestRule.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwActivityTestRule.java index 971c307..ac1767e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwActivityTestRule.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwActivityTestRule.java
@@ -81,7 +81,7 @@ }, description); } - public void setUp() throws Exception { + public void setUp() { if (needsAwBrowserContextCreated()) { createAwBrowserContext(); } @@ -135,7 +135,7 @@ () -> mBrowserContext = createAwBrowserContextOnUiThread(prefs)); } - public void startBrowserProcess() throws Exception { + public void startBrowserProcess() { // The Activity must be launched in order for proper webview statics to be setup. launchActivity(); TestThreadUtils.runOnUiThreadBlocking(() -> AwBrowserProcess.start()); @@ -187,7 +187,7 @@ /** * Loads url on the UI thread but does not block. */ - public void loadUrlAsync(final AwContents awContents, final String url) throws Exception { + public void loadUrlAsync(final AwContents awContents, final String url) { loadUrlAsync(awContents, url, null); } @@ -210,8 +210,7 @@ /** * Loads url on the UI thread but does not block. */ - public void postUrlAsync(final AwContents awContents, final String url, byte[] postData) - throws Exception { + public void postUrlAsync(final AwContents awContents, final String url, byte[] postData) { class PostUrl implements Runnable { byte[] mPostData; public PostUrl(byte[] postData) { @@ -259,7 +258,7 @@ * Loads data on the UI thread but does not block. */ public void loadDataAsync(final AwContents awContents, final String data, final String mimeType, - final boolean isBase64Encoded) throws Exception { + final boolean isBase64Encoded) { TestThreadUtils.runOnUiThreadBlocking( () -> awContents.loadData(data, mimeType, isBase64Encoded ? "base64" : null)); } @@ -326,7 +325,7 @@ // Note that this is a stricter condition that waiting for a visual state callback, // as visual state callback only indicates that *something* has appeared in WebView. public void waitForPixelColorAtCenterOfView(final AwContents awContents, - final AwTestContainerView testContainerView, final int expectedColor) throws Exception { + final AwTestContainerView testContainerView, final int expectedColor) { pollUiThread(() -> GraphicsTestUtils.getPixelColorAtCenterOfView( awContents, testContainerView) == expectedColor); } @@ -379,8 +378,7 @@ return !testMethodHasAnnotation(DisableHardwareAccelerationForTest.class); } - public AwTestContainerView createAwTestContainerViewOnMainSync(final AwContentsClient client) - throws Exception { + public AwTestContainerView createAwTestContainerViewOnMainSync(final AwContentsClient client) { return createAwTestContainerViewOnMainSync(client, false, null); } @@ -463,8 +461,7 @@ * Wrapper around CriteriaHelper.pollInstrumentationThread. This uses AwActivityTestRule-specifc * timeouts and treats timeouts and exceptions as test failures automatically. */ - public static void pollInstrumentationThread(final Callable<Boolean> callable) - throws Exception { + public static void pollInstrumentationThread(final Callable<Boolean> callable) { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() { @@ -482,7 +479,7 @@ * Wrapper around {@link AwActivityTestRule#pollInstrumentationThread()} but runs the * callable on the UI thread. */ - public void pollUiThread(final Callable<Boolean> callable) throws Exception { + public void pollUiThread(final Callable<Boolean> callable) { pollInstrumentationThread(() -> TestThreadUtils.runOnUiThreadBlocking(callable)); } @@ -490,8 +487,7 @@ * Clears the resource cache. Note that the cache is per-application, so this will clear the * cache for all WebViews used. */ - public void clearCacheOnUiThread(final AwContents awContents, final boolean includeDiskFiles) - throws Exception { + public void clearCacheOnUiThread(final AwContents awContents, final boolean includeDiskFiles) { TestThreadUtils.runOnUiThreadBlocking(() -> awContents.clearCache(includeDiskFiles)); } @@ -523,7 +519,7 @@ return TestThreadUtils.runOnUiThreadBlocking(() -> awContents.canZoomOut()); } - public void killRenderProcessOnUiThreadAsync(final AwContents awContents) throws Exception { + public void killRenderProcessOnUiThreadAsync(final AwContents awContents) { TestThreadUtils.runOnUiThreadBlocking(() -> awContents.killRenderProcess()); } @@ -572,7 +568,7 @@ /** * Creates a popup window with AwContents. */ - public PopupInfo createPopupContents(final AwContents parentAwContents) throws Exception { + public PopupInfo createPopupContents(final AwContents parentAwContents) { TestAwContentsClient popupContentsClient; AwTestContainerView popupContainerView; final AwContents popupContents;
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwAutocompleteTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwAutocompleteTest.java index 5b36c74..b6a38c35 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwAutocompleteTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwAutocompleteTest.java
@@ -52,7 +52,7 @@ new MetricsUtils.HistogramDelta("Autofill.AutocompleteEnabled", 0 /*false*/); } - private void verifyUmaAutocompleteEnabled(final boolean enabled) throws Throwable { + private void verifyUmaAutocompleteEnabled(final boolean enabled) { TestThreadUtils.runOnUiThreadBlocking(() -> { if (enabled) { assertEquals(1, mAutocompleteEnabled.getDelta()); @@ -64,7 +64,7 @@ }); } - private void verifyUmaNotRecorded() throws Throwable { + private void verifyUmaNotRecorded() { TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(0, mAutocompleteEnabled.getDelta()); assertEquals(0, mAutocompleteDisabled.getDelta()); @@ -113,7 +113,7 @@ dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_A); } - private void disableAwAutocomplete() throws Throwable { + private void disableAwAutocomplete() { TestThreadUtils.runOnUiThreadBlocking( () -> mAwContents.getSettings().setSaveFormData(false)); } @@ -129,7 +129,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java index 2844df1..203d1503 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java
@@ -641,7 +641,7 @@ }); } - public int getHistogramSampleCount(String name) throws Throwable { + public int getHistogramSampleCount(String name) { TestThreadUtils.runOnUiThreadBlocking(() -> { mHistogramSimpleCount = Integer.valueOf(RecordHistogram.getHistogramTotalCountForTesting(name)); @@ -649,28 +649,28 @@ return mHistogramSimpleCount; } - public void verifyAutofillEnabled() throws Throwable { + public void verifyAutofillEnabled() { TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(1, mAutofillWebViewViewEnabled.getDelta()); assertEquals(0, mAutofillWebViewViewDisabled.getDelta()); }); } - public void verifyAutofillDisabled() throws Throwable { + public void verifyAutofillDisabled() { TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(0, mAutofillWebViewViewEnabled.getDelta()); assertEquals(1, mAutofillWebViewViewDisabled.getDelta()); }); } - public void verifyUserChangedAutofilledField() throws Throwable { + public void verifyUserChangedAutofilledField() { TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(0, mUserChangedNonAutofilledField.getDelta()); assertEquals(1, mUserChangedAutofilledField.getDelta()); }); } - public void verifyUserChangedNonAutofilledField() throws Throwable { + public void verifyUserChangedNonAutofilledField() { // User changed the form, but not the autofilled field. TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(1, mUserChangedNonAutofilledField.getDelta()); @@ -678,7 +678,7 @@ }); } - public void verifyUserDidntChangeForm() throws Throwable { + public void verifyUserDidntChangeForm() { // User didn't change the form at all. TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(0, mUserChangedNonAutofilledField.getDelta()); @@ -686,7 +686,7 @@ }); } - public void verifyWebViewCreatedByActivityContext() throws Throwable { + public void verifyWebViewCreatedByActivityContext() { TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(1, mAutofillWebViewCreatedByActivityContext.getDelta()); assertEquals(0, mAutofillWebViewCreatedByAppContext.getDelta()); @@ -722,7 +722,7 @@ private AwAutofillSessionUMATestHelper mUMATestHelper; @Before - public void setUp() throws Exception { + public void setUp() { mUMATestHelper = new AwAutofillSessionUMATestHelper(this); mContentsClient = new AwAutofillTestClient(); mTestContainerView = mRule.createAwTestContainerViewOnMainSync( @@ -1810,7 +1810,7 @@ @Test @SmallTest @Feature({"AndroidWebView"}) - public void testUMAAutofillCreatedByActivityContext() throws Throwable { + public void testUMAAutofillCreatedByActivityContext() { mUMATestHelper.verifyWebViewCreatedByActivityContext(); } @@ -1903,11 +1903,10 @@ * @param expectedEventArray The callback types that need to be verified. * @return The number of new callbacks since currentCallCount. This should be same as the length * of expectedEventArray. - * @throws InterruptedException * @throws TimeoutException */ private int waitForCallbackAndVerifyTypes(int currentCallCount, Integer[] expectedEventArray) - throws InterruptedException, TimeoutException { + throws TimeoutException { Integer[] adjustedEventArray; // Didn't call cancel after Android P. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentCaptureTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentCaptureTest.java index b1ceccf8..1bb0cfed 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentCaptureTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentCaptureTest.java
@@ -286,8 +286,8 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { mContainerView.scrollTo(0, 0); }); } - private static void verifyFrame(Long expectedId, String expectedUrl, ContentCaptureData result) - throws Exception { + private static void verifyFrame( + Long expectedId, String expectedUrl, ContentCaptureData result) { if (expectedId == null || expectedId.longValue() == 0) { Assert.assertNotEquals(0, result.getId()); } else { @@ -297,8 +297,7 @@ Assert.assertFalse(result.getBounds().isEmpty()); } - private static void verifyFrameSession(FrameSession expected, FrameSession result) - throws Exception { + private static void verifyFrameSession(FrameSession expected, FrameSession result) { if (expected == null && (result == null || result.isEmpty())) return; Assert.assertEquals(expected.size(), result.size()); for (int i = 0; i < expected.size(); i++) { @@ -307,7 +306,7 @@ } private static void verifyContent(Set<String> expectedContent, Set<Long> unexpectedIds, - Set<Long> expectedIds, ContentCaptureData result) throws Exception { + Set<Long> expectedIds, ContentCaptureData result) { Assert.assertEquals(expectedContent.size(), result.getChildren().size()); if (expectedIds != null) { Assert.assertEquals(expectedIds.size(), result.getChildren().size()); @@ -328,8 +327,7 @@ private static void verifyCapturedContent(FrameSession expectedParentSession, Long expectedFrameId, String expectedUrl, Set<String> expectedContent, - Set<Long> unexpectedContentIds, FrameSession parentResult, ContentCaptureData result) - throws Exception { + Set<Long> unexpectedContentIds, FrameSession parentResult, ContentCaptureData result) { verifyFrameSession(expectedParentSession, parentResult); verifyFrame(expectedFrameId, expectedUrl, result); verifyContent(expectedContent, unexpectedContentIds, null, result); @@ -337,14 +335,13 @@ private static void verifyUpdatedContent(FrameSession expectedParentSession, Long expectedFrameId, String expectedUrl, Set<String> expectedContent, - Set<Long> expectedContentIds, FrameSession parentResult, ContentCaptureData result) - throws Exception { + Set<Long> expectedContentIds, FrameSession parentResult, ContentCaptureData result) { verifyFrameSession(expectedParentSession, parentResult); verifyFrame(expectedFrameId, expectedUrl, result); verifyContent(expectedContent, null, expectedContentIds, result); } - private static void verifyRemovedIds(Set<Long> expectedIds, long[] result) throws Exception { + private static void verifyRemovedIds(Set<Long> expectedIds, long[] result) { Assert.assertEquals(expectedIds.size(), result.length); Set<Long> resultSet = new HashSet<Long>(result.length); for (long id : result) { @@ -354,7 +351,7 @@ } private static void verifyRemovedContent(Long expectedFrameId, String expectedUrl, - Set<Long> expectedIds, FrameSession resultFrame, long[] result) throws Exception { + Set<Long> expectedIds, FrameSession resultFrame, long[] result) { Assert.assertEquals(1, resultFrame.size()); verifyFrame(expectedFrameId, expectedUrl, resultFrame.get(0)); verifyRemovedIds(expectedIds, result);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java index c2367f58..1fa4105b 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java
@@ -31,7 +31,7 @@ private AwViewAndroidDelegate mViewDelegate; @Before - public void setUp() throws Exception { + public void setUp() { mContainerView = new FrameLayout(mActivityTestRule.getActivity()); mViewDelegate = new AwViewAndroidDelegate(mContainerView, null, null); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java index a390df5be..7e6868a 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java
@@ -81,7 +81,7 @@ private Looper mLooper; @Before - public void setUp() throws Exception { + public void setUp() { mLooper = Looper.getMainLooper(); mContentsClient = new TestAwContentsClient(); mClientHelper = new AwContentsClientCallbackHelper(mLooper, mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java index 2b6dee9..921cfb5c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java
@@ -68,7 +68,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java index f01b3eb..d299a5f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java
@@ -61,7 +61,7 @@ private AwTestContainerView mTestContainerView; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new FullScreenVideoTestAwContentsClient( mActivityTestRule.getActivity(), mActivityTestRule.isHardwareAcceleratedTest()); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); @@ -345,7 +345,7 @@ mTestContainerView.getWebContents(), CUSTOM_PLAY_CONTROL_ID); } - private void waitUntilHaveEnoughDataForPlay() throws Exception { + private void waitUntilHaveEnoughDataForPlay() { // crbug.com/936757: you are expected to wait before media playback is ready. CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override @@ -392,7 +392,7 @@ return getKeepScreenOnOnInstrumentationThread(view) == expected && DOMUtils.isMediaPaused(getWebContentsOnUiThread(), VIDEO_ID) != expected; - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { Assert.fail(e.getMessage()); return false; } @@ -446,7 +446,7 @@ public boolean isSatisfied() { try { return DOMUtils.isFullscreen(getWebContentsOnUiThread()); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { Assert.fail(e.getMessage()); return false; } @@ -461,7 +461,7 @@ public boolean isSatisfied() { try { return !DOMUtils.isFullscreen(getWebContentsOnUiThread()); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { Assert.fail(e.getMessage()); return false; } @@ -470,7 +470,7 @@ // TODO: Test that inline video is actually displayed. } - private JavascriptEventObserver registerObserver(final String observerName) throws Throwable { + private JavascriptEventObserver registerObserver(final String observerName) { final JavascriptEventObserver observer = new JavascriptEventObserver(); InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> observer.register(mTestContainerView.getWebContents(), observerName));
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java index f32f2922..627f1a2 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java
@@ -50,8 +50,7 @@ return getPoster(); } - public void waitForGetDefaultVideoPosterCalled() throws InterruptedException, - TimeoutException { + public void waitForGetDefaultVideoPosterCalled() throws TimeoutException { mVideoPosterCallbackHelper.waitForCallback(0); } @@ -85,7 +84,7 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testInterceptDefaultVidoePosterURL() throws Throwable { + public void testInterceptDefaultVidoePosterURL() { DefaultVideoPosterClient contentsClient = new DefaultVideoPosterClient( InstrumentationRegistry.getInstrumentation().getTargetContext()); DefaultVideoPosterRequestHandler handler =
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java index 8561a46f..befd574 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java
@@ -82,7 +82,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java index 6473436..760b227 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java
@@ -31,7 +31,7 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java index 92ae3810..e15c512 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java
@@ -62,7 +62,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new KeyEventTestAwContentsClient(); mHelper = new UnhandledKeyEventHelper(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); @@ -146,7 +146,7 @@ dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, code)); } - private void assertUnhandledDownAndUp(final int code) throws Throwable { + private void assertUnhandledDownAndUp(final int code) { List<KeyEvent> list = mHelper.getUnhandledKeyEventList(); Assert.assertEquals( "KeyEvent list: " + Arrays.deepToString(list.toArray()), 2, list.size());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java index a05296d..bcfb1e87 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
@@ -83,7 +83,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); } @@ -366,7 +366,7 @@ } @Override - public long skip(long n) throws IOException { + public long skip(long n) { return n; } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java index 6dfcff22..c80dce08 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
@@ -75,30 +75,29 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); } - private void standardSetup() throws Throwable { + private void standardSetup() { setupWithProvidedContentsClient(new TestAwContentsClient()); mShouldOverrideUrlLoadingHelper = mContentsClient.getShouldOverrideUrlLoadingHelper(); } - private void setupWithProvidedContentsClient(TestAwContentsClient contentsClient) - throws Throwable { + private void setupWithProvidedContentsClient(TestAwContentsClient contentsClient) { mContentsClient = contentsClient; mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(contentsClient); mAwContents = mTestContainerView.getAwContents(); } - private void clickOnLinkUsingJs() throws Throwable { + private void clickOnLinkUsingJs() { AwActivityTestRule.enableJavaScriptOnUiThread(mAwContents); JSUtils.clickOnLinkUsingJs(InstrumentationRegistry.getInstrumentation(), mAwContents, mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link"); } // Since this value is read on the UI thread, it's simpler to set it there too. - void setShouldOverrideUrlLoadingReturnValueOnUiThread(final boolean value) throws Throwable { + void setShouldOverrideUrlLoadingReturnValueOnUiThread(final boolean value) { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mShouldOverrideUrlLoadingHelper.setShouldOverrideUrlLoadingReturnValue( value)); @@ -1189,7 +1188,7 @@ return popupShouldOverrideUrlLoadingHelper; } - private void pollTitleAs(final String title, final AwContents awContents) throws Exception { + private void pollTitleAs(final String title, final AwContents awContents) { AwActivityTestRule.pollInstrumentationThread( () -> title.equals(mActivityTestRule.getTitleOnUiThread(awContents))); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsContainerViewTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsContainerViewTest.java index e40243e..57fee85 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsContainerViewTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsContainerViewTest.java
@@ -26,7 +26,7 @@ private AwTestContainerView mContainerView; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); } @@ -34,7 +34,7 @@ @Test @SmallTest @Feature({"AndroidWebView"}) - public void testContainerViewClickable() throws Throwable { + public void testContainerViewClickable() { Assert.assertTrue(mContainerView.isClickable()); } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java index ad59142..0d58ad7 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java
@@ -58,7 +58,7 @@ private TestDependencyFactory mOverridenFactory; @After - public void tearDown() throws Exception { + public void tearDown() { mOverridenFactory = null; } @@ -99,7 +99,7 @@ @DisableHardwareAccelerationForTest @SmallTest @Feature({"AndroidWebView"}) - public void testCreateAndGcOneTime() throws Throwable { + public void testCreateAndGcOneTime() { gcAndCheckAllAwContentsDestroyed(); TestAwContentsClient client = new TestAwContentsClient(); @@ -158,7 +158,7 @@ @DisableHardwareAccelerationForTest @SmallTest @Feature({"AndroidWebView"}) - public void testAccessibility() throws Throwable { + public void testAccessibility() { gcAndCheckAllAwContentsDestroyed(); TestAwContentsClient client = new TestAwContentsClient(); @@ -193,7 +193,7 @@ @DisableHardwareAccelerationForTest @SmallTest @Feature({"AndroidWebView"}) - public void testReferenceFromClient() throws Throwable { + public void testReferenceFromClient() { gcAndCheckAllAwContentsDestroyed(); AwTestContainerView containerViews[] = new AwTestContainerView[MAX_IDLE_INSTANCES + 1]; @@ -216,7 +216,7 @@ @DisableHardwareAccelerationForTest @SmallTest @Feature({"AndroidWebView"}) - public void testReferenceFromContext() throws Throwable { + public void testReferenceFromContext() { gcAndCheckAllAwContentsDestroyed(); TestAwContentsClient client = new TestAwContentsClient(); @@ -243,7 +243,7 @@ @DisableHardwareAccelerationForTest @LargeTest @Feature({"AndroidWebView"}) - public void testCreateAndGcManyTimes() throws Throwable { + public void testCreateAndGcManyTimes() { gcAndCheckAllAwContentsDestroyed(); final int concurrentInstances = 4; @@ -321,7 +321,7 @@ gcAndCheckAllAwContentsDestroyed(); } - private void removeAllViews() throws Throwable { + private void removeAllViews() { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mActivityTestRule.getActivity().removeAllViews()); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java index 3d3f635..f1f323a 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java
@@ -39,7 +39,7 @@ private AwTestContainerView mContainerView; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = mContainerView.getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java index 872d796..67da6c6 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java
@@ -65,7 +65,7 @@ callbackHelper.waitForCallback(currentCallCount); } - private void createContainerView() throws Exception { + private void createContainerView() { mContentsClient = new TestAwContentsClient(); mTestContainer = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = mTestContainer.getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java index a928f69..befc991 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
@@ -287,7 +287,7 @@ @Test @SmallTest @Feature({"AndroidWebView"}) - public void testClearCacheInQuickSuccession() throws Throwable { + public void testClearCacheInQuickSuccession() { final AwTestContainerView testContainer = mActivityTestRule.createAwTestContainerViewOnMainSync(new TestAwContentsClient()); final AwContents awContents = testContainer.getAwContents(); @@ -527,7 +527,7 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testHardwareModeWorks() throws Throwable { + public void testHardwareModeWorks() { AwTestContainerView testContainer = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); Assert.assertTrue(testContainer.isHardwareAccelerated()); @@ -935,7 +935,7 @@ } } - private int getHistogramSampleCount(String name) throws Throwable { + private int getHistogramSampleCount(String name) { TestThreadUtils.runOnUiThreadBlocking(() -> { mHistogramTotalCount = RecordHistogram.getHistogramTotalCountForTesting(name); }); @@ -1056,7 +1056,7 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testLoadUrlRecordsScheme_http() throws Throwable { + public void testLoadUrlRecordsScheme_http() { // No need to spin up a web server, since we don't care if the load ever succeeds. final String httpUrlWithNoRealPage = "http://some.origin/some/path.html"; loadUrlAndCheckScheme(httpUrlWithNoRealPage, AwContents.UrlScheme.HTTP_SCHEME); @@ -1065,7 +1065,7 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testLoadUrlRecordsScheme_javascript() throws Throwable { + public void testLoadUrlRecordsScheme_javascript() { loadUrlAndCheckScheme( "javascript:console.log('message')", AwContents.UrlScheme.JAVASCRIPT_SCHEME); } @@ -1073,7 +1073,7 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testLoadUrlRecordsScheme_fileAndroidAsset() throws Throwable { + public void testLoadUrlRecordsScheme_fileAndroidAsset() { loadUrlAndCheckScheme("file:///android_asset/some/asset/page.html", AwContents.UrlScheme.FILE_ANDROID_ASSET_SCHEME); } @@ -1081,14 +1081,14 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testLoadUrlRecordsScheme_fileRegular() throws Throwable { + public void testLoadUrlRecordsScheme_fileRegular() { loadUrlAndCheckScheme("file:///some/path/on/disk.html", AwContents.UrlScheme.FILE_SCHEME); } @Test @Feature({"AndroidWebView"}) @SmallTest - public void testLoadUrlRecordsScheme_data() throws Throwable { + public void testLoadUrlRecordsScheme_data() { loadUrlAndCheckScheme( "data:text/html,<html><body>foo</body></html>", AwContents.UrlScheme.DATA_SCHEME); } @@ -1096,12 +1096,11 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testLoadUrlRecordsScheme_blank() throws Throwable { + public void testLoadUrlRecordsScheme_blank() { loadUrlAndCheckScheme("about:blank", AwContents.UrlScheme.EMPTY); } - private void loadUrlAndCheckScheme(String url, @AwContents.UrlScheme int expectedSchemeEnum) - throws Throwable { + private void loadUrlAndCheckScheme(String url, @AwContents.UrlScheme int expectedSchemeEnum) { AwTestContainerView testView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); final AwContents awContents = testView.getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwFormDatabaseTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwFormDatabaseTest.java index c97d137..6596754 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwFormDatabaseTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwFormDatabaseTest.java
@@ -22,7 +22,7 @@ @Test @SmallTest - public void testSmoke() throws Throwable { + public void testSmoke() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { AwFormDatabase.clearFormData(); Assert.assertFalse(AwFormDatabase.hasFormData());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwImeTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwImeTest.java index f9d6139..1fc918f5 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwImeTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwImeTest.java
@@ -63,7 +63,7 @@ private TestInputMethodManagerWrapper mInputMethodManagerWrapper; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); TestThreadUtils.runOnUiThreadBlocking(() -> { // Use detached container view to avoid focus request.
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java index 05bd2ee1..31d1fd0 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java
@@ -34,7 +34,7 @@ private static final int MAX_IDLE_INSTANCES = 1; @Before - public void setUp() throws Exception { + public void setUp() { mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java index 4320fc0..ef43641 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java
@@ -377,12 +377,11 @@ } private AwTestContainerView createAwTestContainerViewOnMainSyncInQuirksMode( - final AwContentsClient client) throws Exception { + final AwContentsClient client) { return mActivityTestRule.createAwTestContainerViewOnMainSync(client, true); } - private void ensureScaleBecomes(final float targetScale, final AwContents awContents) - throws Throwable { + private void ensureScaleBecomes(final float targetScale, final AwContents awContents) { AwActivityTestRule.pollInstrumentationThread( () -> targetScale == mActivityTestRule.getScaleOnUiThread(awContents)); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwNetworkConfigurationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwNetworkConfigurationTest.java index 160b317..3d93689 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwNetworkConfigurationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwNetworkConfigurationTest.java
@@ -47,7 +47,7 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = mTestContainerView.getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwPageLoadMetricsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwPageLoadMetricsTest.java index f78ae9de..da074331 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwPageLoadMetricsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwPageLoadMetricsTest.java
@@ -43,7 +43,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java index b27f918b..4dad6f3 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java
@@ -47,7 +47,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestWebServer.shutdown(); mTestWebServer = null; } @@ -55,7 +55,7 @@ @Test @Feature({"AndroidWebView"}) @SmallTest - public void testRequestMultiple() throws Throwable { + public void testRequestMultiple() { mPage = mTestWebServer.setResponse("/permissions", REQUEST_DUPLICATE, CommonResources.getTextHtmlHeaders(true)); @@ -84,8 +84,7 @@ pollTitleAs("second-granted", awContents); } - private void pollTitleAs(final String title, final AwContents awContents) - throws Exception { + private void pollTitleAs(final String title, final AwContents awContents) { AwActivityTestRule.pollInstrumentationThread( () -> title.equals(mActivityTestRule.getTitleOnUiThread(awContents))); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java index 9c6c7a2..c4ddac4d 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java
@@ -55,20 +55,20 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { deleteAllData(); if (mWebServer != null) { mWebServer.shutdown(); } } - private void deleteAllData() throws Exception { + private void deleteAllData() { final AwQuotaManagerBridge bridge = mActivityTestRule.getAwBrowserContext().getQuotaManagerBridge(); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> bridge.deleteAllData()); } - private void deleteOrigin(final String origin) throws Exception { + private void deleteOrigin(final String origin) { final AwQuotaManagerBridge bridge = mActivityTestRule.getAwBrowserContext().getQuotaManagerBridge(); InstrumentationRegistry.getInstrumentation().runOnMainSync(
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java index 83802341..648a7ed 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java
@@ -46,7 +46,7 @@ private int mSecondBrowserServicePid; @After - public void tearDown() throws Exception { + public void tearDown() { stopSecondBrowserProcess(false); } @@ -109,7 +109,7 @@ mSecondBrowserProcessLatch = null; } - private void stopSecondBrowserProcess(boolean sync) throws Exception { + private void stopSecondBrowserProcess(boolean sync) { if (mSecondBrowserServicePid <= 0) return; Assert.assertTrue(isSecondBrowserServiceRunning()); // Note that using killProcess ensures that the service record gets removed
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java index 2e05ce6d..86cb7db5 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java
@@ -66,7 +66,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java index 0567f80..7daa16f9 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
@@ -2497,16 +2497,15 @@ return mManifestPath; } - int waitUntilHtmlIsRequested(final int initialRequestCount) throws Exception { + int waitUntilHtmlIsRequested(final int initialRequestCount) { return waitUntilResourceIsRequested(mHtmlPath, initialRequestCount); } - int waitUntilManifestIsRequested(final int initialRequestCount) throws Exception { + int waitUntilManifestIsRequested(final int initialRequestCount) { return waitUntilResourceIsRequested(mManifestPath, initialRequestCount); } - private int waitUntilResourceIsRequested( - final String path, final int initialRequestCount) throws Exception { + private int waitUntilResourceIsRequested(final String path, final int initialRequestCount) { AwActivityTestRule.pollInstrumentationThread( () -> mWebServer.getRequestCount(path) > initialRequestCount); return mWebServer.getRequestCount(path); @@ -3048,7 +3047,7 @@ private TestDependencyFactory mOverridenFactory; @After - public void tearDown() throws Exception { + public void tearDown() { mOverridenFactory = null; } @@ -3183,7 +3182,7 @@ expectedResult, getSelectionChangeCountForSelectionUpdateTest(awContents, client)); } - private void pollTitleAs(final String title, final AwContents awContents) throws Exception { + private void pollTitleAs(final String title, final AwContents awContents) { AwActivityTestRule.pollInstrumentationThread( () -> title.equals(mActivityTestRule.getTitleOnUiThread(awContents))); } @@ -3310,11 +3309,11 @@ helper1.ensureSettingHasInitialValue(); } - private ViewPair createViews() throws Throwable { + private ViewPair createViews() { return createViews(false); } - private ViewPair createViews(boolean supportsLegacyQuirks) throws Throwable { + private ViewPair createViews(boolean supportsLegacyQuirks) { TestAwContentsClient client0 = new TestAwContentsClient(); TestAwContentsClient client1 = new TestAwContentsClient(); return new ViewPair(mActivityTestRule.createAwTestContainerViewOnMainSync( @@ -3358,8 +3357,7 @@ return TestContentProvider.createContentUrl(target); } - private void simulateDoubleTapCenterOfWebViewOnUiThread(final AwTestContainerView webView) - throws Throwable { + private void simulateDoubleTapCenterOfWebViewOnUiThread(final AwTestContainerView webView) { final int x = (webView.getRight() - webView.getLeft()) / 2; final int y = (webView.getBottom() - webView.getTop()) / 2; final AwContents awContents = webView.getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java index 09d240a..2a5fa64 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java
@@ -46,20 +46,20 @@ private StrictMode.VmPolicy mOldVmPolicy; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); enableStrictModeOnUiThreadSync(); } @After - public void tearDown() throws Exception { + public void tearDown() { disableStrictModeOnUiThreadSync(); } @Test @LargeTest @Feature({"AndroidWebView"}) - public void testStartup() throws Exception { + public void testStartup() { startEverythingSync(); } @@ -106,7 +106,7 @@ }); } - private void startEverythingSync() throws Exception { + private void startEverythingSync() { mActivityTestRule.getActivity(); mActivityTestRule.createAwBrowserContext(); mActivityTestRule.startBrowserProcess();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java index 762dffd..e6e3930 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java
@@ -31,8 +31,6 @@ import java.io.File; import java.io.IOException; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeoutException; @@ -108,8 +106,7 @@ @Override public SeedInfo downloadContent(@VariationsSeedFetcher.VariationsPlatform int platform, - String restrictMode, String milestone, String channel) - throws SocketTimeoutException, UnknownHostException, IOException { + String restrictMode, String milestone, String channel) { Assert.assertEquals(VariationsSeedFetcher.VariationsPlatform.ANDROID_WEBVIEW, platform); Assert.assertTrue(Integer.parseInt(milestone) > 0); helper.notifyCalled(); @@ -205,7 +202,7 @@ @Test @SmallTest - public void testFetch() throws IOException, InterruptedException, TimeoutException { + public void testFetch() throws IOException, TimeoutException { try { AwVariationsSeedFetcher fetcher = new AwVariationsSeedFetcher() { // p is null in this test. Don't actually call JobService.jobFinished.
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java index 0df3c70d..9ab9f77f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java
@@ -38,7 +38,7 @@ private String mUnreachableWebDataUrl; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mUnreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUrl();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java index 705b8e1..714ef0d 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java
@@ -38,7 +38,7 @@ private static final float EPSILON = 0.00001f; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); @@ -77,7 +77,7 @@ return ThreadUtils.runOnUiThreadBlocking(() -> mAwContents.getZoomControlsForTest()); } - private void invokeZoomPickerOnUiThread() throws Throwable { + private void invokeZoomPickerOnUiThread() { ThreadUtils.runOnUiThreadBlocking(() -> mAwContents.invokeZoomPicker()); } @@ -102,19 +102,19 @@ waitForScaleChange(previousScale); } - private void waitForScaleChange(final float previousScale) throws Throwable { + private void waitForScaleChange(final float previousScale) { AwActivityTestRule.pollInstrumentationThread( () -> previousScale != mActivityTestRule.getPixelScaleOnUiThread(mAwContents)); } - private void waitForScaleToBecome(final float expectedScale) throws Throwable { + private void waitForScaleToBecome(final float expectedScale) { AwActivityTestRule.pollInstrumentationThread( () -> Math.abs(expectedScale - mActivityTestRule.getScaleOnUiThread(mAwContents)) < EPSILON); } - private void waitUntilCanNotZoom() throws Throwable { + private void waitUntilCanNotZoom() { AwActivityTestRule.pollInstrumentationThread( () -> !mActivityTestRule.canZoomInOnUiThread(mAwContents) && !mActivityTestRule.canZoomOutOnUiThread(mAwContents));
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java index 156c18e..8e8a783 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java
@@ -46,7 +46,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { sObjectCount.set(0); } @@ -60,7 +60,7 @@ @Test @SmallTest @Feature({"AndroidWebView"}) - public void testCreateSingle() throws Throwable { + public void testCreateSingle() { Assert.assertEquals(0, sObjectCount.get()); ReferredObject instance = new ReferredObject(); @@ -76,7 +76,7 @@ @Test @SmallTest @Feature({"AndroidWebView"}) - public void testCreateMany() throws Throwable { + public void testCreateMany() { Assert.assertEquals(0, sObjectCount.get()); final int instanceCount = 20; @@ -96,5 +96,4 @@ collectGarbage(); CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, () -> sObjectCount.get())); } - }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java index 0135c4a..d7761525 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java
@@ -36,7 +36,7 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java index c677750..1f79d77d 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java
@@ -38,11 +38,11 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { setTestAwContentsClient(new TestAwContentsClient()); } - private void setTestAwContentsClient(TestAwContentsClient contentsClient) throws Exception { + private void setTestAwContentsClient(TestAwContentsClient contentsClient) { mContentsClient = contentsClient; final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java index 555779f7b..3604418 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java
@@ -80,12 +80,12 @@ } @Before - public void setUp() throws Exception { + public void setUp() { setTestAwContentsClient(new TestAwContentsClient()); AwActivityTestRule.enableJavaScriptOnUiThread(mAwContents); } - private void setTestAwContentsClient(TestAwContentsClient contentsClient) throws Exception { + private void setTestAwContentsClient(TestAwContentsClient contentsClient) { mContentsClient = contentsClient; final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java index 42f2957..1c385dc5 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java
@@ -49,14 +49,14 @@ "http://id.be.really.surprised.if.this.address.existed/a.html"; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new VerifyOnReceivedError2CallClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = mTestContainerView.getAwContents(); } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) mWebServer.shutdown(); } @@ -64,7 +64,7 @@ mWebServer = TestWebServer.start(); } - private void useDefaultTestAwContentsClient() throws Exception { + private void useDefaultTestAwContentsClient() { mContentsClient.enableBypass(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java index 92a17774..610e46e7 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
@@ -34,7 +34,7 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java index 5e1e34e..f7e787a 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java
@@ -49,7 +49,7 @@ mWebServer = TestWebServer.start(); } - private void useDefaultTestAwContentsClient() throws Exception { + private void useDefaultTestAwContentsClient() { mContentsClient.enableBypass(); } @@ -88,7 +88,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java index cdea9a2f4..7f185ddb 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java
@@ -48,7 +48,7 @@ private TestWebServer mWebServer; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = mTestContainerView.getAwContents(); @@ -56,7 +56,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java index 90f8d67..69b9585 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java
@@ -41,7 +41,7 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java index 9dbbe4c..666c8a0f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java
@@ -48,7 +48,7 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { ThreadUtils.setUiThread(null); ThreadUtils.setWillOverrideUiThread(true); @@ -58,16 +58,16 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { ThreadUtils.setWillOverrideUiThread(false); } - private void startChromium() throws Exception { + private void startChromium() { ThreadUtils.setUiThread(Looper.getMainLooper()); startChromiumWithClient(new TestAwContentsClient()); } - private void startChromiumWithClient(TestAwContentsClient contentsClient) throws Exception { + private void startChromiumWithClient(TestAwContentsClient contentsClient) { mActivityTestRule.createAwBrowserContext(); mActivityTestRule.startBrowserProcess(); mContentsClient = contentsClient; @@ -112,7 +112,7 @@ @Test @SmallTest @Feature({"AndroidWebView", "Privacy"}) - public void testAllowFileSchemeCookies() throws Throwable { + public void testAllowFileSchemeCookies() { AwCookieManager cookieManager = new AwCookieManager(); Assert.assertFalse(cookieManager.allowFileSchemeCookies()); cookieManager.setAcceptFileSchemeCookies(true); @@ -124,7 +124,7 @@ @Test @SmallTest @Feature({"AndroidWebView", "Privacy"}) - public void testAllowCookies() throws Throwable { + public void testAllowCookies() { AwCookieManager cookieManager = new AwCookieManager(); Assert.assertTrue(cookieManager.acceptCookie()); cookieManager.setAcceptCookie(false);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java index dda9599..d9bcff1 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java
@@ -74,7 +74,7 @@ private static final String SECURE_COOKIE_HISTOGRAM_NAME = "Android.WebView.SecureCookieAction"; @Before - public void setUp() throws Exception { + public void setUp() { mCookieManager = new AwCookieManager(); mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = @@ -85,7 +85,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { try { clearCookies(); } catch (Throwable e) { @@ -96,7 +96,7 @@ @Test @SmallTest @Feature({"AndroidWebView", "Privacy"}) - public void testAcceptCookie_default() throws Throwable { + public void testAcceptCookie_default() { Assert.assertTrue("Expected CookieManager to accept cookies by default", mCookieManager.acceptCookie()); } @@ -104,7 +104,7 @@ @Test @SmallTest @Feature({"AndroidWebView", "Privacy"}) - public void testAcceptCookie_setterGetterFunctionality() throws Throwable { + public void testAcceptCookie_setterGetterFunctionality() { mCookieManager.setAcceptCookie(false); Assert.assertFalse("Expected #acceptCookie() to return false after setAcceptCookie(false)", mCookieManager.acceptCookie()); @@ -278,7 +278,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testRemoveAllCookies() throws Exception { + public void testRemoveAllCookies() { final String cookieUrl = "http://www.example.com"; mCookieManager.setCookie(cookieUrl, "name=test"); assertHasCookies(cookieUrl); @@ -289,7 +289,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testRemoveSessionCookies() throws Exception { + public void testRemoveSessionCookies() { final String url = "http://www.example.com"; final String sessionCookie = "cookie1=peter"; final String normalCookie = "cookie2=sue"; @@ -308,7 +308,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetCookie() throws Throwable { + public void testSetCookie() { Assert.assertEquals( 0, RecordHistogram.getHistogramTotalCountForTesting(SECURE_COOKIE_HISTOGRAM_NAME)); String url = "http://www.example.com"; @@ -325,7 +325,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetCookieWithDomainForUrl() throws Throwable { + public void testSetCookieWithDomainForUrl() { // If the app passes ".www.example.com" or "http://.www.example.com", the glue layer "fixes" // this to "http:///.www.example.com" String url = "http:///.www.example.com"; @@ -340,7 +340,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetCookieWithDomainForUrlAndExistingDomainAttribute() throws Throwable { + public void testSetCookieWithDomainForUrlAndExistingDomainAttribute() { String url = "http:///.www.example.com"; String differentSubdomainUrl = "http://different.sub.example.com"; String cookie = "name=test"; @@ -352,7 +352,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetCookieWithDomainForUrlWithTrailingSemicolonInCookie() throws Throwable { + public void testSetCookieWithDomainForUrlWithTrailingSemicolonInCookie() { String url = "http:///.www.example.com"; String sameSubdomainUrl = "http://a.www.example.com"; String differentSubdomainUrl = "http://different.sub.example.com"; @@ -365,7 +365,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetSecureCookieForHttpUrl() throws Throwable { + public void testSetSecureCookieForHttpUrl() { Assert.assertEquals( 0, RecordHistogram.getHistogramTotalCountForTesting(SECURE_COOKIE_HISTOGRAM_NAME)); String url = "http://www.example.com"; @@ -383,7 +383,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetSecureCookieForHttpsUrl() throws Throwable { + public void testSetSecureCookieForHttpsUrl() { Assert.assertEquals( 0, RecordHistogram.getHistogramTotalCountForTesting(SECURE_COOKIE_HISTOGRAM_NAME)); String secureUrl = "https://www.example.com"; @@ -400,7 +400,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testHasCookie() throws Throwable { + public void testHasCookie() { Assert.assertFalse(mCookieManager.hasCookies()); mCookieManager.setCookie("http://www.example.com", "name=test"); Assert.assertTrue(mCookieManager.hasCookies()); @@ -446,7 +446,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testSetCookieNullCallback() throws Throwable { + public void testSetCookieNullCallback() { allowFirstPartyCookies(); final String url = "http://www.example.com"; @@ -484,7 +484,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testRemoveAllCookiesNullCallback() throws Throwable { + public void testRemoveAllCookiesNullCallback() { mCookieManager.setCookie("http://www.example.com", "name=test"); mCookieManager.removeAllCookies(null); @@ -527,7 +527,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testRemoveSessionCookiesNullCallback() throws Throwable { + public void testRemoveSessionCookiesNullCallback() { final String url = "http://www.example.com"; final String sessionCookie = "cookie1=peter"; final String normalCookie = "cookie2=sue"; @@ -551,7 +551,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testExpiredCookiesAreNotSet() throws Exception { + public void testExpiredCookiesAreNotSet() { final String url = "http://www.example.com"; final String cookie = "cookie1=peter"; @@ -563,7 +563,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testCookiesExpire() throws Exception { + public void testCookiesExpire() { final String url = "http://www.example.com"; final String cookie = "cookie1=peter"; @@ -579,7 +579,7 @@ @Test @MediumTest @Feature({"AndroidWebView", "Privacy"}) - public void testCookieExpiration() throws Exception { + public void testCookieExpiration() { final String url = "http://www.example.com"; final String sessionCookie = "cookie1=peter"; final String longCookie = "cookie2=marc"; @@ -1023,7 +1023,7 @@ protected final TestAwContentsClient mContentsClient; protected final TestWebServer mWebServer; - ThirdPartyCookiesTestHelper(TestWebServer webServer) throws Throwable { + ThirdPartyCookiesTestHelper(TestWebServer webServer) { mWebServer = webServer; mContentsClient = new TestAwContentsClient(); final AwTestContainerView containerView = @@ -1154,18 +1154,18 @@ return url.replace("localhost", "127.0.0.1"); } - private void setCookieOnUiThread(final String url, final String cookie, - final Callback<Boolean> callback) throws Throwable { + private void setCookieOnUiThread( + final String url, final String cookie, final Callback<Boolean> callback) { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mCookieManager.setCookie(url, cookie, callback)); } - private void removeSessionCookiesOnUiThread(final Callback<Boolean> callback) throws Throwable { + private void removeSessionCookiesOnUiThread(final Callback<Boolean> callback) { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mCookieManager.removeSessionCookies(callback)); } - private void removeAllCookiesOnUiThread(final Callback<Boolean> callback) throws Throwable { + private void removeAllCookiesOnUiThread(final Callback<Boolean> callback) { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mCookieManager.removeAllCookies(callback)); } @@ -1177,7 +1177,7 @@ CookieUtils.clearCookies(InstrumentationRegistry.getInstrumentation(), mCookieManager); } - private void waitForCookie(final String url) throws Exception { + private void waitForCookie(final String url) { AwActivityTestRule.pollInstrumentationThread(() -> mCookieManager.getCookie(url) != null); } @@ -1214,7 +1214,7 @@ * * @param cookieUrl the URL for which we expect no cookies to be set. */ - private void assertNoCookies(final String cookieUrl) throws Exception { + private void assertNoCookies(final String cookieUrl) { String msg = "Expected to not see cookies for '" + cookieUrl + "'"; Assert.assertNull(msg, mCookieManager.getCookie(cookieUrl)); } @@ -1222,7 +1222,7 @@ /** * Asserts there are no cookies set at all. */ - private void assertNoCookies() throws Exception { + private void assertNoCookies() { String msg = "Expected to CookieManager to have no cookies"; Assert.assertFalse(msg, mCookieManager.hasCookies()); } @@ -1232,7 +1232,7 @@ * * @param cookieUrl the URL for which to check for cookies. */ - private void assertHasCookies(final String cookieUrl) throws Exception { + private void assertHasCookies(final String cookieUrl) { String msg = "Expected CookieManager to have cookies for '" + cookieUrl + "' but it has no cookies"; Assert.assertTrue(msg, mCookieManager.hasCookies()); @@ -1248,8 +1248,7 @@ * @param cookieKeyValuePair the expected key/value pair. * @param cookieUrl the URL to check cookies for. */ - private void assertCookieEquals(final String cookieKeyValuePair, final String cookieUrl) - throws Exception { + private void assertCookieEquals(final String cookieKeyValuePair, final String cookieUrl) { assertHasCookies(cookieUrl); String msg = "Unexpected cookie key/value pair"; Assert.assertEquals(msg, cookieKeyValuePair, mCookieManager.getCookie(cookieUrl)); @@ -1262,9 +1261,8 @@ * all cookies have been blocked. * * @param awContents the AwContents for which to allow third-party cookies. - * @throws IllegalStateException if cookies are already blocked globally. */ - private void allowThirdPartyCookies(AwContents awContents) throws Exception { + private void allowThirdPartyCookies(AwContents awContents) { if (!mCookieManager.acceptCookie()) { throw new IllegalStateException("It doesn't make sense to allow third-party cookies if " + "cookies have already been globally blocked."); @@ -1281,7 +1279,7 @@ * * @param awContents the AwContents for which to block third-party cookies. */ - private void blockThirdPartyCookies(AwContents awContents) throws Exception { + private void blockThirdPartyCookies(AwContents awContents) { awContents.getSettings().setAcceptThirdPartyCookies(false); String msg = "getAcceptThirdPartyCookies() should return false after " + "setAcceptThirdPartyCookies(false)"; @@ -1293,7 +1291,7 @@ * affect the third-party cookie settings for any {@link AwContents}. This checks the return * value of {@link AwCookieManager#acceptCookie}. */ - private void allowFirstPartyCookies() throws Exception { + private void allowFirstPartyCookies() { mCookieManager.setAcceptCookie(true); String msg = "acceptCookie() should return true after setAcceptCookie(true)"; Assert.assertTrue(msg, mCookieManager.acceptCookie()); @@ -1303,7 +1301,7 @@ * Block all cookies for all {@link AwContents}. This blocks both first-party and third-party * cookies. This checks the return value of {@link AwCookieManager#acceptCookie}. */ - private void blockAllCookies() throws Exception { + private void blockAllCookies() { mCookieManager.setAcceptCookie(false); String msg = "acceptCookie() should return false after setAcceptCookie(false)"; Assert.assertFalse(msg, mCookieManager.acceptCookie());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java b/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java index 38876540..c7fd841 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java
@@ -99,11 +99,11 @@ return mOnShowCustomViewCallbackHelper.getCallCount() > 0; } - public void waitForCustomViewShown() throws TimeoutException, InterruptedException { + public void waitForCustomViewShown() throws TimeoutException { mOnShowCustomViewCallbackHelper.waitForCallback(0, 1, WAITING_SECONDS, TimeUnit.SECONDS); } - public void waitForCustomViewHidden() throws InterruptedException, TimeoutException { + public void waitForCustomViewHidden() throws TimeoutException { mOnHideCustomViewCallbackHelper.waitForCallback(0, 1, WAITING_SECONDS, TimeUnit.SECONDS); } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java index a363ac2..d068aef2 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java
@@ -93,7 +93,7 @@ } } - private void initAwContents(TestAwContentsClient contentsClient) throws Exception { + private void initAwContents(TestAwContentsClient contentsClient) { mContentsClient = contentsClient; mAwContents = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient) .getAwContents(); @@ -103,13 +103,13 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mMockLocationProvider = new MockLocationProvider(); LocationProviderOverrider.setLocationProviderImpl(mMockLocationProvider); } @After - public void tearDown() throws Exception { + public void tearDown() { mMockLocationProvider.stopUpdates(); mOverridenFactory = null; } @@ -125,7 +125,7 @@ return result; } - private void ensureGeolocationRunning(final boolean running) throws Exception { + private void ensureGeolocationRunning(final boolean running) { AwActivityTestRule.pollInstrumentationThread( () -> mMockLocationProvider.isRunning() == running); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/GetTitleTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/GetTitleTest.java index 7ccc4b8..80ecee5e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/GetTitleTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/GetTitleTest.java
@@ -44,7 +44,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/HeapProfilingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/HeapProfilingTest.java index 48fac7e..76758631 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/HeapProfilingTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/HeapProfilingTest.java
@@ -29,7 +29,7 @@ public AwActivityTestRule mActivityTestRule = new AwActivityTestRule(); @Before - public void setUp() throws Exception {} + public void setUp() {} @Test @MediumTest @@ -38,7 +38,7 @@ @CommandLineFlags.Add({"memlog=browser", "memlog-stack-mode=native-include-thread-names", "memlog-sampling-rate=1"}) public void - testModeBrowser() throws Exception { + testModeBrowser() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue( shim.runTestForMode("browser", false, "native-include-thread-names", false, false)); @@ -46,21 +46,21 @@ @Test @MediumTest - public void testModeBrowserDynamicPseudo() throws Exception { + public void testModeBrowserDynamicPseudo() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", false, false)); } @Test @MediumTest - public void testModeBrowserDynamicPseudoSampleEverything() throws Exception { + public void testModeBrowserDynamicPseudoSampleEverything() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", true, true)); } @Test @MediumTest - public void testModeBrowserDynamicPseudoSamplePartial() throws Exception { + public void testModeBrowserDynamicPseudoSamplePartial() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", true, false)); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java index 9695b95..45e38eaf 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java
@@ -27,19 +27,19 @@ private static final String TEST_DATABASE = "http_auth_for_HttpAuthDatabaseTest.db"; @Before - public void setUp() throws Exception { + public void setUp() { InstrumentationRegistry.getTargetContext().deleteDatabase(TEST_DATABASE); } @After - public void tearDown() throws Exception { + public void tearDown() { InstrumentationRegistry.getTargetContext().deleteDatabase(TEST_DATABASE); } @Test @SmallTest @Feature({"AndroidWebView"}) - public void testAccessHttpAuthUsernamePassword() throws Exception { + public void testAccessHttpAuthUsernamePassword() { HttpAuthDatabase instance = HttpAuthDatabase.newInstance( InstrumentationRegistry.getTargetContext(), TEST_DATABASE);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/JsJavaInteractionTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/JsJavaInteractionTest.java index 982b567..37b2d49 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/JsJavaInteractionTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/JsJavaInteractionTest.java
@@ -122,7 +122,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java index 4d1380f..1a920d0 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
@@ -51,7 +51,7 @@ private WebContents mWebContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mCookieManager = new AwCookieManager(); final AwTestContainerView testContainerView =
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java index ac2daba5..84e2bee 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java
@@ -47,13 +47,13 @@ private AwEmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = AwEmbeddedTestServer.createAndStartServer( InstrumentationRegistry.getInstrumentation().getTargetContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java index 26f10ca..6c67122 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java
@@ -72,7 +72,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestWebServer.shutdown(); mTestWebServer = null; } @@ -130,8 +130,7 @@ pollTitleAs("deny", awContents); } - private void pollTitleAs(final String title, final AwContents awContents) - throws Exception { + private void pollTitleAs(final String title, final AwContents awContents) { AwActivityTestRule.pollInstrumentationThread( () -> title.equals(mActivityTestRule.getTitleOnUiThread(awContents))); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/MemoryMetricsLoggerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/MemoryMetricsLoggerTest.java index c7ade0c..f08905e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/MemoryMetricsLoggerTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/MemoryMetricsLoggerTest.java
@@ -41,13 +41,13 @@ } @After - public void tearDown() throws Exception {} + public void tearDown() {} @Test @Feature({"AndroidWebView"}) @OnlyRunIn(MULTI_PROCESS) @SmallTest - public void testMultiProcessHistograms() throws Throwable { + public void testMultiProcessHistograms() { Assert.assertNotEquals(0, RecordHistogram.getHistogramTotalCountForTesting( "Memory.Browser.PrivateMemoryFootprint")); @@ -60,7 +60,7 @@ @Feature({"AndroidWebView"}) @OnlyRunIn(SINGLE_PROCESS) @SmallTest - public void testSingleProcessHistograms() throws Throwable { + public void testSingleProcessHistograms() { Assert.assertNotEquals(0, RecordHistogram.getHistogramTotalCountForTesting( "Memory.Browser.PrivateMemoryFootprint"));
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java index c09602c..1cf334c3 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java
@@ -52,7 +52,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/OnDiskFileTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/OnDiskFileTest.java index 97cf008..f9a77cc 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/OnDiskFileTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/OnDiskFileTest.java
@@ -75,7 +75,7 @@ @Test @SmallTest @Feature({"AndroidWebView"}) - public void testCookiePathIsInsideDataDir() throws Exception { + public void testCookiePathIsInsideDataDir() { File webViewCookiePath = new File(InstrumentationRegistry.getInstrumentation() .getTargetContext() .getDir("webview", Context.MODE_PRIVATE)
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java index 13aa9f06..3e8a30c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java
@@ -32,7 +32,7 @@ private WebContents mWebContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mWebContents = mTestContainerView.getWebContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java index 670aea4..6928409 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java
@@ -66,7 +66,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/PopupWindowTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/PopupWindowTest.java index bab4aa8..08e7f54f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/PopupWindowTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/PopupWindowTest.java
@@ -59,7 +59,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) { mWebServer.shutdown(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/PostMessageTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/PostMessageTest.java index bfc180b..9be8f0a2 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/PostMessageTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/PostMessageTest.java
@@ -65,7 +65,7 @@ } @JavascriptInterface - public void setMessageParams(String message, String origin, int[] ports) throws Exception { + public void setMessageParams(String message, String origin, int[] ports) { mQueue.add(new Data(message, origin, ports)); } @@ -147,7 +147,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mWebServer.shutdown(); } @@ -196,7 +196,7 @@ + "</body></html>"; // Call on non-UI thread. - private void expectTitle(String title) throws Throwable { + private void expectTitle(String title) { CriteriaHelper.pollUiThread(Criteria.equals(title, () -> mAwContents.getTitle())); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java index ae4236a..2fdc9e2c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java
@@ -342,7 +342,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new SafeBrowsingContentsClient(); mContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync( mContentsClient, false, new SafeBrowsingDependencyFactory()); @@ -357,7 +357,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -394,7 +394,7 @@ return helper.getValue(); } - private void waitForInterstitialDomToLoad() throws Exception { + private void waitForInterstitialDomToLoad() { final String script = "document.readyState;"; final String expected = "\"complete\""; @@ -445,21 +445,21 @@ mAwContents, mContainerView))); } - private void assertGreenPageShowing() throws Exception { + private void assertGreenPageShowing() { Assert.assertEquals("Original page should be showing", colorToString(GREEN_PAGE_BACKGROUND_COLOR), colorToString(GraphicsTestUtils.getPixelColorAtCenterOfView( mAwContents, mContainerView))); } - private void assertGreenPageNotShowing() throws Exception { + private void assertGreenPageNotShowing() { assertNotEquals("Original page should not be showing", colorToString(GREEN_PAGE_BACKGROUND_COLOR), colorToString(GraphicsTestUtils.getPixelColorAtCenterOfView( mAwContents, mContainerView))); } - private void assertTargetPageNotShowing(int pageColor) throws Exception { + private void assertTargetPageNotShowing(int pageColor) { assertNotEquals("Target page should not be showing", colorToString(pageColor), colorToString(GraphicsTestUtils.getPixelColorAtCenterOfView( mAwContents, mContainerView))); @@ -1225,7 +1225,7 @@ // As long as we've reached this line without crashing, there should be no bug. } - private void destroyOnMainSync() throws Exception { + private void destroyOnMainSync() { // The AwActivityTestRule method invokes AwContents#destroy() on the main thread, but // Awcontents#destroy() posts an asynchronous task itself to destroy natives. Therefore, we // still need to wait for the real work to actually finish.
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java index d6573b2..10e97c6 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java
@@ -47,7 +47,7 @@ } } - private TestVars createNewView() throws Exception { + private TestVars createNewView() { TestAwContentsClient contentsClient = new TestAwContentsClient(); AwTestContainerView testView = mActivityTestRule.createAwTestContainerViewOnMainSync(contentsClient); @@ -79,7 +79,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) { mWebServer.shutdown(); } @@ -118,7 +118,7 @@ } } - private TestVars saveAndRestoreStateOnUiThread(final TestVars vars) throws Throwable { + private TestVars saveAndRestoreStateOnUiThread(final TestVars vars) { final TestVars restoredVars = createNewView(); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { Bundle bundle = new Bundle();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/SslPreferencesTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/SslPreferencesTest.java index 4d32ae7..4bbfb46 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/SslPreferencesTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/SslPreferencesTest.java
@@ -38,7 +38,7 @@ private static final String HELLO_WORLD_TITLE = "Hello, World!"; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = mTestContainerView.getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java index d537f47c..8bf34939 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java
@@ -30,7 +30,7 @@ private AwContents mAwContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mAwContents = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient) .getAwContents();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java index becc222..09720fe6 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java
@@ -60,7 +60,7 @@ } public void writeSeedIfNewerBlocking(File destination, long date) - throws IOException, TimeoutException, InterruptedException { + throws IOException, TimeoutException { ParcelFileDescriptor fd = null; try { fd = ParcelFileDescriptor.open(destination, ParcelFileDescriptor.MODE_WRITE_ONLY); @@ -72,8 +72,7 @@ } } - public void updateSeedBlocking(SeedInfo newSeed) - throws TimeoutException, InterruptedException { + public void updateSeedBlocking(SeedInfo newSeed) throws TimeoutException { int calls = mUpdateFinished.getCallCount(); updateSeed(newSeed, /*onFinished=*/() -> mUpdateFinished.notifyCalled()); mUpdateFinished.waitForCallback(calls); @@ -94,7 +93,7 @@ // write should happen. @Test @MediumTest - public void testWriteNoSeed() throws IOException, TimeoutException, InterruptedException { + public void testWriteNoSeed() throws IOException, TimeoutException { TestHolder holder = new TestHolder(); File file = null; try { @@ -110,8 +109,7 @@ // an empty file. The written seed should match the mock seed. @Test @MediumTest - public void testUpdateAndWriteToEmptySeed() - throws IOException, TimeoutException, InterruptedException { + public void testUpdateAndWriteToEmptySeed() throws IOException, TimeoutException { try { TestHolder holder = new TestHolder(); holder.updateSeedBlocking(VariationsTestUtils.createMockSeed()); @@ -136,7 +134,7 @@ @Test @MediumTest public void testUpdateAndWriteToStaleSeed() - throws IOException, TimeoutException, InterruptedException, ParseException { + throws IOException, TimeoutException, ParseException { try { SeedInfo mockSeed = VariationsTestUtils.createMockSeed(); long mockDateMinusOneDay = mockSeed.parseDate().getTime() - TimeUnit.DAYS.toMillis(1); @@ -161,7 +159,7 @@ @Test @MediumTest public void testUpdateAndWriteToFreshSeed() - throws IOException, TimeoutException, InterruptedException, ParseException { + throws IOException, TimeoutException, ParseException { try { SeedInfo mockSeed = VariationsTestUtils.createMockSeed(); long mockDate = mockSeed.parseDate().getTime(); @@ -183,7 +181,7 @@ @Test @MediumTest public void testConcurrentUpdatesAndWrites() - throws IOException, FileNotFoundException, InterruptedException, TimeoutException { + throws IOException, FileNotFoundException, TimeoutException { ArrayList<File> files = new ArrayList<>(); try { ArrayList<ParcelFileDescriptor> fds = new ArrayList<>();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java index 2c2634f..af2ac96 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java
@@ -83,7 +83,7 @@ // Create a TestLoader, run it on the UI thread, and block until it's finished. The return value // indicates whether the loader decided to request a new seed. - private boolean runTestLoaderBlocking() throws InterruptedException, TimeoutException { + private boolean runTestLoaderBlocking() throws TimeoutException { final TestLoaderResult result = new TestLoaderResult(); Runnable run = () -> { TestLoader loader = new TestLoader(result);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java index 4f61483..206cd18 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/VisualStateTest.java
@@ -101,7 +101,7 @@ // This image delays returning data for 1 (scaled) second in order to simlate a slow network // connection. public static final long IMAGE_LOADING_DELAY_MS = scaleTimeout(1000); - public SlowBlueImage() throws Throwable { + public SlowBlueImage() { super("image/png", "utf-8", new DelayedInputStream(new ByteArrayInputStream( Base64.decode(CommonResources.BLUE_PNG_BASE64, Base64.DEFAULT))));
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java index 32c5e4c1..1da58b24 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java
@@ -60,7 +60,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mWebServer != null) { mWebServer.shutdown(); } @@ -82,7 +82,7 @@ + href + "\" " + "onclick=\"return false;\">" + anchorText + "</a>"); } - private void simulateTabDownUpOnUiThread() throws Throwable { + private void simulateTabDownUpOnUiThread() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mAwContents.getWebContents().getEventForwarder().dispatchKeyEvent( new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_TAB)); @@ -91,7 +91,7 @@ }); } - private void simulateInput(boolean byTouch) throws Throwable { + private void simulateInput(boolean byTouch) { // Send a touch click event if byTouch is true. Otherwise, send a TAB // key event to change the focused element of the page. if (byTouch) { @@ -105,8 +105,7 @@ return a == null ? b == null : a.equals(b); } - private void pollForHitTestDataOnUiThread( - final int expectedType, final String expectedExtra) throws Throwable { + private void pollForHitTestDataOnUiThread(final int expectedType, final String expectedExtra) { mActivityTestRule.pollUiThread(() -> { AwContents.HitTestData data = mAwContents.getLastHitTestResult(); return expectedType == data.hitTestResultType @@ -114,10 +113,8 @@ }); } - private void pollForHrefAndImageSrcOnUiThread( - final String expectedHref, - final String expectedAnchorText, - final String expectedImageSrc) throws Throwable { + private void pollForHrefAndImageSrcOnUiThread(final String expectedHref, + final String expectedAnchorText, final String expectedImageSrc) { mActivityTestRule.pollUiThread(() -> { AwContents.HitTestData data = mAwContents.getLastHitTestResult(); return stringEquals(expectedHref, data.href)
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java b/android_webview/javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java index ca2279e..8364911a 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java
@@ -116,9 +116,8 @@ /** * Invokes clearMatches on the UI thread. * - * @throws Throwable */ - public void clearMatchesOnUiThread() throws Throwable { + public void clearMatchesOnUiThread() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> mContents.clearMatches()); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/WebViewWebVrTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/WebViewWebVrTest.java index c6d6832..b83d4dec 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/WebViewWebVrTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/WebViewWebVrTest.java
@@ -34,7 +34,7 @@ private WebContents mWebContents; @Before - public void setUp() throws Exception { + public void setUp() { mContentsClient = new TestAwContentsClient(); mTestContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient); mWebContents = mTestContainerView.getWebContents(); @@ -55,7 +55,7 @@ try { result = JavaScriptUtils.executeJavaScriptAndWaitForResult( mWebContents, "promiseResolved", 100, TimeUnit.MILLISECONDS); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { // Expected to happen regularly, do nothing } return Boolean.parseBoolean(result);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java index 98362f6..6c0cd00 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java
@@ -47,7 +47,7 @@ */ @Test @MediumTest - public void testCopyingAbortsForInvalidFds() throws IOException { + public void testCopyingAbortsForInvalidFds() { Assert.assertFalse(CrashReceiverService.copyMinidumps(0 /* uid */, null, null)); Assert.assertFalse(CrashReceiverService.copyMinidumps( 0 /* uid */, new ParcelFileDescriptor[] {null, null}, null));
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java index 618a335..73cd10a0 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java
@@ -48,7 +48,7 @@ } @After - public void tearDown() throws IOException { + public void tearDown() { Assert.assertTrue("Failed to delete \"" + mTempFile + "\"", mTempFile.delete()); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java index 37e3b5c..572929c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java
@@ -140,7 +140,7 @@ private RenderProcessGoneHelper mHelper; @Before - public void setUp() throws Exception { + public void setUp() { RenderProcessGoneTestAwContentsClient contentsClient = new RenderProcessGoneTestAwContentsClient(); AwTestContainerView testView = mActivityTestRule.createAwTestContainerViewOnMainSync(
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java index 33e0bf22..ab22a4a4 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java
@@ -52,7 +52,7 @@ @Test @SmallTest - public void testParseEmptyDir() throws IOException { + public void testParseEmptyDir() { List<CrashInfo> crashInfoList = mCrashInfoLoader.loadCrashesInfo(); Assert.assertEquals(0, crashInfoList.size()); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UploadedCrashesInfoLoaderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UploadedCrashesInfoLoaderTest.java index 860fd78..2fe71725 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UploadedCrashesInfoLoaderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UploadedCrashesInfoLoaderTest.java
@@ -153,7 +153,7 @@ @Test @SmallTest - public void testParseNonExistFile() throws IOException { + public void testParseNonExistFile() { mLogFile.delete(); UploadedCrashesInfoLoader crashesInfoLoader = new UploadedCrashesInfoLoader(mLogFile); List<CrashInfo> infoList = crashesInfoLoader.loadCrashesInfo();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/WebViewCrashLogParserTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/WebViewCrashLogParserTest.java index 0a3e673e..64ba4f75 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/WebViewCrashLogParserTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/WebViewCrashLogParserTest.java
@@ -78,7 +78,7 @@ @Test @MediumTest - public void testParseNonExistDir() throws Exception { + public void testParseNonExistDir() { List<CrashInfo> crashInfoList = new WebViewCrashLogParser(new File("non_exsiting_dir")).loadCrashesInfo(); Assert.assertThat(crashInfoList, empty());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java index f33ef6c..1949b4a8 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java
@@ -74,7 +74,7 @@ * * @param view The view the coordinates are relative to. */ - public static void simulateTouchCenterOfView(final View view) throws Throwable { + public static void simulateTouchCenterOfView(final View view) { view.post(() -> { long eventTime = SystemClock.uptimeMillis(); float x = (float) (view.getRight() - view.getLeft()) / 2;
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java index 14a2941..93f5d916 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java
@@ -86,8 +86,7 @@ .getPixel(0, 0)); } - public static void pollForBackgroundColor(final AwContents awContents, final int c) - throws Throwable { + public static void pollForBackgroundColor(final AwContents awContents, final int c) { AwActivityTestRule.pollInstrumentationThread( () -> sampleBackgroundColorOnUiThread(awContents) == c); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java index b8f4b36..0f6405c 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java
@@ -32,7 +32,7 @@ public static void clickOnLinkUsingJs(final Instrumentation instrumentation, final AwContents awContents, final OnEvaluateJavaScriptResultHelper onEvaluateJavaScriptResultHelper, - final String linkId) throws Exception { + final String linkId) { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() {
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/JavascriptEventObserver.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/JavascriptEventObserver.java index f813bcd..cc563be 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/JavascriptEventObserver.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/JavascriptEventObserver.java
@@ -38,7 +38,7 @@ * Wait for the javascript event happen for specific time, there is no timeout parameter, * return true if the event happened. */ - public boolean waitForEvent(long time) throws InterruptedException { + public boolean waitForEvent(long time) { try { mCallbackHelper.waitForCallback(mCurCallCount, 1, time, TimeUnit.MILLISECONDS); mCurCallCount = mCallbackHelper.getCallCount();
diff --git a/android_webview/support_library/boundary_interfaces/BUILD.gn b/android_webview/support_library/boundary_interfaces/BUILD.gn index 58f07873..a6cc4b5 100644 --- a/android_webview/support_library/boundary_interfaces/BUILD.gn +++ b/android_webview/support_library/boundary_interfaces/BUILD.gn
@@ -37,9 +37,13 @@ proguard_configs = [ "proguard.flags" ] - # We can't use ANY deps here, the support library should be able to build - # these interfaces without any other chromium dependencies. - deps = [] + # Our choice of deps is limited, because boundary_interfaces/ must continue to + # build when we mirror this into AndroidX. We are only permitted to depend on + # core Android classes and other AndroidX classes (must be in the androidx.* + # package name). + deps = [ + "//third_party/android_deps:androidx_annotation_annotation_java", + ] # This is to verify the boundary interfaces compile and lint correctly against # the minSdkVersion of the webkit support library module. As the minSdkVersion
diff --git a/android_webview/support_library/boundary_interfaces/build.gradle b/android_webview/support_library/boundary_interfaces/build.gradle index 2b29cae..300ab6c 100644 --- a/android_webview/support_library/boundary_interfaces/build.gradle +++ b/android_webview/support_library/boundary_interfaces/build.gradle
@@ -11,6 +11,10 @@ id('com.android.library') } +dependencies { + api("androidx.annotation:annotation:1.1.0") +} + android { // COMPILE_SDK_VERSION provided by AndroidX build scripts to build all AndroidX modules. compileSdkVersion SupportConfig.COMPILE_SDK_VERSION
diff --git a/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java b/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java index 931cc89..ff00bbc 100644 --- a/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java +++ b/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java
@@ -7,6 +7,9 @@ import android.annotation.TargetApi; import android.os.Build; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -61,29 +64,57 @@ /** * Returns an implementation of the boundary interface named clazz, by delegating method calls * to the {@link InvocationHandler} invocationHandler. + * + * <p>A {@code null} {@link InvocationHandler} is treated as representing a {@code null} object. + * + * @param clazz a {@link Class} object representing the desired boundary interface. + * @param invocationHandler an {@link InvocationHandler} compatible with this boundary + * interface. */ - public static <T> T castToSuppLibClass(Class<T> clazz, InvocationHandler invocationHandler) { + @Nullable + public static <T> T castToSuppLibClass( + @NonNull Class<T> clazz, @Nullable InvocationHandler invocationHandler) { + if (invocationHandler == null) return null; return clazz.cast( Proxy.newProxyInstance(BoundaryInterfaceReflectionUtil.class.getClassLoader(), new Class[] {clazz}, invocationHandler)); } /** - * Create an {@link java.lang.reflect.InvocationHandler} that delegates method calls to - * {@param delegate}, making sure that the {@link java.lang.reflect.Method} and parameters being - * passed to {@param delegate} exist in the same {@link java.lang.ClassLoader} as {@param - * delegate}. + * Create an {@link InvocationHandler} that delegates method calls to {@code delegate}, making + * sure that the {@link Method} and parameters being passed exist in the same {@link + * ClassLoader} as {@code delegate}. + * + * <p>A {@code null} delegate is represented with a {@code null} {@link InvocationHandler}. + * + * @param delegate the object which the resulting {@link InvocationHandler} should delegate + * method calls to. + * @return an {@link InvocationHandlerWithDelegateGetter} wrapping {@code delegate} */ @TargetApi(Build.VERSION_CODES.KITKAT) - public static InvocationHandler createInvocationHandlerFor(final Object delegate) { + @Nullable + public static InvocationHandler createInvocationHandlerFor(@Nullable final Object delegate) { + if (delegate == null) return null; return new InvocationHandlerWithDelegateGetter(delegate); } /** - * Plural version of {@link #createInvocationHandlerFor(Object)}. + * Plural version of {@link #createInvocationHandlerFor(Object)}. The resulting array will be + * the same length as {@code delegates}, where the nth {@code InvocationHandler} wraps the nth + * delegate object. + * + * <p>A {@code null} array of delegates is represented with a {@code null} array of {@link + * InvocationHandler}s. Any individual {@code null} delegate is represented with a {@code null} + * {@link InvocationHandler}. + + * @param delegates an array of objects to which to delegate. + * @return an array of {@link InvocationHandlerWithDelegateGetter} instances, each delegating to + * the corresponding member of {@code delegates}. */ @TargetApi(Build.VERSION_CODES.KITKAT) - public static InvocationHandler[] createInvocationHandlersForArray(final Object[] delegates) { + @Nullable + public static InvocationHandler[] createInvocationHandlersForArray( + @Nullable final Object[] delegates) { if (delegates == null) return null; InvocationHandler[] handlers = new InvocationHandler[delegates.length]; @@ -97,8 +128,16 @@ * Assuming that the given InvocationHandler was created in the current classloader and is an * InvocationHandlerWithDelegateGetter, return the object the InvocationHandler delegates its * method calls to. + * + * <p>A {@code null} {@link InvocationHandler} is treated as wrapping a {@code null} delegate. + * + * @param invocationHandler a {@link Nullable} {@link InvocationHandlerWithDelegateGetter}. + * @return the corresponding delegate. */ - public static Object getDelegateFromInvocationHandler(InvocationHandler invocationHandler) { + @Nullable + public static Object getDelegateFromInvocationHandler( + @Nullable InvocationHandler invocationHandler) { + if (invocationHandler == null) return null; InvocationHandlerWithDelegateGetter objectHolder = (InvocationHandlerWithDelegateGetter) invocationHandler; return objectHolder.getDelegate(); @@ -113,7 +152,7 @@ private static class InvocationHandlerWithDelegateGetter implements InvocationHandler { private final Object mDelegate; - public InvocationHandlerWithDelegateGetter(final Object delegate) { + public InvocationHandlerWithDelegateGetter(@NonNull final Object delegate) { mDelegate = delegate; } @@ -130,6 +169,10 @@ } } + /** + * Gets the delegate object (which is never {@code null}). + */ + @NonNull public Object getDelegate() { return mDelegate; }
diff --git a/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java b/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java index 3db842b..18edaa2 100644 --- a/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java +++ b/android_webview/test/embedded_test_server/java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java
@@ -42,8 +42,7 @@ * @param context The context in which the server will run. * @return The created server. */ - public static AwEmbeddedTestServer createAndStartServer(Context context) - throws InterruptedException { + public static AwEmbeddedTestServer createAndStartServer(Context context) { return initializeAndStartServer(new AwEmbeddedTestServer(), context, 0 /* port */); } }
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java b/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java index a0b5d42..c6751f5b 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java
@@ -49,7 +49,7 @@ return START_STICKY; } - private void startBrowserProcess() throws Exception { + private void startBrowserProcess() { AwResource.setResources(this.getResources()); AwResource.setConfigKeySystemUuidMapping(R.array.config_key_system_uuid_mapping); AwBrowserProcess.loadLibrary(null);
diff --git a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewSyncWrapper.java b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewSyncWrapper.java index eeec330..8c1e503 100644 --- a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewSyncWrapper.java +++ b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewSyncWrapper.java
@@ -118,7 +118,7 @@ } public void loadDataSync(final String data, final String mimeType, final String encoding, - boolean confirmByJavaScript) throws InterruptedException { + boolean confirmByJavaScript) { mErrorMessageList.clear(); int currentPageCount = mPageCallback.getCallCount(); int currentJsCount = mJsCallback.getCallCount(); @@ -138,8 +138,7 @@ } } - public void loadFileSync(final String html, boolean confirmByJavaScript) - throws InterruptedException { + public void loadFileSync(final String html, boolean confirmByJavaScript) { mErrorMessageList.clear(); int currentPageCount = mPageCallback.getCallCount(); int currentJsCount = mJsCallback.getCallCount(); @@ -159,8 +158,7 @@ } } - public void loadJavaScriptSync(String js, boolean appendJavaScriptConfirmation) - throws InterruptedException { + public void loadJavaScriptSync(String js, boolean appendJavaScriptConfirmation) { mErrorMessageList.clear(); int currentJsCount = mJsCallback.getCallCount(); final String jsWithCallback;
diff --git a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java index 3fed446..5633335f08 100644 --- a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java +++ b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java
@@ -24,7 +24,6 @@ import android.support.test.rule.ActivityTestRule; import android.webkit.WebView; -import org.junit.Assert; import org.junit.runner.Description; import org.junit.runners.model.Statement; @@ -80,27 +79,15 @@ public void loadDataSync( String data, String mimeType, String encoding, boolean confirmByJavaScript) { - try { - mSyncWrapper.loadDataSync(data, mimeType, encoding, confirmByJavaScript); - } catch (InterruptedException e) { - Assert.fail(e.getMessage()); - } + mSyncWrapper.loadDataSync(data, mimeType, encoding, confirmByJavaScript); } public void loadJavaScriptSync(String js, boolean appendConfirmationJavascript) { - try { - mSyncWrapper.loadJavaScriptSync(js, appendConfirmationJavascript); - } catch (InterruptedException e) { - Assert.fail(e.getMessage()); - } + mSyncWrapper.loadJavaScriptSync(js, appendConfirmationJavascript); } public void loadFileSync(String html, boolean confirmByJavaScript) { - try { - mSyncWrapper.loadFileSync(html, confirmByJavaScript); - } catch (InterruptedException e) { - Assert.fail(e.getMessage()); - } + mSyncWrapper.loadFileSync(html, confirmByJavaScript); } /**
diff --git a/android_webview/tools/cts_config/expected_failure_on_bot.json b/android_webview/tools/cts_config/expected_failure_on_bot.json deleted file mode 100644 index 2c63c08..0000000 --- a/android_webview/tools/cts_config/expected_failure_on_bot.json +++ /dev/null
@@ -1,2 +0,0 @@ -{ -}
diff --git a/android_webview/tools/run_cts.py b/android_webview/tools/run_cts.py index 09cf661..1fc8def3 100755 --- a/android_webview/tools/run_cts.py +++ b/android_webview/tools/run_cts.py
@@ -34,11 +34,6 @@ os.path.dirname(__file__), os.pardir, os.pardir, 'build', 'android', 'test_runner.py') -# TODO(crbug.com/928093): remove this file as it is covered by -# webview_cts_gcs_path.json. -_EXPECTED_FAILURES_FILE = os.path.join( - os.path.dirname(__file__), 'cts_config', 'expected_failure_on_bot.json') - _WEBVIEW_CTS_GCS_PATH_FILE = os.path.join( os.path.dirname(__file__), 'cts_config', 'webview_cts_gcs_path.json') _ARCH_SPECIFIC_CTS_INFO = ["filename", "unzip_dir", "_origin"] @@ -100,20 +95,6 @@ return [os.path.basename(r['apk']) for r in test_runs] -def GetExpectedFailures(): - """Gets list of tests expected to fail in <class>#<method> format. - - See _EXPECTED_FAILURES_FILE - """ - with open(_EXPECTED_FAILURES_FILE) as f: - expected_failures_info = json.load(f) - expected_failures = [] - for class_name, methods in expected_failures_info.iteritems(): - expected_failures.extend(['%s#%s' % (class_name, m['name']) - for m in methods]) - return expected_failures - - def GetTestRunFilterArg(args, test_run): """ Merges json file filters with cmdline filters using test_filter.InitializeFilterFromArgs @@ -130,15 +111,11 @@ filter_string, positive_patterns=[i["match"] for i in includes]) - excludes = test_run.get("excludes", []) - filter_string = test_filter.AppendPatternsToFilter( - filter_string, - negative_patterns=[e["match"] for e in excludes]) - if args.skip_expected_failures: + excludes = test_run.get("excludes", []) filter_string = test_filter.AppendPatternsToFilter( filter_string, - negative_patterns=GetExpectedFailures()) + negative_patterns=[e["match"] for e in excludes]) if filter_string: return [TEST_FILTER_OPT + '=' + filter_string]
diff --git a/android_webview/tools/run_cts_test.py b/android_webview/tools/run_cts_test.py index 7377ccb3..a14f2d1e 100644 --- a/android_webview/tools/run_cts_test.py +++ b/android_webview/tools/run_cts_test.py
@@ -34,11 +34,8 @@ args.update(kwargs) return mock.Mock(**args) - def _getSkipString(self, skip_known_failures): - skips = [self._EXCLUDED_TEST.replace('#', '.')] - if skip_known_failures: - skips += [f.replace('#', '.') for f in run_cts.GetExpectedFailures()] - return ':'.join(skips) + def _getSkipString(self): + return self._EXCLUDED_TEST.replace('#', '.') def testDetermineArch_arm64(self): logging_mock = mock.Mock() @@ -87,114 +84,97 @@ msg='Should recommend the highest supported CTS release') def testNoFilter_SkipExpectedFailures(self): - skip_expected_failures = True - mock_args = self._getArgsMock(skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + mock_args = self._getArgsMock(skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=-' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testNoFilter_ExcludedMatches(self): - skip_expected_failures = False - mock_args = self._getArgsMock(skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) - self.assertEqual([run_cts.TEST_FILTER_OPT + '=-' + skip], + mock_args = self._getArgsMock(skip_expected_failures=False) + self.assertEqual([], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testFilter_CombinesExcludedMatches(self): - skip_expected_failures = False mock_args = self._getArgsMock(test_filter='good#test', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) - self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test-' + skip], + skip_expected_failures=False) + self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test'], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testFilter_CombinesAll(self): - skip_expected_failures = True mock_args = self._getArgsMock(test_filter='good#test', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test-' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testFilter_ForMultipleTests(self): - skip_expected_failures = True mock_args = self._getArgsMock(test_filter='good#t1:good#t2', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.t1:good.t2-' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testIsolatedFilter_CombinesExcludedMatches(self): - skip_expected_failures = False mock_args = self._getArgsMock(isolated_script_test_filter='good#test', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) - self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test-' + skip], + skip_expected_failures=False) + self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test'], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testIsolatedFilter_CombinesAll(self): - skip_expected_failures = True mock_args = self._getArgsMock(isolated_script_test_filter='good#test', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test-' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testIsolatedFilter_ForMultipleTests(self): - skip_expected_failures = True # Isolated test filters use :: to separate matches mock_args = self._getArgsMock( isolated_script_test_filter='good#t1::good#t2', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.t1:good.t2-' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testFilterFile_CombinesExcludedMatches(self): - skip_expected_failures = False with tempfile.NamedTemporaryFile(prefix='cts_run_test') as filter_file: filter_file.write('suite.goodtest') filter_file.seek(0) mock_args = self._getArgsMock( test_filter_file=filter_file.name, - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) - self.assertEqual([run_cts.TEST_FILTER_OPT + '=suite.goodtest-' + skip], + skip_expected_failures=False) + self.assertEqual([run_cts.TEST_FILTER_OPT + '=suite.goodtest'], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testFilterFile_CombinesAll(self): - skip_expected_failures = True with tempfile.NamedTemporaryFile(prefix='cts_run_test') as filter_file: filter_file.write('suite.goodtest') filter_file.seek(0) mock_args = self._getArgsMock( test_filter_file=filter_file.name, - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=suite.goodtest-' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testNegative_Filter(self): - skip_expected_failures = True mock_args = self._getArgsMock(test_filter='-good#t1:good#t2', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=-good.t1:good.t2:' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testNegative_IsolatedFilter(self): - skip_expected_failures = True mock_args = self._getArgsMock( isolated_script_test_filter='-good#t1::good#t2', - skip_expected_failures=skip_expected_failures) - skip = self._getSkipString(skip_expected_failures) + skip_expected_failures=True) + skip = self._getSkipString() self.assertEqual([run_cts.TEST_FILTER_OPT + '=-good.t1:good.t2:' + skip], run_cts.GetTestRunFilterArg(mock_args, self._CTS_RUN)) def testFilter_OverridesInclusion(self): - skip_expected_failures = False mock_args = self._getArgsMock(test_filter='good#test1', - skip_expected_failures=skip_expected_failures) + skip_expected_failures=False) cts_run = {'apk': 'module.apk', 'includes': [{'match': 'good#test2'}]} self.assertEqual([run_cts.TEST_FILTER_OPT + '=good.test1'], run_cts.GetTestRunFilterArg(mock_args, cts_run))
diff --git a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebPlatformTestsActivityTest.java b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebPlatformTestsActivityTest.java index 3af9980..52538e93 100644 --- a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebPlatformTestsActivityTest.java +++ b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebPlatformTestsActivityTest.java
@@ -52,7 +52,7 @@ new ActivityTestRule<>(WebPlatformTestsActivity.class, false, true); @Before - public void setUp() throws Exception { + public void setUp() { mTestActivity = mActivityTestRule.getActivity(); }
diff --git a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java index 22515c4..755fef9 100644 --- a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java +++ b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java
@@ -82,7 +82,7 @@ new ActivityTestRule<>(WebViewLayoutTestActivity.class, false, false); @Before - public void setUp() throws Exception { + public void setUp() { mTestActivity = mActivityTestRule.launchActivity(new Intent()); Bundle arguments = InstrumentationRegistry.getArguments(); if (arguments != null) { @@ -92,7 +92,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestActivity.finish(); }
diff --git a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewThreadTest.java b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewThreadTest.java index 8296543..d71c2d0 100644 --- a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewThreadTest.java +++ b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewThreadTest.java
@@ -39,12 +39,12 @@ new ActivityTestRule<>(WebViewThreadTestActivity.class, false, false); @Before - public void setUp() throws Exception { + public void setUp() { mActivity = mActivityTestRule.launchActivity(new Intent()); } @After - public void tearDown() throws Exception { + public void tearDown() { mActivity.finish(); }
diff --git a/android_webview/tools/system_webview_shell/page_cycler/src/org/chromium/webview_shell/page_cycler/PageCyclerTest.java b/android_webview/tools/system_webview_shell/page_cycler/src/org/chromium/webview_shell/page_cycler/PageCyclerTest.java index c3d2536b..17956ee 100644 --- a/android_webview/tools/system_webview_shell/page_cycler/src/org/chromium/webview_shell/page_cycler/PageCyclerTest.java +++ b/android_webview/tools/system_webview_shell/page_cycler/src/org/chromium/webview_shell/page_cycler/PageCyclerTest.java
@@ -62,7 +62,7 @@ new ActivityTestRule<>(PageCyclerTestActivity.class); @Before - public void setUp() throws Exception { + public void setUp() { mRule.launchActivity(null); } @@ -70,7 +70,7 @@ @LargeTest @UseMethodParameter(WebsiteParams.class) @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) - public void testVisitPage(String url) throws Throwable { + public void testVisitPage(String url) { final PageCyclerWebViewClient pageCyclerWebViewClient = new PageCyclerWebViewClient(); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override @@ -118,7 +118,7 @@ } private void loadUrlSync(final String url, final CallbackHelper pageFinishedCallback, - final CallbackHelper errorCallback) throws InterruptedException { + final CallbackHelper errorCallback) { boolean timeout = false; int pageFinishedCount = pageFinishedCallback.getCallCount(); int errorCount = errorCallback.getCallCount();
diff --git a/ash/app_list/views/app_list_folder_view.cc b/ash/app_list/views/app_list_folder_view.cc index 83f3fe5..c543afc 100644 --- a/ash/app_list/views/app_list_folder_view.cc +++ b/ash/app_list/views/app_list_folder_view.cc
@@ -610,10 +610,10 @@ 0, GetAppListConfig().search_box_fullscreen_top_padding(), 0, 0); } // Avoid overlap with the search box widget. - container_bounds.Inset(0, + container_bounds.Inset(8, search_box::kSearchBoxPreferredHeight + SearchBoxView::GetFocusRingSpacing(), - 0, 0); + 8, 0); preferred_bounds_.AdjustToFit(container_bounds);
diff --git a/ash/app_list/views/search_box_view.cc b/ash/app_list/views/search_box_view.cc index cc1eb50..ac126f9 100644 --- a/ash/app_list/views/search_box_view.cc +++ b/ash/app_list/views/search_box_view.cc
@@ -798,17 +798,13 @@ return; } - const bool embedded_assistant = - app_list_features::IsEmbeddedAssistantUIEnabled(); views::ImageButton* assistant = assistant_button(); assistant->SetImage( views::ImageButton::STATE_NORMAL, - gfx::CreateVectorIcon( - embedded_assistant ? ash::kAssistantMicIcon : ash::kAssistantIcon, - search_box::kIconSize, gfx::kGoogleGrey700)); - base::string16 assistant_button_label(l10n_util::GetStringUTF16( - embedded_assistant ? IDS_APP_LIST_START_ASSISTANT_VOICE_QUERY - : IDS_APP_LIST_START_ASSISTANT)); + gfx::CreateVectorIcon(ash::kAssistantIcon, search_box::kIconSize, + gfx::kGoogleGrey700)); + base::string16 assistant_button_label( + l10n_util::GetStringUTF16(IDS_APP_LIST_START_ASSISTANT)); assistant->SetAccessibleName(assistant_button_label); assistant->SetTooltipText(assistant_button_label); }
diff --git a/ash/app_list/views/search_result_container_view.h b/ash/app_list/views/search_result_container_view.h index f9c65fd..5a7093b 100644 --- a/ash/app_list/views/search_result_container_view.h +++ b/ash/app_list/views/search_result_container_view.h
@@ -124,7 +124,7 @@ // If true, left/right key events will traverse this container bool horizontally_traversable_ = false; - double container_score_; + double container_score_ = 0.0; SearchModel::SearchResults* results_ = nullptr; // Owned by SearchModel.
diff --git a/ash/display/screen_orientation_controller_unittest.cc b/ash/display/screen_orientation_controller_unittest.cc index 4642631..e3ef1af 100644 --- a/ash/display/screen_orientation_controller_unittest.cc +++ b/ash/display/screen_orientation_controller_unittest.cc
@@ -12,6 +12,7 @@ #include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller_test_api.h" #include "ash/public/cpp/app_types.h" +#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/ash_switches.h" #include "ash/shell.h" #include "ash/system/screen_layout_observer.h" @@ -24,6 +25,7 @@ #include "ash/wm/window_state.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/test/scoped_feature_list.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/compositor/layer_type.h" @@ -441,6 +443,10 @@ // Tests that the screen rotation notifications are suppressed when // triggered by the accelerometer. TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature( + features::kReduceDisplayNotifications); + EnableTabletMode(true); Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( true);
diff --git a/ash/public/cpp/ash_features.cc b/ash/public/cpp/ash_features.cc index 3a2add2..a0fa75d 100644 --- a/ash/public/cpp/ash_features.cc +++ b/ash/public/cpp/ash_features.cc
@@ -58,6 +58,9 @@ const base::Feature kPipRoundedCorners{"PipRoundedCorners", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kReduceDisplayNotifications{ + "ReduceDisplayNotifications", base::FEATURE_ENABLED_BY_DEFAULT}; + const base::Feature kSeparateNetworkIcons{"SeparateNetworkIcons", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -188,5 +191,9 @@ return base::FeatureList::IsEnabled(kDragFromShelfToHomeOrOverview); } +bool IsReduceDisplayNotificationsEnabled() { + return base::FeatureList::IsEnabled(kReduceDisplayNotifications); +} + } // namespace features } // namespace ash
diff --git a/ash/public/cpp/ash_features.h b/ash/public/cpp/ash_features.h index 3868c6f9..ee5abe8 100644 --- a/ash/public/cpp/ash_features.h +++ b/ash/public/cpp/ash_features.h
@@ -75,6 +75,9 @@ // Enables rounded corners for the Picture-in-picture window. ASH_PUBLIC_EXPORT extern const base::Feature kPipRoundedCorners; +// Enables suppression of Displays notifications other than resolution change. +ASH_PUBLIC_EXPORT extern const base::Feature kReduceDisplayNotifications; + // Enables displaying separate network icons for different networks types. // https://crbug.com/902409 ASH_PUBLIC_EXPORT extern const base::Feature kSeparateNetworkIcons; @@ -173,6 +176,8 @@ ASH_PUBLIC_EXPORT bool IsDragFromShelfToHomeOrOverviewEnabled(); +ASH_PUBLIC_EXPORT bool IsReduceDisplayNotificationsEnabled(); + } // namespace features } // namespace ash
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index 0557e77..5a4c216f 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -11,7 +11,6 @@ icons = [ "always_show_shelf.icon", "assistant.icon", - "assistant_mic.icon", "auto_hide.icon", "autoclick.icon", "autoclick_close.icon",
diff --git a/ash/resources/vector_icons/assistant_mic.icon b/ash/resources/vector_icons/assistant_mic.icon deleted file mode 100644 index 54f522a4..0000000 --- a/ash/resources/vector_icons/assistant_mic.icon +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -CANVAS_DIMENSIONS, 24, -PATH_COLOR_ARGB, 0xFF, 0x42, 0x85, 0xF4, -MOVE_TO, 12, 15, -R_ARC_TO, 3, 3, 0, 0, 0, 3, -3, -V_LINE_TO, 5, -R_ARC_TO, 3, 3, 0, 0, 0, -6, 0, -R_V_LINE_TO, 7, -R_ARC_TO, 3, 3, 0, 0, 0, 3, 3, -CLOSE, -NEW_PATH, -PATH_COLOR_ARGB, 0xFF, 0x34, 0xA8, 0x53, -MOVE_TO, 11, 18.92f, -R_H_LINE_TO, 2, -V_LINE_TO, 22, -R_H_LINE_TO, -2, -CLOSE, -NEW_PATH, -PATH_COLOR_ARGB, 0xFF, 0xFA, 0xBB, 0x05, -MOVE_TO, 7, 12, -H_LINE_TO, 5, -R_ARC_TO, 7, 7, 0, 0, 0, 2, 4.95f, -R_LINE_TO, 1.41f, -1.41f, -ARC_TO, 5, 5, 0, 0, 1, 7, 12, -CLOSE, -NEW_PATH, -PATH_COLOR_ARGB, 0xFF, 0xE9, 0x42, 0x35, -MOVE_TO, 12, 17, -R_ARC_TO, 5, 5, 0, 0, 1, -3.54f, -1.47f, -R_LINE_TO, -1.41f, 1.42f, -ARC_TO, 7, 7, 0, 0, 0, 19, 12, -R_H_LINE_TO, -2, -R_ARC_TO, 5, 5, 0, 0, 1, -5, 5, -CLOSE
diff --git a/ash/shelf/hotseat_widget.cc b/ash/shelf/hotseat_widget.cc index 77d4236..7dac7b4 100644 --- a/ash/shelf/hotseat_widget.cc +++ b/ash/shelf/hotseat_widget.cc
@@ -87,6 +87,9 @@ void HotseatWidget::DelegateView::Init( ScrollableShelfView* scrollable_shelf_view, ui::Layer* parent_layer) { + if (!chromeos::switches::ShouldShowScrollableShelf()) + return; + if (wallpaper_controller_) wallpaper_controller_->AddObserver(this); SetLayoutManager(std::make_unique<views::FillLayout>()); @@ -145,6 +148,9 @@ } void HotseatWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) { + if (!chromeos::switches::ShouldShowScrollableShelf()) + return; + views::View::ReorderChildLayers(parent_layer); parent_layer->StackAtBottom(&opaque_background_); }
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index bbfa191..63e90e0 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -2298,7 +2298,9 @@ // Tests that the shelf animates to the auto hidden bounds after a swipe down // on the visible shelf. -TEST_P(ShelfLayoutManagerTest, ShelfAnimatesToHiddenWhenGestureOutComplete) { +// TODO(https://crbug.com/1000463): Flaky. +TEST_P(ShelfLayoutManagerTest, + DISABLED_ShelfAnimatesToHiddenWhenGestureOutComplete) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
diff --git a/ash/system/network/network_tray_view.cc b/ash/system/network/network_tray_view.cc index 0a2e41f..95a44d2 100644 --- a/ash/system/network/network_tray_view.cc +++ b/ash/system/network/network_tray_view.cc
@@ -36,6 +36,7 @@ NetworkTrayView::NetworkTrayView(Shelf* shelf, ActiveNetworkIcon::Type type) : TrayItemView(shelf), type_(type) { Shell::Get()->system_tray_model()->network_state_model()->AddObserver(this); + Shell::Get()->session_controller()->AddObserver(this); CreateImageView(); UpdateNetworkStateHandlerIcon(); UpdateConnectionStatus(true /* notify_a11y */); @@ -45,6 +46,7 @@ network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); Shell::Get()->system_tray_model()->network_state_model()->RemoveObserver( this); + Shell::Get()->session_controller()->RemoveObserver(this); } const char* NetworkTrayView::GetClassName() const {
diff --git a/ash/system/screen_layout_observer.cc b/ash/system/screen_layout_observer.cc index 52085c2..2183674 100644 --- a/ash/system/screen_layout_observer.cc +++ b/ash/system/screen_layout_observer.cc
@@ -11,6 +11,7 @@ #include "ash/display/screen_orientation_controller.h" #include "ash/metrics/user_metrics_action.h" #include "ash/metrics/user_metrics_recorder.h" +#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/notification_utils.h" #include "ash/public/cpp/system_tray_client.h" #include "ash/resources/vector_icons/vector_icons.h" @@ -442,10 +443,19 @@ base::string16 message; base::string16 additional_message; - if (GetDisplayMessageForNotification(old_info, - should_notify_has_unassociated_display, - &message, &additional_message)) - CreateOrUpdateNotification(message, additional_message); + if (!GetDisplayMessageForNotification(old_info, + should_notify_has_unassociated_display, + &message, &additional_message)) + return; + + if (features::IsReduceDisplayNotificationsEnabled() && + !should_notify_has_unassociated_display) { + // If display notifications should be suppressed and the notification is not + // to alert the user of an unassociated display, do not show a notification. + return; + } + + CreateOrUpdateNotification(message, additional_message); } bool ScreenLayoutObserver::GetExitMirrorModeMessage(
diff --git a/ash/system/screen_layout_observer_unittest.cc b/ash/system/screen_layout_observer_unittest.cc index 5cb37e3..5c34e07 100644 --- a/ash/system/screen_layout_observer_unittest.cc +++ b/ash/system/screen_layout_observer_unittest.cc
@@ -4,6 +4,7 @@ #include "ash/system/screen_layout_observer.h" +#include "ash/public/cpp/ash_features.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/test/ash_test_base.h" @@ -53,13 +54,20 @@ base::string16 GetUnifiedDisplayName(); + bool IsNotificationShown() const; + + base::test::ScopedFeatureList scoped_feature_list_; + private: const message_center::Notification* GetDisplayNotification() const; DISALLOW_COPY_AND_ASSIGN(ScreenLayoutObserverTest); }; -ScreenLayoutObserverTest::ScreenLayoutObserverTest() = default; +ScreenLayoutObserverTest::ScreenLayoutObserverTest() { + scoped_feature_list_.InitAndDisableFeature( + features::kReduceDisplayNotifications); +} ScreenLayoutObserverTest::~ScreenLayoutObserverTest() = default; @@ -116,6 +124,11 @@ display_manager()->GetDisplayNameForId(display::kUnifiedDisplayId)); } +bool ScreenLayoutObserverTest::IsNotificationShown() const { + return !(GetDisplayNotificationText().empty() && + GetDisplayNotificationAdditionalText().empty()); +} + const message_center::Notification* ScreenLayoutObserverTest::GetDisplayNotification() const { const message_center::NotificationList::Notifications notifications = @@ -157,8 +170,7 @@ // No-update CloseNotification(); UpdateDisplay("400x400"); - EXPECT_TRUE(GetDisplayNotificationText().empty()); - EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); + EXPECT_FALSE(IsNotificationShown()); // Extended. CloseNotification(); @@ -176,8 +188,8 @@ display::ManagedDisplayInfo second_display_info = display::CreateDisplayInfo(second_display_id, gfx::Rect(2, 2, 500, 500)); std::vector<display::ManagedDisplayInfo> display_info_list; - display_info_list.emplace_back(first_display_info); - display_info_list.emplace_back(second_display_info); + display_info_list.push_back(first_display_info); + display_info_list.push_back(second_display_info); display_manager()->OnNativeDisplaysChanged(display_info_list); // Simulate that device can support at most two displays and user @@ -242,7 +254,7 @@ // Restore mirror mode. CloseNotification(); - display_info_list.emplace_back(second_display_info); + display_info_list.push_back(second_display_info); display_manager()->OnNativeDisplaysChanged(display_info_list); EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, GetMirroringDisplayNames()), @@ -273,6 +285,74 @@ EXPECT_TRUE(GetDisplayNotificationText().empty()); } +TEST_F(ScreenLayoutObserverTest, DisplayNotificationsDisabled) { + scoped_feature_list_.Reset(); + scoped_feature_list_.InitAndEnableFeature( + features::kReduceDisplayNotifications); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); + + UpdateDisplay("400x400"); + display::Display::SetInternalDisplayId(display_manager()->first_display_id()); + EXPECT_TRUE(GetDisplayNotificationText().empty()); + + // Rotation. + UpdateDisplay("400x400/r"); + EXPECT_FALSE(IsNotificationShown()); + + // Extended. + UpdateDisplay("400x400,200x200"); + EXPECT_FALSE(IsNotificationShown()); + + const int64_t first_display_id = + display::Screen::GetScreen()->GetPrimaryDisplay().id(); + const int64_t second_display_id = first_display_id + 1; + display::ManagedDisplayInfo first_display_info = + display::CreateDisplayInfo(first_display_id, gfx::Rect(1, 1, 500, 500)); + display::ManagedDisplayInfo second_display_info = + display::CreateDisplayInfo(second_display_id, gfx::Rect(2, 2, 500, 500)); + std::vector<display::ManagedDisplayInfo> display_info_list; + display_info_list.push_back(first_display_info); + display_info_list.push_back(second_display_info); + display_manager()->OnNativeDisplaysChanged(display_info_list); + + // Simulate that device can support at most two displays and user + // connects it with three displays. Notification should still be created to + // warn user of it. See issue 827406 (https://crbug.com/827406). + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) + .set_maximum_display(2u); + UpdateDisplay("400x400,200x200,100x100"); + EXPECT_TRUE(GetDisplayNotificationText().empty()); + EXPECT_EQ(l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_DISPLAY_REMOVED_EXCEEDED_MAXIMUM), + GetDisplayNotificationAdditionalText()); + EXPECT_TRUE(GetDisplayNotificationText().empty()); + UpdateDisplay("400x400,200x200"); + CloseNotification(); + + // Start tablet mode and wait until display mode is updated. + Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); + base::RunLoop().RunUntilIdle(); + + // Exit mirror mode manually. Now display mode should be extending mode. + display_manager()->SetMirrorMode(display::MirrorMode::kOff, base::nullopt); + EXPECT_FALSE(IsNotificationShown()); + + // Simulate that device can support at most two displays and user connects + // it with three displays. Because device is in tablet mode, display mode + // becomes mirror mode from extending mode. Under this circumstance, user is + // still notified of connecting more displays than maximum. See issue 827406 + // (https://crbug.com/827406). Notification should still be shown. + UpdateDisplay("400x400,200x200,100x100"); + EXPECT_EQ(l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_DISPLAY_REMOVED_EXCEEDED_MAXIMUM), + GetDisplayNotificationAdditionalText()); + EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, + GetMirroringDisplayNames()), + GetDisplayNotificationText()); + CloseNotification(); +} + // Zooming in Unified Mode results in display size changes rather than changes // in the UI scales, in which case, we still want to show a notification when // the source of change is not the settings ui. @@ -371,14 +451,12 @@ // /o creates the default overscan. UpdateDisplay("400x400, 300x300/o"); - EXPECT_TRUE(GetDisplayNotificationText().empty()); - EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); + EXPECT_FALSE(IsNotificationShown()); // Reset the overscan. Shell::Get()->display_manager()->SetOverscanInsets( display_manager()->GetSecondaryDisplay().id(), gfx::Insets()); - EXPECT_TRUE(GetDisplayNotificationText().empty()); - EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); + EXPECT_FALSE(IsNotificationShown()); } // Tests that exiting mirror mode by closing the lid shows the correct "exiting @@ -515,8 +593,7 @@ // Close the lid. We go to docked mode, but we show no notifications. UpdateDisplay("400x400"); - EXPECT_TRUE(GetDisplayNotificationText().empty()); - EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); + EXPECT_FALSE(IsNotificationShown()); } // Tests that rotation notifications are only shown when the rotation source is @@ -532,8 +609,7 @@ display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_90, display::Display::RotationSource::ACCELEROMETER); - EXPECT_TRUE(GetDisplayNotificationText().empty()); - EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); + EXPECT_FALSE(IsNotificationShown()); // The user source. display_manager()->SetDisplayRotation(primary_id,
diff --git a/base/android/javatests/src/org/chromium/base/CommandLineTest.java b/base/android/javatests/src/org/chromium/base/CommandLineTest.java index 787f85d..99c7916a 100644 --- a/base/android/javatests/src/org/chromium/base/CommandLineTest.java +++ b/base/android/javatests/src/org/chromium/base/CommandLineTest.java
@@ -38,7 +38,7 @@ static final String CL_ADDED_VALUE_2 = "bozo"; @Before - public void setUp() throws Exception { + public void setUp() { CommandLine.reset(); }
diff --git a/base/android/javatests/src/org/chromium/base/EarlyTraceEventTest.java b/base/android/javatests/src/org/chromium/base/EarlyTraceEventTest.java index 419cc6f..badab58 100644 --- a/base/android/javatests/src/org/chromium/base/EarlyTraceEventTest.java +++ b/base/android/javatests/src/org/chromium/base/EarlyTraceEventTest.java
@@ -63,7 +63,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); EarlyTraceEvent.resetForTesting(); }
diff --git a/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java b/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java index a943b16..871140a 100644 --- a/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java +++ b/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
@@ -22,7 +22,7 @@ @RunWith(BaseJUnit4ClassRunner.class) public class RecordHistogramTest { @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); }
diff --git a/base/android/javatests/src/org/chromium/base/task/PostTaskTest.java b/base/android/javatests/src/org/chromium/base/task/PostTaskTest.java index 85d2c7c..088124089 100644 --- a/base/android/javatests/src/org/chromium/base/task/PostTaskTest.java +++ b/base/android/javatests/src/org/chromium/base/task/PostTaskTest.java
@@ -60,7 +60,7 @@ @Test @SmallTest - public void testCreateSingleThreadTaskRunner() throws Exception { + public void testCreateSingleThreadTaskRunner() { TaskRunner taskQueue = PostTask.createSingleThreadTaskRunner(TaskTraits.USER_BLOCKING); // A SingleThreadTaskRunner with default traits will run in the native thread pool // and tasks posted won't run until after the native library has loaded. @@ -70,7 +70,7 @@ @Test @SmallTest - public void testCreateSequencedTaskRunner() throws Exception { + public void testCreateSequencedTaskRunner() { TaskRunner taskQueue = PostTask.createSequencedTaskRunner(TaskTraits.USER_BLOCKING); List<Integer> orderList = new ArrayList<>(); try { @@ -87,7 +87,7 @@ @Test @SmallTest - public void testCreateTaskRunner() throws Exception { + public void testCreateTaskRunner() { TaskRunner taskQueue = PostTask.createTaskRunner(TaskTraits.USER_BLOCKING); // This should not timeout.
diff --git a/base/android/javatests/src/org/chromium/base/task/SingleThreadTaskRunnerImplTest.java b/base/android/javatests/src/org/chromium/base/task/SingleThreadTaskRunnerImplTest.java index 173aebc..819ab69 100644 --- a/base/android/javatests/src/org/chromium/base/task/SingleThreadTaskRunnerImplTest.java +++ b/base/android/javatests/src/org/chromium/base/task/SingleThreadTaskRunnerImplTest.java
@@ -35,7 +35,7 @@ @RunWith(BaseJUnit4ClassRunner.class) public class SingleThreadTaskRunnerImplTest { @Before - public void setUp() throws Exception { + public void setUp() { mHandlerThread = new HandlerThread("SingleThreadTaskRunnerImplTest thread"); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper());
diff --git a/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java b/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java index 5186a80..d9848df 100644 --- a/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java +++ b/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java
@@ -102,7 +102,7 @@ // call ClearException() and act as appropriate. // See more details at the "@CalledByNativeUnchecked" annotation. @CalledByNativeUnchecked - void methodThatThrowsException() throws Exception {} + void methodThatThrowsException() {} // The generator is not confused by inline comments: // @CalledByNative void thisShouldNotAppearInTheOutput();
diff --git a/base/android/junit/src/org/chromium/base/ApplicationStatusTest.java b/base/android/junit/src/org/chromium/base/ApplicationStatusTest.java index 9607699..df2c13c9 100644 --- a/base/android/junit/src/org/chromium/base/ApplicationStatusTest.java +++ b/base/android/junit/src/org/chromium/base/ApplicationStatusTest.java
@@ -49,7 +49,7 @@ } @Test - public void testWindowsFocusChanged() throws Exception { + public void testWindowsFocusChanged() { ApplicationStatus.WindowFocusChangedListener mock = mock(ApplicationStatus.WindowFocusChangedListener.class); ApplicationStatus.registerWindowFocusChangedListener(mock);
diff --git a/base/android/junit/src/org/chromium/base/process_launcher/ChildProcessConnectionTest.java b/base/android/junit/src/org/chromium/base/process_launcher/ChildProcessConnectionTest.java index f5275fb..29f80a1 100644 --- a/base/android/junit/src/org/chromium/base/process_launcher/ChildProcessConnectionTest.java +++ b/base/android/junit/src/org/chromium/base/process_launcher/ChildProcessConnectionTest.java
@@ -394,7 +394,7 @@ } @Test - public void testBindingStateCounts() throws RemoteException { + public void testBindingStateCounts() { ChildProcessConnection.resetBindingStateCountsForTesting(); ChildProcessConnection connection0 = createDefaultTestConnection(); ChildServiceConnectionMock connectionMock0 = mFirstServiceConnection;
diff --git a/base/test/android/javatests/src/org/chromium/base/test/DestroyActivitiesRule.java b/base/test/android/javatests/src/org/chromium/base/test/DestroyActivitiesRule.java index 0c0b8b26..9f4e95f 100644 --- a/base/test/android/javatests/src/org/chromium/base/test/DestroyActivitiesRule.java +++ b/base/test/android/javatests/src/org/chromium/base/test/DestroyActivitiesRule.java
@@ -82,7 +82,7 @@ }); try { allDestroyedCalledback.waitForFirst(); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { // There appears to be a framework bug on K and L where onStop and onDestroy are not // called for a handful of tests. We ignore these exceptions. Log.w(TAG, "Activity failed to be destroyed after a test");
diff --git a/base/test/android/javatests/src/org/chromium/base/test/util/CallbackHelper.java b/base/test/android/javatests/src/org/chromium/base/test/util/CallbackHelper.java index 2aa5d4a..c735d7b 100644 --- a/base/test/android/javatests/src/org/chromium/base/test/util/CallbackHelper.java +++ b/base/test/android/javatests/src/org/chromium/base/test/util/CallbackHelper.java
@@ -169,18 +169,21 @@ * currentCallCount was obtained) that we will wait for. * @param timeout timeout value for all callbacks to occur. * @param unit timeout unit. - * @throws InterruptedException * @throws TimeoutException Thrown if the method times out before onPageFinished is called. */ public void waitForCallback(String msg, int currentCallCount, int numberOfCallsToWaitFor, - long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { + long timeout, TimeUnit unit) throws TimeoutException { assert mCallCount >= currentCallCount; assert numberOfCallsToWaitFor > 0; TimeoutTimer timer = new TimeoutTimer(unit.toMillis(timeout)); synchronized (mLock) { int callCountWhenDoneWaiting = currentCallCount + numberOfCallsToWaitFor; while (callCountWhenDoneWaiting > mCallCount && !timer.isTimedOut()) { - mLock.wait(timer.getRemainingMs()); + try { + mLock.wait(timer.getRemainingMs()); + } catch (InterruptedException e) { + // Ignore the InterruptedException. Rely on the outer while loop to re-run. + } if (mFailureString != null) { String s = mFailureString; mFailureString = null; @@ -197,7 +200,7 @@ * @see #waitForCallback(String, int, int, long, TimeUnit) */ public void waitForCallback(int currentCallCount, int numberOfCallsToWaitFor, long timeout, - TimeUnit unit) throws InterruptedException, TimeoutException { + TimeUnit unit) throws TimeoutException { waitForCallback(null, currentCallCount, numberOfCallsToWaitFor, timeout, unit); } @@ -205,7 +208,7 @@ * @see #waitForCallback(String, int, int, long, TimeUnit) */ public void waitForCallback(int currentCallCount, int numberOfCallsToWaitFor) - throws InterruptedException, TimeoutException { + throws TimeoutException { waitForCallback(null, currentCallCount, numberOfCallsToWaitFor, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); } @@ -213,24 +216,21 @@ /** * @see #waitForCallback(String, int, int, long, TimeUnit) */ - public void waitForCallback(String msg, int currentCallCount) - throws InterruptedException, TimeoutException { + public void waitForCallback(String msg, int currentCallCount) throws TimeoutException { waitForCallback(msg, currentCallCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); } /** * @see #waitForCallback(String, int, int, long, TimeUnit) */ - public void waitForCallback(int currentCallCount) - throws InterruptedException, TimeoutException { + public void waitForCallback(int currentCallCount) throws TimeoutException { waitForCallback(null, currentCallCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); } /** * Wait until the callback has been called once. */ - public void waitForFirst(String msg, long timeout, TimeUnit unit) - throws InterruptedException, TimeoutException { + public void waitForFirst(String msg, long timeout, TimeUnit unit) throws TimeoutException { MatcherAssert.assertThat( "Use waitForCallback(currentCallCount) for callbacks that are called multiple " + "times.", @@ -242,22 +242,21 @@ /** * Wait until the callback has been called once. */ - public void waitForFirst(long timeout, TimeUnit unit) - throws InterruptedException, TimeoutException { + public void waitForFirst(long timeout, TimeUnit unit) throws TimeoutException { waitForFirst(null, timeout, unit); } /** * Wait until the callback has been called once. */ - public void waitForFirst(String msg) throws InterruptedException, TimeoutException { + public void waitForFirst(String msg) throws TimeoutException { waitForFirst(msg, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); } /** * Wait until the callback has been called at least once. */ - public void waitForFirst() throws InterruptedException, TimeoutException { + public void waitForFirst() throws TimeoutException { waitForFirst(null); }
diff --git a/base/test/android/junit/src/org/chromium/base/task/test/BackgroundShadowAsyncTask.java b/base/test/android/junit/src/org/chromium/base/task/test/BackgroundShadowAsyncTask.java index 6d53954..a39298d 100644 --- a/base/test/android/junit/src/org/chromium/base/task/test/BackgroundShadowAsyncTask.java +++ b/base/test/android/junit/src/org/chromium/base/task/test/BackgroundShadowAsyncTask.java
@@ -34,7 +34,7 @@ return sExecutorService .submit(new Callable<AsyncTask<Result>>() { @Override - public AsyncTask<Result> call() throws Exception { + public AsyncTask<Result> call() { return BackgroundShadowAsyncTask.super.executeInRobolectric(); } })
diff --git a/base/test/android/junit/src/org/chromium/base/test/util/TestRunnerTestRule.java b/base/test/android/junit/src/org/chromium/base/test/util/TestRunnerTestRule.java index 64805c1..22efb72a 100644 --- a/base/test/android/junit/src/org/chromium/base/test/util/TestRunnerTestRule.java +++ b/base/test/android/junit/src/org/chromium/base/test/util/TestRunnerTestRule.java
@@ -43,7 +43,7 @@ } @Override - protected void before() throws Throwable { + protected void before() { // Register a fake Instrumentation so that class runners for instrumentation tests // can be run even in Robolectric tests. Instrumentation instrumentation = new Instrumentation() { @@ -82,17 +82,17 @@ // TODO(bauerb): Using Mockito mock() or spy() throws a ClassCastException. RunListener runListener = new RunListener() { @Override - public void testStarted(Description description) throws Exception { + public void testStarted(Description description) { testLog.runTests.add(description); } @Override - public void testFinished(Description description) throws Exception { + public void testFinished(Description description) { Assert.assertThat(description, isIn(testLog.runTests)); } @Override - public void testFailure(Failure failure) throws Exception { + public void testFailure(Failure failure) { fail(failure.toString()); } @@ -102,7 +102,7 @@ } @Override - public void testIgnored(Description description) throws Exception { + public void testIgnored(Description description) { testLog.skippedTests.add(description); } };
diff --git a/base/trace_event/trace_config.h b/base/trace_event/trace_config.h index 29261905..3e3d0078a 100644 --- a/base/trace_event/trace_config.h +++ b/base/trace_event/trace_config.h
@@ -256,6 +256,11 @@ // Write the string representation of the CategoryFilter part. std::string ToCategoryFilterString() const; + // Write the string representation of the trace options part (record mode, + // systrace, argument filtering). Does not include category filters, event + // filters, or memory dump configs. + std::string ToTraceOptionsString() const; + // Returns true if at least one category in the list is enabled by this // trace config. This is used to determine if the category filters are // enabled in the TRACE_* macros. @@ -323,8 +328,6 @@ void SetEventFiltersFromConfigList(const Value& event_filters); Value ToValue() const; - std::string ToTraceOptionsString() const; - TraceRecordMode record_mode_; size_t trace_buffer_size_in_events_ = 0; // 0 specifies default size size_t trace_buffer_size_in_kb_ = 0; // 0 specifies default size
diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py index 8664908e..9df4897 100755 --- a/build/android/apk_operations.py +++ b/build/android/apk_operations.py
@@ -18,7 +18,6 @@ import random import re import shlex -import shutil import sys import tempfile import textwrap @@ -129,8 +128,6 @@ def _InstallBundle(devices, bundle_apks, package_name, command_line_flags_file, modules, fake_modules): - # Path to push fake modules for Chrome to pick up. - MODULES_SRC_DIRECTORY_PATH = '/data/local/tmp/modules' # Path Chrome creates after validating fake modules. This needs to be cleared # for pushed fake modules to be picked up. SPLITCOMPAT_PATH = '/data/data/' + package_name + '/files/splitcompat' @@ -151,88 +148,24 @@ else: logging.info('Skipped removing nonexistent %s', SPLITCOMPAT_PATH) - def InstallFakeModules(device): - try: - temp_path = tempfile.mkdtemp() - - if not fake_modules: - # Push empty temp_path to clear folder on device and update the cache. - device.PushChangedFiles([(temp_path, MODULES_SRC_DIRECTORY_PATH)], - delete_device_stale=True) - return - - # Device-spec JSON is needed, so create that first. - device_spec_filename = os.path.join(temp_path, 'device_spec.json') - get_device_spec_cmd_args = [ - 'get-device-spec', '--adb=' + adb_wrapper.AdbWrapper.GetAdbPath(), - '--device-id=' + device.serial, '--output=' + device_spec_filename - ] - bundletool.RunBundleTool(get_device_spec_cmd_args) - - # Extract fake modules to temp directory. For now, installation - # requires running 'bundletool extract-apks'. Unfortunately, this leads - # to unneeded compression of module files. - extract_apks_cmd_args = [ - 'extract-apks', '--apks=' + bundle_apks, - '--device-spec=' + device_spec_filename, - '--modules=' + ','.join(fake_modules), '--output-dir=' + temp_path - ] - bundletool.RunBundleTool(extract_apks_cmd_args) - - # Push fake modules, with renames. - fake_module_apks = set() - for fake_module in fake_modules: - found_master = False - - for filename in os.listdir(temp_path): - # If file matches expected format, rename it to follow conventions - # required by splitcompatting. - match = re.match(r'%s-([a-z_0-9]+)\.apk' % fake_module, filename) - local_path = os.path.join(temp_path, filename) - - if not match: - continue - - module_suffix = match.group(1) - remote = os.path.join( - temp_path, '%s.config.%s.apk' % (fake_module, module_suffix)) - # Check if filename matches a master apk. - if 'master' in module_suffix: - if found_master: - raise Exception('Expect 1 master apk file for %s' % fake_module) - found_master = True - remote = os.path.join(temp_path, '%s.apk' % fake_module) - - os.rename(local_path, remote) - fake_module_apks.add(os.path.basename(remote)) - - # Files that weren't renamed should not be pushed, remove from temp_path. - for filename in os.listdir(temp_path): - if filename not in fake_module_apks: - os.remove(os.path.join(temp_path, filename)) - - device.PushChangedFiles([(temp_path, MODULES_SRC_DIRECTORY_PATH)], - delete_device_stale=True) - - finally: - shutil.rmtree(temp_path, ignore_errors=True) - def Install(device): ClearFakeModules(device) - if fake_modules: + if fake_modules and ShouldWarnFakeFeatureModuleInstallFlag(device): # Print warning if command line is not set up for fake modules. - if ShouldWarnFakeFeatureModuleInstallFlag(device): - msg = ('Command line has no %s: Fake modules will be ignored.' % - FAKE_FEATURE_MODULE_INSTALL) - print(_Colorize(msg, colorama.Fore.YELLOW + colorama.Style.BRIGHT)) + msg = ('Command line has no %s: Fake modules will be ignored.' % + FAKE_FEATURE_MODULE_INSTALL) + print(_Colorize(msg, colorama.Fore.YELLOW + colorama.Style.BRIGHT)) - InstallFakeModules(device) - device.Install(bundle_apks, modules=modules, allow_downgrade=True) + device.Install( + bundle_apks, + modules=modules, + fake_modules=fake_modules, + allow_downgrade=True) # Basic checks for |modules| and |fake_modules|. # * |fake_modules| cannot include 'base'. # * If |fake_modules| is given, ensure |modules| includes 'base'. - # * They must be disjoint. + # * They must be disjoint (checked by device.Install). modules_set = set(modules) if modules else set() fake_modules_set = set(fake_modules) if fake_modules else set() if BASE_MODULE in fake_modules_set: @@ -240,8 +173,6 @@ if fake_modules_set and BASE_MODULE not in modules_set: raise Exception( '\'-f FAKE\' must be accompanied by \'-m {}\''.format(BASE_MODULE)) - if fake_modules_set.intersection(modules_set): - raise Exception('\'-m\' and \'-f\' entries must be disjoint.') logging.info('Installing bundle.') device_utils.DeviceUtils.parallel(devices).pMap(Install)
diff --git a/build/android/bytecode/BUILD.gn b/build/android/bytecode/BUILD.gn index 326b380..fa911f6 100644 --- a/build/android/bytecode/BUILD.gn +++ b/build/android/bytecode/BUILD.gn
@@ -14,7 +14,6 @@ "java/org/chromium/bytecode/ConstantPoolReferenceReader.java", "java/org/chromium/bytecode/CustomClassLoaderClassWriter.java", "java/org/chromium/bytecode/CustomResourcesClassAdapter.java", - "java/org/chromium/bytecode/SplitCompatClassAdapter.java", "java/org/chromium/bytecode/ThreadAssertionClassAdapter.java", "java/org/chromium/bytecode/TypeUtils.java", ]
diff --git a/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java b/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java index 56b84845..2a0ea504f 100644 --- a/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java +++ b/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java
@@ -64,7 +64,6 @@ private static ClassLoader sFullClassPathClassLoader; private static Set<String> sFullClassPathJarPaths; private static String sGenerateClassDepsPath; - private static Set<String> sSplitCompatClassNames; private static ClassPathValidator sValidator; private static class EntryDataPair { @@ -138,10 +137,6 @@ chain = new CustomResourcesClassAdapter( chain, reader.getClassName(), reader.getSuperName(), sFullClassPathClassLoader); } - if (!sSplitCompatClassNames.isEmpty()) { - chain = new SplitCompatClassAdapter( - chain, sSplitCompatClassNames, sFullClassPathClassLoader); - } reader.accept(chain, 0); byte[] patchedByteCode = writer.toByteArray(); return EntryDataPair.create(entry.getName(), patchedByteCode); @@ -277,13 +272,6 @@ currIndex += directJarsLength; sDirectClassPathClassLoader = loadJars(directClassPathJarPaths); - // Load list of class names that need to be fixed. - int splitCompatClassNamesLength = Integer.parseInt(args[currIndex++]); - sSplitCompatClassNames = new HashSet<>(); - sSplitCompatClassNames.addAll(Arrays.asList( - Arrays.copyOfRange(args, currIndex, currIndex + splitCompatClassNamesLength))); - currIndex += splitCompatClassNamesLength; - // Load all jars that are on the classpath for the input jar for analyzing class hierarchy. sFullClassPathJarPaths = new HashSet<>(); sFullClassPathJarPaths.clear();
diff --git a/build/android/bytecode/java/org/chromium/bytecode/SplitCompatClassAdapter.java b/build/android/bytecode/java/org/chromium/bytecode/SplitCompatClassAdapter.java deleted file mode 100644 index 199c038..0000000 --- a/build/android/bytecode/java/org/chromium/bytecode/SplitCompatClassAdapter.java +++ /dev/null
@@ -1,167 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.bytecode; - -import static org.objectweb.asm.Opcodes.ACC_PROTECTED; -import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.INVOKEINTERFACE; -import static org.objectweb.asm.Opcodes.INVOKESPECIAL; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; -import static org.objectweb.asm.Opcodes.RETURN; - -import static org.chromium.bytecode.TypeUtils.CONTEXT; -import static org.chromium.bytecode.TypeUtils.VOID; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -import java.util.Set; - -/** - * A ClassVisitor for injecting ModuleInstaller.initActivity(activity) method call - * into Activity's attachBaseContext() method. The goal is to eventually invoke - * SplitCompat.install() method if running with the binary that has bundle support - * enabled. This needs to happen for activities that were not built with SplitCompat - * support. - */ -class SplitCompatClassAdapter extends ClassVisitor { - private static final String ANDROID_APP_ACTIVITY_CLASS_NAME = "android/app/Activity"; - private static final String ATTACH_BASE_CONTEXT_METHOD_NAME = "attachBaseContext"; - private static final String ATTACH_BASE_CONTEXT_DESCRIPTOR = - TypeUtils.getMethodDescriptor(VOID, CONTEXT); - - private static final String MODULE_INSTALLER_CLASS_NAME = - "org/chromium/components/module_installer/ModuleInstaller"; - private static final String GET_INSTANCE_METHOD_NAME = "getInstance"; - private static final String GET_INSTANCE_DESCRIPTOR = - TypeUtils.getMethodDescriptor(MODULE_INSTALLER_CLASS_NAME); - private static final String INIT_ACTIVITY_METHOD_NAME = "initActivity"; - private static final String INIT_ACTIVITY_DESCRIPTOR = - TypeUtils.getMethodDescriptor(VOID, ANDROID_APP_ACTIVITY_CLASS_NAME); - - private boolean mShouldTransform; - - private Set<String> mClassNames; - - private ClassLoader mClassLoader; - - /** - * Creates instance of SplitCompatClassAdapter. - * - * @param visitor - * @param classNames Names of classes into which the attachBaseContext method will be - * injected. Currently, we'll only consider classes for bytecode rewriting only if - * they inherit directly from android.app.Activity & not already contain - * attachBaseContext method. - * @param classLoader - */ - SplitCompatClassAdapter(ClassVisitor visitor, Set<String> classNames, ClassLoader classLoader) { - super(Opcodes.ASM5, visitor); - - mShouldTransform = false; - mClassNames = classNames; - mClassLoader = classLoader; - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, - String[] interfaces) { - super.visit(version, access, name, signature, superName, interfaces); - - if (mClassNames.contains(name)) { - if (!isSubclassOfActivity(name)) { - throw new RuntimeException(name - + " should be transformed but does not inherit from android.app.Activity"); - } - - mShouldTransform = true; - } - } - - @Override - public MethodVisitor visitMethod( - int access, String name, String descriptor, String signature, String[] exceptions) { - // Check if current method matches attachBaseContext & we're supposed to emit code - if so, - // fail. - if (mShouldTransform && name.equals(ATTACH_BASE_CONTEXT_METHOD_NAME)) { - throw new RuntimeException(ATTACH_BASE_CONTEXT_METHOD_NAME + " method already exists"); - } - - return super.visitMethod(access, name, descriptor, signature, exceptions); - } - - @Override - public void visitEnd() { - if (mShouldTransform) { - // If we reached this place, it means we're rewriting a class that inherits from - // Activity and there was no exception thrown due to existence of attachBaseContext - // method - emit code. - emitAttachBaseContext(); - } - - super.visitEnd(); - } - - /** - * Generates: - * - * <pre> - * protected void attachBaseContext(Context base) { - * super.attachBaseContext(base); - * ModuleInstaller.getInstance().initActivity(this); - * } - * </pre> - */ - private void emitAttachBaseContext() { - MethodVisitor mv = super.visitMethod(ACC_PROTECTED, ATTACH_BASE_CONTEXT_METHOD_NAME, - ATTACH_BASE_CONTEXT_DESCRIPTOR, null, null); - mv.visitCode(); - // Push "this" on stack. - mv.visitVarInsn(ALOAD, 0); - // Push first method parameter on stack (Context). - mv.visitVarInsn(ALOAD, 1); - // Pop argument from stack (Context). - // Pop target object from stack ("this"). - // Calls attachBaseContext. - mv.visitMethodInsn(INVOKESPECIAL, ANDROID_APP_ACTIVITY_CLASS_NAME, - ATTACH_BASE_CONTEXT_METHOD_NAME, ATTACH_BASE_CONTEXT_DESCRIPTOR, false); - // Push return value on stack (ModuleInstaller). - // Calls getInstance. - mv.visitMethodInsn(INVOKESTATIC, MODULE_INSTALLER_CLASS_NAME, GET_INSTANCE_METHOD_NAME, - GET_INSTANCE_DESCRIPTOR, true); - // Push "this" on stack. - mv.visitVarInsn(ALOAD, 0); - // Pop argument from stack ("this"). - // Pop target object from stack (ModuleInstaller). - // Calls initActivity. - mv.visitMethodInsn(INVOKEINTERFACE, MODULE_INSTALLER_CLASS_NAME, INIT_ACTIVITY_METHOD_NAME, - INIT_ACTIVITY_DESCRIPTOR, true); - mv.visitInsn(RETURN); - // Max stack size = 2 (Only push at most 2 before popping). - // Max locals = 2 ("this" and 1 parameter). - mv.visitMaxs(2, 2); - mv.visitEnd(); - } - - /** - * Checks whether passed in class inherits from android.app.Activity. - * @param name Name of the class to be checked. - * @return true if class inherits from android.app.Activity, false otherwise. - */ - private boolean isSubclassOfActivity(String name) { - Class<?> activityClass = loadClass(ANDROID_APP_ACTIVITY_CLASS_NAME); - Class<?> candidateClass = loadClass(name); - return activityClass.isAssignableFrom(candidateClass); - } - - private Class<?> loadClass(String className) { - try { - return mClassLoader.loadClass(className.replace('/', '.')); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - } -}
diff --git a/build/android/gyp/bytecode_processor.py b/build/android/gyp/bytecode_processor.py index adff162..e1bfefc 100755 --- a/build/android/gyp/bytecode_processor.py +++ b/build/android/gyp/bytecode_processor.py
@@ -37,11 +37,6 @@ _AddSwitch(parser, '--enable-thread-annotations') _AddSwitch(parser, '--enable-check-class-path') parser.add_argument('--enable-class-deps-output', default='') - parser.add_argument( - '--split-compat-class-names', - action='append', - default=[], - help='Names of classes that need to be made SplitCompat-enabled.') args = parser.parse_args(argv) sdk_jars = build_utils.ParseGnList(args.sdk_classpath_jars) @@ -54,9 +49,6 @@ for a in args.extra_jars: extra_classpath_jars.extend(build_utils.ParseGnList(a)) - split_compat_class_names = build_utils.ParseGnList( - args.split_compat_class_names) - if args.verbose: verbose = '--verbose' else: @@ -68,9 +60,7 @@ args.enable_thread_annotations, args.enable_check_class_path, args.enable_class_deps_output, str(len(sdk_jars)) - ] + sdk_jars + [str(len(direct_jars))] + direct_jars + [ - str(len(split_compat_class_names)) - ] + split_compat_class_names + extra_classpath_jars) + ] + sdk_jars + [str(len(direct_jars))] + direct_jars + extra_classpath_jars) subprocess.check_call(cmd)
diff --git a/build/android/gyp/dex.py b/build/android/gyp/dex.py index 6d29ac5..955c8f6 100755 --- a/build/android/gyp/dex.py +++ b/build/android/gyp/dex.py
@@ -27,7 +27,23 @@ build_utils.AddDepfileOption(parser) parser.add_argument('--output', required=True, help='Dex output path.') - parser.add_argument('--input-list', help='GN-list of additional input paths.') + parser.add_argument( + '--class-inputs', + action='append', + help='GN-list of .jars with .class files.') + parser.add_argument( + '--class-inputs-filearg', + action='append', + help='GN-list of .jars with .class files (added to depfile).') + parser.add_argument( + '--dex-inputs', action='append', help='GN-list of .jars with .dex files.') + parser.add_argument( + '--dex-inputs-filearg', + action='append', + help='GN-list of .jars with .dex files (added to depfile).') + parser.add_argument( + '--incremental-dir', + help='Path of directory to put intermediate dex files.') parser.add_argument( '--main-dex-list-path', help='File containing a list of the classes to include in the main dex.') @@ -44,7 +60,6 @@ 'main dex and keeps all line number information, and then some.') parser.add_argument( '--min-api', help='Minimum Android API level compatibility.') - parser.add_argument('inputs', nargs='*', help='Input .jar files.') group = parser.add_argument_group('Dexlayout') group.add_argument( @@ -79,8 +94,12 @@ if options.main_dex_list_path and not options.multi_dex: parser.error('--main-dex-list-path is unused if multidex is not enabled') - if options.input_list: - options.inputs += build_utils.ParseGnList(options.input_list) + options.class_inputs = build_utils.ParseGnList(options.class_inputs) + options.class_inputs_filearg = build_utils.ParseGnList( + options.class_inputs_filearg) + options.dex_inputs = build_utils.ParseGnList(options.dex_inputs) + options.dex_inputs_filearg = build_utils.ParseGnList( + options.dex_inputs_filearg) return options @@ -249,48 +268,142 @@ return final_output -def _PerformDexing(options): - dex_cmd = ['java', '-jar', options.r8_jar_path, 'd8', '--no-desugaring'] +def _CreateFinalDex(options, d8_inputs, tmp_dir, dex_cmd): if options.multi_dex and options.main_dex_list_path: - dex_cmd += ['--main-dex-list', options.main_dex_list_path] + # Provides a list of classes that should be included in the main dex file. + dex_cmd = dex_cmd + ['--main-dex-list', options.main_dex_list_path] + + tmp_dex_dir = os.path.join(tmp_dir, 'tmp_dex_dir') + os.mkdir(tmp_dex_dir) + _RunD8(dex_cmd, d8_inputs, tmp_dex_dir) + + dex_files = [os.path.join(tmp_dex_dir, f) for f in os.listdir(tmp_dex_dir)] + + if not options.output.endswith('.dex'): + tmp_dex_output = os.path.join(tmp_dir, 'tmp_dex_output.zip') + _ZipAligned(sorted(dex_files), tmp_dex_output) + else: + # Output to a .dex file. + if len(dex_files) > 1: + raise Exception('%d files created, expected 1' % len(dex_files)) + tmp_dex_output = dex_files[0] + + if options.dexlayout_profile: + tmp_dex_output = _PerformDexlayout(tmp_dir, tmp_dex_output, options) + + # The dex file is complete and can be moved out of tmp_dir. + shutil.move(tmp_dex_output, options.output) + + +def _IntermediateDexFilePathsFromInputJars(class_inputs, incremental_dir): + """Returns a list of all intermediate dex file paths.""" + dex_files = [] + for jar in class_inputs: + with zipfile.ZipFile(jar, 'r') as z: + for subpath in z.namelist(): + if subpath.endswith('.class'): + subpath = subpath[:-5] + 'dex' + dex_files.append(os.path.join(incremental_dir, subpath)) + return dex_files + + +def _DeleteStaleIncrementalDexFiles(dex_dir, dex_files): + """Deletes intermediate .dex files that are no longer needed.""" + all_files = build_utils.FindInDirectory(dex_dir) + desired_files = set(dex_files) + for path in all_files: + if path not in desired_files: + os.unlink(path) + + +def _ExtractClassFiles(changes, tmp_dir, class_inputs): + classes_list = [] + for jar in class_inputs: + if changes: + changed_class_list = set(changes.IterChangedSubpaths(jar)) + predicate = lambda x: x in changed_class_list and x.endswith('.class') + else: + predicate = lambda x: x.endswith('.class') + + classes_list.extend( + build_utils.ExtractAll(jar, path=tmp_dir, predicate=predicate)) + return classes_list + + +def _CreateIntermediateDexFiles(changes, options, tmp_dir, dex_cmd): + # Create temporary directory for classes to be extracted to. + tmp_extract_dir = os.path.join(tmp_dir, 'tmp_extract_dir') + os.mkdir(tmp_extract_dir) + + # Check whether changes were to a non-jar file, requiring full re-dex. + # E.g. r8.jar updated. + rebuild_all = changes.HasStringChanges() or not all( + p.endswith('.jar') for p in changes.IterChangedPaths()) + + if rebuild_all: + changes = None + class_files = _ExtractClassFiles(changes, tmp_extract_dir, + options.class_inputs) + + # If the only change is deleting a file, class_files will be empty. + if class_files: + # Dex necessary classes into intermediate dex files. + dex_cmd = dex_cmd + ['--intermediate', '--file-per-class'] + _RunD8(dex_cmd, class_files, options.incremental_dir) + + +def _OnStaleMd5(changes, options, final_dex_inputs, dex_cmd): + with build_utils.TempDir() as tmp_dir: + if options.incremental_dir: + # Create directory for all intermediate dex files. + if not os.path.exists(options.incremental_dir): + os.makedirs(options.incremental_dir) + + _DeleteStaleIncrementalDexFiles(options.incremental_dir, final_dex_inputs) + _CreateIntermediateDexFiles(changes, options, tmp_dir, dex_cmd) + + _CreateFinalDex(options, final_dex_inputs, tmp_dir, dex_cmd) + + +def main(args): + logging.basicConfig( + level=logging.INFO, + format='%(levelname).1s %(relativeCreated)6d %(message)s') + options = _ParseArgs(args) + + options.class_inputs += options.class_inputs_filearg + options.dex_inputs += options.dex_inputs_filearg + + input_paths = options.class_inputs + options.dex_inputs + if options.multi_dex and options.main_dex_list_path: + input_paths.append(options.main_dex_list_path) + input_paths.append(options.r8_jar_path) + + output_paths = [options.output] + + if options.incremental_dir: + final_dex_inputs = _IntermediateDexFilePathsFromInputJars( + options.class_inputs, options.incremental_dir) + output_paths += final_dex_inputs + else: + final_dex_inputs = list(options.class_inputs) + final_dex_inputs += options.dex_inputs + + dex_cmd = ['java', '-jar', options.r8_jar_path, 'd8', '--no-desugaring'] if options.release: dex_cmd += ['--release'] if options.min_api: dex_cmd += ['--min-api', options.min_api] - with build_utils.TempDir() as tmp_dir: - tmp_dex_dir = os.path.join(tmp_dir, 'tmp_dex_dir') - os.mkdir(tmp_dex_dir) - _RunD8(dex_cmd, options.inputs, tmp_dex_dir) - dex_files = [os.path.join(tmp_dex_dir, f) for f in os.listdir(tmp_dex_dir)] - - if not options.output.endswith('.dex'): - tmp_dex_output = os.path.join(tmp_dir, 'tmp_dex_output.zip') - _ZipAligned(sorted(dex_files), tmp_dex_output) - else: - # Output to a .dex file. - if len(dex_files) > 1: - raise Exception('%d files created, expected 1' % len(dex_files)) - tmp_dex_output = dex_files[0] - - if options.dexlayout_profile: - tmp_dex_output = _PerformDexlayout(tmp_dir, tmp_dex_output, options) - - # The dex file is complete and can be moved out of tmp_dir. - shutil.move(tmp_dex_output, options.output) - - -def main(args): - options = _ParseArgs(args) - - input_paths = list(options.inputs) - if options.multi_dex and options.main_dex_list_path: - input_paths.append(options.main_dex_list_path) - - _PerformDexing(options) - - build_utils.WriteDepfile( - options.depfile, options.output, input_paths, add_pydeps=False) + build_utils.CallAndWriteDepfileIfStale( + lambda changes: _OnStaleMd5(changes, options, final_dex_inputs, dex_cmd), + options, + depfile_deps=options.class_inputs_filearg + options.dex_inputs_filearg, + output_paths=output_paths, + input_paths=input_paths, + input_strings=dex_cmd + [bool(options.incremental_dir)], + pass_changes=True, + add_pydeps=False) if __name__ == '__main__':
diff --git a/build/android/gyp/main_dex_list.py b/build/android/gyp/main_dex_list.py index d610982..0f431986 100755 --- a/build/android/gyp/main_dex_list.py +++ b/build/android/gyp/main_dex_list.py
@@ -28,26 +28,25 @@ 'main dex.') parser.add_argument('--main-dex-list-path', required=True, help='The main dex list file to generate.') - parser.add_argument('--inputs', - help='JARs for which a main dex list should be ' - 'generated.') + parser.add_argument( + '--class-inputs', + action='append', + help='GN-list of .jars with .class files.') + parser.add_argument( + '--class-inputs-filearg', + action='append', + help='GN-list of .jars with .class files (added to depfile).') parser.add_argument( '--r8-path', required=True, help='Path to the r8 executable.') parser.add_argument('--negative-main-dex-globs', help='GN-list of globs of .class names (e.g. org/chromium/foo/Bar.class) ' 'that will fail the build if they match files in the main dex.') - parser.add_argument('paths', nargs='*', default=[], - help='JARs for which a main dex list should be ' - 'generated.') - args = parser.parse_args(build_utils.ExpandFileArgs(args)) - depfile_deps = [] - if args.inputs: - args.inputs = build_utils.ParseGnList(args.inputs) - depfile_deps = args.inputs - args.paths.extend(args.inputs) + args.class_inputs = build_utils.ParseGnList(args.class_inputs) + args.class_inputs_filearg = build_utils.ParseGnList(args.class_inputs_filearg) + args.class_inputs += args.class_inputs_filearg if args.negative_main_dex_globs: args.negative_main_dex_globs = build_utils.ParseGnList( @@ -82,7 +81,7 @@ '--disable-annotation-resolution-workaround', ] - input_paths = list(args.paths) + input_paths = list(args.class_inputs) input_paths += [ args.shrinked_android_path, args.dx_path, @@ -106,8 +105,8 @@ ] def _LineLengthHelperForOnStaleMd5(): - _OnStaleMd5(proguard_cmd, proguard_flags, main_dex_list_cmd, args.paths, - args.main_dex_list_path) + _OnStaleMd5(proguard_cmd, proguard_flags, main_dex_list_cmd, + args.class_inputs, args.main_dex_list_path) build_utils.CallAndWriteDepfileIfStale( _LineLengthHelperForOnStaleMd5, @@ -115,7 +114,7 @@ input_paths=input_paths, input_strings=input_strings, output_paths=output_paths, - depfile_deps=depfile_deps, + depfile_deps=args.class_inputs_filearg, add_pydeps=False) return 0
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py index ecb41a3..0238d425 100644 --- a/build/android/gyp/util/build_utils.py +++ b/build/android/gyp/util/build_utils.py
@@ -70,7 +70,7 @@ os.utime(path, None) -def FindInDirectory(directory, filename_filter): +def FindInDirectory(directory, filename_filter='*'): files = [] for root, _dirnames, filenames in os.walk(directory): matched_files = fnmatch.filter(filenames, filename_filter)
diff --git a/build/android/gyp/util/md5_check.py b/build/android/gyp/util/md5_check.py index 9a15ee6..8c4ac31 100644 --- a/build/android/gyp/util/md5_check.py +++ b/build/android/gyp/util/md5_check.py
@@ -106,19 +106,20 @@ def HasChanges(self): """Returns whether any changes exist.""" - return (self.force or - not self.old_metadata or - self.old_metadata.StringsMd5() != self.new_metadata.StringsMd5() or - self.old_metadata.FilesMd5() != self.new_metadata.FilesMd5()) + return (self.HasStringChanges() + or self.old_metadata.FilesMd5() != self.new_metadata.FilesMd5()) + + def HasStringChanges(self): + """Returns whether string metadata changed.""" + return (self.force or not self.old_metadata + or self.old_metadata.StringsMd5() != self.new_metadata.StringsMd5()) def AddedOrModifiedOnly(self): """Returns whether the only changes were from added or modified (sub)files. No missing outputs, no removed paths/subpaths. """ - if (self.force or - not self.old_metadata or - self.old_metadata.StringsMd5() != self.new_metadata.StringsMd5()): + if self.HasStringChanges(): return False if any(self.IterRemovedPaths()): return False
diff --git a/build/config/android/config.gni b/build/config/android/config.gni index 6a606d6..0076433 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni
@@ -230,17 +230,13 @@ android_sdk_platform_version = android_sdk_version } - # Speed up dexing using dx --incremental. - enable_incremental_dx = is_java_debug + # Reduce build time by using d8 incremental build. + enable_incremental_d8 = true # Use hashed symbol names to reduce JNI symbol overhead. use_hashed_jni_names = !is_java_debug } - # This should not be used for release builds since dx --incremental is known - # to not produce byte-for-byte identical output. - assert(!(enable_incremental_dx && !is_java_debug)) - # Path to where selected build variables are written to. android_build_vars = "$root_build_dir/build_vars.txt"
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index af2ccf4..3231f90 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -1133,8 +1133,11 @@ } } - assert(!(defined(invoker.input_jars) && _proguard_enabled), - "input_jars can't be specified when proguarding a dex.") + assert(!_proguard_enabled || !(defined(invoker.input_dex_filearg) || + defined(invoker.input_dex_jars) || + defined(invoker.input_classes_filearg) || + defined(invoker.input_class_jars)), + "Cannot explicitly set inputs when proguarding a dex.") assert(!(defined(invoker.apply_mapping) && !_proguard_enabled), "apply_mapping can only be specified if proguard is enabled.") @@ -1143,13 +1146,6 @@ _main_dex_rules = "//build/android/main_dex_classes.flags" } - if (!_proguarding_with_r8) { - _dexing_jars = [] - if (defined(invoker.input_jars)) { - _dexing_jars += invoker.input_jars - } - } - if (_proguard_enabled) { if (_proguarding_with_r8) { _proguard_output_path = invoker.output @@ -1158,7 +1154,6 @@ } else { _proguard_output_path = invoker.output + ".proguard.jar" _proguard_target_name = "${target_name}__proguard" - _dexing_jars += [ _proguard_output_path ] } proguard(_proguard_target_name) { @@ -1234,6 +1229,18 @@ } if (!_proguarding_with_r8) { + _input_class_jars = [] + if (defined(invoker.input_class_jars)) { + _input_class_jars = invoker.input_class_jars + } + if (_proguard_enabled) { + _input_class_jars += [ _proguard_output_path ] + } + if (_input_class_jars != []) { + _rebased_input_class_jars = + rebase_path(_input_class_jars, root_build_dir) + } + if (_enable_main_dex_list) { _main_dex_list_path = invoker.output + ".main_dex_list" _main_dex_list_target_name = "${target_name}__main_dex_list" @@ -1254,11 +1261,11 @@ _dx = "$android_sdk_build_tools/lib/dx.jar" _r8 = "//third_party/r8/lib/r8.jar" inputs = [ - _main_dex_rules, - _dx, - _r8, - _shrinked_android, - ] + _main_dex_rules, + _dx, + _r8, + _shrinked_android, + ] + _input_class_jars outputs = [ _main_dex_list_path, @@ -1298,14 +1305,17 @@ ] } - if (defined(invoker.input_jar_classpath)) { + if (defined(invoker.input_classes_filearg)) { inputs += [ invoker.build_config ] - args += [ "--inputs=@FileArg(${invoker.input_jar_classpath})" ] - } else { - inputs += _dexing_jars - if (_dexing_jars != []) { - args += rebase_path(_dexing_jars, root_build_dir) - } + args += + [ "--class-inputs-filearg=${invoker.input_classes_filearg}" ] + } + if (defined(invoker.main_dex_list_input_classes_filearg)) { + inputs += [ invoker.build_config ] + args += [ "--class-inputs-filearg=${invoker.main_dex_list_input_classes_filearg}" ] + } + if (_input_class_jars != []) { + args += [ "--class-inputs=${_rebased_input_class_jars}" ] } } } @@ -1332,6 +1342,12 @@ if (_proguard_enabled) { deps += [ ":${_proguard_target_name}" ] + } else if (enable_incremental_d8) { + # Don't use incremental dexing for ProGuarded inputs as a precaution. + args += [ + "--incremental-dir", + rebase_path("$target_out_dir/$target_name", root_build_dir), + ] } if (_enable_multidex) { @@ -1346,14 +1362,23 @@ } } - if (defined(invoker.input_dex_classpath)) { + if (defined(invoker.input_dex_filearg)) { inputs += [ invoker.build_config ] - args += [ "--input-list=@FileArg(${invoker.input_dex_classpath})" ] + args += [ "--dex-inputs-filearg=${invoker.input_dex_filearg}" ] } - - inputs += _dexing_jars - if (_dexing_jars != []) { - args += rebase_path(_dexing_jars, root_build_dir) + if (defined(invoker.input_dex_jars) && invoker.input_dex_jars != []) { + inputs += invoker.input_dex_jars + _rebased_input_dex_jars = + rebase_path(invoker.input_dex_jars, root_build_dir) + args += [ "--dex-inputs=${_rebased_input_dex_jars}" ] + } + if (defined(invoker.input_classes_filearg)) { + inputs += [ invoker.build_config ] + args += [ "--class-inputs-filearg=${invoker.input_classes_filearg}" ] + } + if (_input_class_jars != []) { + inputs += _input_class_jars + args += [ "--class-inputs=${_rebased_input_class_jars}" ] } if (defined(invoker.dexlayout_profile)) { @@ -1493,13 +1518,11 @@ _desugar = defined(invoker.supports_android) && invoker.supports_android _jacoco_instrument = invoker.jacoco_instrument - _enable_split_compat = defined(invoker.split_compat_class_names) _enable_class_deps_output = defined(invoker.enable_class_deps_output) _enable_bytecode_rewriter = _enable_assert || _enable_custom_resources || - _enable_thread_annotations || _enable_split_compat || - _enable_class_deps_output + _enable_thread_annotations || _enable_class_deps_output _is_prebuilt = defined(invoker.is_prebuilt) && invoker.is_prebuilt _enable_bytecode_checks = !defined(invoker.enable_bytecode_checks) || invoker.enable_bytecode_checks @@ -1517,7 +1540,6 @@ "_enable_assert", "_enable_class_deps_output", "_enable_custom_resources", - "_enable_split_compat", "_enable_thread_annotations", ]) _enable_bytecode_rewriter = invoker.enable_bytecode_rewriter @@ -1584,10 +1606,6 @@ if (_enable_bytecode_checks) { args += [ "--enable-check-class-path" ] } - if (_enable_split_compat) { - args += [ "--split-compat-class-names" ] + - invoker.split_compat_class_names - } if (_enable_class_deps_output) { args += [ "--enable-class-deps-output" ] + [ invoker.enable_class_deps_output ] @@ -3603,7 +3621,6 @@ "enable_class_deps_output", "jar_excluded_patterns", "jar_included_patterns", - "split_compat_class_names", ]) is_prebuilt = _is_prebuilt supports_android = _supports_android @@ -3623,7 +3640,7 @@ if (defined(_dex_path)) { dex("${target_name}__dex") { - input_jars = [ _final_jar_path ] + input_class_jars = [ _final_jar_path ] output = _dex_path deps = [ ":$_process_prebuilt_target_name",
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 5316a75..2d5d634 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -2909,12 +2909,10 @@ deps += _deps + [ ":$_compile_resources_target" ] proguard_mapping_path = _proguard_mapping_path } else { - input_jars = [ _lib_dex_path ] - input_dex_classpath = - "${_rebased_build_config}:final_dex:dependency_dex_files" + input_dex_jars = [ _lib_dex_path ] + input_dex_filearg = "@FileArg(${_rebased_build_config}:final_dex:dependency_dex_files)" if (_enable_main_dex_list) { - input_jar_classpath = - "${_rebased_build_config}:deps_info:java_runtime_classpath" + main_dex_list_input_classes_filearg = "@FileArg(${_rebased_build_config}:deps_info:java_runtime_classpath)" } } @@ -4117,10 +4115,6 @@ # extract_native_libraries: Whether to extract .so files found in the .aar. # If the file contains .so, either extract_native_libraries or # ignore_native_libraries must be set. - # split_compat_class_names: Names of the classes that will have their - # bytecode rewritten to inject the call to SplitCompat.install(). - # Used to make dependencies compatible with SplitCompat to immediately - # access resources brought in by the modules. # create_srcjar: If false, does not create an R.java file. # TODO(jbudorick@): remove this arguments after crbug.com/522043 is fixed. # requires_android: Whether this target can only be used for compiling @@ -4317,7 +4311,6 @@ "jar_included_patterns", "proguard_configs", "requires_android", - "split_compat_class_names", "testonly", ]) if (!defined(deps)) {
diff --git a/build/util/generate_wrapper.py b/build/util/generate_wrapper.py index 339e15e..5a7d1ee8 100755 --- a/build/util/generate_wrapper.py +++ b/build/util/generate_wrapper.py
@@ -101,7 +101,7 @@ template = SCRIPT_TEMPLATES[args.script_language] wrapper_script.write(template.format( script=py_contents)) - os.chmod(args.wrapper_script, 0750) + os.chmod(args.wrapper_script, 0o750) return 0
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 718f01d..e5e6448a 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -189,7 +189,6 @@ "java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManagerImpl.java", "java/src/org/chromium/chrome/browser/compositor/CompositorView.java", "java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java", - "java/src/org/chromium/chrome/browser/compositor/EventOffsetHandler.java", "java/src/org/chromium/chrome/browser/compositor/Invalidator.java", "java/src/org/chromium/chrome/browser/compositor/LayerTitleCache.java", "java/src/org/chromium/chrome/browser/compositor/TitleCache.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 0e4de9ec..1d84460 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -34,7 +34,6 @@ "junit/src/org/chromium/chrome/browser/browserservices/trustedwebactivityui/controller/TrustedWebActivityOpenTimeRecorderTest.java", "junit/src/org/chromium/chrome/browser/browserservices/trustedwebactivityui/controller/TrustedWebActivityVerifierTest.java", "junit/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManagerImplTest.java", - "junit/src/org/chromium/chrome/browser/compositor/EventOffsetHandlerTest.java", "junit/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimationHandlerTest.java", "junit/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimatorTest.java", "junit/src/org/chromium/chrome/browser/compositor/layouts/MockLayoutUpdateHost.java",
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java index e972192e..90d48709 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java
@@ -120,7 +120,7 @@ @Test @MediumTest @DisableIf.Build(sdk_is_greater_than = 22) // TODO(crbug/990118): re-enable - public void testOnboardingWithNoTabs() throws Exception { + public void testOnboardingWithNoTabs() { AssistantOnboardingCoordinator coordinator = createCoordinator(/* tab= */ null); showOnboardingAndWait(coordinator, mCallback); @@ -157,8 +157,8 @@ } /** Trigger onboarding and wait until it is fully displayed. */ - private void showOnboardingAndWait(AssistantOnboardingCoordinator coordinator, - Callback<Boolean> callback) throws Exception { + private void showOnboardingAndWait( + AssistantOnboardingCoordinator coordinator, Callback<Boolean> callback) { ThreadUtils.runOnUiThreadBlocking(() -> coordinator.show(callback)); waitUntilViewMatchesCondition(withId(R.id.button_init_ok), isDisplayed()); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionsCarouselUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionsCarouselUiTest.java index e5af680..8d84e272 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionsCarouselUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionsCarouselUiTest.java
@@ -65,7 +65,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { AutofillAssistantUiTestUtil.startOnBlankPage(mTestRule); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java index cc28b32..f401db1 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java
@@ -41,7 +41,7 @@ public CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { AutofillAssistantPreferencesUtil.setInitialPreferences(true); } @@ -50,7 +50,7 @@ */ @Test @MediumTest - public void testAutostart() throws Exception { + public void testAutostart() { AutofillAssistantTestScript script = new AutofillAssistantTestScript( SupportedScriptProto.newBuilder() .setPath("example.com/hello")
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java index de4a44e..6a2516d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java
@@ -146,8 +146,7 @@ } } - public AutofillAssistantCollectUserDataTestHelper() - throws TimeoutException, InterruptedException { + public AutofillAssistantCollectUserDataTestHelper() throws TimeoutException { registerDataObserver(); setRequestTimeoutForTesting(); setSyncServiceForTesting(); @@ -163,8 +162,7 @@ () -> PersonalDataManager.getInstance().setSyncServiceForTesting()); } - public String setProfile(final AutofillProfile profile) - throws TimeoutException, InterruptedException { + public String setProfile(final AutofillProfile profile) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); String guid = TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().setProfile(profile)); @@ -181,7 +179,7 @@ * @return the GUID of the created profile. */ public String addDummyProfile(String fullName, String email, String postcode) - throws TimeoutException, InterruptedException { + throws TimeoutException { PersonalDataManager.AutofillProfile profile = new PersonalDataManager.AutofillProfile( "" /* guid */, "https://www.example.com" /* origin */, fullName, "Acme Inc.", "123 Main", "California", "Los Angeles", "", postcode, "", "Uzbekistan", @@ -189,8 +187,7 @@ return setProfile(profile); } - public String addDummyProfile(String fullName, String email) - throws TimeoutException, InterruptedException { + public String addDummyProfile(String fullName, String email) throws TimeoutException { return addDummyProfile(fullName, email, "90210"); } @@ -214,8 +211,7 @@ .getShippingAddressLabelWithCountryForPaymentRequest(profile)); } - public String setCreditCard(final CreditCard card) - throws TimeoutException, InterruptedException { + public String setCreditCard(final CreditCard card) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); String guid = TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().setCreditCard(card)); @@ -229,8 +225,7 @@ * @param billingAddressId The billing address profile GUID. * @return the GUID of the created credit card */ - public String addDummyCreditCard(String billingAddressId) - throws TimeoutException, InterruptedException { + public String addDummyCreditCard(String billingAddressId) throws TimeoutException { String profileName = TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().getProfile(billingAddressId).getFullName()); @@ -241,21 +236,21 @@ return setCreditCard(creditCard); } - public void deleteProfile(final String guid) throws InterruptedException, TimeoutException { + public void deleteProfile(final String guid) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().deleteProfile(guid)); mOnPersonalDataChangedHelper.waitForCallback(callCount); } - public void deleteCreditCard(final String guid) throws InterruptedException, TimeoutException { + public void deleteCreditCard(final String guid) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().deleteCreditCard(guid)); mOnPersonalDataChangedHelper.waitForCallback(callCount); } - private void registerDataObserver() throws TimeoutException, InterruptedException { + private void registerDataObserver() throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); boolean isDataLoaded = TestThreadUtils.runOnUiThreadBlockingNoException( ()
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java index 135ecaf7..3b87045 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java
@@ -91,7 +91,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { AutofillAssistantUiTestUtil.startOnBlankPage(mTestRule); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java index 2d36b02c..2567f66 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java
@@ -84,7 +84,7 @@ @Test @MediumTest - public void testReportAvailableDirectActions() throws Exception { + public void testReportAvailableDirectActions() { FakeDirectActionReporter reporter = new FakeDirectActionReporter(); mHandler.reportAvailableDirectActions(reporter);
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHeaderUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHeaderUiTest.java index 098d1f4..dc16fbce 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHeaderUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHeaderUiTest.java
@@ -79,7 +79,7 @@ public Runnable mRunnableMock; @Before - public void setUp() throws Exception { + public void setUp() { mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( InstrumentationRegistry.getTargetContext(), "about:blank"));
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInfoBoxUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInfoBoxUiTest.java index 3b321ce..df2589b9 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInfoBoxUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInfoBoxUiTest.java
@@ -67,7 +67,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { AutofillAssistantUiTestUtil.startOnBlankPage(mTestRule); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java index 0079e50..02646e5 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java
@@ -56,7 +56,7 @@ "/components/test/data/autofill_assistant/autofill_assistant_target_website.html"; @Before - public void setUp() throws Exception { + public void setUp() { mTestRule.startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustomTabIntent( InstrumentationRegistry.getTargetContext(), mTestRule.getTestServer().getURL(TEST_PAGE)));
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java index d8f8816..b1daeba 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java
@@ -77,7 +77,7 @@ public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { ThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(true)); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); @@ -87,7 +87,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { ThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java index 4e96e07..df965e08 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java
@@ -197,8 +197,7 @@ /** * Starts the CCT test rule on a blank page. */ - public static void startOnBlankPage(CustomTabActivityTestRule testRule) - throws InterruptedException { + public static void startOnBlankPage(CustomTabActivityTestRule testRule) { testRule.startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustomTabIntent( InstrumentationRegistry.getTargetContext(), "about:blank")); }
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryIntegrationTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryIntegrationTest.java index 1707143..6a1bb124 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryIntegrationTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryIntegrationTest.java
@@ -77,7 +77,7 @@ } private void loadTestPage(ChromeWindow.KeyboardVisibilityDelegateFactory keyboardDelegate) - throws InterruptedException, ExecutionException, TimeoutException { + throws TimeoutException { mHelper.loadTestPage("/chrome/test/data/autofill/autofill_test_form.html", false, false, keyboardDelegate); ManualFillingTestHelper.createAutofillTestProfiles(); @@ -89,8 +89,7 @@ */ @Test @MediumTest - public void testAutofocusedFieldDoesNotShowKeyboardAccessory() - throws ExecutionException, InterruptedException, TimeoutException { + public void testAutofocusedFieldDoesNotShowKeyboardAccessory() throws TimeoutException { loadTestPage(FakeKeyboard::new); CriteriaHelper.pollUiThread(() -> { View accessory = mActivityTestRule.getActivity().findViewById(R.id.keyboard_accessory); @@ -103,8 +102,7 @@ */ @Test @MediumTest - public void testTapInputFieldShowsKeyboardAccessory() - throws ExecutionException, InterruptedException, TimeoutException { + public void testTapInputFieldShowsKeyboardAccessory() throws TimeoutException { loadTestPage(FakeKeyboard::new); mHelper.clickNodeAndShowKeyboard("NAME_FIRST"); mHelper.waitForKeyboardAccessoryToBeShown(); @@ -116,8 +114,7 @@ @Test @MediumTest @FlakyTest(message = "https://crbug.com/984489") - public void testSwitchFieldsRescrollsKeyboardAccessory() - throws ExecutionException, InterruptedException, TimeoutException { + public void testSwitchFieldsRescrollsKeyboardAccessory() throws TimeoutException { loadTestPage(FakeKeyboard::new); mHelper.clickNodeAndShowKeyboard("EMAIL_ADDRESS"); mHelper.waitForKeyboardAccessoryToBeShown(true); @@ -143,7 +140,7 @@ @Test @MediumTest public void testSelectSuggestionHidesKeyboardAccessory() - throws ExecutionException, InterruptedException, TimeoutException { + throws ExecutionException, TimeoutException { loadTestPage(FakeKeyboard::new); mHelper.clickNodeAndShowKeyboard("NAME_FIRST"); mHelper.waitForKeyboardAccessoryToBeShown(true); @@ -156,7 +153,7 @@ @Test @MediumTest public void testSuggestionsCloseAccessoryWhenClicked() - throws ExecutionException, InterruptedException, TimeoutException { + throws ExecutionException, TimeoutException { MultiWindowUtils.getInstance().setIsInMultiWindowModeForTesting(true); loadTestPage(MultiWindowKeyboard::new); mHelper.clickNode("NAME_FIRST", FocusedFieldType.FILLABLE_NON_SEARCH_FIELD); @@ -170,7 +167,7 @@ @Test @SmallTest public void testPressingBackButtonHidesAccessoryWithAutofillSuggestions() - throws InterruptedException, TimeoutException, ExecutionException { + throws TimeoutException, ExecutionException { loadTestPage(MultiWindowKeyboard::new); mHelper.clickNodeAndShowKeyboard("NAME_FIRST"); mHelper.waitForKeyboardAccessoryToBeShown(true); @@ -189,8 +186,7 @@ @Test @MediumTest - public void testSheetHasMinimumSizeWhenTriggeredBySuggestion() - throws ExecutionException, InterruptedException, TimeoutException { + public void testSheetHasMinimumSizeWhenTriggeredBySuggestion() throws TimeoutException { MultiWindowUtils.getInstance().setIsInMultiWindowModeForTesting(true); loadTestPage(MultiWindowKeyboard::new); mHelper.clickNode("NAME_FIRST", FocusedFieldType.FILLABLE_NON_SEARCH_FIELD);
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingIntegrationTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingIntegrationTest.java index 637b7d04..66db4fc 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingIntegrationTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingIntegrationTest.java
@@ -77,7 +77,7 @@ @Test @SmallTest - public void testAccessoryIsAvailable() throws InterruptedException { + public void testAccessoryIsAvailable() { mHelper.loadTestPage(false); assertNotNull("Controller for Manual filling should be available.", @@ -86,8 +86,7 @@ @Test @SmallTest - public void testKeyboardAccessoryHiddenUntilKeyboardShows() - throws InterruptedException, TimeoutException { + public void testKeyboardAccessoryHiddenUntilKeyboardShows() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -102,8 +101,7 @@ @Test @SmallTest - public void testKeyboardAccessoryDisappearsWithKeyboard() - throws InterruptedException, TimeoutException { + public void testKeyboardAccessoryDisappearsWithKeyboard() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -118,8 +116,7 @@ @Test @SmallTest - public void testAccessorySheetHiddenUntilManuallyTriggered() - throws InterruptedException, TimeoutException { + public void testAccessorySheetHiddenUntilManuallyTriggered() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -139,8 +136,7 @@ @Test @SmallTest - public void testAccessorySheetHiddenWhenRefocusingField() - throws InterruptedException, TimeoutException { + public void testAccessorySheetHiddenWhenRefocusingField() throws TimeoutException { AtomicReference<ViewGroup.MarginLayoutParams> accessoryMargins = new AtomicReference<>(); AtomicReference<View> accessorySheetView = new AtomicReference<>(); mHelper.loadTestPage(false); @@ -177,8 +173,7 @@ @Test @SmallTest @Features.DisableFeatures(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY) - public void testAccessoryHiddenAfterTappingAutoGenerationButton() - throws InterruptedException, TimeoutException { + public void testAccessoryHiddenAfterTappingAutoGenerationButton() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory and add the generation button. @@ -200,7 +195,7 @@ @Test @SmallTest @Features.DisableFeatures(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY) - public void testHidingSheetBringsBackKeyboard() throws InterruptedException, TimeoutException { + public void testHidingSheetBringsBackKeyboard() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -224,8 +219,7 @@ @Test @SmallTest @Features.DisableFeatures({ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) - public void testSelectingNonPasswordInputDismissesAccessory() - throws InterruptedException, TimeoutException { + public void testSelectingNonPasswordInputDismissesAccessory() throws TimeoutException { mHelper.loadTestPage(false); // Focus the password field to bring up the accessory. @@ -241,8 +235,7 @@ @Test @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testInvokingTabSwitcherHidesAccessory() - throws InterruptedException, TimeoutException { + public void testInvokingTabSwitcherHidesAccessory() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -265,8 +258,7 @@ @Test @SmallTest - public void testResumingTheAppDismissesAllInputMethods() - throws InterruptedException, TimeoutException { + public void testResumingTheAppDismissesAllInputMethods() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -305,8 +297,7 @@ @Test @SmallTest - public void testPressingBackButtonHidesAccessorySheet() - throws InterruptedException, TimeoutException { + public void testPressingBackButtonHidesAccessorySheet() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -328,7 +319,7 @@ @Test @SmallTest public void testInfobarStaysHiddenWhileChangingFieldsWithOpenKeybaord() - throws InterruptedException, TimeoutException { + throws TimeoutException { mHelper.loadTestPage(false); // Initialize and wait for the infobar. @@ -367,8 +358,7 @@ @Test @SmallTest - public void testInfobarStaysHiddenWhenOpeningSheet() - throws InterruptedException, TimeoutException { + public void testInfobarStaysHiddenWhenOpeningSheet() throws TimeoutException { mHelper.loadTestPage(false); // Initialize and wait for the infobar. @@ -412,7 +402,7 @@ @Test @SmallTest - public void testMovesUpSnackbar() throws InterruptedException, TimeoutException { + public void testMovesUpSnackbar() throws TimeoutException { final String kSnackbarText = "snackbar"; mHelper.loadTestPage(false); @@ -448,7 +438,7 @@ @Test @SmallTest - public void testInfobarReopensOnPressingBack() throws InterruptedException, TimeoutException { + public void testInfobarReopensOnPressingBack() throws TimeoutException { mHelper.loadTestPage(false); // Initialize and wait for the infobar.
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java index 6ef710b..5715e77 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java
@@ -62,7 +62,6 @@ import org.chromium.net.test.ServerCertificate; import org.chromium.ui.DropdownPopupWindowInterface; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; @@ -70,9 +69,9 @@ * Helpers in this class simplify interactions with the Keyboard Accessory and the sheet below it. */ public class ManualFillingTestHelper { - private final static String PASSWORD_NODE_ID = "password_field"; - private final static String USERNAME_NODE_ID = "username_field"; - private final static String SUBMIT_NODE_ID = "input_submit_button"; + private static final String PASSWORD_NODE_ID = "password_field"; + private static final String USERNAME_NODE_ID = "username_field"; + private static final String SUBMIT_NODE_ID = "input_submit_button"; private final ChromeTabbedActivityTestRule mActivityTestRule; private final AtomicReference<WebContents> mWebContentsRef = new AtomicReference<>(); @@ -90,17 +89,16 @@ mActivityTestRule = activityTestRule; } - public void loadTestPage(boolean isRtl) throws InterruptedException { + public void loadTestPage(boolean isRtl) { loadTestPage("/chrome/test/data/password/password_form.html", isRtl); } - public void loadTestPage(String url, boolean isRtl) throws InterruptedException { + public void loadTestPage(String url, boolean isRtl) { loadTestPage(url, isRtl, false, FakeKeyboard::new); } public void loadTestPage(String url, boolean isRtl, boolean waitForNode, - ChromeWindow.KeyboardVisibilityDelegateFactory keyboardDelegate) - throws InterruptedException { + ChromeWindow.KeyboardVisibilityDelegateFactory keyboardDelegate) { mEmbeddedTestServer = EmbeddedTestServer.createAndStartHTTPSServer( InstrumentationRegistry.getInstrumentation().getContext(), ServerCertificate.CERT_OK); @@ -158,23 +156,22 @@ return isKeyboardAccessoryTabLayout().matches(view) ? null : view; } - public void focusPasswordField() throws TimeoutException, InterruptedException { + public void focusPasswordField() throws TimeoutException { DOMUtils.focusNode(mActivityTestRule.getWebContents(), PASSWORD_NODE_ID); TestThreadUtils.runOnUiThreadBlocking( () -> { mActivityTestRule.getWebContents().scrollFocusedEditableNodeIntoView(); }); getKeyboard().showKeyboard(mActivityTestRule.getActivity().getCurrentFocus()); } - public String getPasswordText() throws TimeoutException, InterruptedException { + public String getPasswordText() throws TimeoutException { return DOMUtils.getNodeValue(mWebContentsRef.get(), PASSWORD_NODE_ID); } - public String getFieldText(String nodeId) throws TimeoutException, InterruptedException { + public String getFieldText(String nodeId) throws TimeoutException { return DOMUtils.getNodeValue(mWebContentsRef.get(), nodeId); } - public void clickEmailField(boolean forceAccessory) - throws TimeoutException, InterruptedException { + public void clickEmailField(boolean forceAccessory) throws TimeoutException { // TODO(fhorschig): This should be |focusNode|. Change with autofill popup deprecation. DOMUtils.clickNode(mWebContentsRef.get(), USERNAME_NODE_ID); if (forceAccessory) { @@ -185,19 +182,17 @@ getKeyboard().showKeyboard(mActivityTestRule.getActivity().getCurrentFocus()); } - public void clickNodeAndShowKeyboard(String node) - throws TimeoutException, InterruptedException { + public void clickNodeAndShowKeyboard(String node) throws TimeoutException { clickNodeAndShowKeyboard(node, FILLABLE_NON_SEARCH_FIELD); } public void clickNodeAndShowKeyboard(String node, int focusedFieldType) - throws TimeoutException, InterruptedException { + throws TimeoutException { clickNode(node, focusedFieldType); getKeyboard().showKeyboard(mActivityTestRule.getActivity().getCurrentFocus()); } - public void clickNode(String node, int focusedFieldType) - throws TimeoutException, InterruptedException { + public void clickNode(String node, int focusedFieldType) throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), node); TestThreadUtils.runOnUiThreadBlocking(() -> { ManualFillingComponentBridge.notifyFocusedFieldType( @@ -209,7 +204,7 @@ * Although the submit button has no effect, it takes the focus from the input field and should * hide the keyboard. */ - public void clickSubmit() throws TimeoutException, InterruptedException { + public void clickSubmit() throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), SUBMIT_NODE_ID); getKeyboard().hideAndroidSoftKeyboard(null); } @@ -345,8 +340,7 @@ }); } - public static void createAutofillTestProfiles() - throws InterruptedException, ExecutionException, TimeoutException { + public static void createAutofillTestProfiles() throws TimeoutException { new AutofillTestHelper().setProfile(new AutofillProfile("", "https://www.example.com", "Johnathan Smithonian-Jackson", "Acme Inc", "1 Main\nApt A", "CA", "San Francisco", "", "94102", "", "US", "(415) 888-9999", "john.sj@acme-mail.inc", "en")); @@ -368,7 +362,7 @@ * @param tabIndex The index to be selected. * @return The action executed by |perform|. */ - static public ViewAction selectTabAtPosition(int tabIndex) { + public static ViewAction selectTabAtPosition(int tabIndex) { return new ViewAction() { @Override public Matcher<View> getConstraints() { @@ -398,7 +392,7 @@ * Use in a |onView().perform| action to scroll to the end of a {@link RecyclerView}. * @return The action executed by |perform|. */ - static public ViewAction scrollToLastElement() { + public static ViewAction scrollToLastElement() { return new ViewAction() { @Override public Matcher<View> getConstraints() {
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingUiCaptureTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingUiCaptureTest.java index 113c6e98..620bd27 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingUiCaptureTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingUiCaptureTest.java
@@ -35,7 +35,6 @@ import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; /** @@ -120,7 +119,7 @@ @EnableFeatures(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY) @Feature({"KeyboardAccessoryModern", "LTR", "UiCatalogue"}) public void testCaptureKeyboardAccessoryV2WithPasswords() - throws InterruptedException, TimeoutException, ExecutionException { + throws InterruptedException, TimeoutException { mHelper.loadTestPage(false); ManualFillingTestHelper.createAutofillTestProfiles(); mHelper.cacheTestCredentials(); @@ -150,7 +149,7 @@ @EnableFeatures(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY) @Feature({"KeyboardAccessoryModern", "RTL", "UiCatalogue"}) public void testCaptureKeyboardAccessoryV2WithPasswordsRTL() - throws InterruptedException, TimeoutException, ExecutionException { + throws InterruptedException, TimeoutException { mHelper.loadTestPage(true); ManualFillingTestHelper.createAutofillTestProfiles(); mHelper.cacheTestCredentials();
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/AccessorySheetViewTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/AccessorySheetViewTest.java index 5a682d0..2db6cbb 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/AccessorySheetViewTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/AccessorySheetViewTest.java
@@ -55,7 +55,6 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutionException; /** * View tests for the keyboard accessory sheet component. @@ -96,8 +95,7 @@ @Test @MediumTest - public void testAccessoryVisibilityChangedByModel() - throws ExecutionException, InterruptedException { + public void testAccessoryVisibilityChangedByModel() throws InterruptedException { // Initially, there shouldn't be a view yet. assertNull(mViewPager.poll());
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java index 4b069887..8bed555 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java
@@ -75,7 +75,7 @@ } private void loadTestPage(ChromeWindow.KeyboardVisibilityDelegateFactory keyboardDelegate) - throws InterruptedException, TimeoutException { + throws TimeoutException { mHelper.loadTestPage("/chrome/test/data/autofill/autofill_test_form.html", false, false, keyboardDelegate); new AutofillTestHelper().setProfile(new AutofillProfile("", "https://www.example.com", @@ -87,7 +87,7 @@ @Test @SmallTest @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testAddressSheetIsAvailable() throws InterruptedException { + public void testAddressSheetIsAvailable() { mHelper.loadTestPage(false); CriteriaHelper.pollUiThread(() -> { @@ -98,7 +98,7 @@ @Test @SmallTest @DisableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testAddressSheetUnavailableWithoutFeature() throws InterruptedException { + public void testAddressSheetUnavailableWithoutFeature() { mHelper.loadTestPage(false); Assert.assertNull("Address sheet should not have been created.", @@ -108,8 +108,7 @@ @Test @SmallTest @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testDisplaysEmptyStateMessageWithoutSavedPasswords() - throws InterruptedException, TimeoutException { + public void testDisplaysEmptyStateMessageWithoutSavedPasswords() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -128,7 +127,7 @@ @Test @MediumTest @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testFillsSuggestionOnClick() throws InterruptedException, TimeoutException { + public void testFillsSuggestionOnClick() throws TimeoutException { loadTestPage(FakeKeyboard::new); mHelper.clickNodeAndShowKeyboard("NAME_FIRST"); mHelper.waitForKeyboardAccessoryToBeShown(true);
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessoryIntegrationTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessoryIntegrationTest.java index f3ef0c3..9ff332c 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessoryIntegrationTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessoryIntegrationTest.java
@@ -76,7 +76,7 @@ } private void loadTestPage(ChromeWindow.KeyboardVisibilityDelegateFactory keyboardDelegate) - throws InterruptedException, TimeoutException { + throws TimeoutException { mHelper.loadTestPage("/chrome/test/data/autofill/autofill_creditcard_form.html", false, false, keyboardDelegate); CreditCard card = new CreditCard(); @@ -92,7 +92,7 @@ @Test @SmallTest @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testCreditCardSheetAvailable() throws InterruptedException { + public void testCreditCardSheetAvailable() { mHelper.loadTestPage(false); CriteriaHelper.pollUiThread(() -> { @@ -103,7 +103,7 @@ @Test @SmallTest @DisableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testCreditCardSheetUnavailableWithoutFeature() throws InterruptedException { + public void testCreditCardSheetUnavailableWithoutFeature() { mHelper.loadTestPage(false); Assert.assertNull("Credit Card sheet should not have been created.", @@ -113,8 +113,7 @@ @Test @SmallTest @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testDisplaysEmptyStateMessageWithoutSavedCards() - throws InterruptedException, TimeoutException { + public void testDisplaysEmptyStateMessageWithoutSavedCards() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -133,7 +132,7 @@ @Test @MediumTest @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) - public void testFillsSuggestionOnClick() throws InterruptedException, TimeoutException { + public void testFillsSuggestionOnClick() throws TimeoutException { loadTestPage(FakeKeyboard::new); mHelper.clickNodeAndShowKeyboard("CREDIT_CARD_NAME_FULL"); DOMUtils.focusNode(mActivityTestRule.getWebContents(), "CREDIT_CARD_NAME_FULL");
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetViewTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetViewTest.java index 4757fb8b..ebea8b3 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetViewTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetViewTest.java
@@ -140,7 +140,7 @@ @Test @MediumTest - public void testAddingUnselectableFieldsRendersUnclickabeChips() throws ExecutionException { + public void testAddingUnselectableFieldsRendersUnclickabeChips() { assertThat(mView.get().getChildCount(), is(0)); TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryIntegrationTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryIntegrationTest.java index c7182c0..277b5ab 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryIntegrationTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryIntegrationTest.java
@@ -60,7 +60,7 @@ @Test @SmallTest - public void testPasswordSheetIsAvailable() throws InterruptedException { + public void testPasswordSheetIsAvailable() { mHelper.loadTestPage(false); CriteriaHelper.pollUiThread(() -> { @@ -71,8 +71,7 @@ @Test @SmallTest @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.LOLLIPOP, message = "crbug.com/958631") - public void testPasswordSheetDisplaysProvidedItems() - throws InterruptedException, TimeoutException { + public void testPasswordSheetDisplaysProvidedItems() throws TimeoutException { mHelper.loadTestPage(false); mHelper.cacheCredentials("mayapark@gmail.com", "SomeHiddenPassword"); @@ -88,7 +87,7 @@ @Test @SmallTest - public void testPasswordSheetDisplaysOptions() throws InterruptedException, TimeoutException { + public void testPasswordSheetDisplaysOptions() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory. @@ -103,7 +102,7 @@ @Test @SmallTest - public void testFillsPasswordOnTap() throws InterruptedException, TimeoutException { + public void testFillsPasswordOnTap() throws TimeoutException { mHelper.loadTestPage(false); mHelper.cacheCredentials("mpark@abc.com", "ShorterPassword"); @@ -123,8 +122,7 @@ @Test @SmallTest - public void testDisplaysEmptyStateMessageWithoutSavedPasswords() - throws InterruptedException, TimeoutException { + public void testDisplaysEmptyStateMessageWithoutSavedPasswords() throws TimeoutException { mHelper.loadTestPage(false); // Focus the field to bring up the accessory.
diff --git a/chrome/android/features/media_router/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java b/chrome/android/features/media_router/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java index bb54f0bc..d9cce2e 100644 --- a/chrome/android/features/media_router/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java +++ b/chrome/android/features/media_router/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java
@@ -40,7 +40,6 @@ import org.chromium.ui.test.util.UiRestriction; import java.io.StringWriter; -import java.util.concurrent.TimeoutException; /** * Integration tests for MediaRouter. @@ -95,7 +94,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { // Temporary until support library is updated, see http://crbug.com/576393. TestThreadUtils.runOnUiThreadBlocking(() -> { StrictMode.setThreadPolicy(mOldPolicy); }); mTestServer.stopAndDestroyServer(); @@ -203,7 +202,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testBasic() throws InterruptedException, TimeoutException { + public void testBasic() { mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); executeJavaScriptApi(webContents, WAIT_DEVICE_SCRIPT); @@ -225,7 +224,7 @@ @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) @Feature({"MediaRouter"}) @LargeTest - public void testSendAndOnMessage() throws InterruptedException, TimeoutException { + public void testSendAndOnMessage() { mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); executeJavaScriptApi(webContents, WAIT_DEVICE_SCRIPT); @@ -246,7 +245,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testOnClose() throws InterruptedException, TimeoutException { + public void testOnClose() { MockMediaRouteProvider.Factory.sProvider.setCloseRouteWithErrorOnSend(true); mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); @@ -267,7 +266,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testFailNoProvider() throws InterruptedException, TimeoutException { + public void testFailNoProvider() { MockMediaRouteProvider.Factory.sProvider.setIsSupportsSource(false); mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); @@ -286,7 +285,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testFailCreateRoute() throws InterruptedException, TimeoutException { + public void testFailCreateRoute() { MockMediaRouteProvider.Factory.sProvider.setCreateRouteErrorMessage("Unknown sink"); mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); @@ -304,7 +303,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testReconnectSession() throws InterruptedException, TimeoutException { + public void testReconnectSession() { mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); executeJavaScriptApi(webContents, WAIT_DEVICE_SCRIPT); @@ -331,7 +330,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testFailReconnectSession() throws InterruptedException, TimeoutException { + public void testFailReconnectSession() { mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); executeJavaScriptApi(webContents, WAIT_DEVICE_SCRIPT); @@ -356,7 +355,7 @@ @Feature({"MediaRouter"}) @LargeTest @RetryOnFailure - public void testFailStartCancelled() throws InterruptedException, TimeoutException { + public void testFailStartCancelled() { mActivityTestRule.loadUrl(mTestServer.getURL(TEST_PAGE)); WebContents webContents = mActivityTestRule.getWebContents(); executeJavaScriptApi(webContents, WAIT_DEVICE_SCRIPT);
diff --git a/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterSinkObservationTest.java b/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterSinkObservationTest.java index 0f0215d..42e4705 100644 --- a/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterSinkObservationTest.java +++ b/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterSinkObservationTest.java
@@ -108,7 +108,7 @@ @Test @Feature({"MediaRouter"}) - public void testNotLowRamDevice() throws Exception { + public void testNotLowRamDevice() { SysUtils.resetForTesting(); CommandLine.getInstance().appendSwitch(BaseSwitches.DISABLE_LOW_END_DEVICE_MODE); assertTrue(mChromeMediaRouter.startObservingMediaSinks(SOURCE_ID1)); @@ -116,7 +116,7 @@ @Test @Feature({"MediaRouter"}) - public void testIsLowRamDevice() throws Exception { + public void testIsLowRamDevice() { SysUtils.resetForTesting(); CommandLine.getInstance().appendSwitch(BaseSwitches.ENABLE_LOW_END_DEVICE_MODE); assertEquals(false, mChromeMediaRouter.startObservingMediaSinks(SOURCE_ID1));
diff --git a/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/caf/CafMessageHandlerTest.java b/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/caf/CafMessageHandlerTest.java index e76e1ea..b3a372b0 100644 --- a/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/caf/CafMessageHandlerTest.java +++ b/chrome/android/features/media_router/junit/src/org/chromium/chrome/browser/media/router/caf/CafMessageHandlerTest.java
@@ -87,7 +87,7 @@ private CafMessageHandler mMessageHandler; private int mNumStopApplicationCalled; - private interface CheckedRunnable { void run() throws Exception; } + private interface CheckedRunnable { void run(); } @Before public void setUp() { @@ -513,7 +513,7 @@ } @Test - public void testHandleStopMessage() throws JSONException { + public void testHandleStopMessage() { InOrder inOrder = inOrder(mSessionController); assertEquals(0, mMessageHandler.getStopRequestsForTest().size()); mMessageHandler.handleStopMessage(CLIENT_ID1, SEQUENCE_NUMBER1); @@ -754,7 +754,7 @@ } @Test - public void testOnMessageReceivedWithoutRequestId() throws JSONException { + public void testOnMessageReceivedWithoutRequestId() { doNothing() .when(mMessageHandler) .onAppMessage(anyString(), anyString(), any(RequestRecord.class)); @@ -770,7 +770,7 @@ } @Test - public void testOnMessageReceivedOfMediaNamespace() throws JSONException { + public void testOnMessageReceivedOfMediaNamespace() { doNothing().when(mMessageHandler).onMediaMessage(anyString(), any(RequestRecord.class)); mMessageHandler.onMessageReceived(MEDIA_NAMESPACE, "anymessage"); verify(mMessageHandler).onMediaMessage(eq("anymessage"), (RequestRecord) isNull()); @@ -939,7 +939,7 @@ } @Test - public void testSendEnclosedMessageToClient() throws JSONException { + public void testSendEnclosedMessageToClient() { String message = "dontcare_message1"; doReturn(message) .when(mMessageHandler)
diff --git a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutPerfTest.java b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutPerfTest.java index c2c0ec8..78276605 100644 --- a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutPerfTest.java +++ b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutPerfTest.java
@@ -86,7 +86,7 @@ private int mTabNumCap; @Before - public void setUp() throws InterruptedException { + public void setUp() { FeatureUtilities.setGridTabSwitcherEnabledForTesting(true); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.startMainActivityFromLauncher(); @@ -194,7 +194,7 @@ * @param url The URL to load. Skip loading when null, but the thumbnail for the NTP might not * be saved. */ - private void prepareTabs(int numTabs, @Nullable String url) throws InterruptedException { + private void prepareTabs(int numTabs, @Nullable String url) { assertTrue(numTabs >= 1); assertEquals(1, mActivityTestRule.getActivity().getTabModelSelector().getTotalTabCount()); // Only run the full size when doing local perf tests.
diff --git a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutTest.java b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutTest.java index 1757506..ffd490e 100644 --- a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutTest.java +++ b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutTest.java
@@ -97,7 +97,7 @@ (bitmap) -> mAllBitmaps.add(new WeakReference<>(bitmap)); @Before - public void setUp() throws InterruptedException { + public void setUp() { FeatureUtilities.setGridTabSwitcherEnabledForTesting(true); EmbeddedTestServer testServer = @@ -222,7 +222,7 @@ * Make Chrome have {@code numTabs} or Tabs with {@code url} loaded. * @see #prepareTabs(int, String, boolean) */ - private void prepareTabs(int numTabs, @Nullable String url) throws InterruptedException { + private void prepareTabs(int numTabs, @Nullable String url) { prepareTabs(numTabs, url, true); } @@ -233,8 +233,7 @@ * be saved. * @param waitForLoading Whether wait for URL loading. */ - private void prepareTabs(int numTabs, @Nullable String url, boolean waitForLoading) - throws InterruptedException { + private void prepareTabs(int numTabs, @Nullable String url, boolean waitForLoading) { assertTrue(numTabs >= 1); assertEquals(1, mActivityTestRule.getActivity().getTabModelSelector().getTotalTabCount()); @@ -548,7 +547,7 @@ // clang-format off @DisabledTest(message = "http://crbug/1005865 - Test was previously flaky but only on bots." + "Was not locally reproducible. Disabling until verified that it's deflaked on bots.") - public void testIncognitoEnterGts() throws Exception { + public void testIncognitoEnterGts() { // clang-format on mActivityTestRule.newIncognitoTabFromMenu(); TestThreadUtils.runOnUiThreadBlocking(
diff --git a/chrome/android/features/tab_ui/BUILD.gn b/chrome/android/features/tab_ui/BUILD.gn index 2d7f16a..e163622a 100644 --- a/chrome/android/features/tab_ui/BUILD.gn +++ b/chrome/android/features/tab_ui/BUILD.gn
@@ -108,6 +108,7 @@ "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetMediator.java", "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetContent.java", "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinder.java", + "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupTitleEditor.java", "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiCoordinator.java", "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java", "java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiToolbarView.java",
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/EmptyTabGroupModelFilterObserver.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/EmptyTabGroupModelFilterObserver.java index 9366113..d5f377f 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/EmptyTabGroupModelFilterObserver.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/EmptyTabGroupModelFilterObserver.java
@@ -13,6 +13,12 @@ */ public class EmptyTabGroupModelFilterObserver implements TabGroupModelFilter.Observer { @Override + public void willMergeTabToGroup(Tab movedTab) {} + + @Override + public void willMoveTabOutOfGroup(Tab movedTab, int newRootId) {} + + @Override public void didMergeTabToGroup(Tab movedTab, int selectedTabIdInGroup) {} @Override
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter.java index 9657a526..34ea2a9 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter.java
@@ -50,6 +50,22 @@ */ public interface Observer { /** + * This method is called before a tab is moved to form a group or moved into an existed + * group. + * @param movedTab The {@link Tab} which will be moved. If a group will be merged to a tab + * or another group, this is the last tab of the merged group. + */ + void willMergeTabToGroup(Tab movedTab); + + /** + * This method is called before a tab within a group is moved out of the group. + * + * @param movedTab The tab which will be moved. + * @param newRootId The new root id of the group from which {@code movedTab} is moved out. + */ + void willMoveTabOutOfGroup(Tab movedTab, int newRootId); + + /** * This method is called after a tab is moved to form a group or moved into an existed * group. * @param movedTab The {@link Tab} which has been moved. If a group is merged to a tab or @@ -281,6 +297,9 @@ int destinationIndexInTabModel = getTabModelDestinationIndex(destinationTab); if (!needToUpdateTabModel(tabsToMerge, destinationIndexInTabModel)) { + for (Observer observer : mGroupFilterObserver) { + observer.willMergeTabToGroup(tabsToMerge.get(tabsToMerge.size() - 1)); + } for (int i = 0; i < tabsToMerge.size(); i++) { Tab tab = tabsToMerge.get(i); tab.setRootId(destinationGroupId); @@ -320,6 +339,12 @@ for (int i = 0; i < tabs.size(); i++) { Tab tab = tabs.get(i); + // When merging tabs are in the same group, only make one willMergeTabToGroup call. + if (!isSameGroup || i == tabs.size() - 1) { + for (Observer observer : mGroupFilterObserver) { + observer.willMergeTabToGroup(tab); + } + } int index = TabModelUtils.getTabIndexById(getTabModel(), tab.getId()); assert index != TabModel.INVALID_TAB_INDEX; originalIndexes.add(index); @@ -354,12 +379,17 @@ sourceTabGroup.getTabIdForIndex(sourceTabGroup.getTabIdList().size() - 1)); int targetIndex = tabModel.indexOf(lastTabInSourceGroup); assert targetIndex != TabModel.INVALID_TAB_INDEX; - assert sourceTabGroup.size() > 1; int prevFilterIndex = mGroupIdToGroupIndexMap.get(sourceTab.getRootId()); + if (sourceTabGroup.size() == 1) { + for (Observer observer : mGroupFilterObserver) { + observer.didMoveTabOutOfGroup(sourceTab, prevFilterIndex); + } + return; + } + int newRootId = sourceTab.getRootId(); if (sourceTab.getId() == sourceTab.getRootId()) { // If moving tab's id is the root id of the group, find a new root id. - int newRootId = Tab.INVALID_TAB_ID; if (sourceIndex != 0 && tabModel.getTabAt(sourceIndex - 1).getRootId() == sourceTab.getRootId()) { newRootId = tabModel.getTabAt(sourceIndex - 1).getId(); @@ -367,9 +397,13 @@ && tabModel.getTabAt(sourceIndex + 1).getRootId() == sourceTab.getRootId()) { newRootId = tabModel.getTabAt(sourceIndex + 1).getId(); } + } + assert newRootId != Tab.INVALID_TAB_ID; - assert newRootId != Tab.INVALID_TAB_ID; - + for (Observer observer : mGroupFilterObserver) { + observer.willMoveTabOutOfGroup(sourceTab, newRootId); + } + if (sourceTab.getId() == sourceTab.getRootId()) { for (int tabId : sourceTabGroup.getTabIdList()) { TabModelUtils.getTabById(tabModel, tabId).setRootId(newRootId); } @@ -460,6 +494,19 @@ return getRelatedTabList(group.getTabIdList()); } + /** + * This method returns all tabs in a tab group with reference to {@code tabRootId} as group id. + * + * @param tabRootId The tab root id that is used to find the related group. + * @return An unmodifiable list of {@link Tab} that relate with the given tab root id. + */ + public List<Tab> getRelatedTabListForRootId(int tabRootId) { + if (tabRootId == Tab.INVALID_TAB_ID) return super.getRelatedTabList(tabRootId); + TabGroup group = mGroupIdToGroupMap.get(tabRootId); + if (group == null) return super.getRelatedTabList(TabModel.INVALID_TAB_INDEX); + return getRelatedTabList(group.getTabIdList()); + } + @Override public boolean hasOtherRelatedTabs(Tab tab) { int groupId = tab.getRootId();
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java index 3936fcfa..b460c70 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java
@@ -244,7 +244,6 @@ } private void updateDialog() { - if (mCurrentTabId == Tab.INVALID_TAB_ID) return; List<Tab> relatedTabs = getRelatedTabs(mCurrentTabId); int tabsCount = relatedTabs.size(); if (tabsCount == 0) {
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallback.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallback.java index ae60240f..d8fc124 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallback.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallback.java
@@ -181,7 +181,11 @@ View ungroupItemView = ungroupViewHolder.itemView; filter.moveTabOutOfGroup( mModel.get(mUnGroupTabIndex).model.get(TabProperties.TAB_ID)); - mRecyclerView.getLayoutManager().removeView(ungroupItemView); + // Handle the case where the recyclerView is cleared out after ungrouping the + // last tab in group. + if (mRecyclerView.getAdapter().getItemCount() != 0) { + mRecyclerView.getLayoutManager().removeView(ungroupItemView); + } RecordUserAction.record("TabGrid.Drag.RemoveFromGroup." + mComponentName); } } @@ -239,8 +243,6 @@ } } else if (actionState == ItemTouchHelper.ACTION_STATE_DRAG && mTabGridDialogHandler != null) { - // Not allow ungrouping the last tab in group. - if (recyclerView.getAdapter().getItemCount() == 1) return; boolean isHoveredOnUngroupBar = viewHolder.itemView.getBottom() + dY > recyclerView.getBottom() - mUngroupThreshold; if (mSelectedTabIndex == TabModel.INVALID_TAB_INDEX) return;
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupTitleEditor.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupTitleEditor.java new file mode 100644 index 0000000..52c0514 --- /dev/null +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupTitleEditor.java
@@ -0,0 +1,119 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.tasks.tab_management; + +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; +import org.chromium.chrome.browser.tabmodel.TabModelObserver; +import org.chromium.chrome.browser.tabmodel.TabModelSelector; +import org.chromium.chrome.browser.tasks.tab_groups.EmptyTabGroupModelFilterObserver; +import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter; +import org.chromium.ui.modelutil.PropertyModel; + +/** + * This class hosts logic related to edit tab group title. Concrete class that extends this abstract + * class needs to specify the title storage/fetching implementation as well as handle {@link + * PropertyModel} update. + */ +public abstract class TabGroupTitleEditor { + private final TabModelSelector mTabModelSelector; + private final TabModelObserver mTabModelObserver; + private final TabGroupModelFilter.Observer mFilterObserver; + + public TabGroupTitleEditor(TabModelSelector tabModelSelector) { + mTabModelSelector = tabModelSelector; + + mTabModelObserver = new EmptyTabModelObserver() { + @Override + public void tabClosureCommitted(Tab tab) { + int tabRootId = tab.getRootId(); + TabGroupModelFilter filter = + (TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider() + .getCurrentTabModelFilter(); + // If the group becomes a single tab after closing or we are closing a group, delete + // the stored title. + if (filter.getRelatedTabListForRootId(tabRootId).size() == 1) { + deleteTabGroupTitle(tabRootId); + } + } + }; + + mFilterObserver = new EmptyTabGroupModelFilterObserver() { + @Override + public void willMergeTabToGroup(Tab movedTab) { + deleteTabGroupTitle(movedTab.getRootId()); + } + + @Override + public void willMoveTabOutOfGroup(Tab movedTab, int newRootId) { + TabGroupModelFilter filter = + (TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider() + .getCurrentTabModelFilter(); + String title = getTabGroupTitle(movedTab.getRootId()); + if (title == null) return; + // If the group size is 2, i.e. the group becomes a single tab after ungroup, delete + // the stored title. + if (filter.getRelatedTabList(movedTab.getId()).size() == 2) { + deleteTabGroupTitle(movedTab.getRootId()); + return; + } + // If the root tab in group is moved out, try to fetch the title and + // reassign it to the new root tab in group. + if (movedTab.getRootId() != newRootId) { + updateTabGroupTitle(mTabModelSelector.getTabById(newRootId), title); + } + } + }; + + mTabModelSelector.getTabModelFilterProvider().addTabModelFilterObserver(mTabModelObserver); + assert mTabModelSelector.getTabModelFilterProvider().getTabModelFilter(false) + instanceof TabGroupModelFilter; + assert mTabModelSelector.getTabModelFilterProvider().getTabModelFilter(true) + instanceof TabGroupModelFilter; + ((TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider().getTabModelFilter( + false)) + .addTabGroupObserver(mFilterObserver); + ((TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider().getTabModelFilter( + true)) + .addTabGroupObserver(mFilterObserver); + } + + /** + * This method uses tab group root ID of {@code tab} as a reference to update tab group title. + * Implementation of this method needs to store the updated title and maybe update relevant + * {@link PropertyModel} as well. + * + * @param tab The {@link Tab} whose root ID is used as reference to update group title. + * @param title The tab group title to store. + */ + protected abstract void updateTabGroupTitle(Tab tab, String title); + + /** + * This method deletes specific stored tab group title. + * @param tabRootId The tab root ID whose related tab group title will be deleted. + */ + protected abstract void deleteTabGroupTitle(int tabRootId); + + /** + * This method fetches tab group title with related tab group root ID. + * @param tabRootId The tab root ID whose related tab group title will be deleted. + * @return The stored title of the related group, default value is null. + */ + protected abstract String getTabGroupTitle(int tabRootId); + + /** + * Destroy any members that needs clean up. + */ + public void destroy() { + mTabModelSelector.getTabModelFilterProvider().removeTabModelFilterObserver( + mTabModelObserver); + ((TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider().getTabModelFilter( + false)) + .removeTabGroupObserver(mFilterObserver); + ((TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider().getTabModelFilter( + true)) + .removeTabGroupObserver(mFilterObserver); + } +}
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java index 62631c0..d8da896b 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java
@@ -43,6 +43,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelUtils; import org.chromium.chrome.browser.tabmodel.TabSelectionType; +import org.chromium.chrome.browser.tasks.tab_groups.EmptyTabGroupModelFilterObserver; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupUtils; import org.chromium.chrome.browser.tasks.tab_management.TabProperties.UiType; @@ -484,7 +485,7 @@ if (mTabModelSelector.getTabModelFilterProvider().getCurrentTabModelFilter() instanceof TabGroupModelFilter) { - mTabGroupObserver = new TabGroupModelFilter.Observer() { + mTabGroupObserver = new EmptyTabGroupModelFilterObserver() { @Override public void didMoveWithinGroup( Tab movedTab, int tabModelOldIndex, int tabModelNewIndex) { @@ -507,11 +508,15 @@ @Override public void didMoveTabOutOfGroup(Tab movedTab, int prevFilterIndex) { assert !(mActionsOnAllRelatedTabs && mTabGridDialogHandler != null); - TabGroupModelFilter filter = (TabGroupModelFilter) mTabModelSelector.getTabModelFilterProvider() .getCurrentTabModelFilter(); + boolean isUngroupingLastTabInGroup = + filter.getTabAt(prevFilterIndex).getId() == movedTab.getId(); if (mActionsOnAllRelatedTabs) { + if (isUngroupingLastTabInGroup) { + return; + } Tab currentSelectedTab = mTabModelSelector.getCurrentTab(); int index = TabModelUtils.getTabIndexById( mTabModelSelector.getTabModelFilterProvider() @@ -528,8 +533,9 @@ if (!isValidMovePosition(curIndex)) return; mModel.removeAt(curIndex); if (mTabGridDialogHandler != null) { - mTabGridDialogHandler.updateDialogContent( - filter.getTabAt(prevFilterIndex).getId()); + mTabGridDialogHandler.updateDialogContent(isUngroupingLastTabInGroup + ? Tab.INVALID_TAB_ID + : filter.getTabAt(prevFilterIndex).getId()); } } }
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogParentTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogParentTest.java index c8c1dd2..a5d90c4 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogParentTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogParentTest.java
@@ -78,7 +78,7 @@ @Test @SmallTest @UiThreadTest - public void testUpdateDialogWithOrientation() throws Exception { + public void testUpdateDialogWithOrientation() { mockDialogStatus(false); mTabGridDialogParent.updateDialogWithOrientation( @@ -119,7 +119,7 @@ @Test @SmallTest @UiThreadTest - public void testResetDialog() throws Exception { + public void testResetDialog() { mTabGridDialogContainer.removeAllViews(); View toolbarView = new View(getActivity()); View recyclerView = new View(getActivity()); @@ -140,7 +140,7 @@ @Test @MediumTest - public void testUpdateUngroupBar() throws Exception { + public void testUpdateUngroupBar() { mTabGridDialogContainer.removeAllViews(); View toolbarView = new View(getActivity()); View recyclerView = new View(getActivity()); @@ -249,7 +249,7 @@ @Test @MediumTest - public void testDialog_ZoomInZoomOut() throws Exception { + public void testDialog_ZoomInZoomOut() { // Setup the animation with a dummy animation params. TabGridDialogParent.AnimationParams params = new TabGridDialogParent.AnimationParams( new Rect(3, 3, 3, 3), new View(getActivity())); @@ -306,7 +306,7 @@ @Test @MediumTest - public void testDialog_ZoomInFadeOut() throws Exception { + public void testDialog_ZoomInFadeOut() { // Setup the animation with a dummy animation params. TabGridDialogParent.AnimationParams params = new TabGridDialogParent.AnimationParams( new Rect(3, 3, 3, 3), new View(getActivity())); @@ -337,7 +337,7 @@ @Test @MediumTest - public void testDialog_FadeInFadeOut() throws Exception { + public void testDialog_FadeInFadeOut() { // Setup the the basic fade-in and fade-out animation. mTabGridDialogParent.setupDialogAnimation(null);
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java index 828b824a..c544027 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java
@@ -117,7 +117,7 @@ @Features.EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) @DisabledTest // Failed multiple times on Android CFI https://crbug.com/954145 - public void testShowWithAnimation() throws Exception { + public void testShowWithAnimation() { TestThreadUtils.runOnUiThreadBlocking(() -> { mContainerModel.set( TabListContainerProperties.VISIBILITY_LISTENER, mMockVisibilityListener); @@ -145,7 +145,7 @@ @MediumTest @UiThreadTest @Features.EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) - public void testShowWithoutAnimation() throws Exception { + public void testShowWithoutAnimation() { mContainerModel.set( TabListContainerProperties.VISIBILITY_LISTENER, mMockVisibilityListener); @@ -162,7 +162,7 @@ @Test @MediumTest @Features.EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) - public void testHidesWithAnimation() throws Exception { + public void testHidesWithAnimation() { TestThreadUtils.runOnUiThreadBlocking(() -> { mContainerModel.set( TabListContainerProperties.VISIBILITY_LISTENER, mMockVisibilityListener); @@ -200,7 +200,7 @@ @MediumTest @UiThreadTest @Features.EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) - public void testHidesWithoutAnimation() throws Exception { + public void testHidesWithoutAnimation() { mContainerModel.set( TabListContainerProperties.VISIBILITY_LISTENER, mMockVisibilityListener); @@ -222,7 +222,7 @@ @Test @MediumTest @UiThreadTest - public void testIsIncognitoSetsBackgroundColor() throws Exception { + public void testIsIncognitoSetsBackgroundColor() { mContainerModel.set(TabListContainerProperties.IS_INCOGNITO, true); assertThat(mRecyclerView.getBackground(), instanceOf(ColorDrawable.class)); assertThat(((ColorDrawable) mRecyclerView.getBackground()).getColor(), @@ -239,7 +239,7 @@ @Test @MediumTest @UiThreadTest - public void testTopContainerHeightSetsTopMargin() throws Exception { + public void testTopContainerHeightSetsTopMargin() { assertThat(mRecyclerView.getLayoutParams(), instanceOf(FrameLayout.LayoutParams.class)); assertThat( ((FrameLayout.LayoutParams) mRecyclerView.getLayoutParams()).topMargin, equalTo(0)); @@ -252,7 +252,7 @@ @Test @MediumTest @UiThreadTest - public void testBottomContainerHeightSetsBottomMargin() throws Exception { + public void testBottomContainerHeightSetsBottomMargin() { assertThat(mRecyclerView.getLayoutParams(), instanceOf(FrameLayout.LayoutParams.class)); assertThat(((FrameLayout.LayoutParams) mRecyclerView.getLayoutParams()).bottomMargin, equalTo(0));
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java index 2d1289d7..87a2551 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java
@@ -187,7 +187,7 @@ @Test @MediumTest @UiThreadTest - public void testSelected() throws Exception { + public void testSelected() { testGridSelected(mTabGridView, mGridModel); mStripModel.set(TabProperties.IS_SELECTED, true); @@ -209,7 +209,7 @@ @Test @MediumTest - public void testAnimationRestored() throws Exception { + public void testAnimationRestored() { View backgroundView = mTabGridView.findViewById(R.id.background_view); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -250,7 +250,7 @@ @Test @MediumTest @UiThreadTest - public void testTitle() throws Exception { + public void testTitle() { final String title = "Surf the cool webz"; mGridModel.set(TabProperties.TITLE, title); TextView textView = mTabGridView.findViewById(R.id.tab_title); @@ -264,7 +264,7 @@ @Test @MediumTest @UiThreadTest - public void testThumbnail() throws Exception { + public void testThumbnail() { mGridModel.set(TabProperties.THUMBNAIL_FETCHER, mMockThumbnailProvider); ImageView thumbnail = mTabGridView.findViewById(R.id.tab_thumbnail); Assert.assertNull(thumbnail.getDrawable()); @@ -279,7 +279,7 @@ @Test @MediumTest @UiThreadTest - public void testThumbnailGCAfterNullBitmap() throws Exception { + public void testThumbnailGCAfterNullBitmap() { ImageView thumbnail = mTabGridView.findViewById(R.id.tab_thumbnail); mShouldReturnBitmap = true; mGridModel.set(TabProperties.THUMBNAIL_FETCHER, mMockThumbnailProvider); @@ -299,7 +299,7 @@ @Test @MediumTest @UiThreadTest - public void testThumbnailGCAfterNewBitmap() throws Exception { + public void testThumbnailGCAfterNewBitmap() { ImageView thumbnail = mTabGridView.findViewById(R.id.tab_thumbnail); mShouldReturnBitmap = true; mGridModel.set(TabProperties.THUMBNAIL_FETCHER, mMockThumbnailProvider); @@ -318,7 +318,7 @@ @Test @MediumTest @UiThreadTest - public void testResetThumbnailGC() throws Exception { + public void testResetThumbnailGC() { ImageView thumbnail = mTabGridView.findViewById(R.id.tab_thumbnail); mShouldReturnBitmap = true; mGridModel.set(TabProperties.THUMBNAIL_FETCHER, mMockThumbnailProvider); @@ -336,7 +336,7 @@ @Test @MediumTest @UiThreadTest - public void testHiddenGC() throws Exception { + public void testHiddenGC() { ImageView thumbnail = mTabGridView.findViewById(R.id.tab_thumbnail); mShouldReturnBitmap = true; mGridModel.set(TabProperties.THUMBNAIL_FETCHER, mMockThumbnailProvider); @@ -356,7 +356,7 @@ @Test @MediumTest @UiThreadTest - public void testHiddenThenShow() throws Exception { + public void testHiddenThenShow() { ImageView thumbnail = mTabGridView.findViewById(R.id.tab_thumbnail); mShouldReturnBitmap = true; mGridModel.set(TabProperties.THUMBNAIL_FETCHER, mMockThumbnailProvider); @@ -375,7 +375,7 @@ @Test @MediumTest @UiThreadTest - public void testClickToSelect() throws Exception { + public void testClickToSelect() { Assert.assertFalse(mSelectClicked.get()); mTabGridView.performClick(); Assert.assertTrue(mSelectClicked.get()); @@ -416,7 +416,7 @@ @Test @MediumTest @UiThreadTest - public void testClickToClose() throws Exception { + public void testClickToClose() { ImageView actionButton = mTabGridView.findViewById(R.id.action_button); ImageButton button = mTabStripView.findViewById(R.id.tab_strip_item_button); Assert.assertFalse(mCloseClicked.get()); @@ -448,7 +448,7 @@ @Test @MediumTest @UiThreadTest - public void testSetCreateGroupListener() throws Exception { + public void testSetCreateGroupListener() { ButtonCompat actionButton = mTabGridView.findViewById(R.id.create_group_button); // By default, the create group button is invisible. Assert.assertEquals(View.GONE, actionButton.getVisibility());
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilterUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilterUnitTest.java index 7233aa9..d8b6b52 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilterUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilterUnitTest.java
@@ -105,12 +105,14 @@ doAnswer(new Answer() { @Override - public Object answer(InvocationOnMock invocation) throws Throwable { + public Object answer(InvocationOnMock invocation) { int newRootId = invocation.getArgument(0); doReturn(newRootId).when(tab).getRootId(); return null; } - }).when(tab).setRootId(anyInt()); + }) + .when(tab) + .setRootId(anyInt()); doReturn(tabId).when(tab).getId(); doReturn(parentTabId).when(tab).getParentId(); @@ -122,12 +124,14 @@ private void setRootId(Tab tab, int rootId) { doAnswer(new Answer() { @Override - public Object answer(InvocationOnMock invocation) throws Throwable { + public Object answer(InvocationOnMock invocation) { int newRootId = invocation.getArgument(0); doReturn(newRootId).when(tab).getRootId(); return null; } - }).when(tab).setRootId(rootId); + }) + .when(tab) + .setRootId(rootId); } private void setUpTab() { @@ -142,18 +146,20 @@ private void setUpTabModel() { doAnswer(new Answer() { @Override - public Object answer(InvocationOnMock invocation) throws Throwable { + public Object answer(InvocationOnMock invocation) { Tab tab = invocation.getArgument(0); int index = invocation.getArgument(1); index = index == -1 ? mTabs.size() : index; mTabs.add(index, tab); return null; } - }).when(mTabModel).addTab(any(Tab.class), anyInt(), anyInt()); + }) + .when(mTabModel) + .addTab(any(Tab.class), anyInt(), anyInt()); doAnswer(new Answer() { @Override - public Object answer(InvocationOnMock invocation) throws Throwable { + public Object answer(InvocationOnMock invocation) { int movedTabId = invocation.getArgument(0); int newIndex = invocation.getArgument(1); @@ -166,30 +172,38 @@ mTabModelObserverCaptor.getValue().didMoveTab(tab, newIndex, oldIndex); return null; } - }).when(mTabModel).moveTab(anyInt(), anyInt()); + }) + .when(mTabModel) + .moveTab(anyInt(), anyInt()); doAnswer(new Answer() { @Override - public Tab answer(InvocationOnMock invocation) throws Throwable { + public Tab answer(InvocationOnMock invocation) { int index = invocation.getArgument(0); return mTabs.get(index); } - }).when(mTabModel).getTabAt(anyInt()); + }) + .when(mTabModel) + .getTabAt(anyInt()); doAnswer(new Answer() { @Override - public Integer answer(InvocationOnMock invocation) throws Throwable { + public Integer answer(InvocationOnMock invocation) { Tab tab = invocation.getArgument(0); return mTabs.indexOf(tab); } - }).when(mTabModel).indexOf(any(Tab.class)); + }) + .when(mTabModel) + .indexOf(any(Tab.class)); doAnswer(new Answer() { @Override - public Integer answer(InvocationOnMock invocation) throws Throwable { + public Integer answer(InvocationOnMock invocation) { return mTabs.size(); } - }).when(mTabModel).getCount(); + }) + .when(mTabModel) + .getCount(); doReturn(0).when(mTabModel).index(); doNothing().when(mTabModel).addObserver(mTabModelObserverCaptor.capture()); @@ -360,7 +374,11 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB3_ID); mTabGroupModelFilter.moveTabOutOfGroup(TAB6_ID); + verify(mTabGroupModelFilterObserver).willMoveTabOutOfGroup(mTab3, TAB2_ROOT_ID); + verify(mTabGroupModelFilterObserver).willMoveTabOutOfGroup(mTab6, TAB5_ROOT_ID); verify(mTabModel, never()).moveTab(anyInt(), anyInt()); + verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab3, POSITION2); + verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab6, POSITION5); assertArrayEquals(mTabs.toArray(), expectedTabModel.toArray()); assertThat(mTab3.getRootId(), equalTo(TAB3_ID)); assertThat(mTab6.getRootId(), equalTo(TAB6_ID)); @@ -384,7 +402,11 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB2_ID); mTabGroupModelFilter.moveTabOutOfGroup(TAB5_ID); + mTabGroupModelFilterObserver.willMoveTabOutOfGroup(mTab2, TAB3_ID); + mTabGroupModelFilterObserver.willMoveTabOutOfGroup(mTab5, TAB6_ID); mTabModelInOrder.verify(mTabModel, never()).moveTab(anyInt(), anyInt()); + mTabGroupModelFilterObserver.didMoveTabOutOfGroup(mTab2, POSITION2); + mTabGroupModelFilterObserver.didMoveTabOutOfGroup(mTab5, POSITION5); assertArrayEquals(mTabs.toArray(), expectedTabModel.toArray()); assertThat(mTab2.getRootId(), equalTo(TAB2_ID)); assertThat(mTab3.getRootId(), equalTo(TAB3_ID)); @@ -408,6 +430,7 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB3_ID); + mTabGroupModelFilterObserver.willMoveTabOutOfGroup(mTab3, TAB2_ROOT_ID); // Plus one as offset because we are moving backwards in tab model. mTabModelInOrder.verify(mTabModel).moveTab(TAB3_ID, POSITION3 + 1); verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab3, POSITION2); @@ -434,6 +457,7 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB3_ID); + verify(mTabGroupModelFilterObserver).willMoveTabOutOfGroup(mTab3, TAB2_ROOT_ID); // Plus one as offset because we are moving backwards in tab model. mTabModelInOrder.verify(mTabModel).moveTab(TAB3_ID, POSITION4 + 1); verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab3, POSITION2); @@ -455,6 +479,7 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB2_ID); + verify(mTabGroupModelFilterObserver).willMoveTabOutOfGroup(mTab2, TAB3_ID); // Plus one as offset because we are moving backwards in tab model. verify(mTabModel).moveTab(mTab2.getId(), POSITION3 + 1); verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab2, POSITION2); @@ -481,6 +506,7 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB2_ID); + verify(mTabGroupModelFilterObserver).willMoveTabOutOfGroup(mTab2, NEW_TAB_ID); // Plus one as offset because we are moving backwards in tab model. verify(mTabModel).moveTab(mTab2.getId(), POSITION4 + 1); verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab2, POSITION2); @@ -492,6 +518,20 @@ } @Test + public void moveTabOutOfGroup_LastTab() { + List<Tab> expectedTabModelBeforeUngroup = + new ArrayList<>(Arrays.asList(mTab1, mTab2, mTab3, mTab4, mTab5, mTab6)); + assertArrayEquals(mTabs.toArray(), expectedTabModelBeforeUngroup.toArray()); + + mTabGroupModelFilter.moveTabOutOfGroup(TAB1_ID); + + // Ungrouping the last tab in group should have no effect on tab model. + verify(mTabModel, never()).moveTab(anyInt(), anyInt()); + verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab1, POSITION1); + assertArrayEquals(mTabs.toArray(), expectedTabModelBeforeUngroup.toArray()); + } + + @Test public void moveTabOutOfGroup_OtherGroupsLastShownIdUnchanged() { List<Tab> expectedTabModel = new ArrayList<>(Arrays.asList(mTab1, mTab3, mTab2, mTab4, mTab5, mTab6)); @@ -513,6 +553,7 @@ mTabGroupModelFilter.moveTabOutOfGroup(TAB2_ID); + verify(mTabGroupModelFilterObserver).willMoveTabOutOfGroup(mTab2, TAB3_ID); // Plus one as offset because we are moving backwards in tab model. verify(mTabModel).moveTab(mTab2.getId(), POSITION3 + 1); verify(mTabGroupModelFilterObserver).didMoveTabOutOfGroup(mTab2, POSITION2); @@ -554,6 +595,7 @@ mTabGroupModelFilter.mergeTabsToGroup(mTab4.getId(), mTab1.getId()); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab4); verify(mTabModel).moveTab(mTab4.getId(), ++startIndex); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab4, mTab1.getId()); assertArrayEquals(mTabGroupModelFilter.getRelatedTabList(mTab4.getId()).toArray(), @@ -570,6 +612,7 @@ mTabGroupModelFilter.mergeTabsToGroup(mTab5.getId(), mTab1.getId()); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab6); verify(mTabModel).moveTab(mTab5.getId(), ++startIndex); verify(mTabModel).moveTab(mTab6.getId(), ++startIndex); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab6, mTab1.getId()); @@ -587,6 +630,7 @@ mTabGroupModelFilter.mergeTabsToGroup(mTab5.getId(), mTab2.getId()); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab6); verify(mTabModel).moveTab(mTab5.getId(), ++startIndex); verify(mTabModel).moveTab(mTab6.getId(), ++startIndex); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab6, mTab2.getId()); @@ -604,6 +648,7 @@ mTabGroupModelFilter.mergeTabsToGroup(mTab1.getId(), mTab4.getId()); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab1); verify(mTabModel).moveTab(mTab1.getId(), startIndex + 1); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab1, mTab4.getId()); assertArrayEquals(mTabGroupModelFilter.getRelatedTabList(mTab1.getId()).toArray(), @@ -620,6 +665,7 @@ mTabGroupModelFilter.mergeTabsToGroup(mTab2.getId(), mTab4.getId()); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab3); verify(mTabModel).moveTab(mTab2.getId(), startIndex + 1); verify(mTabModel).moveTab(mTab3.getId(), startIndex + 1); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab3, mTab4.getId()); @@ -636,6 +682,8 @@ mTabGroupModelFilter.mergeListOfTabsToGroup(tabsToMerge, mTab5, false, false); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab1); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab4); verify(mTabModel).moveTab(mTab1.getId(), POSITION6 + 1); verify(mTabModel).moveTab(mTab4.getId(), POSITION6 + 1); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab1, mTab5.getId()); @@ -652,6 +700,8 @@ mTabGroupModelFilter.mergeListOfTabsToGroup(tabsToMerge, mTab1, false, false); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab4); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(newTab); verify(mTabModel).moveTab(mTab4.getId(), POSITION1 + 1); verify(mTabModel).moveTab(newTab.getId(), POSITION1 + 2); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab4, mTab1.getId()); @@ -668,6 +718,8 @@ mTabGroupModelFilter.mergeListOfTabsToGroup(tabsToMerge, mTab4, false, false); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab1); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(newTab); verify(mTabModel).moveTab(mTab1.getId(), POSITION4 + 1); verify(mTabModel).moveTab(newTab.getId(), POSITION4 + 1); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab1, mTab4.getId()); @@ -707,6 +759,7 @@ mTabGroupModelFilter.mergeTabsToGroup(mTab4.getId(), mTab1.getId()); + verify(mTabGroupModelFilterObserver).willMergeTabToGroup(mTab4); verify(mTabModel).moveTab(mTab4.getId(), ++startIndex); verify(mTabGroupModelFilterObserver).didMergeTabToGroup(mTab4, mTab1.getId()); assertArrayEquals(mTabGroupModelFilter.getRelatedTabList(mTab4.getId()).toArray(), @@ -890,4 +943,18 @@ mTabGroupModelFilter.resetFilterState(); assertThat(mTab3.getRootId(), equalTo(TAB1_ROOT_ID)); } + + @Test + public void testGetRelatedTabListForRootId() { + Tab[] group1 = new Tab[] {mTab2, mTab3}; + Tab[] group2 = new Tab[] {mTab5, mTab6}; + assertArrayEquals( + mTabGroupModelFilter.getRelatedTabListForRootId(TAB2_ROOT_ID).toArray(), group1); + assertArrayEquals( + mTabGroupModelFilter.getRelatedTabListForRootId(TAB3_ROOT_ID).toArray(), group1); + assertArrayEquals( + mTabGroupModelFilter.getRelatedTabListForRootId(TAB5_ROOT_ID).toArray(), group2); + assertArrayEquals( + mTabGroupModelFilter.getRelatedTabListForRootId(TAB6_ROOT_ID).toArray(), group2); + } }
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallbackUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallbackUnitTest.java index ea20f9f..c7840c2 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallbackUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallbackUnitTest.java
@@ -707,22 +707,6 @@ } @Test - public void onDragTab_Ungroup_LastTab() { - initAndAssertAllProperties(); - setupItemTouchHelperCallback(true); - - // Assume that there is only one tab in the group. - doReturn(1).when(mAdapter).getItemCount(); - - // Simulate dragging the only tab down to the ungroup bar. - mItemTouchHelperCallback.onChildDraw(mCanvas, mRecyclerView, mDummyViewHolder1, 0, 8, - ItemTouchHelper.ACTION_STATE_DRAG, true); - - verify(mTabGridDialogHandler, never()) - .updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HOVERED); - } - - @Test public void onDragTab_AfterRelease() { initAndAssertAllProperties(); setupItemTouchHelperCallback(true);
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java index 36fa4755..ecc7fd79 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java
@@ -457,8 +457,9 @@ @Test @Features.EnableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID, ChromeFeatureList.TAB_GROUPS_UI_IMPROVEMENTS_ANDROID}) - public void - sendsUngroupSignalCorrectly() { + // clang-format off + public void sendsUngroupSignalCorrectly() { + // clang-format on initAndAssertAllProperties(); setUpForTabGroupOperation(); FeatureUtilities.setTabGroupsAndroidEnabledForTesting(true); @@ -470,6 +471,7 @@ doReturn(mTabGroupModelFilter).when(mTabModelFilterProvider).getCurrentTabModelFilter(); doReturn(mAdapter).when(mRecyclerView).getAdapter(); + doReturn(1).when(mAdapter).getItemCount(); // Simulate the ungroup action. itemTouchHelperCallback.onSelectedChanged( @@ -799,6 +801,24 @@ } @Test + public void tabMoveOutOfGroup_GTS_LastTab() { + setUpForTabGroupOperation(); + // Assume that tab1 is a single tab. + List<Tab> tabs = new ArrayList<>(Arrays.asList(mTab1)); + mMediator.resetWithListOfTabs(tabs, false, false); + doReturn(1).when(mTabGroupModelFilter).getCount(); + doReturn(mTab1).when(mTabGroupModelFilter).getTabAt(POSITION1); + doReturn(tabs).when(mTabGroupModelFilter).getRelatedTabList(TAB1_ID); + + // Ungroup the single tab. + mTabGroupModelFilterObserverCaptor.getValue().didMoveTabOutOfGroup(mTab1, POSITION1); + + assertThat(mModel.size(), equalTo(1)); + assertThat(mModel.get(0).model.get(TabProperties.TAB_ID), equalTo(TAB1_ID)); + assertThat(mModel.get(0).model.get(TabProperties.TITLE), equalTo(TAB1_TITLE)); + } + + @Test public void tabMoveOutOfGroup_Dialog() { setUpForTabGroupOperation(); @@ -824,6 +844,27 @@ } @Test + public void tabMoveOutOfGroup_Dialog_LastTab() { + setUpForTabGroupOperation(); + + // Setup the mediator with a DialogHandler. + mMediator = new TabListMediator(mContext, mModel, mTabModelSelector, + mTabContentManager::getTabThumbnailWithCallback, null, mTabListFaviconProvider, + false, null, null, null, mTabGridDialogHandler, getClass().getSimpleName(), 0); + // Assume that tab1 is a single tab. + List<Tab> tabs = new ArrayList<>(Arrays.asList(mTab1)); + mMediator.resetWithListOfTabs(tabs, false, false); + doReturn(1).when(mTabGroupModelFilter).getCount(); + doReturn(mTab1).when(mTabGroupModelFilter).getTabAt(POSITION1); + doReturn(tabs).when(mTabGroupModelFilter).getRelatedTabList(TAB1_ID); + + // Ungroup the single tab. + mTabGroupModelFilterObserverCaptor.getValue().didMoveTabOutOfGroup(mTab1, POSITION1); + + verify(mTabGridDialogHandler).updateDialogContent(Tab.INVALID_TAB_ID); + } + + @Test public void tabMoveOutOfGroup_Strip() { setUpForTabGroupOperation();
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/StaleTabSuggestionProviderTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/StaleTabSuggestionProviderTest.java index 714e26b..62f6b11 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/StaleTabSuggestionProviderTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/StaleTabSuggestionProviderTest.java
@@ -40,7 +40,7 @@ TabContext mTabContext; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); } @@ -57,7 +57,7 @@ + "close_tab_suggestions_stale_time_ms/86400000"}) // 86400000 milliseconds = 1 day public void - testIdentifyStaleTabs() throws Exception { + testIdentifyStaleTabs() { StaleTabSuggestionProvider staleSuggestionsProvider = new StaleTabSuggestionProvider(); List<TabContext.TabInfo> tabInfos = new ArrayList<>(); tabInfos.add(new TabContext.TabInfo(3, "mock_recent_title", "mock_recent_url",
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextObserverTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextObserverTest.java index 6cac6aa..4065fda 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextObserverTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextObserverTest.java
@@ -63,7 +63,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); doReturn(mTabModelFitlerProvider).when(mTabModelSelector).getTabModelFilterProvider(); doNothing() @@ -73,7 +73,7 @@ } @Test - public void testAddTab() throws Exception { + public void testAddTab() { TabContextObserverTestHelper tabContextObserverTestHelper = new TabContextObserverTestHelper(mTabModelSelector); tabContextObserverTestHelper.mTabModelObserver.didAddTab(null, 0); @@ -82,7 +82,7 @@ } @Test - public void testMoveTab() throws Exception { + public void testMoveTab() { TabContextObserverTestHelper tabContextObserverTestHelper = new TabContextObserverTestHelper(mTabModelSelector); tabContextObserverTestHelper.mTabModelObserver.didMoveTab(null, 0, 0); @@ -91,7 +91,7 @@ } @Test - public void testCloseTab() throws Exception { + public void testCloseTab() { TabContextObserverTestHelper tabContextObserverTestHelper = new TabContextObserverTestHelper(mTabModelSelector); tabContextObserverTestHelper.mTabModelObserver.didCloseTab(0, false); @@ -100,7 +100,7 @@ } @Test - public void testDidFirstVisuallyNonEmptyPaint() throws Exception { + public void testDidFirstVisuallyNonEmptyPaint() { TabContextObserverTestHelper tabContextObserverTestHelper = new TabContextObserverTestHelper(mTabModelSelector); tabContextObserverTestHelper.mTabModelSelectorTabObserver.didFirstVisuallyNonEmptyPaint( @@ -111,7 +111,7 @@ } @Test - public void testDestroy() throws Exception { + public void testDestroy() { TabContextObserverTestHelper tabContextObserverTestHelper = new TabContextObserverTestHelper(mTabModelSelector); tabContextObserverTestHelper.mTabModelSelectorTabObserver = mTabModelSelectorTabObserver;
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextTests.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextTests.java index 37a78c7b..49128dc 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextTests.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabContextTests.java
@@ -64,7 +64,7 @@ "mock_original_url_related_tab_1", "mock_referrer_url_related_tab_1", 300); @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); doReturn(mTabModelFilterProvider).when(mTabModelSelector).getTabModelFilterProvider(); doReturn(mTabModelFilter).when(mTabModelFilterProvider).getCurrentTabModelFilter(); @@ -95,7 +95,7 @@ * Test finding related tabs */ @Test - public void testRelatedTabsExist() throws Exception { + public void testRelatedTabsExist() { doReturn(sTab0).when(mTabModelFilter).getTabAt(eq(TAB_0_ID)); doReturn(1).when(mTabModelFilter).getCount(); doReturn(Arrays.asList(sTab0, sRelatedTab0, sRelatedTab1)) @@ -116,7 +116,7 @@ * Test finding no related tabs */ @Test - public void testFindNoRelatedTabs() throws Exception { + public void testFindNoRelatedTabs() { doReturn(sTab0).when(mTabModelFilter).getTabAt(eq(TAB_0_ID)); doReturn(1).when(mTabModelFilter).getCount(); doReturn(Arrays.asList(sTab0)).when(mTabModelFilter).getRelatedTabList(eq(TAB_0_ID));
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabSuggestionsClientFetcherTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabSuggestionsClientFetcherTest.java index 42e49595..0a37400d 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabSuggestionsClientFetcherTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/suggestions/TabSuggestionsClientFetcherTest.java
@@ -47,7 +47,7 @@ private Callback<TabSuggestionsFetcherResults> mTabSuggestionsFetcherResultsCallback; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); } @@ -62,7 +62,7 @@ // 86400000 milliseconds = 1 day @Test public void - testClientFetcher() throws Exception { + testClientFetcher() { TabSuggestionsClientFetcher tabSuggestionsClientFetcher = new TabSuggestionsClientFetcher(); // Ensures we call StaleTabSuggestionsProvider by ensuring stale tabs // are recommended to be closed. @@ -97,7 +97,7 @@ // 86400000 milliseconds = 1 day @Test public void - testNullResults() throws Exception { + testNullResults() { TabSuggestionsClientFetcher tabSuggestionsClientFetcher = new TabSuggestionsClientFetcher(); doReturn(null).when(mTabContext).getUngroupedTabs(); tabSuggestionsClientFetcher.fetch(mTabContext, mTabSuggestionsFetcherResultsCallback); @@ -118,7 +118,7 @@ // 86400000 milliseconds = 1 day @Test public void - testEmptyResults() throws Exception { + testEmptyResults() { TabSuggestionsClientFetcher tabSuggestionsClientFetcher = new TabSuggestionsClientFetcher(); doReturn(Collections.emptyList()).when(mTabContext).getUngroupedTabs(); tabSuggestionsClientFetcher.fetch(mTabContext, mTabSuggestionsFetcherResultsCallback);
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml index c786463..486b386 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml
@@ -300,6 +300,29 @@ {{ self.mhtml_view_intent_shared_filter_body() }} <data android:mimeType="*/*"/> </intent-filter> + <!-- Bundled HTTP Exchanges (.wbn) support --> + {% if channel in ['dev', 'canary', 'default'] %} + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + <data android:scheme="file" /> + <data android:scheme="content" /> + <data android:mimeType="*/*" /> + <data android:host="*" /> + <data android:pathPattern="/.*\\.wbn" /> + <data android:pathPattern="/.*\\..*\\.wbn" /> + <data android:pathPattern="/.*\\..*\\..*\\.wbn" /> + <data android:pathPattern="/.*\\..*\\..*\\..*\\.wbn" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + <data android:scheme="content" /> + <data android:mimeType="application/webbundle" /> + </intent-filter> + {% endif %} <intent-filter> <action android:name="android.intent.action.MEDIA_SEARCH" /> <category android:name="android.intent.category.DEFAULT" />
diff --git a/chrome/android/java/res/drawable-hdpi/btn_incognito_tabs.png b/chrome/android/java/res/drawable-hdpi/btn_incognito_tabs.png deleted file mode 100644 index 31d3815..0000000 --- a/chrome/android/java/res/drawable-hdpi/btn_incognito_tabs.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_incognito.png b/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_incognito.png deleted file mode 100644 index 76b7bfd..0000000 --- a/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_incognito.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_normal.png b/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_normal.png index 768f224..85184d7 100644 --- a/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_normal.png +++ b/chrome/android/java/res/drawable-hdpi/btn_tabstrip_switch_normal.png Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/incognito_simple.png b/chrome/android/java/res/drawable-hdpi/incognito_simple.png index 85d9b850..9ac8439 100644 --- a/chrome/android/java/res/drawable-hdpi/incognito_simple.png +++ b/chrome/android/java/res/drawable-hdpi/incognito_simple.png Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/incognito_small.png b/chrome/android/java/res/drawable-hdpi/incognito_small.png deleted file mode 100644 index f03a5afc..0000000 --- a/chrome/android/java/res/drawable-hdpi/incognito_small.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/incognito_splash.png b/chrome/android/java/res/drawable-hdpi/incognito_splash.png index e0e13ce..6a55a9a1 100644 --- a/chrome/android/java/res/drawable-hdpi/incognito_splash.png +++ b/chrome/android/java/res/drawable-hdpi/incognito_splash.png Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/location_bar_incognito_badge.png b/chrome/android/java/res/drawable-hdpi/location_bar_incognito_badge.png new file mode 100644 index 0000000..7524390 --- /dev/null +++ b/chrome/android/java/res/drawable-hdpi/location_bar_incognito_badge.png Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/btn_incognito_tabs.png b/chrome/android/java/res/drawable-mdpi/btn_incognito_tabs.png deleted file mode 100644 index 6838de1b..0000000 --- a/chrome/android/java/res/drawable-mdpi/btn_incognito_tabs.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_incognito.png b/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_incognito.png deleted file mode 100644 index d235556d..0000000 --- a/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_incognito.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_normal.png b/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_normal.png index 19c96ce..b91f3c4 100644 --- a/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_normal.png +++ b/chrome/android/java/res/drawable-mdpi/btn_tabstrip_switch_normal.png Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/incognito_simple.png b/chrome/android/java/res/drawable-mdpi/incognito_simple.png index 007a1b1..d6f14a0 100644 --- a/chrome/android/java/res/drawable-mdpi/incognito_simple.png +++ b/chrome/android/java/res/drawable-mdpi/incognito_simple.png Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/incognito_small.png b/chrome/android/java/res/drawable-mdpi/incognito_small.png deleted file mode 100644 index 29b65457..0000000 --- a/chrome/android/java/res/drawable-mdpi/incognito_small.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/incognito_splash.png b/chrome/android/java/res/drawable-mdpi/incognito_splash.png index 256f1e3..4ca0613d 100644 --- a/chrome/android/java/res/drawable-mdpi/incognito_splash.png +++ b/chrome/android/java/res/drawable-mdpi/incognito_splash.png Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/location_bar_incognito_badge.png b/chrome/android/java/res/drawable-mdpi/location_bar_incognito_badge.png new file mode 100644 index 0000000..5f3c5fe --- /dev/null +++ b/chrome/android/java/res/drawable-mdpi/location_bar_incognito_badge.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/btn_incognito_tabs.png b/chrome/android/java/res/drawable-xhdpi/btn_incognito_tabs.png deleted file mode 100644 index d1ee752..0000000 --- a/chrome/android/java/res/drawable-xhdpi/btn_incognito_tabs.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_incognito.png b/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_incognito.png deleted file mode 100644 index cefb4fc..0000000 --- a/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_incognito.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_normal.png b/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_normal.png index 84bb2ed6..14569d7 100644 --- a/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_normal.png +++ b/chrome/android/java/res/drawable-xhdpi/btn_tabstrip_switch_normal.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/incognito_simple.png b/chrome/android/java/res/drawable-xhdpi/incognito_simple.png index bd3fc0f..3b85703 100644 --- a/chrome/android/java/res/drawable-xhdpi/incognito_simple.png +++ b/chrome/android/java/res/drawable-xhdpi/incognito_simple.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/incognito_small.png b/chrome/android/java/res/drawable-xhdpi/incognito_small.png deleted file mode 100644 index 01f017f..0000000 --- a/chrome/android/java/res/drawable-xhdpi/incognito_small.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/incognito_splash.png b/chrome/android/java/res/drawable-xhdpi/incognito_splash.png index 99b72da1..2422ff28 100644 --- a/chrome/android/java/res/drawable-xhdpi/incognito_splash.png +++ b/chrome/android/java/res/drawable-xhdpi/incognito_splash.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/location_bar_incognito_badge.png b/chrome/android/java/res/drawable-xhdpi/location_bar_incognito_badge.png new file mode 100644 index 0000000..4d2682a1 --- /dev/null +++ b/chrome/android/java/res/drawable-xhdpi/location_bar_incognito_badge.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/btn_incognito_tabs.png b/chrome/android/java/res/drawable-xxhdpi/btn_incognito_tabs.png deleted file mode 100644 index 58e9c22a..0000000 --- a/chrome/android/java/res/drawable-xxhdpi/btn_incognito_tabs.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_incognito.png b/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_incognito.png deleted file mode 100644 index c284cb9..0000000 --- a/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_incognito.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_normal.png b/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_normal.png index 31973ee2..aa89207 100644 --- a/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_normal.png +++ b/chrome/android/java/res/drawable-xxhdpi/btn_tabstrip_switch_normal.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/incognito_simple.png b/chrome/android/java/res/drawable-xxhdpi/incognito_simple.png index 78ca809..0cb5e93 100644 --- a/chrome/android/java/res/drawable-xxhdpi/incognito_simple.png +++ b/chrome/android/java/res/drawable-xxhdpi/incognito_simple.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/incognito_small.png b/chrome/android/java/res/drawable-xxhdpi/incognito_small.png deleted file mode 100644 index b25ca557..0000000 --- a/chrome/android/java/res/drawable-xxhdpi/incognito_small.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/incognito_splash.png b/chrome/android/java/res/drawable-xxhdpi/incognito_splash.png index 30fa024..23a3ac96 100644 --- a/chrome/android/java/res/drawable-xxhdpi/incognito_splash.png +++ b/chrome/android/java/res/drawable-xxhdpi/incognito_splash.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/location_bar_incognito_badge.png b/chrome/android/java/res/drawable-xxhdpi/location_bar_incognito_badge.png new file mode 100644 index 0000000..a1cd7a7 --- /dev/null +++ b/chrome/android/java/res/drawable-xxhdpi/location_bar_incognito_badge.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/btn_incognito_tabs.png b/chrome/android/java/res/drawable-xxxhdpi/btn_incognito_tabs.png deleted file mode 100644 index f4e827f..0000000 --- a/chrome/android/java/res/drawable-xxxhdpi/btn_incognito_tabs.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_incognito.png b/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_incognito.png deleted file mode 100644 index 2e7a2b8..0000000 --- a/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_incognito.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_normal.png b/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_normal.png index 39788c68..9d76955 100644 --- a/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_normal.png +++ b/chrome/android/java/res/drawable-xxxhdpi/btn_tabstrip_switch_normal.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/incognito_simple.png b/chrome/android/java/res/drawable-xxxhdpi/incognito_simple.png index e8970a29..f37479c 100644 --- a/chrome/android/java/res/drawable-xxxhdpi/incognito_simple.png +++ b/chrome/android/java/res/drawable-xxxhdpi/incognito_simple.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/incognito_small.png b/chrome/android/java/res/drawable-xxxhdpi/incognito_small.png deleted file mode 100644 index a19ae85..0000000 --- a/chrome/android/java/res/drawable-xxxhdpi/incognito_small.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/incognito_splash.png b/chrome/android/java/res/drawable-xxxhdpi/incognito_splash.png index c6d25bd..b6dde9cd 100644 --- a/chrome/android/java/res/drawable-xxxhdpi/incognito_splash.png +++ b/chrome/android/java/res/drawable-xxxhdpi/incognito_splash.png Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/location_bar_incognito_badge.png b/chrome/android/java/res/drawable-xxxhdpi/location_bar_incognito_badge.png new file mode 100644 index 0000000..1c5c303 --- /dev/null +++ b/chrome/android/java/res/drawable-xxxhdpi/location_bar_incognito_badge.png Binary files differ
diff --git a/chrome/android/java/res/drawable/ic_location_bar_incognito_badge.xml b/chrome/android/java/res/drawable/ic_location_bar_incognito_badge.xml deleted file mode 100644 index 84f5e41..0000000 --- a/chrome/android/java/res/drawable/ic_location_bar_incognito_badge.xml +++ /dev/null
@@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2019 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> - -<!-- The location bar incognito badge has a 22dpx22dp circle instead of the regular 24dpx24dp - circle. --> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - tools:targetApi="21" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24.0" - android:viewportHeight="24.0"> - - <path - android:pathData="M12,12m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0" - android:fillColor="@color/default_icon_color_dark" /> - <path - android:pathData="M8.175,8.506L9.333,4.95L12,5.839L14.667,4.95L15.906,8.506L8.175,8.506ZM16.62,10L20,12L4,12L7.497,10L16.62,10ZM12,15.333C12.353,15.333 12.682,15.436 12.959,15.614C13.234,14.434 14.292,13.556 15.556,13.556C17.028,13.556 18.222,14.749 18.222,16.222C18.222,17.695 17.028,18.889 15.556,18.889C14.166,18.889 13.025,17.826 12.9,16.469C12.637,16.312 12.329,16.222 12,16.222C11.671,16.222 11.363,16.312 11.1,16.469C10.975,17.826 9.834,18.889 8.444,18.889C6.972,18.889 5.778,17.695 5.778,16.222C5.778,14.749 6.972,13.556 8.444,13.556C9.708,13.556 10.766,14.434 11.041,15.613C11.318,15.436 11.647,15.333 12,15.333ZM8.444,18C9.426,18 10.222,17.204 10.222,16.222C10.222,15.24 9.426,14.444 8.444,14.444C7.462,14.444 6.667,15.24 6.667,16.222C6.667,17.204 7.462,18 8.444,18ZM15.556,18C16.537,18 17.333,17.204 17.333,16.222C17.333,15.24 16.537,14.444 15.556,14.444C14.573,14.444 13.778,15.24 13.778,16.222C13.778,17.204 14.573,18 15.556,18Z" - android:fillColor="@android:color/white" /> -</vector> \ No newline at end of file
diff --git a/chrome/android/java/res/layout/accessibility_tab_switcher.xml b/chrome/android/java/res/layout/accessibility_tab_switcher.xml index e197d3b..830501d 100644 --- a/chrome/android/java/res/layout/accessibility_tab_switcher.xml +++ b/chrome/android/java/res/layout/accessibility_tab_switcher.xml
@@ -76,7 +76,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:src="@drawable/btn_incognito_tabs" + android:src="@drawable/incognito_simple" app:tint="@color/tint_on_dark_bg" android:background="@drawable/btn_bg_holo" android:contentDescription="@string/accessibility_tab_switcher_incognito_stack"
diff --git a/chrome/android/java/res/layout/location_status_incognito_badge.xml b/chrome/android/java/res/layout/location_status_incognito_badge.xml index a44269d5..0b134e19 100644 --- a/chrome/android/java/res/layout/location_status_incognito_badge.xml +++ b/chrome/android/java/res/layout/location_status_incognito_badge.xml
@@ -11,4 +11,4 @@ android:layout_gravity="center_vertical" android:visibility="gone" android:contentDescription="@string/accessibility_incognito_badge" - app:srcCompat="@drawable/ic_location_bar_incognito_badge" /> + app:srcCompat="@drawable/location_bar_incognito_badge" />
diff --git a/chrome/android/java/res/layout/new_tab_page_incognito.xml b/chrome/android/java/res/layout/new_tab_page_incognito.xml index b294fa1..29a20b7 100644 --- a/chrome/android/java/res/layout/new_tab_page_incognito.xml +++ b/chrome/android/java/res/layout/new_tab_page_incognito.xml
@@ -6,12 +6,13 @@ <org.chromium.chrome.browser.ntp.IncognitoNewTabPageView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/ntp_content" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" android:focusableInTouchMode="true" - android:contentDescription="@string/accessibility_new_incognito_tab_page" > + android:contentDescription="@string/accessibility_new_incognito_tab_page"> <org.chromium.chrome.browser.ntp.NewTabPageScrollView android:id="@+id/ntp_scrollview" @@ -35,7 +36,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" tools:ignore="ContentDescription" - android:src="@drawable/incognito_splash" /> + android:src="@drawable/incognito_splash" + app:tint="@color/default_icon_color_white" /> <TextView android:id="@+id/new_tab_incognito_title"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/accessibility_tab_switcher/AccessibilityTabModelWrapper.java b/chrome/android/java/src/org/chromium/chrome/browser/accessibility_tab_switcher/AccessibilityTabModelWrapper.java index f3b05a8..18a1df10 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/accessibility_tab_switcher/AccessibilityTabModelWrapper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/accessibility_tab_switcher/AccessibilityTabModelWrapper.java
@@ -111,7 +111,7 @@ mStandardButtonIcon.setContentDescription( getResources().getString(R.string.accessibility_tab_switcher_standard_stack)); mIncognitoButtonIcon = new ChromeImageView(getContext()); - mIncognitoButtonIcon.setImageResource(R.drawable.btn_incognito_tabs); + mIncognitoButtonIcon.setImageResource(R.drawable.incognito_simple); mIncognitoButtonIcon.setScaleY(-1.0f); mIncognitoButtonIcon.setContentDescription( getResources().getString(R.string.accessibility_tab_switcher_incognito_stack));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java index be0ff55..b407ff4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java
@@ -61,6 +61,7 @@ import org.chromium.ui.KeyboardVisibilityDelegate; import org.chromium.ui.UiUtils; import org.chromium.ui.base.EventForwarder; +import org.chromium.ui.base.EventOffsetHandler; import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.resources.ResourceManager; import org.chromium.ui.resources.dynamics.DynamicResourceLoader; @@ -225,18 +226,18 @@ private final RectF mCacheViewport = new RectF(); @Override - public RectF getViewport() { + public float getTop() { if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport); - return mCacheViewport; + return mCacheViewport.top; } @Override - public void setCurrentTouchEventOffsets(float x, float y) { + public void setCurrentTouchEventOffsets(float top) { if (mTabVisible == null) return; WebContents webContents = mTabVisible.getWebContents(); if (webContents == null) return; EventForwarder forwarder = webContents.getEventForwarder(); - forwarder.setCurrentTouchEventOffsets(x, y); + forwarder.setCurrentTouchEventOffsets(0, top); } });
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/EventOffsetHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/EventOffsetHandler.java deleted file mode 100644 index 973e84d..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/EventOffsetHandler.java +++ /dev/null
@@ -1,87 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser.compositor; - -import android.graphics.RectF; -import android.view.DragEvent; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; - -import org.chromium.ui.base.SPenSupport; - -/** - * A class to update motion event offset while dragging. This is needed to compensate the change - * caused by top control. - */ -public class EventOffsetHandler { - /** - * A delegate for EventOffsetHandler. - */ - interface EventOffsetHandlerDelegate { - RectF getViewport(); - void setCurrentTouchEventOffsets(float left, float top); - } - - private final EventOffsetHandlerDelegate mDelegate; - - public EventOffsetHandler(EventOffsetHandlerDelegate delegate) { - mDelegate = delegate; - } - - /** - * Call this before handling onDispatchDragEvent. - * @param action Drag event action. - */ - public void onPreDispatchDragEvent(int action) { - RectF viewport = mDelegate.getViewport(); - setTouchEventOffsets(-viewport.left, -viewport.top); - } - - /** - * Call this after handling onDispatchDragEvent. - * @param action Drag event action. - */ - public void onPostDispatchDragEvent(int action) { - if (action == DragEvent.ACTION_DRAG_EXITED || action == DragEvent.ACTION_DRAG_ENDED - || action == DragEvent.ACTION_DROP) { - setTouchEventOffsets(0.f, 0.f); - } - } - - /** See {@link ViewGroup#onInterceptTouchEvent(MotionEvent)}. */ - public void onInterceptTouchEvent(MotionEvent e) { - setContentViewMotionEventOffsets(e, false); - } - - /** See {@link View#onTouchEvent(MotionEvent)}. */ - public void onTouchEvent(MotionEvent e) { - setContentViewMotionEventOffsets(e, true); - } - - /** See {@link ViewGroup#onInterceptHoverEvent(MotionEvent)}. */ - public void onInterceptHoverEvent(MotionEvent e) { - setContentViewMotionEventOffsets(e, true); - } - - private void setContentViewMotionEventOffsets(MotionEvent e, boolean canClear) { - int actionMasked = SPenSupport.convertSPenEventAction(e.getActionMasked()); - if (actionMasked == MotionEvent.ACTION_DOWN - || actionMasked == MotionEvent.ACTION_HOVER_ENTER - || actionMasked == MotionEvent.ACTION_HOVER_MOVE) { - RectF viewport = mDelegate.getViewport(); - setTouchEventOffsets(-viewport.left, -viewport.top); - } else if (canClear - && (actionMasked == MotionEvent.ACTION_UP - || actionMasked == MotionEvent.ACTION_CANCEL - || actionMasked == MotionEvent.ACTION_HOVER_EXIT)) { - setTouchEventOffsets(0.f, 0.f); - } - } - - private void setTouchEventOffsets(float x, float y) { - mDelegate.setCurrentTouchEventOffsets(x, y); - } -} \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java index f8f973d..c6a8753 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java
@@ -156,8 +156,8 @@ mModelSelectorButton.setVisible(false); // Pressed resources are the same as the unpressed resources. mModelSelectorButton.setResources(R.drawable.btn_tabstrip_switch_normal, - R.drawable.btn_tabstrip_switch_normal, R.drawable.btn_tabstrip_switch_incognito, - R.drawable.btn_tabstrip_switch_incognito); + R.drawable.btn_tabstrip_switch_normal, R.drawable.location_bar_incognito_badge, + R.drawable.location_bar_incognito_badge); mModelSelectorButton.setY(MODEL_SELECTOR_BUTTON_Y_OFFSET_DP); Resources res = context.getResources();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/resources/StaticResourcePreloads.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/resources/StaticResourcePreloads.java index 14db2da..f29fec0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/resources/StaticResourcePreloads.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/resources/StaticResourcePreloads.java
@@ -27,7 +27,7 @@ /** A list of resources to load asynchronously once the compositor is initialized. */ private static int[] sAsynchronousResources = new int[] { - R.drawable.btn_tabstrip_switch_normal, R.drawable.btn_tabstrip_switch_incognito}; + R.drawable.btn_tabstrip_switch_normal, R.drawable.location_bar_incognito_badge}; private static int[] sEmptyList = new int[] {};
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java index d5cc390..196e101 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java
@@ -5,9 +5,11 @@ package org.chromium.chrome.browser.externalnav; import android.content.Intent; -import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import androidx.annotation.NonNull; + +import org.chromium.base.PackageManagerUtils; import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.OverrideUrlLoadingResult; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.webapps.WebappScopePolicy; @@ -20,11 +22,9 @@ */ interface ExternalNavigationDelegate { /** - * Get the list of component name of activities which can resolve |intent|. If the request - * fails, null will be returned. - * - * See {@link PackageManager#queryIntentActivities(Intent, int)} + * See {@link PackageManagerUtils#queryIntentActivities(Intent, int)} */ + @NonNull List<ResolveInfo> queryIntentActivities(Intent intent); /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java index 7dc16b0..26b3582 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -18,6 +18,7 @@ import android.webkit.WebView; import androidx.annotation.IntDef; +import androidx.annotation.Nullable; import org.chromium.base.CommandLine; import org.chromium.base.ContextUtils; @@ -150,29 +151,25 @@ */ public @OverrideUrlLoadingResult int shouldOverrideUrlLoading(ExternalNavigationParams params) { if (DEBUG) Log.i(TAG, "shouldOverrideUrlLoading called on " + params.getUrl()); - Intent intent; + Intent targetIntent; // Perform generic parsing of the URI to turn it into an Intent. try { - intent = Intent.parseUri(params.getUrl(), Intent.URI_INTENT_SCHEME); + targetIntent = Intent.parseUri(params.getUrl(), Intent.URI_INTENT_SCHEME); } catch (Exception ex) { Log.w(TAG, "Bad URI %s", params.getUrl(), ex); return OverrideUrlLoadingResult.NO_OVERRIDE; } - boolean hasBrowserFallbackUrl = false; String browserFallbackUrl = - IntentUtils.safeGetStringExtra(intent, EXTRA_BROWSER_FALLBACK_URL); + IntentUtils.safeGetStringExtra(targetIntent, EXTRA_BROWSER_FALLBACK_URL); if (browserFallbackUrl != null - && UrlUtilities.isValidForIntentFallbackNavigation(browserFallbackUrl)) { - hasBrowserFallbackUrl = true; - } else { + && !UrlUtilities.isValidForIntentFallbackNavigation(browserFallbackUrl)) { browserFallbackUrl = null; } long time = SystemClock.elapsedRealtime(); @OverrideUrlLoadingResult - int result = shouldOverrideUrlLoadingInternal( - params, intent, hasBrowserFallbackUrl, browserFallbackUrl); + int result = shouldOverrideUrlLoadingInternal(params, targetIntent, browserFallbackUrl); RecordHistogram.recordTimesHistogram( "Android.StrictMode.OverrideUrlLoadingTime", SystemClock.elapsedRealtime() - time); @@ -185,11 +182,11 @@ "Android.Intent.LaunchExternalAppFormSubmitHasUserGesture", params.hasUserGesture()); } - } else if (result == OverrideUrlLoadingResult.NO_OVERRIDE && hasBrowserFallbackUrl + } else if (result == OverrideUrlLoadingResult.NO_OVERRIDE && browserFallbackUrl != null && (params.getRedirectHandler() == null // For instance, if this is a chained fallback URL, we ignore it. || !params.getRedirectHandler().shouldNotOverrideUrlLoading())) { - if (InstantAppsHandler.isIntentToInstantApp(intent)) { + if (InstantAppsHandler.isIntentToInstantApp(targetIntent)) { RecordHistogram.recordEnumeratedHistogram( "Android.InstantApps.DirectInstantAppsIntent", AiaIntent.FALLBACK_USED, AiaIntent.NUM_ENTRIES); @@ -257,10 +254,11 @@ // If accessing a file URL, ensure that the user has granted the necessary file access // to Chrome. - private boolean startFileIntentIfNecessary(ExternalNavigationParams params, Intent intent) { + private boolean startFileIntentIfNecessary( + ExternalNavigationParams params, Intent targetIntent) { if (params.getUrl().startsWith(UrlConstants.FILE_URL_SHORT_PREFIX) && mDelegate.shouldRequestFileAccess(params.getUrl())) { - mDelegate.startFileIntent(intent, params.getReferrerUrl(), + mDelegate.startFileIntent(targetIntent, params.getReferrerUrl(), params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent()); if (DEBUG) Log.i(TAG, "OVERRIDE_WITH_ASYNC_ACTION: Requesting filesystem access"); return true; @@ -293,11 +291,11 @@ } private boolean redirectShouldStayInChrome( - ExternalNavigationParams params, boolean isExternalProtocol, Intent intent) { + ExternalNavigationParams params, boolean isExternalProtocol, Intent targetIntent) { TabRedirectHandler handler = params.getRedirectHandler(); if (handler == null) return false; boolean shouldStayInChrome = handler.shouldStayInChrome( - isExternalProtocol, mDelegate.isIntentForTrustedCallingApp(intent)); + isExternalProtocol, mDelegate.isIntentForTrustedCallingApp(targetIntent)); if (shouldStayInChrome || handler.shouldNotOverrideUrlLoading()) { if (DEBUG) Log.i(TAG, "NO_OVERRIDE: RedirectHandler decision"); return true; @@ -420,9 +418,72 @@ return false; } + // http://crbug.com/647569 : Stay in a PWA window for a URL within the same scope. + private boolean shouldStayInWebapp(ExternalNavigationParams params) { + @WebappScopePolicy.NavigationDirective + int webappScopePolicyDirective = mDelegate.applyWebappScopePolicyForUrl(params.getUrl()); + if (webappScopePolicyDirective + == WebappScopePolicy.NavigationDirective.IGNORE_EXTERNAL_INTENT_REQUESTS) { + if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Stay in PWA window"); + return true; + } + return false; + } + + private int handleUnresolvableIntent( + ExternalNavigationParams params, Intent targetIntent, String browserFallbackUrl) { + if (browserFallbackUrl != null) { + return handleFallbackUrl(params, targetIntent, browserFallbackUrl); + } + if (targetIntent.getPackage() != null) return handleWithMarketIntent(params, targetIntent); + + if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Could not find an external activity to use"); + return OverrideUrlLoadingResult.NO_OVERRIDE; + } + + private @OverrideUrlLoadingResult int handleFallbackUrl( + ExternalNavigationParams params, Intent intent, String browserFallbackUrl) { + // Launch WebAPK if it can handle the URL. + if (!TextUtils.isEmpty(intent.getPackage()) + || (intent.getSelector() != null + && !TextUtils.isEmpty(intent.getSelector().getPackage()))) { + try { + intent = Intent.parseUri(browserFallbackUrl, Intent.URI_INTENT_SCHEME); + } catch (Exception e) { + if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Could not parse fallback url"); + return OverrideUrlLoadingResult.NO_OVERRIDE; + } + sanitizeQueryIntentActivitiesIntent(intent); + List<ResolveInfo> resolvingInfos = mDelegate.queryIntentActivities(intent); + switch (launchWebApkIfSoleIntentHandler(params, resolvingInfos, intent)) { + case WebApkLaunchDecision.ALREADY_IN_WEBAPK: + if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Already in WebAPK"); + return OverrideUrlLoadingResult.NO_OVERRIDE; + case WebApkLaunchDecision.LAUNCH_FAILED: + if (DEBUG) Log.i(TAG, "NO_OVERRIDE: WebAPK launch failed"); + return OverrideUrlLoadingResult.NO_OVERRIDE; + case WebApkLaunchDecision.LAUNCHED: + if (DEBUG) Log.i(TAG, "OVERRIDE_WITH_EXTERNAL_INTENT: Launched WebAPK"); + return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT; + case WebApkLaunchDecision.WEBAPK_NOT_SOLE_INTENT_HANDLER: + break; + } + } + return clobberCurrentTabWithFallbackUrl(browserFallbackUrl, params); + } + + private @OverrideUrlLoadingResult int handleWithMarketIntent( + ExternalNavigationParams params, Intent intent) { + String marketReferrer = IntentUtils.safeGetStringExtra(intent, EXTRA_MARKET_REFERRER); + if (TextUtils.isEmpty(marketReferrer)) { + marketReferrer = ContextUtils.getApplicationContext().getPackageName(); + } + return sendIntentToMarket(intent.getPackage(), marketReferrer, params); + } + private @OverrideUrlLoadingResult int shouldOverrideUrlLoadingInternal( - ExternalNavigationParams params, Intent intent, boolean hasBrowserFallbackUrl, - String browserFallbackUrl) { + ExternalNavigationParams params, Intent targetIntent, + @Nullable String browserFallbackUrl) { if (blockExternalNavWhileBackgrounded(params) || blockExternalNavFromBackgroundTab(params) || ignoreBackForwardNav(params)) { return OverrideUrlLoadingResult.NO_OVERRIDE; @@ -436,7 +497,7 @@ // This check should happen for reloads, navigations, etc..., which is why // it occurs before the subsequent blocks. - if (startFileIntentIfNecessary(params, intent)) { + if (startFileIntentIfNecessary(params, targetIntent)) { return OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION; } @@ -466,7 +527,7 @@ // Don't stay in Chrome for Custom Tabs redirecting to Instant Apps. if (handleCCTRedirectsToInstantApps(params, isExternalProtocol, incomingIntentRedirect)) { return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT; - } else if (redirectShouldStayInChrome(params, isExternalProtocol, intent)) { + } else if (redirectShouldStayInChrome(params, isExternalProtocol, targetIntent)) { return OverrideUrlLoadingResult.NO_OVERRIDE; } @@ -489,94 +550,44 @@ if (isYoutubePairingCode(params)) return OverrideUrlLoadingResult.NO_OVERRIDE; - // http://crbug.com/647569 : Stay in a PWA window for a URL within the same scope. - @WebappScopePolicy.NavigationDirective - int webappScopePolicyDirective = mDelegate.applyWebappScopePolicyForUrl(params.getUrl()); - if (webappScopePolicyDirective - == WebappScopePolicy.NavigationDirective.IGNORE_EXTERNAL_INTENT_REQUESTS) { - if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Stay in PWA window"); - return OverrideUrlLoadingResult.NO_OVERRIDE; - } + if (shouldStayInWebapp(params)) return OverrideUrlLoadingResult.NO_OVERRIDE; - sanitizeQueryIntentActivitiesIntent(intent); + sanitizeQueryIntentActivitiesIntent(targetIntent); - List<ResolveInfo> resolvingInfos = mDelegate.queryIntentActivities(intent); - if (resolvingInfos == null) return OverrideUrlLoadingResult.NO_OVERRIDE; - + List<ResolveInfo> resolvingInfos = mDelegate.queryIntentActivities(targetIntent); boolean canResolveActivity = resolvingInfos.size() > 0; - String packageName = ContextUtils.getApplicationContext().getPackageName(); // Check whether the intent can be resolved. If not, we will see whether we can download it // from the Market. if (!canResolveActivity) { - if (hasBrowserFallbackUrl) { - // Launch WebAPK if it can handle the URL. - if (!TextUtils.isEmpty(intent.getPackage()) - || (intent.getSelector() != null - && !TextUtils.isEmpty(intent.getSelector().getPackage()))) { - try { - intent = Intent.parseUri(browserFallbackUrl, Intent.URI_INTENT_SCHEME); - } catch (Exception e) { - if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Could not parse fallback url"); - return OverrideUrlLoadingResult.NO_OVERRIDE; - } - sanitizeQueryIntentActivitiesIntent(intent); - resolvingInfos = mDelegate.queryIntentActivities(intent); - switch (launchWebApkIfSoleIntentHandler(params, resolvingInfos, intent)) { - case WebApkLaunchDecision.ALREADY_IN_WEBAPK: - if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Already in WebAPK"); - return OverrideUrlLoadingResult.NO_OVERRIDE; - case WebApkLaunchDecision.LAUNCH_FAILED: - if (DEBUG) Log.i(TAG, "NO_OVERRIDE: WebAPK launch failed"); - return OverrideUrlLoadingResult.NO_OVERRIDE; - case WebApkLaunchDecision.LAUNCHED: - if (DEBUG) Log.i(TAG, "OVERRIDE_WITH_EXTERNAL_INTENT: Launched WebAPK"); - return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT; - case WebApkLaunchDecision.WEBAPK_NOT_SOLE_INTENT_HANDLER: - break; - } - } - return clobberCurrentTabWithFallbackUrl(browserFallbackUrl, params); - } - - if (intent.getPackage() != null) { - String marketReferrer = IntentUtils.safeGetStringExtra( - intent, EXTRA_MARKET_REFERRER); - if (TextUtils.isEmpty(marketReferrer)) { - marketReferrer = packageName; - } - return sendIntentToMarket(intent.getPackage(), marketReferrer, params); - } - if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Could not find an external activity to use"); - return OverrideUrlLoadingResult.NO_OVERRIDE; + return handleUnresolvableIntent(params, targetIntent, browserFallbackUrl); } - if (hasBrowserFallbackUrl) { - intent.removeExtra(EXTRA_BROWSER_FALLBACK_URL); - } + if (browserFallbackUrl != null) targetIntent.removeExtra(EXTRA_BROWSER_FALLBACK_URL); - final Uri uri = intent.getData(); - if (intent.getPackage() == null && uri != null + final Uri uri = targetIntent.getData(); + if (targetIntent.getPackage() == null && uri != null && UrlConstants.SMS_SCHEME.equals(uri.getScheme())) { - intent.setPackage(getDefaultSmsPackageName(resolvingInfos)); + targetIntent.setPackage(getDefaultSmsPackageName(resolvingInfos)); } else if (uri != null && UrlConstants.TEL_SCHEME.equals(uri.getScheme()) - || (Intent.ACTION_DIAL.equals(intent.getAction())) - || (Intent.ACTION_CALL.equals(intent.getAction()))) { + || (Intent.ACTION_DIAL.equals(targetIntent.getAction())) + || (Intent.ACTION_CALL.equals(targetIntent.getAction()))) { RecordUserAction.record("Android.PhoneIntent"); } // Set the Browser application ID to us in case the user chooses Chrome // as the app. This will make sure the link is opened in the same tab // instead of making a new one. - intent.putExtra(Browser.EXTRA_APPLICATION_ID, packageName); - if (params.isOpenInNewTab()) intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + targetIntent.putExtra(Browser.EXTRA_APPLICATION_ID, + ContextUtils.getApplicationContext().getPackageName()); + if (params.isOpenInNewTab()) targetIntent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); + targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Ensure intents re-target potential caller activity when we run in CCT mode. - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - mDelegate.maybeSetWindowId(intent); - mDelegate.maybeRecordAppHandlersInIntent(intent, resolvingInfos); + targetIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + mDelegate.maybeSetWindowId(targetIntent); + mDelegate.maybeRecordAppHandlersInIntent(targetIntent, resolvingInfos); if (params.getReferrerUrl() != null) { - IntentHandler.setPendingReferrer(intent, params.getReferrerUrl()); + IntentHandler.setPendingReferrer(targetIntent, params.getReferrerUrl()); } if (params.isIncognito()) { @@ -587,7 +598,7 @@ return OverrideUrlLoadingResult.NO_OVERRIDE; } - IntentHandler.setPendingIncognitoUrl(intent); + IntentHandler.setPendingIncognitoUrl(targetIntent); } // Make sure webkit can handle it internally before checking for specialized @@ -650,12 +661,12 @@ } boolean isDirectInstantAppsIntent = - isExternalProtocol && InstantAppsHandler.isIntentToInstantApp(intent); + isExternalProtocol && InstantAppsHandler.isIntentToInstantApp(targetIntent); boolean shouldProxyForInstantApps = isDirectInstantAppsIntent && mDelegate.isSerpReferrer(); if (shouldProxyForInstantApps) { RecordHistogram.recordEnumeratedHistogram("Android.InstantApps.DirectInstantAppsIntent", AiaIntent.SERP, AiaIntent.NUM_ENTRIES); - intent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true); + targetIntent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true); } else if (isDirectInstantAppsIntent) { // For security reasons, we disable all intent:// URLs to Instant Apps that are // not coming from SERP. @@ -665,11 +676,11 @@ return OverrideUrlLoadingResult.NO_OVERRIDE; } else { // Make sure this extra is not sent unless we've done the verification. - intent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER); + targetIntent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER); } - boolean deviceCanHandleIntent = deviceCanHandleIntent(intent); - if (params.isIncognito() && !mDelegate.willChromeHandleIntent(intent)) { + boolean deviceCanHandleIntent = deviceCanHandleIntent(targetIntent); + if (params.isIncognito() && !mDelegate.willChromeHandleIntent(targetIntent)) { // Assume the browser can handle it if there's no activity for this intent. if (!deviceCanHandleIntent) { if (DEBUG) { @@ -681,8 +692,8 @@ // This intent may leave Chrome. Warn the user that incognito does not carry over // to apps out side of Chrome. try { - if (!mDelegate.startIncognitoIntent(intent, params.getReferrerUrl(), - hasBrowserFallbackUrl ? browserFallbackUrl : null, params.getTab(), + if (!mDelegate.startIncognitoIntent(targetIntent, params.getReferrerUrl(), + browserFallbackUrl, params.getTab(), params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent(), shouldProxyForInstantApps)) { if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Failed to show incognito alert dialog."); @@ -706,7 +717,7 @@ // picker and "picking Chrome" is handled inside the support library. if (params.getRedirectHandler() != null && incomingIntentRedirect) { if (!isExternalProtocol && !params.getRedirectHandler().isFromCustomTabIntent() - && !params.getRedirectHandler().hasNewResolver(intent)) { + && !params.getRedirectHandler().hasNewResolver(targetIntent)) { if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Custom tab redirect no handled"); return OverrideUrlLoadingResult.NO_OVERRIDE; } @@ -715,10 +726,10 @@ // The intent can be used to launch Chrome itself, record the user // gesture here so that it can be used later. if (params.hasUserGesture()) { - IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent); + IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(targetIntent); } - switch (launchWebApkIfSoleIntentHandler(params, resolvingInfos, intent)) { + switch (launchWebApkIfSoleIntentHandler(params, resolvingInfos, targetIntent)) { case WebApkLaunchDecision.ALREADY_IN_WEBAPK: if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Already in WebAPK"); return OverrideUrlLoadingResult.NO_OVERRIDE; @@ -734,7 +745,7 @@ try { if (deviceCanHandleIntent - && mDelegate.startActivityIfNeeded(intent, shouldProxyForInstantApps)) { + && mDelegate.startActivityIfNeeded(targetIntent, shouldProxyForInstantApps)) { // Assume the browser can handle it if there's no activity for this intent. if (DEBUG) Log.i(TAG, "OVERRIDE_WITH_EXTERNAL_INTENT: startActivityIfNeeded"); return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java index f197f1c..8beecd1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java
@@ -7,6 +7,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.content.Context; +import android.os.Build; import org.chromium.base.ContextUtils; import org.chromium.chrome.R; @@ -34,7 +35,12 @@ Context context = ContextUtils.getApplicationContext(); String actionMessage = context.getResources().getString(R.string.close_all_incognito_notification); - String title = context.getResources().getString(R.string.app_name); + + // From Android N, notification by default has the app name and title should not be the same + // as app name. + String title = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N + ? context.getResources().getString(R.string.close_all_incognito_notification_title) + : context.getResources().getString(R.string.app_name); ChromeNotificationBuilder builder = NotificationBuilderFactory
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionMediator.java index 77a53d84..c49d3fd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionMediator.java
@@ -244,9 +244,6 @@ public void onSheetClosed(@StateChangeReason int reason) {} @Override - public void onSheetReleased() {} - - @Override public void onLoadUrl(String url) {} @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java index eef0ef5..7a1eee0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java
@@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; +import android.os.Build; import android.util.Log; import org.chromium.base.ContextUtils; @@ -90,9 +91,17 @@ */ private void showSyncNotification(int message, Intent intent) { Context applicationContext = ContextUtils.getApplicationContext(); - String title = applicationContext.getString(R.string.app_name); - String text = applicationContext.getString(R.string.sign_in_sync) + ": " - + applicationContext.getString(message); + String title = null, text = null; + // From Android N, notification by default has the app name and title should not be the same + // as app name. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + title = applicationContext.getString(R.string.sign_in_sync); + text = applicationContext.getString(message); + } else { + title = applicationContext.getString(R.string.app_name); + text = applicationContext.getString(R.string.sign_in_sync) + ": " + + applicationContext.getString(message); + } PendingIntentProvider contentIntent = PendingIntentProvider.getActivity(applicationContext, 0, intent, 0);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java index 5506bab..327209e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java
@@ -60,7 +60,7 @@ mStandardButtonIcon.setContentDescription( getResources().getString(R.string.accessibility_tab_switcher_standard_stack)); mIncognitoButtonIcon = new ChromeImageView(getContext()); - mIncognitoButtonIcon.setImageResource(R.drawable.incognito_small); + mIncognitoButtonIcon.setImageResource(R.drawable.incognito_simple); mIncognitoButtonIcon.setContentDescription( getResources().getString(R.string.accessibility_tab_switcher_incognito_stack));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/incognitotoggle/IncognitoToggleButtonTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/incognitotoggle/IncognitoToggleButtonTablet.java index 910d02a8..09869a0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/incognitotoggle/IncognitoToggleButtonTablet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/tablet/emptybackground/incognitotoggle/IncognitoToggleButtonTablet.java
@@ -53,7 +53,7 @@ @Override protected void setImage(boolean isIncognitoSelected) { - setImageResource(isIncognitoSelected ? R.drawable.btn_tabstrip_switch_incognito + setImageResource(isIncognitoSelected ? R.drawable.location_bar_incognito_badge : R.drawable.btn_tabstrip_switch_normal); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java index 53d44f0..56e3218 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
@@ -940,8 +940,6 @@ int targetState = getTargetSheetState(offset, -velocityY); setSheetState(targetState, true, BottomSheet.StateChangeReason.SWIPE); - - for (BottomSheetObserver o : mObservers) o.onSheetReleased(); } else { setInternalCurrentState( BottomSheet.SheetState.SCROLLING, BottomSheet.StateChangeReason.SWIPE); @@ -1126,9 +1124,7 @@ /** * @return The target state that the sheet is moving to during animation. If the sheet is * stationary or a target state has not been determined, SheetState.NONE will be - * returned. A target state will be set when the user releases the sheet from drag - * ({@link BottomSheetObserver#onSheetReleased()}) and has begun animation to the next - * state. + * returned. */ public int getTargetSheetState() { return mTargetState;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserver.java index ff520dc..d57ef184 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserver.java
@@ -28,12 +28,6 @@ void onSheetClosed(@StateChangeReason int reason); /** - * A notification that the bottom sheet is no longer being dragged by the user and is instead - * animating to its final state. - */ - void onSheetReleased(); - - /** * A notification that the sheet has begun loading a URL. * * @param url The URL being loaded.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/EmptyBottomSheetObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/EmptyBottomSheetObserver.java index 7e625ce..71dc73f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/EmptyBottomSheetObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/EmptyBottomSheetObserver.java
@@ -18,9 +18,6 @@ public void onSheetClosed(@StateChangeReason int reason) {} @Override - public void onSheetReleased() {} - - @Override public void onLoadUrl(String url) {} @Override
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 1281128..afcfcf1 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -2555,8 +2555,11 @@ Search your history </message> - <!-- Document mode messages --> - <message name="IDS_CLOSE_ALL_INCOGNITO_NOTIFICATION" desc="Message on the notification that closes all incognito tabs in document mode"> + <!-- Close Incognito tabs notification messages --> + <message name="IDS_CLOSE_ALL_INCOGNITO_NOTIFICATION_TITLE" desc="Title on the notification that closes all incognito tabs on Android N+."> + Incognito Tabs + </message> + <message name="IDS_CLOSE_ALL_INCOGNITO_NOTIFICATION" desc="Message on the notification that closes all incognito tabs."> Close all incognito tabs </message>
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ActivityTabProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ActivityTabProviderTest.java index e01938a..0e052518 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ActivityTabProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ActivityTabProviderTest.java
@@ -101,7 +101,7 @@ @Test @SmallTest @Feature({"ActivityTabObserver"}) - public void testTriggerOnAddObserver() throws InterruptedException, TimeoutException { + public void testTriggerOnAddObserver() throws TimeoutException { CallbackHelper helper = new CallbackHelper(); mProvider.addObserverAndTrigger((tab, hint) -> helper.notifyCalled()); helper.waitForCallback(0); @@ -117,7 +117,7 @@ @SmallTest @Feature({"ActivityTabObserver"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testTriggerWithTabSwitcher() throws InterruptedException, TimeoutException { + public void testTriggerWithTabSwitcher() throws TimeoutException { assertEquals("The activity tab should be the model's selected tab.", getModelSelectedTab(), mActivityTab); @@ -142,7 +142,7 @@ @LargeTest @Feature({"ActivityTabObserver"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testTriggerHintWithTabSwitcher() throws InterruptedException, TimeoutException { + public void testTriggerHintWithTabSwitcher() throws TimeoutException { assertEquals("The hint should not yet have triggered.", 0, mActivityTabChangedHintHelper.getCallCount()); @@ -165,7 +165,7 @@ @Test @SmallTest @Feature({"ActivityTabObserver"}) - public void testTriggerWithTabSelection() throws InterruptedException, TimeoutException { + public void testTriggerWithTabSelection() throws TimeoutException { Tab startingTab = getModelSelectedTab(); ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivity, @@ -192,7 +192,7 @@ @Test @SmallTest @Feature({"ActivityTabObserver"}) - public void testTriggerOnLastTabClosed() throws InterruptedException, TimeoutException { + public void testTriggerOnLastTabClosed() throws TimeoutException { int callCount = mActivityTabChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> { mActivity.getTabModelSelector().closeTab(getModelSelectedTab()); }); @@ -210,7 +210,7 @@ @Test @SmallTest @Feature({"ActivityTabObserver"}) - public void testCorrectTabAfterTabClosed() throws InterruptedException, TimeoutException { + public void testCorrectTabAfterTabClosed() { Tab startingTab = getModelSelectedTab(); ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivity, @@ -233,7 +233,7 @@ @Test @SmallTest @Feature({"ActivityTabObserver"}) - public void testActivityTabTabObserver() throws InterruptedException, TimeoutException { + public void testActivityTabTabObserver() { Tab startingTab = getModelSelectedTab(); TestActivityTabTabObserver tabObserver = new TestActivityTabTabObserver(mProvider); @@ -255,8 +255,7 @@ * Enter or exit the tab switcher with animations and wait for the scene to change. * @param inSwitcher Whether to enter or exit the tab switcher. */ - private void setTabSwitcherModeAndWait(boolean inSwitcher) - throws InterruptedException, TimeoutException { + private void setTabSwitcherModeAndWait(boolean inSwitcher) throws TimeoutException { final CallbackHelper sceneChangeHelper = new CallbackHelper(); SceneChangeObserver observer = new SceneChangeObserver() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java index 1e137fc9..d1123807 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java
@@ -43,7 +43,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -55,7 +55,7 @@ // TODO(jbudorick): Attempt to reenable this after the server switch has stabilized. @Test @FlakyTest(message = "crbug.com/331122") - public void testPlayMp3() throws InterruptedException, TimeoutException { + public void testPlayMp3() throws TimeoutException { Tab tab = mActivityTestRule.getActivity().getActivityTab(); TabTitleObserver titleObserver = new TabTitleObserver(tab, "ready_to_play"); mActivityTestRule.loadUrl(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java index 846b41e..7e80de3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java
@@ -47,7 +47,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeBackgroundServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeBackgroundServiceTest.java index ffadcd91..e4f7e00 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeBackgroundServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeBackgroundServiceTest.java
@@ -107,7 +107,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); mSnippetsLauncher = SnippetsLauncher.create(); mTaskService = new MockTaskService(); @@ -115,7 +115,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java index 76d10e5..c2173bb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/CopylessPasteTest.java
@@ -72,7 +72,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); AppIndexingUtil.setCallbackForTesting(null); @@ -97,7 +97,7 @@ @Test @LargeTest @Feature({"CopylessPaste"}) - public void testIncognito() throws InterruptedException, TimeoutException { + public void testIncognito() { // Incognito tabs are ignored. mActivityTestRule.newIncognitoTabsFromMenu(1); mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE)); @@ -113,7 +113,7 @@ @Test @LargeTest @Feature({"CopylessPaste"}) - public void testInvalidScheme() throws InterruptedException, TimeoutException { + public void testInvalidScheme() { // CopylessPaste only parses http and https. mActivityTestRule.loadUrl(UrlConstants.NTP_NON_NATIVE_URL); mActivityTestRule.loadUrl(UrlConstants.ABOUT_URL); @@ -127,7 +127,7 @@ @LargeTest @RetryOnFailure @Feature({"CopylessPaste"}) - public void testNoMeta() throws InterruptedException, TimeoutException { + public void testNoMeta() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE)); mCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); Assert.assertNull(mCallbackHelper.getWebPage()); @@ -140,7 +140,7 @@ @LargeTest @RetryOnFailure @Feature({"CopylessPaste"}) - public void testValid() throws InterruptedException, TimeoutException { + public void testValid() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE)); mCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); WebPage extracted = mCallbackHelper.getWebPage(); @@ -172,7 +172,7 @@ @LargeTest @RetryOnFailure @Feature({"CopylessPaste"}) - public void testCache() throws InterruptedException, TimeoutException { + public void testCache() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NODATA_PAGE)); mCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); mActivityTestRule.loadUrl(mTestServer.getURL(DATA_PAGE));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java index 8fe58c4..e541989d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java
@@ -19,8 +19,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.ui.test.util.UiRestriction; -import java.io.IOException; - /** * Simple test to demonstrate use of ScreenShooter rule. */ @@ -36,19 +34,17 @@ public ScreenShooter mScreenShooter = new ScreenShooter(); @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); } /** * Capture the New Tab Page and the tab switcher. - * @throws IOException - * @throws InterruptedException */ @Test @SmallTest @Feature({"UiCatalogue"}) - public void testCaptureNewTabPage() throws IOException, InterruptedException { + public void testCaptureNewTabPage() { mScreenShooter.shoot("NTP", ScreenShooter.TagsEnum.UiCatalogueExample); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java index eeaf2c7..cc9a0e9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java
@@ -49,7 +49,7 @@ private Coordinates mCoordinates; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.startMainActivityWithURL( mTestServer.getURL("/chrome/test/data/android/focused_editable_zoom.html")); @@ -58,7 +58,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java index b842f56..d8cc178 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java
@@ -43,13 +43,11 @@ /** * Tests that an http:// referrer is not stripped in case of https:// navigation with * default Policy. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testReferrerPolicyHttpReferrerHttpsNavigationsPolicyDefault() - throws InterruptedException { + public void testReferrerPolicyHttpReferrerHttpsNavigationsPolicyDefault() { mTestServer = EmbeddedTestServer.createAndStartHTTPSServer( InstrumentationRegistry.getContext(), ServerCertificate.CERT_OK); try {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java index ace69c2..fdbde50c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java
@@ -81,7 +81,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTab.removeObserver(mUpdateWaiter); mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/IntentHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/IntentHandlerTest.java index 9ed750be..c4572f2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/IntentHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/IntentHandlerTest.java
@@ -145,7 +145,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { IntentHandler.setTestIntentsEnabled(false); mIntentHandler = new IntentHandler(null, null); mIntent = new Intent(); @@ -219,7 +219,7 @@ @MediumTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testGetQueryFromVoiceSearchResultIntent_validVoiceQuery() throws Throwable { + public void testGetQueryFromVoiceSearchResultIntent_validVoiceQuery() { Intent intent = new Intent(RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS); intent.putStringArrayListExtra(RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_STRINGS, CollectionUtil.newArrayList(VOICE_SEARCH_QUERY)); @@ -233,7 +233,7 @@ @MediumTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testGetQueryFromVoiceSearchResultIntent_validUrlQuery() throws Throwable { + public void testGetQueryFromVoiceSearchResultIntent_validUrlQuery() { Intent intent = new Intent(RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS); intent.putStringArrayListExtra(RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_STRINGS, CollectionUtil.newArrayList(VOICE_URL_QUERY)); @@ -250,7 +250,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRefererUrl_extraReferrer() throws Throwable { + public void testRefererUrl_extraReferrer() { // Check that EXTRA_REFERRER is not accepted with a random URL. Intent foreignIntent = new Intent(Intent.ACTION_VIEW); foreignIntent.putExtra(Intent.EXTRA_REFERRER, GOOGLE_URL); @@ -283,7 +283,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRefererUrl_extraHeadersInclReferer() throws Throwable { + public void testRefererUrl_extraHeadersInclReferer() { // Check that invalid header specified in EXTRA_HEADERS isn't used. Bundle bundle = new Bundle(); bundle.putString("X-custom-header", "X-custom-value"); @@ -299,7 +299,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRefererUrl_extraHeadersInclRefererMultiple() throws Throwable { + public void testRefererUrl_extraHeadersInclRefererMultiple() { // Check that invalid header specified in EXTRA_HEADERS isn't used. Bundle bundle = new Bundle(); bundle.putString("X-custom-header", "X-custom-value"); @@ -316,7 +316,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRefererUrl_extraHeadersOnlyReferer() throws Throwable { + public void testRefererUrl_extraHeadersOnlyReferer() { // Check that invalid header specified in EXTRA_HEADERS isn't used. Bundle bundle = new Bundle(); bundle.putString("Referer", GOOGLE_URL); @@ -329,7 +329,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRefererUrl_extraHeadersAndExtraReferrer() throws Throwable { + public void testRefererUrl_extraHeadersAndExtraReferrer() { String validReferer = "android-app://package/http/url"; Bundle bundle = new Bundle(); bundle.putString("Referer", GOOGLE_URL); @@ -345,7 +345,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRefererUrl_extraHeadersValidReferrer() throws Throwable { + public void testRefererUrl_extraHeadersValidReferrer() { String validReferer = "android-app://package/http/url"; Bundle bundle = new Bundle(); bundle.putString("Referer", validReferer); @@ -387,7 +387,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testRemoveChromeCustomHeaderFromExtraIntentHeaders() throws Throwable { + public void testRemoveChromeCustomHeaderFromExtraIntentHeaders() { Bundle bundle = new Bundle(); bundle.putString("X-Chrome-intent-type", "X-custom-value"); Intent headersIntent = new Intent(Intent.ACTION_VIEW);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java index 3ef1536..70a6eace 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java
@@ -49,7 +49,7 @@ + "<body><button id=\"test\">Test button</button></body></html>"); @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityWithURL(JSTEST_URL); } @@ -61,8 +61,7 @@ @LargeTest @Feature({"Browser"}) @RetryOnFailure - public void testJavaScriptEvalIsCorrectlyOrderedWithinOneTab() - throws InterruptedException, TimeoutException { + public void testJavaScriptEvalIsCorrectlyOrderedWithinOneTab() throws TimeoutException { Tab tab1 = mActivityTestRule.getActivity().getActivityTab(); Tab tab2; ChromeTabUtils.newTabFromMenu(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/MainActivityWithURLTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/MainActivityWithURLTest.java index b9bcbea5..a03f1c8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/MainActivityWithURLTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/MainActivityWithURLTest.java
@@ -38,7 +38,7 @@ @Test @SmallTest @Feature({"Navigation"}) - public void testLaunchActivityWithURL() throws Exception { + public void testLaunchActivityWithURL() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); try { @@ -60,7 +60,7 @@ @Test @SmallTest @Feature({"Navigation"}) - public void testLaunchActivity() throws Exception { + public void testLaunchActivity() { // Launch chrome mActivityTestRule.startMainActivityFromLauncher(); String currentUrl = mActivityTestRule.getActivity().getActivityTab().getUrl(); @@ -75,7 +75,7 @@ @Test @SmallTest @Feature({"Navigation"}) - public void testNewTabPageLaunch() throws Exception { + public void testNewTabPageLaunch() { // Launch chrome with NTP. mActivityTestRule.startMainActivityWithURL(UrlConstants.NTP_URL); String currentUrl = mActivityTestRule.getActivity().getActivityTab().getUrl();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java index 317397ef..bbd6d76f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigateTest.java
@@ -71,13 +71,13 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java index b65f527..1e87a9d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java
@@ -162,7 +162,7 @@ "force-fieldtrial-params=GestureNavigation.Disabled:" + "overscroll_history_navigation_bottom_sheet/false"}) public void - testLongPressBackTriggering() throws ExecutionException { + testLongPressBackTriggering() { KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); TestThreadUtils.runOnUiThreadBlocking( () -> { mActivityTestRule.getActivity().onKeyDown(KeyEvent.KEYCODE_BACK, event); });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java index 8e3aa7e..4d7973c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java
@@ -86,7 +86,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mStatus != null) { mStatus.cleanUp(); } @@ -227,10 +227,8 @@ * @param url the page URL * @param failureWriter the writer where failures/crashes/timeouts are logged. * @throws IOException unable to read from input or write to writer. - * @throws InterruptedException the thread was interrupted waiting for the page to load. */ - public void loadUrl(final String url, OutputStreamWriter failureWriter) - throws InterruptedException, IOException { + public void loadUrl(final String url, OutputStreamWriter failureWriter) throws IOException { Tab tab = mActivityTestRule.getActivity().getActivityTab(); final CallbackHelper loadedCallback = new CallbackHelper(); final CallbackHelper failedCallback = new CallbackHelper(); @@ -320,11 +318,10 @@ * @param clearCache determines whether the cache is cleared before loading each page. * @param loopCount the number of times to loop through the list of pages. * @throws IOException unable to read from input or write to writer. - * @throws InterruptedException the thread was interrupted waiting for the page to load. */ private void loopUrls(BufferedReader input, OutputStreamWriter outputWriter, OutputStreamWriter failureWriter, boolean clearCache, int loopCount) - throws IOException, InterruptedException { + throws IOException { List<String> pages = new ArrayList<>(); String page; @@ -373,9 +370,8 @@ * Navigate to all the pages listed in the input. * @param perf Whether this is a performance test or stability test. * @throws IOException - * @throws InterruptedException */ - public void loadPages(boolean perf) throws IOException, InterruptedException { + public void loadPages(boolean perf) throws IOException { OutputStreamWriter outputWriter = null; if (perf) { outputWriter = getOutputStream(OUTPUT_FILE); @@ -412,7 +408,7 @@ */ @Test @Manual - public void testLoadPerformance() throws IOException, InterruptedException { + public void testLoadPerformance() throws IOException { loadPages(true); } @@ -421,7 +417,7 @@ */ @Test @Manual - public void testStability() throws IOException, InterruptedException { + public void testStability() throws IOException { loadPages(false); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java index f21beceb..171928ed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java
@@ -77,7 +77,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); MockSafeBrowsingApiHandler.clearMockResponses(); } @@ -85,7 +85,7 @@ @Test @MediumTest @Feature({"Popup"}) - public void testPopupInfobarAppears() throws Exception { + public void testPopupInfobarAppears() { mActivityTestRule.loadUrl(mPopupHtmlUrl); CriteriaHelper.pollUiThread(Criteria.equals(1, () -> getNumInfobarsShowing())); } @@ -159,7 +159,7 @@ @Test @MediumTest @Feature({"Popup"}) - public void testPopupWindowsAppearWhenAllowed() throws Exception { + public void testPopupWindowsAppearWhenAllowed() { final TabModelSelector selector = mActivityTestRule.getActivity().getTabModelSelector(); mActivityTestRule.loadUrl(mPopupHtmlUrl);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/PrerenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/PrerenderTest.java index 911434b..2ea876b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/PrerenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/PrerenderTest.java
@@ -53,7 +53,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -91,7 +91,7 @@ */ @Test @FlakyTest(message = "crbug.com/339668") - public void testPrerenderNotDead() throws InterruptedException, TimeoutException { + public void testPrerenderNotDead() throws TimeoutException { String testUrl = mTestServer.getURL( "/chrome/test/data/android/prerender/google.html"); final Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -130,7 +130,7 @@ */ @Test @DisabledTest(message = "Prerenderer disables infobars. crbug.com/588808") - public void testInfoBarDismissed() throws InterruptedException { + public void testInfoBarDismissed() { final String url = mTestServer.getURL( "/chrome/test/data/geolocation/geolocation_on_load.html"); final ExternalPrerenderHandler handler = PrerenderTestHelper.prerenderUrl(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java index 886318e..6fc9a7c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java
@@ -40,14 +40,13 @@ /** * Verifies that process isolation works, i.e., that the browser and * renderer processes use different user IDs. - * @throws InterruptedException */ @Test @MediumTest @DisableIf.Build(sdk_is_greater_than = 22, message = "crbug.com/517611") @Feature({"Browser", "Security"}) @RetryOnFailure - public void testProcessIsolationForRenderers() throws InterruptedException, IOException { + public void testProcessIsolationForRenderers() throws IOException { int tabsCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); // The ActivityManager can be used to retrieve the current processes, but the reported UID // in the RunningAppProcessInfo for isolated processes is the same as the parent process @@ -124,7 +123,7 @@ } @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java index aebbbad0..58f00c9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java
@@ -42,7 +42,7 @@ @SmallTest @DisableFeatures(ChromeFeatureList.REACHED_CODE_PROFILER) @CommandLineFlags.Add(BaseSwitches.ENABLE_REACHED_CODE_PROFILER) - public void testExplicitlyEnableViaCommandLineSwitch() throws Exception { + public void testExplicitlyEnableViaCommandLineSwitch() { mActivityTestRule.startMainActivityFromLauncher(); assertReachedCodeProfilerIsEnabled(); } @@ -54,7 +54,7 @@ @Test @SmallTest @EnableFeatures(ChromeFeatureList.REACHED_CODE_PROFILER) - public void testEnabledViaCachedSharedPreference() throws Exception { + public void testEnabledViaCachedSharedPreference() { setReachedCodeProfilerSharedPreference(true); mActivityTestRule.startMainActivityFromLauncher(); assertReachedCodeProfilerIsEnabled(); @@ -67,7 +67,7 @@ @Test @SmallTest @EnableFeatures(ChromeFeatureList.REACHED_CODE_PROFILER) - public void testSharedPreferenceIsCached_Enable() throws Exception { + public void testSharedPreferenceIsCached_Enable() { mActivityTestRule.startMainActivityFromLauncher(); Assert.assertTrue(getReachedCodeProfilerSharedPreference()); @@ -83,7 +83,7 @@ @Test @SmallTest @DisableFeatures(ChromeFeatureList.REACHED_CODE_PROFILER) - public void testSharedPreferenceIsCached_Disable() throws Exception { + public void testSharedPreferenceIsCached_Disable() { setReachedCodeProfilerSharedPreference(true); mActivityTestRule.startMainActivityFromLauncher(); @@ -100,7 +100,7 @@ @SmallTest @CommandLineFlags. Add("force-fieldtrials=" + ChromeFeatureList.REACHED_CODE_PROFILER + "/" + FAKE_GROUP_NAME) - public void testSharedPreferenceTrialGroupIsCached() throws Exception { + public void testSharedPreferenceTrialGroupIsCached() { mActivityTestRule.startMainActivityFromLauncher(); Assert.assertEquals(FAKE_GROUP_NAME, ChromePreferenceManager.getInstance().readString(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java index 3a047d3..74a31a1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java
@@ -73,7 +73,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { // Create a new temporary instance to ensure the Class is loaded. Otherwise we will get a // ClassNotFoundException when trying to instantiate during startup. SafeBrowsingApiBridge.setSafeBrowsingHandlerType( @@ -81,7 +81,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java index 9ac6126..1896534e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java
@@ -93,7 +93,7 @@ private ActivityWindowAndroidForTest mActivityWindowAndroidForTest; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityWithURL(DATA_URL); TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java index 6605f1f..de2911df 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java
@@ -139,7 +139,7 @@ @After @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) - public void tearDown() throws Exception { + public void tearDown() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { mHandlerThread.quitSafely(); } else { @@ -194,7 +194,7 @@ @MediumTest @Feature({"SmartClip"}) @RetryOnFailure - public void testSmartClipDataCallback() throws InterruptedException, TimeoutException { + public void testSmartClipDataCallback() throws TimeoutException { final float dpi = Coordinates.createFor(mWebContents).getDeviceScaleFactor(); final Rect bounds = DOMUtils.getNodeBounds(mWebContents, "simple_text"); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -226,7 +226,7 @@ @MediumTest @Feature({"SmartClip"}) @RetryOnFailure - public void testSmartClipNoHandlerDoesntCrash() throws InterruptedException, TimeoutException { + public void testSmartClipNoHandlerDoesntCrash() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking(() -> { Object scp = findSmartClipProvider( mActivityTestRule.getActivity().findViewById(android.R.id.content));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SubresourceFilterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SubresourceFilterTest.java index 4ca609e..6199aa7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SubresourceFilterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SubresourceFilterTest.java
@@ -84,7 +84,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); MockSafeBrowsingApiHandler.clearMockResponses(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabCountLabelTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabCountLabelTest.java index 69e28b6..788d04a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabCountLabelTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabCountLabelTest.java
@@ -57,7 +57,7 @@ @Feature({"Browser", "Main"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @RetryOnFailure - public void testTabCountLabel() throws InterruptedException { + public void testTabCountLabel() { final int tabCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); tabCountLabelCheck("Initial state", tabCount); ChromeTabUtils.newTabFromMenu(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabObserverTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabObserverTest.java index 63f1109..2bc3242 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabObserverTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabObserverTest.java
@@ -64,7 +64,7 @@ @Test @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testTabInteractable_tabSwitcher() throws InterruptedException, TimeoutException { + public void testTabInteractable_tabSwitcher() throws TimeoutException { final LayoutManagerChrome layoutManager = mActivity.getLayoutManager(); CallbackHelper interactabilityHelper = mTabObserver.mInteractabilityHelper; @@ -88,7 +88,7 @@ @Test @SmallTest - public void testTabInteractable_multipleTabs() throws InterruptedException, TimeoutException { + public void testTabInteractable_multipleTabs() throws TimeoutException { CallbackHelper interactabilityHelper = mTabObserver.mInteractabilityHelper; assertTrue("Tab should be interactable.", mTab.isUserInteractable());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java index 98e5493..c10956d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java
@@ -68,7 +68,7 @@ @Test @SmallTest @Feature({"Tab"}) - public void testTabContext() throws Throwable { + public void testTabContext() { Assert.assertFalse("The tab context cannot be an activity", mTab.getContentView().getContext() instanceof Activity); Assert.assertNotSame("The tab context's theme should have been updated",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java index 222c0b28..e084d86 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java
@@ -102,8 +102,7 @@ @MediumTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @RetryOnFailure - public void testThemeColorIsCorrect() - throws ExecutionException, InterruptedException, TimeoutException { + public void testThemeColorIsCorrect() throws ExecutionException, TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java index 23e471a..1aa9137 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java
@@ -101,10 +101,6 @@ nodeId = null; } nodeId = jsonText; - } catch (InterruptedException e) { - e.printStackTrace(); - Assert.fail("Failed to retrieve focused node: InterruptedException was thrown"); - return false; } catch (TimeoutException e) { e.printStackTrace(); Assert.fail("Failed to retrieve focused node: TimeoutException was thrown"); @@ -131,9 +127,6 @@ try { String text = DOMUtils.getNodeValue(mTab.getWebContents(), mElementId); return TextUtils.equals(mExpectedText, text); - } catch (InterruptedException e) { - e.printStackTrace(); - return false; } catch (TimeoutException e) { e.printStackTrace(); return false; @@ -165,10 +158,6 @@ mTab.getWebContents(), GET_REFERRER_JS); if (jsonText.equalsIgnoreCase("null")) jsonText = ""; referrer = jsonText; - } catch (InterruptedException e) { - e.printStackTrace(); - Assert.fail("InterruptedException was thrown"); - return false; } catch (TimeoutException e) { e.printStackTrace(); Assert.fail("TimeoutException was thrown"); @@ -181,23 +170,22 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } /** * Launch the specified URL as if it was triggered by an external application with id appId. * Returns when the URL has been navigated to. - * @throws InterruptedException */ private static void launchUrlFromExternalApp(ChromeActivityTestRule testRule, String url, String expectedUrl, String appId, boolean createNewTab, Bundle extras, - boolean firstParty) throws InterruptedException { + boolean firstParty) { final Intent intent = new Intent(Intent.ACTION_VIEW); if (appId != null) { intent.putExtra(Browser.EXTRA_APPLICATION_ID, appId); @@ -229,25 +217,23 @@ ChromeTabUtils.waitForTabPageLoaded(testRule.getActivity().getActivityTab(), expectedUrl); } - private void launchUrlFromExternalApp(String url, String expectedUrl, String appId, - boolean createNewTab, Bundle extras) throws InterruptedException { + private void launchUrlFromExternalApp( + String url, String expectedUrl, String appId, boolean createNewTab, Bundle extras) { launchUrlFromExternalApp( mActivityTestRule, url, expectedUrl, appId, createNewTab, extras, false); } - private void launchUrlFromExternalApp(String url, String appId, boolean createNewTab) - throws InterruptedException { + private void launchUrlFromExternalApp(String url, String appId, boolean createNewTab) { launchUrlFromExternalApp(mActivityTestRule, url, url, appId, createNewTab, null, false); } /** * Tests that URLs opened from external apps can set an android-app scheme referrer. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testReferrer() throws InterruptedException { + public void testReferrer() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); mActivityTestRule.startMainActivityFromLauncher(); Bundle extras = new Bundle(); @@ -261,12 +247,11 @@ /** * Tests that URLs opened from external apps cannot set an invalid android-app referrer. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testInvalidAndroidAppReferrer() throws InterruptedException { + public void testInvalidAndroidAppReferrer() { String invalidReferrer = "android-app:///note.the.extra.leading/"; String url = mTestServer.getURL("/chrome/test/data/android/about.html"); mActivityTestRule.startMainActivityFromLauncher(); @@ -280,12 +265,11 @@ /** * Tests that URLs opened from external apps cannot set an arbitrary referrer scheme. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testCannotSetArbitraryReferrer() throws InterruptedException { + public void testCannotSetArbitraryReferrer() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); mActivityTestRule.startMainActivityFromLauncher(); String referrer = "foobar://totally.legit.referrer"; @@ -299,12 +283,11 @@ /** * Tests that URLs opened from external applications cannot set an http:// referrer. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testNoHttpReferrer() throws InterruptedException { + public void testNoHttpReferrer() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); mActivityTestRule.startMainActivityFromLauncher(); Bundle extras = new Bundle(); @@ -319,12 +302,11 @@ /** * Tests that URLs opened from First party apps can set an http:// referrrer. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testHttpReferrerFromFirstParty() throws InterruptedException { + public void testHttpReferrerFromFirstParty() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); mActivityTestRule.startMainActivityFromLauncher(); Bundle extras = new Bundle(); @@ -340,12 +322,11 @@ /** * Tests that an https:// referrer is not stripped in case of downgrade with Origin Policy. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testReferrerPolicyHttpsReferrerPolicyOrigin() throws InterruptedException { + public void testReferrerPolicyHttpsReferrerPolicyOrigin() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); launchAndVerifyReferrerWithPolicy(url, mActivityTestRule, ReferrerPolicy.ORIGIN, HTTPS_REFERRER_WITH_PATH, HTTPS_REFERRER); @@ -354,13 +335,11 @@ /** * Tests that an https:// referrer is not stripped in case of downgrade * with Origin When Cross Origin Policy. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testReferrerPolicyHttpsReferrerPolicyOriginWhenCrossOrigin() - throws InterruptedException { + public void testReferrerPolicyHttpsReferrerPolicyOriginWhenCrossOrigin() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); launchAndVerifyReferrerWithPolicy(url, mActivityTestRule, ReferrerPolicy.ORIGIN_WHEN_CROSS_ORIGIN, HTTPS_REFERRER_WITH_PATH, HTTPS_REFERRER); @@ -368,12 +347,11 @@ /** * Tests that an https:// referrer is stripped in case of downgrade with Strict Origin Policy. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testReferrerPolicyHttpsReferrerPolicyStrictOrigin() throws InterruptedException { + public void testReferrerPolicyHttpsReferrerPolicyStrictOrigin() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); launchAndVerifyReferrerWithPolicy( url, mActivityTestRule, ReferrerPolicy.STRICT_ORIGIN, HTTPS_REFERRER, ""); @@ -385,7 +363,7 @@ * referrer after loaded. */ static void launchAndVerifyReferrerWithPolicy(String url, ChromeActivityTestRule testRule, - int policy, String referrer, String expectedReferrer) throws InterruptedException { + int policy, String referrer, String expectedReferrer) { testRule.startMainActivityFromLauncher(); Bundle extras = new Bundle(); extras.putParcelable(Intent.EXTRA_REFERRER, Uri.parse(referrer)); @@ -398,12 +376,11 @@ /** * Tests that an https:// referrer is stripped in case of downgrade. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testHttpsReferrerFromFirstPartyNoDowngrade() throws InterruptedException { + public void testHttpsReferrerFromFirstPartyNoDowngrade() { String url = mTestServer.getURL("/chrome/test/data/android/about.html"); mActivityTestRule.startMainActivityFromLauncher(); Bundle extras = new Bundle(); @@ -417,13 +394,12 @@ /** * Tests that URLs opened from the same external app don't create new tabs. - * @throws InterruptedException */ // @LargeTest // @Feature({"Navigation"}) @Test @DisabledTest - public void testNoNewTabForSameApp() throws InterruptedException { + public void testNoNewTabForSameApp() { mActivityTestRule.startMainActivityFromLauncher(); String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); @@ -460,13 +436,12 @@ /** * Tests that URLs opened from an unspecified external app (no Browser.EXTRA_APPLICATION_ID in * the intent extras) don't create new tabs. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testNewTabForUnknownApp() throws InterruptedException { + public void testNewTabForUnknownApp() { mActivityTestRule.startMainActivityFromLauncher(); String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); @@ -508,13 +483,12 @@ /** * Tests that URLs opened with the Browser.EXTRA_CREATE_NEW_TAB extra in * the intent do create new tabs. - * @throws InterruptedException */ // @LargeTest // @Feature({"Navigation"}) @Test @DisabledTest - public void testNewTabWithNewTabExtra() throws InterruptedException { + public void testNewTabWithNewTabExtra() { mActivityTestRule.startMainActivityFromLauncher(); String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); @@ -551,12 +525,11 @@ /** * Similar to testNoNewTabForSameApp but actually starting the application (not just opening a * tab) from the external app. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation", "Main"}) - public void testNoNewTabForSameAppOnStart() throws InterruptedException { + public void testNoNewTabForSameAppOnStart() { String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); String url2 = mTestServer.getURL("/chrome/test/data/android/about.html"); @@ -585,12 +558,11 @@ /** * Test that URLs opened from different external apps do create new tabs. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation", "Main"}) - public void testNewTabForDifferentApps() throws InterruptedException { + public void testNewTabForDifferentApps() { mActivityTestRule.startMainActivityFromLauncher(); String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); @@ -623,12 +595,11 @@ /** * Tests that a tab is not reused when launched from the same app as an already opened tab and * when the user has navigated elsewhere manually in the same tab. - * @throws InterruptedException */ @Test @LargeTest @Feature({"Navigation"}) - public void testNewTabAfterNavigation() throws InterruptedException { + public void testNewTabAfterNavigation() { mActivityTestRule.startMainActivityFromLauncher(); String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); @@ -661,7 +632,7 @@ */ @Test @FlakyTest(message = "http://crbug.com/6467101") - public void testNewTabWhenPageEdited() throws InterruptedException, TimeoutException { + public void testNewTabWhenPageEdited() throws TimeoutException { mActivityTestRule.startMainActivityFromLauncher(); String url1 = mTestServer.getURL("/chrome/test/data/android/google.html"); @@ -698,7 +669,6 @@ mActivityTestRule.getActivity().getActivityTab().getUrl()); } - private static class TestTabObserver extends EmptyTabObserver { private ContextMenu mContextMenu; @@ -798,7 +768,7 @@ @EnableFeatures( {"DataReductionProxyDecidesTransform", "DataReductionProxyEnabledWithNetworkService"}) public void - testLaunchWebLiteURL() throws InterruptedException { + testLaunchWebLiteURL() { mActivityTestRule.startMainActivityFromLauncher(); String url = mTestServer.getURL("/chrome/test/data/android/about.html"); @@ -819,7 +789,7 @@ @MediumTest @CommandLineFlags.Add("enable-spdy-proxy-auth") @DisableFeatures("DataReductionProxyDecidesTransform") - public void testLaunchWebLiteURLNoPreviews() throws InterruptedException { + public void testLaunchWebLiteURLNoPreviews() { mActivityTestRule.startMainActivityFromLauncher(); String url = "http://googleweblight.com/i?u=chrome/test/data/android/about.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java index 76fd814d..21ca8a7e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
@@ -170,9 +170,8 @@ true); } - @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) { mTestServer.stopAndDestroyServer(); } @@ -180,8 +179,6 @@ /** * Verify that spawning a popup from a background tab in a different model works properly. - * @throws InterruptedException - * @throws TimeoutException */ @Test @LargeTest @@ -189,7 +186,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @CommandLineFlags.Add(ContentSwitches.DISABLE_POPUP_BLOCKING) @RetryOnFailure - public void testSpawnPopupOnBackgroundTab() throws InterruptedException, TimeoutException { + public void testSpawnPopupOnBackgroundTab() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.loadUrl(mTestServer.getURL(TEST_FILE_PATH)); final Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -212,7 +209,7 @@ @Test @MediumTest @RetryOnFailure - public void testAlertDialogDoesNotChangeActiveModel() throws InterruptedException { + public void testAlertDialogDoesNotChangeActiveModel() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.newIncognitoTabFromMenu(); mActivityTestRule.loadUrl(mTestServer.getURL(TEST_FILE_PATH)); @@ -251,16 +248,13 @@ /** * Verify New Tab Open and Close Event not from the context menu. - * @throws InterruptedException - * - * https://crbug.com/490473 * @LargeTest * @Feature({"Android-TabSwitcher"}) * @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) */ @Test @DisabledTest - public void testOpenAndCloseNewTabButton() throws InterruptedException { + public void testOpenAndCloseNewTabButton() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.startMainActivityWithURL(mTestServer.getURL(TEST_FILE_PATH)); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { @@ -304,7 +298,7 @@ mActivityTestRule.getActivity().getCurrentTabModel().getCount())); } - private void assertWaitForKeyboardStatus(final boolean show) throws InterruptedException { + private void assertWaitForKeyboardStatus(final boolean show) { CriteriaHelper.pollUiThread(new Criteria() { @Override public boolean isSatisfied() { @@ -382,7 +376,7 @@ assertWaitForKeyboardStatus(false); } - private void assertWaitForSelectedText(final String text) throws InterruptedException { + private void assertWaitForSelectedText(final String text) { CriteriaHelper.pollUiThread(new Criteria() { @Override public boolean isSatisfied() { @@ -446,13 +440,12 @@ /** * Verify that opening a new tab and navigating immediately sets a size on the newly created * renderer. https://crbug.com/434477. - * @throws InterruptedException * @throws TimeoutException */ @Test @SmallTest @RetryOnFailure - public void testNewTabSetsContentViewSize() throws InterruptedException, TimeoutException { + public void testNewTabSetsContentViewSize() throws TimeoutException { ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); @@ -525,10 +518,8 @@ /** * Verify that the provided click position closes a tab. - * @throws InterruptedException */ - private void checkCloseTabAtPosition(final float x, final float y) - throws InterruptedException { + private void checkCloseTabAtPosition(final float x, final float y) { mActivityTestRule.getActivity(); int initialTabCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); @@ -555,14 +546,13 @@ /** * Verify close button works in the TabSwitcher in portrait mode. * This code does not handle properly different screen densities. - * @throws InterruptedException */ @Test @LargeTest @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) @Feature({"Android-TabSwitcher"}) @RetryOnFailure - public void testTabSwitcherPortraitCloseButton() throws InterruptedException { + public void testTabSwitcherPortraitCloseButton() { mActivityTestRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); int portraitWidth = Math.min( @@ -577,14 +567,13 @@ /** * Verify close button works in the TabSwitcher in landscape mode. * This code does not handle properly different screen densities. - * @throws InterruptedException * @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) * @LargeTest * @Feature({"Android-TabSwitcher"}) */ @Test @FlakyTest(message = "crbug.com/170179") - public void testTabSwitcherLandscapeCloseButton() throws InterruptedException { + public void testTabSwitcherLandscapeCloseButton() { mActivityTestRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // Hard-coded coordinates of the close button on the bottom left of the screen. @@ -606,7 +595,7 @@ */ @Test @DisabledTest - public void testOpenManyTabsSlowly() throws InterruptedException { + public void testOpenManyTabsSlowly() { int startCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); for (int i = 1; i <= STRESSFUL_TAB_COUNT; ++i) { ChromeTabUtils.newTabFromMenu( @@ -648,7 +637,7 @@ */ @Test @FlakyTest - public void testOpenManyTabsInBursts() throws InterruptedException, TimeoutException { + public void testOpenManyTabsInBursts() throws TimeoutException { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); final int burstSize = 5; final String url = mTestServer.getURL(TEST_PAGE_FILE_PATH); @@ -670,7 +659,7 @@ */ @Test @FlakyTest(message = "crbug.com/223110") - public void testOpenManyTabsAtOnce10() throws InterruptedException, TimeoutException { + public void testOpenManyTabsAtOnce10() throws TimeoutException { openAndVerifyManyTestTabs(10); } @@ -678,8 +667,7 @@ * Verify that we can open a large number of tabs all at once and that each * tab loads when selected. */ - private void openAndVerifyManyTestTabs(final int num) - throws InterruptedException, TimeoutException { + private void openAndVerifyManyTestTabs(final int num) throws TimeoutException { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); final String url = mTestServer.getURL(TEST_PAGE_FILE_PATH); int startCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); @@ -703,7 +691,7 @@ /** * Displays the tabSwitcher mode and wait for it to settle. */ - private void showOverviewAndWaitForAnimation() throws InterruptedException { + private void showOverviewAndWaitForAnimation() { OverviewModeBehaviorWatcher overviewModeWatcher = new OverviewModeBehaviorWatcher( mActivityTestRule.getActivity().getLayoutManager(), true, false); // For some unknown reasons calling clickById(R.id.tab_switcher_button) sometimes hang. @@ -716,7 +704,7 @@ /** * Exits the tabSwitcher mode and wait for it to settle. */ - private void hideOverviewAndWaitForAnimation() throws InterruptedException { + private void hideOverviewAndWaitForAnimation() { OverviewModeBehaviorWatcher overviewModeWatcher = new OverviewModeBehaviorWatcher( mActivityTestRule.getActivity().getLayoutManager(), false, true); InstrumentationRegistry.getInstrumentation().runOnMainSync( @@ -729,9 +717,8 @@ * @param targetTabCount The desired number of tabs in the model. * @param waitToLoad Whether the tabs need to be fully loaded. * @return The new number of tabs in the model. - * @throws InterruptedException */ - private int openTabs(final int targetTabCount, boolean waitToLoad) throws InterruptedException { + private int openTabs(final int targetTabCount, boolean waitToLoad) { int tabCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); while (tabCount < targetTabCount) { ChromeTabUtils.newTabFromMenu( @@ -759,7 +746,7 @@ @Test @DisabledTest(message = "crbug.com/156746") @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) - public void testTabsCulling() throws InterruptedException { + public void testTabsCulling() { // Open one more tabs than maxTabsDrawn. final int maxTabsDrawn = 8; int tabCount = openTabs(maxTabsDrawn + 1, false); @@ -775,9 +762,8 @@ /** * Checks the stacked tabs in the stack are visible. - * @throws InterruptedException */ - private void checkTabsStacking() throws InterruptedException { + private void checkTabsStacking() { final int count = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); Assert.assertEquals( "The number of tab in the stack should match the number of tabs in the model", @@ -806,7 +792,7 @@ @Test @FlakyTest(message = "crbug.com/170179") @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) - public void testTabsStacking() throws InterruptedException { + public void testTabsStacking() { final int count = openTabs(12, false); // Selecting the first tab to scroll all the way to the top. @@ -865,7 +851,7 @@ @Test @FlakyTest(message = "crbug.com/303319") @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testTabSwitcherMemoryLeak() throws InterruptedException { + public void testTabSwitcherMemoryLeak() { openTabs(4, true); int maxTries = 10; @@ -920,7 +906,7 @@ @LargeTest @Feature({"Android-TabSwitcher"}) @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) - public void testTabSelectionPortrait() throws InterruptedException { + public void testTabSelectionPortrait() { mActivityTestRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); checkTabSelection(2, 0, false); @@ -945,7 +931,7 @@ @Test @FlakyTest(message = "crbug.com/170179") @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) - public void testTabSelectionLandscape() throws InterruptedException { + public void testTabSelectionLandscape() { mActivityTestRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); checkTabSelection(2, 0, true); @@ -971,7 +957,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Android-TabSwitcher"}) @RetryOnFailure - public void testCloseLastTabFromMain() throws InterruptedException { + public void testCloseLastTabFromMain() { OverviewModeBehaviorWatcher overviewModeWatcher = new OverviewModeBehaviorWatcher( mActivityTestRule.getActivity().getLayoutManager(), true, false); ChromeTabUtils.closeCurrentTab( @@ -1064,8 +1050,8 @@ return target; } - private void checkTabSelection(int additionalTabsToOpen, int tabIndexToSelect, - boolean isLandscape) throws InterruptedException { + private void checkTabSelection( + int additionalTabsToOpen, int tabIndexToSelect, boolean isLandscape) { for (int i = 0; i < additionalTabsToOpen; i++) { ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); @@ -1092,7 +1078,7 @@ } public void swipeToCloseTab(final int tabIndexToClose, final boolean isLandscape, - final boolean isIncognito, final int swipeDirection) throws InterruptedException { + final boolean isIncognito, final int swipeDirection) { final LayoutManagerChrome layoutManager = updateTabsViewSize(); float[] coordinates = getStackTabClickTarget(tabIndexToClose, isIncognito, isLandscape); final float clickX = coordinates[0]; @@ -1122,10 +1108,8 @@ }); } - private void swipeToCloseNTabs(int number, boolean isLandscape, boolean isIncognito, - int swipeDirection) - throws InterruptedException { - + private void swipeToCloseNTabs( + int number, boolean isLandscape, boolean isIncognito, int swipeDirection) { for (int i = number - 1; i >= 0; i--) { swipeToCloseTab(i, isLandscape, isIncognito, swipeDirection); } @@ -1139,7 +1123,7 @@ @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) @Feature({"Android-TabSwitcher", "Main"}) @RetryOnFailure - public void testCloseTabPortrait() throws InterruptedException { + public void testCloseTabPortrait() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.startMainActivityWithURL( mTestServer.getURL("/chrome/test/data/android/test.html")); @@ -1168,7 +1152,7 @@ @Feature({"Android-TabSwitcher", "Main"}) @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) @RetryOnFailure - public void testCloseTabLandscape() throws InterruptedException { + public void testCloseTabLandscape() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.startMainActivityWithURL( mTestServer.getURL("/chrome/test/data/android/test.html")); @@ -1371,7 +1355,7 @@ @SmallTest @Feature({"Android-TabSwitcher"}) @RetryOnFailure - public void testCloseTabDuringFling() throws InterruptedException { + public void testCloseTabDuringFling() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.loadUrlInNewTab( mTestServer.getURL("/chrome/test/data/android/tabstest/text_page.html")); @@ -1392,7 +1376,7 @@ */ @Test @FlakyTest - public void testQuickSwitchBetweenTabAndSwitcherMode() throws InterruptedException { + public void testQuickSwitchBetweenTabAndSwitcherMode() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); final String[] urls = { mTestServer.getURL("/chrome/test/data/android/navigate/one.html"), @@ -1425,7 +1409,7 @@ @MediumTest @Feature({"Android-TabSwitcher"}) @RetryOnFailure - public void testOpenIncognitoTab() throws InterruptedException { + public void testOpenIncognitoTab() { mActivityTestRule.newIncognitoTabFromMenu(); Assert.assertTrue("Current Tab should be an incognito tab.", @@ -1466,7 +1450,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @RetryOnFailure @DisabledTest(message = "https://crbug.com/947694") - public void testToolbarSwipeOnlyTab() throws InterruptedException, TimeoutException { + public void testToolbarSwipeOnlyTab() throws TimeoutException { final TabModel tabModel = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); @@ -1596,9 +1580,8 @@ runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.RIGHT, 0, true); } - private void runToolbarSideSwipeTestOnCurrentModel( - @ScrollDirection int direction, int finalIndex, boolean expectsSelection) - throws InterruptedException, TimeoutException { + private void runToolbarSideSwipeTestOnCurrentModel(@ScrollDirection int direction, + int finalIndex, boolean expectsSelection) throws TimeoutException { final CallbackHelper selectCallback = new CallbackHelper(); final ChromeTabbedActivity activity = mActivityTestRule.getActivity(); final int id = activity.getCurrentTabModel().getTabAt(finalIndex).getId(); @@ -1911,8 +1894,7 @@ assertFileExists(incognitoTabFile, false); } - private void assertFileExists(final File fileToCheck, final boolean expected) - throws InterruptedException { + private void assertFileExists(final File fileToCheck, final boolean expected) { CriteriaHelper.pollInstrumentationThread( Criteria.equals(expected, () -> fileToCheck.exists())); } @@ -1924,8 +1906,7 @@ * @param url The url of the page to load. * @param numTabs The number of tabs to open. */ - private void loadUrlInManyNewTabs(final String url, final int numTabs) - throws InterruptedException, TimeoutException { + private void loadUrlInManyNewTabs(final String url, final int numTabs) throws TimeoutException { final CallbackHelper[] pageLoadedCallbacks = new CallbackHelper[numTabs]; final int[] tabIds = new int[numTabs]; for (int i = 0; i < numTabs; ++i) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java index 539dde0..fbd45df1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java
@@ -49,7 +49,7 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); TestContentProvider.resetResourceRequestCounts(InstrumentationRegistry.getTargetContext()); TestContentProvider.setDataFilePath( @@ -58,7 +58,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -92,7 +92,7 @@ @Test @MediumTest @Feature({"Navigation"}) - public void testContentUrlAccess() throws InterruptedException { + public void testContentUrlAccess() { String resource = SIMPLE_SRC; mActivityTestRule.loadUrl(createContentUrl(resource)); ensureResourceRequestCountInContentProviderNotLessThan(resource, 1); @@ -189,7 +189,7 @@ @Test @MediumTest @Feature({"Navigation"}) - public void testContentUrlFromData() throws InterruptedException { + public void testContentUrlFromData() { final String target = SIMPLE_IMAGE; mActivityTestRule.loadUrl( UrlUtils.encodeHtmlDataUri("<img src=\"" + createContentUrl(target) + "\">")); @@ -202,7 +202,7 @@ @Test @MediumTest @Feature({"Navigation"}) - public void testContentUrlFromFile() throws InterruptedException, IOException { + public void testContentUrlFromFile() throws IOException { final String target = SIMPLE_IMAGE; final File file = new File(Environment.getExternalStorageDirectory(), target + ".html"); try { @@ -226,7 +226,7 @@ @Test @MediumTest @Feature({"Navigation"}) - public void testFileUrlNavigation() throws InterruptedException, IOException { + public void testFileUrlNavigation() throws IOException { final File file = new File(Environment.getExternalStorageDirectory(), "url_navigation_test.html");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/VideoFullscreenOrientationLockChromeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/VideoFullscreenOrientationLockChromeTest.java index b5815f1e..ed5a8f2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/VideoFullscreenOrientationLockChromeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/VideoFullscreenOrientationLockChromeTest.java
@@ -50,8 +50,7 @@ return mActivityTestRule.getActivity().getCurrentWebContents(); } - private void waitForContentsFullscreenState(boolean fullscreenValue) - throws InterruptedException { + private void waitForContentsFullscreenState(boolean fullscreenValue) { CriteriaHelper.pollInstrumentationThread( Criteria.equals(fullscreenValue, () -> DOMUtils.isFullscreen(getWebContents()))); } @@ -61,7 +60,7 @@ != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; } - private boolean isScreenOrientationLandscape() throws InterruptedException, TimeoutException { + private boolean isScreenOrientationLandscape() throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" return screen.orientation.type.startsWith('landscape');"); @@ -71,14 +70,12 @@ .equals("true"); } - private void waitUntilLockedToLandscape() throws InterruptedException { + private void waitUntilLockedToLandscape() { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() { try { return isScreenOrientationLocked() && isScreenOrientationLandscape(); - } catch (InterruptedException e) { - return false; } catch (TimeoutException e) { return false; } @@ -86,7 +83,7 @@ }); } - private void waitUntilUnlocked() throws InterruptedException { + private void waitUntilUnlocked() { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() { @@ -96,7 +93,7 @@ } @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityWithURL(UrlUtils.getIsolatedTestFileUrl(TEST_URL)); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/WarmupManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/WarmupManagerTest.java index cfdaf62d..c14fe6e6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/WarmupManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/WarmupManagerTest.java
@@ -57,7 +57,7 @@ .getApplicationContext(); TestThreadUtils.runOnUiThreadBlocking(new Callable<Void>() { @Override - public Void call() throws Exception { + public Void call() { ChromeBrowserInitializer.getInstance(mContext).handleSynchronousStartup(); mWarmupManager = WarmupManager.getInstance(); return null; @@ -66,7 +66,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> mWarmupManager.destroySpareWebContents()); } @@ -109,7 +109,7 @@ @Test @SmallTest @UiThreadTest - public void testTakeSpareWebContents() throws Throwable { + public void testTakeSpareWebContents() { mWarmupManager.createSpareWebContents(!WarmupManager.FOR_CCT); WebContents webContents = mWarmupManager.takeSpareWebContents(false, false, !WarmupManager.FOR_CCT); @@ -121,7 +121,7 @@ @Test @SmallTest @UiThreadTest - public void testTakeSpareWebContentsChecksArguments() throws Throwable { + public void testTakeSpareWebContentsChecksArguments() { mWarmupManager.createSpareWebContents(!WarmupManager.FOR_CCT); Assert.assertNull(mWarmupManager.takeSpareWebContents(true, false, !WarmupManager.FOR_CCT)); Assert.assertNull(mWarmupManager.takeSpareWebContents(true, true, !WarmupManager.FOR_CCT)); @@ -134,7 +134,7 @@ @Test @SmallTest @UiThreadTest - public void testClearsDeadWebContents() throws Throwable { + public void testClearsDeadWebContents() { mWarmupManager.createSpareWebContents(!WarmupManager.FOR_CCT); WebContentsUtils.simulateRendererKilled(mWarmupManager.mSpareWebContents, false); Assert.assertNull( @@ -144,7 +144,7 @@ @Test @SmallTest @UiThreadTest - public void testRecordWebContentsStatus() throws Throwable { + public void testRecordWebContentsStatus() { String name = WarmupManager.WEBCONTENTS_STATUS_HISTOGRAM; MetricsUtils.HistogramDelta createdDelta = new MetricsUtils.HistogramDelta(name, WarmupManager.WebContentsStatus.CREATED); @@ -199,7 +199,7 @@ @Test @SmallTest @UiThreadTest - public void testInflateLayout() throws Throwable { + public void testInflateLayout() { int layoutId = R.layout.custom_tabs_control_container; int toolbarId = R.layout.custom_tabs_toolbar; mWarmupManager.initializeViewHierarchy(mContext, layoutId, toolbarId);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility/FontSizePrefsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility/FontSizePrefsTest.java index 3075b6a..1c7944f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility/FontSizePrefsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility/FontSizePrefsTest.java
@@ -34,7 +34,7 @@ private FontSizePrefs mFontSizePrefs; @Before - public void setUp() throws Exception { + public void setUp() { resetSharedPrefs(); Context context = InstrumentationRegistry.getTargetContext(); mFontSizePrefs = getFontSizePrefs(context);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility_tab_switcher/OverviewListLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility_tab_switcher/OverviewListLayoutTest.java index 2bccbb97..08b6e1b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility_tab_switcher/OverviewListLayoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/accessibility_tab_switcher/OverviewListLayoutTest.java
@@ -110,7 +110,7 @@ } @Before - public void setUp() throws InterruptedException { + public void setUp() { CommandLine.getInstance().appendSwitch(ChromeSwitches.ENABLE_ACCESSIBILITY_TAB_SWITCHER); mActivityTestRule.startMainActivityFromLauncher(); } @@ -124,7 +124,7 @@ return (ListView) getContainer().findViewById(R.id.list_view); } - private void setupTabs() throws InterruptedException { + private void setupTabs() { ChromeTabUtils.newTabsFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), 3); @@ -153,7 +153,7 @@ return childTextView.getText(); } - private void toggleTabSwitcher(final boolean expectVisible) throws Exception { + private void toggleTabSwitcher(final boolean expectVisible) { TestTouchUtils.performClickOnMainSync(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button)); CriteriaHelper.pollUiThread(new Criteria() { @@ -198,7 +198,7 @@ @MediumTest @Feature({"Accessibility"}) @RetryOnFailure - public void testCanCloseWithCloseButton() throws InterruptedException, TimeoutException { + public void testCanCloseWithCloseButton() throws TimeoutException { setupTabs(); AccessibilityTabModelListItem item = getListItemAndDisableAnimations(0); @@ -226,7 +226,7 @@ @MediumTest @Feature({"Accessibility"}) @RetryOnFailure - public void testCanSwipeClosed() throws InterruptedException, TimeoutException { + public void testCanSwipeClosed() throws TimeoutException { setupTabs(); AccessibilityTabModelListItem item = getListItemAndDisableAnimations(1); @@ -259,7 +259,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @MediumTest @Feature({"Accessibility"}) - public void testResetSwipe() throws InterruptedException { + public void testResetSwipe() { setupTabs(); AccessibilityTabModelListItem item = getListItemAndDisableAnimations(0); @@ -279,7 +279,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @MediumTest @Feature({"Accessibility"}) - public void testCloseAndUndo() throws InterruptedException, TimeoutException { + public void testCloseAndUndo() throws TimeoutException { setupTabs(); final AccessibilityTabModelListItem item = getListItem(0); @@ -312,7 +312,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @MediumTest @Feature({"Accessibility"}) - public void testCloseAll() throws InterruptedException { + public void testCloseAll() { setupTabs(); MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(), @@ -332,7 +332,7 @@ @MediumTest @Feature({"Accessibility"}) @RetryOnFailure - public void testCloseAllIncognito() throws InterruptedException { + public void testCloseAllIncognito() { setupTabs(); mActivityTestRule.newIncognitoTabsFromMenu(2); TestTouchUtils.performClickOnMainSync(InstrumentationRegistry.getInstrumentation(), @@ -364,7 +364,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @MediumTest @Feature({"Accessibility"}) - public void testModelSwitcherVisibility() throws InterruptedException { + public void testModelSwitcherVisibility() { setupTabs(); View switcherButtons = getContainer().findViewById(R.id.tab_wrapper); @@ -385,7 +385,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @MediumTest @Feature({"Accessibility"}) - public void testModelSwitcherFunctionality() throws InterruptedException { + public void testModelSwitcherFunctionality() { mActivityTestRule.newIncognitoTabsFromMenu(2); ChromeTabUtils.newTabsFromMenu( @@ -446,7 +446,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_TABLET) @MediumTest @Feature({"Accessibility"}) - public void testCloseTabThroughTabStrip() throws InterruptedException, TimeoutException { + public void testCloseTabThroughTabStrip() throws TimeoutException { setupTabs(); getListItemAndDisableAnimations(0);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java index 9f3a5ebe..948d219 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java
@@ -82,7 +82,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { // We need list selection; ensure we are not in touch mode. InstrumentationRegistry.getInstrumentation().setInTouchMode(false); @@ -115,7 +115,7 @@ @Test @SmallTest @Feature({"Browser", "Main"}) - public void testMenuNewTab() throws InterruptedException { + public void testMenuNewTab() { final int tabCountBefore = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); ChromeTabUtils.newTabFromMenu(InstrumentationRegistry.getInstrumentation(), (ChromeTabbedActivity) mActivityTestRule.getActivity()); @@ -236,7 +236,7 @@ @SmallTest @Feature({"Browser", "Main"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testHideMenuOnToggleOverview() throws TimeoutException, InterruptedException { + public void testHideMenuOnToggleOverview() throws TimeoutException { CallbackHelper overviewModeFinishedShowingCallback = new CallbackHelper(); OverviewModeBehavior.OverviewModeObserver overviewModeObserver = new EmptyOverviewModeObserver() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java index 557fa53..02a074a79 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java
@@ -147,7 +147,7 @@ private List<AutofillLogger.LogEntry> mAutofillLoggedEntries; @Before - public void setUp() throws Exception { + public void setUp() { mAutofillLoggedEntries = new ArrayList<AutofillLogger.LogEntry>(); AutofillLogger.setLoggerForTesting( logEntry -> mAutofillLoggedEntries.add(logEntry) @@ -158,15 +158,14 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mActivityTestRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); } private void loadForm(final String formDataUrl, final String inputText, - @Nullable Callback<Activity> updateActivity) - throws InterruptedException, TimeoutException { + @Nullable Callback<Activity> updateActivity) throws TimeoutException { mActivityTestRule.startMainActivityWithURL(formDataUrl); if (updateActivity != null) { updateActivity.onResult(mActivityTestRule.getActivity()); @@ -203,8 +202,7 @@ } private void loadAndFillForm(final String formDataUrl, final String inputText, - @Nullable Callback<Activity> updateActivity) - throws InterruptedException, TimeoutException { + @Nullable Callback<Activity> updateActivity) throws TimeoutException { loadForm(formDataUrl, inputText, updateActivity); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -224,7 +222,7 @@ } private void loadAndFillForm(final String formDataUrl, final String inputText) - throws InterruptedException, TimeoutException { + throws TimeoutException { loadAndFillForm(formDataUrl, inputText, null); } @@ -236,7 +234,7 @@ @MediumTest @Feature({"autofill"}) @DisabledTest(message = "Flaky. crbug.com/936183") - public void testClickAutofillPopupSuggestion() throws InterruptedException, TimeoutException { + public void testClickAutofillPopupSuggestion() throws TimeoutException { loadAndFillForm(BASIC_PAGE_DATA, "J"); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -282,7 +280,7 @@ @Test @MediumTest @Feature({"autofill"}) - public void testLoggingInitiatedElementFilled() throws InterruptedException, TimeoutException { + public void testLoggingInitiatedElementFilled() throws TimeoutException { loadAndFillForm(INITIATING_ELEMENT_FILLED, "o"); final String profileFullName = FIRST_NAME + " " + LAST_NAME; final int loggedEntries = 4; @@ -301,7 +299,7 @@ @Test @MediumTest @Feature({"autofill"}) - public void testLoggingAnotherElementFilled() throws InterruptedException, TimeoutException { + public void testLoggingAnotherElementFilled() throws TimeoutException { loadAndFillForm(ANOTHER_ELEMENT_FILLED, "J"); final String profileFullName = FIRST_NAME + " " + LAST_NAME; final int loggedEntries = 3; @@ -319,7 +317,7 @@ @Test @MediumTest @Feature({"autofill"}) - public void testNotLoggingInvalidOption() throws InterruptedException, TimeoutException { + public void testNotLoggingInvalidOption() throws TimeoutException { loadAndFillForm(INVALID_OPTION, "o"); final String profileFullName = FIRST_NAME + " " + LAST_NAME; final int loggedEntries = 3; @@ -335,7 +333,7 @@ @MediumTest @Feature({"autofill"}) @EnableFeatures(ChromeFeatureList.AUTOFILL_REFRESH_STYLE_ANDROID) - public void testScreenOrientationPortrait() throws InterruptedException, TimeoutException { + public void testScreenOrientationPortrait() throws TimeoutException { runTestScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } @@ -343,12 +341,11 @@ @MediumTest @Feature({"autofill"}) @EnableFeatures(ChromeFeatureList.AUTOFILL_REFRESH_STYLE_ANDROID) - public void testScreenOrientationLandscape() throws InterruptedException, TimeoutException { + public void testScreenOrientationLandscape() throws TimeoutException { runTestScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } - private void runTestScreenOrientation(int orientation) - throws InterruptedException, TimeoutException { + private void runTestScreenOrientation(int orientation) throws TimeoutException { // TODO(crbug.com/905081): Also test different screen sizes. loadForm(BASIC_PAGE_DATA, "J", activity -> activity.setRequestedOrientation(orientation)); @@ -415,8 +412,6 @@ DOMUtils.getNodeValue( mActivityTestRule.getActivity().getCurrentWebContents(), "fn")); - } catch (InterruptedException e) { - return false; } catch (TimeoutException e) { return false; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java index 2f55f8c..e882ad813 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java
@@ -47,7 +47,7 @@ new ChromeActivityTestRule<>(ChromeActivity.class); @Before - public void setUp() throws Exception { + public void setUp() { // TODO(crbug.com/894428) - fix this suite to use the embedded test server instead of // data urls. Features.getInstance().enable(ChromeFeatureList.AUTOFILL_ALLOW_NON_HTTP_ACTIVATION); @@ -61,8 +61,7 @@ @Feature({"autofill-keyboard"}) @RetryOnFailure @DisabledTest - public void testShowAutofillPopupAndKeyboardimultaneously() - throws InterruptedException, TimeoutException { + public void testShowAutofillPopupAndKeyboardimultaneously() throws TimeoutException { mActivityTestRule.startMainActivityWithURL(UrlUtils.encodeHtmlDataUri("<html><head>" + "<meta name=\"viewport\"" + "content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0\" /></head>"
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java index e31241b..024848f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java
@@ -146,7 +146,7 @@ @Test @SmallTest @Feature({"autofill"}) - public void testAutofillWithDifferentNumberSuggestions() throws Exception { + public void testAutofillWithDifferentNumberSuggestions() { openAutofillPopupAndWaitUntilReady(createTwoAutofillSuggestionArray()); Assert.assertEquals(2, mAutofillPopup.getListView().getCount()); @@ -157,7 +157,7 @@ @Test @SmallTest @Feature({"autofill"}) - public void testAutofillClickFirstSuggestion() throws Exception { + public void testAutofillClickFirstSuggestion() { AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); openAutofillPopupAndWaitUntilReady(suggestions); Assert.assertEquals(2, mAutofillPopup.getListView().getCount());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java index 749dece..261047e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java
@@ -58,8 +58,7 @@ return getProfilesForSettings().size(); } - public String setProfile(final AutofillProfile profile) - throws InterruptedException, TimeoutException { + public String setProfile(final AutofillProfile profile) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); String guid = TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().setProfile(profile)); @@ -67,7 +66,7 @@ return guid; } - public void deleteProfile(final String guid) throws InterruptedException, TimeoutException { + public void deleteProfile(final String guid) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().deleteProfile(guid)); @@ -99,8 +98,7 @@ return getCreditCardsForSettings().size(); } - public String setCreditCard(final CreditCard card) - throws InterruptedException, TimeoutException { + public String setCreditCard(final CreditCard card) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); String guid = TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().setCreditCard(card)); @@ -108,15 +106,14 @@ return guid; } - public void addServerCreditCard(final CreditCard card) - throws InterruptedException, TimeoutException { + public void addServerCreditCard(final CreditCard card) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().addServerCreditCardForTest(card)); mOnPersonalDataChangedHelper.waitForCallback(callCount); } - void deleteCreditCard(final String guid) throws InterruptedException, TimeoutException { + void deleteCreditCard(final String guid) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().deleteCreditCard(guid)); @@ -130,7 +127,7 @@ * * @param guid The GUID of the profile. */ - void recordAndLogProfileUse(final String guid) throws InterruptedException, TimeoutException { + void recordAndLogProfileUse(final String guid) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().recordAndLogProfileUse(guid)); @@ -149,7 +146,7 @@ * positive number. */ public void setProfileUseStatsForTesting(final String guid, final int count, final long date) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().setProfileUseStatsForTesting(guid, count, @@ -163,7 +160,7 @@ * @param guid The GUID of the profile to query. * @return The non-negative use count of the profile. */ - public int getProfileUseCountForTesting(final String guid) throws InterruptedException { + public int getProfileUseCountForTesting(final String guid) { return TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().getProfileUseCountForTesting(guid)); } @@ -176,7 +173,7 @@ * absolute point in coordinated universal time (UTC) represented as microseconds since * the Windows epoch. For more details see the comment header in time.h. */ - public long getProfileUseDateForTesting(final String guid) throws InterruptedException { + public long getProfileUseDateForTesting(final String guid) { return TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().getProfileUseDateForTesting(guid)); } @@ -188,8 +185,7 @@ * * @param guid The GUID of the credit card. */ - public void recordAndLogCreditCardUse(final String guid) throws InterruptedException, - TimeoutException { + public void recordAndLogCreditCardUse(final String guid) throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().recordAndLogCreditCardUse(guid)); @@ -208,7 +204,7 @@ * positive number. */ public void setCreditCardUseStatsForTesting(final String guid, final int count, final long date) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = mOnPersonalDataChangedHelper.getCallCount(); TestThreadUtils.runOnUiThreadBlocking( () -> PersonalDataManager.getInstance().setCreditCardUseStatsForTesting( @@ -222,7 +218,7 @@ * @param guid The GUID of the credit card to query. * @return The non-negative use count of the credit card. */ - public int getCreditCardUseCountForTesting(final String guid) throws InterruptedException { + public int getCreditCardUseCountForTesting(final String guid) { return TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().getCreditCardUseCountForTesting(guid)); } @@ -235,7 +231,7 @@ * an absolute point in coordinated universal time (UTC) represented as microseconds * since the Windows epoch. For more details see the comment header in time.h. */ - public long getCreditCardUseDateForTesting(final String guid) throws InterruptedException { + public long getCreditCardUseDateForTesting(final String guid) { return TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().getCreditCardUseDateForTesting(guid)); } @@ -247,7 +243,7 @@ * coordinated universal time (UTC) represented as microseconds since the Windows epoch. * For more details see the comment header in time.h. */ - public long getCurrentDateForTesting() throws InterruptedException { + public long getCurrentDateForTesting() { return TestThreadUtils.runOnUiThreadBlockingNoException( () -> PersonalDataManager.getInstance().getCurrentDateForTesting()); } @@ -261,7 +257,7 @@ () -> mOnPersonalDataChangedHelper.notifyCalled())); if (isDataLoaded) return; mOnPersonalDataChangedHelper.waitForCallback(callCount); - } catch (TimeoutException | InterruptedException e) { + } catch (TimeoutException e) { throw new AssertionError(e); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java index 17dbb9c1..d82635f0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java
@@ -36,7 +36,6 @@ import org.chromium.ui.widget.ButtonCompat; import java.util.List; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; /** @@ -62,7 +61,7 @@ private EmbeddedTestServer mServer; @Before - public void setUp() throws Exception { + public void setUp() { mSyncTestRule.setUpTestAccountAndSignIn(); mServer = new EmbeddedTestServer(); mServer.initializeNative(InstrumentationRegistry.getContext(), @@ -72,7 +71,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mServer.stopAndDestroyServer(); } @@ -117,8 +116,7 @@ @Test @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) - public void testSaveCardInfoBarWithAllFieldsFilled() - throws InterruptedException, ExecutionException, TimeoutException { + public void testSaveCardInfoBarWithAllFieldsFilled() throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -133,8 +131,7 @@ @Test @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) - public void testSaveCardInfoBarWithEmptyMonth() - throws InterruptedException, ExecutionException, TimeoutException { + public void testSaveCardInfoBarWithEmptyMonth() throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -151,8 +148,7 @@ @Test @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) - public void testSaveCardInfoBarWithEmptyYear() - throws InterruptedException, ExecutionException, TimeoutException { + public void testSaveCardInfoBarWithEmptyYear() throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -169,8 +165,7 @@ @Test @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) - public void testSaveCardInfoBarWithEmptyMonthAndYear() - throws InterruptedException, ExecutionException, TimeoutException { + public void testSaveCardInfoBarWithEmptyMonthAndYear() throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -188,7 +183,7 @@ @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) public void testSaveCardInfoBarContinueButton_EmptyExpDate_launchesExpDateFixFlow() - throws InterruptedException, ExecutionException, TimeoutException { + throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -210,8 +205,7 @@ @Test @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) - public void testSaveCardInfoBarWithEmptyName() - throws InterruptedException, ExecutionException, TimeoutException { + public void testSaveCardInfoBarWithEmptyName() throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents(); @@ -229,7 +223,7 @@ @MediumTest @Restriction(Restriction.RESTRICTION_TYPE_INTERNET) public void testSaveCardInfoBarContinueButton_EmptyName_launchesNameFixFlow() - throws InterruptedException, ExecutionException, TimeoutException { + throws TimeoutException { mActivityTestRule.startMainActivityWithURL(mServer.getURL(TEST_FORM_URL)); final WebContents webContents = mActivityTestRule.getActivity().getCurrentWebContents();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java index 9a28a09..4761326 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java
@@ -48,7 +48,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testAddAndEditProfiles() throws InterruptedException, TimeoutException { + public void testAddAndEditProfiles() throws TimeoutException { AutofillProfile profile = new AutofillProfile("" /* guid */, "" /* origin */, "John Smith", "Acme Inc.", "1 Main\nApt A", "CA", "San Francisco", "", "94102", "", "US", "4158889999", "john@acme.inc", ""); @@ -79,7 +79,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testUpdateLanguageCodeInProfile() throws InterruptedException, TimeoutException { + public void testUpdateLanguageCodeInProfile() throws TimeoutException { AutofillProfile profile = new AutofillProfile("" /* guid */, "" /* origin */, "John Smith", "Acme Inc.", "1 Main\nApt A", "CA", "San Francisco", "", "94102", "", "US", "4158889999", "john@acme.inc", "fr"); @@ -108,7 +108,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testAddAndDeleteProfile() throws InterruptedException, TimeoutException { + public void testAddAndDeleteProfile() throws TimeoutException { String profileOneGUID = mHelper.setProfile(createTestProfile()); Assert.assertEquals(1, mHelper.getNumberOfProfilesForSettings()); @@ -120,7 +120,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testAddAndEditCreditCards() throws InterruptedException, TimeoutException { + public void testAddAndEditCreditCards() throws TimeoutException { CreditCard card = new CreditCard( "" /* guid */, "" /* origin */, "Visa", "1234123412341234", "", "5", "2020"); String cardOneGUID = mHelper.setCreditCard(card); @@ -158,7 +158,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testAddAndDeleteCreditCard() throws InterruptedException, TimeoutException { + public void testAddAndDeleteCreditCard() throws TimeoutException { CreditCard card = new CreditCard( "" /* guid */, "Chrome settings" /* origin */, "Visa", "1234123412341234", "", "5", "2020"); @@ -172,7 +172,7 @@ @Test @SmallTest @Feature({"Autofill"}) - public void testRespectCountryCodes() throws InterruptedException, TimeoutException { + public void testRespectCountryCodes() throws TimeoutException { // The constructor should accept country names and ISO 3166-1-alpha-2 country codes. // getCountryCode() should return a country code. AutofillProfile profile1 = new AutofillProfile("" /* guid */, "" /* origin */, "John Smith", @@ -198,7 +198,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testMultilineStreetAddress() throws InterruptedException, TimeoutException { + public void testMultilineStreetAddress() throws TimeoutException { final String streetAddress1 = "Chez Mireille COPEAU Appartment. 2\n" + "Entree A Batiment Jonquille\n" + "25 RUE DE L'EGLISE"; @@ -233,7 +233,7 @@ @Test @SmallTest @Feature({"Autofill"}) - public void testLabels() throws InterruptedException, TimeoutException { + public void testLabels() throws TimeoutException { AutofillProfile profile1 = new AutofillProfile("" /* guid */, "" /* origin */, "John Major", "Acme Inc.", "123 Main", "California", "Los Angeles", "", "90210", "", "US", "555 123-4567", "jm@example.com", ""); @@ -273,7 +273,7 @@ @Test @SmallTest @Feature({"Autofill"}) - public void testProfilesFrecency() throws InterruptedException, TimeoutException { + public void testProfilesFrecency() throws TimeoutException { // Create 3 profiles. AutofillProfile profile1 = new AutofillProfile("" /* guid */, "" /* origin */, "John Major", "Acme Inc.", "123 Main", "California", "Los Angeles", "", "90210", "", "US", @@ -313,7 +313,7 @@ @Test @SmallTest @Feature({"Autofill"}) - public void testCreditCardsFrecency() throws InterruptedException, TimeoutException { + public void testCreditCardsFrecency() throws TimeoutException { // Create 3 credit cards. CreditCard card1 = new CreditCard( "" /* guid */, "" /* origin */, "Visa", "1234123412341234", "", "5", "2020"); @@ -349,7 +349,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testCreditCardsDeduping() throws InterruptedException, TimeoutException { + public void testCreditCardsDeduping() throws TimeoutException { // Create a local card and an identical server card. CreditCard card1 = new CreditCard("" /* guid */, "" /* origin */, true /* isLocal */, false /* isCached */, "John Doe", "1234123412341234", "", "5", "2020", "Visa", @@ -375,8 +375,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testProfileUseStatsSettingAndGetting() - throws InterruptedException, TimeoutException { + public void testProfileUseStatsSettingAndGetting() throws TimeoutException { String guid = mHelper.setProfile(createTestProfile()); // Make sure the profile does not have the specific use stats form the start. @@ -395,8 +394,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testCreditCardUseStatsSettingAndGetting() - throws InterruptedException, TimeoutException { + public void testCreditCardUseStatsSettingAndGetting() throws TimeoutException { String guid = mHelper.setCreditCard(new CreditCard("" /* guid */, "" /* origin */, true /* isLocal */, false /* isCached */, "John Doe", "1234123412341234", "", "5", "2020", "Visa", 0 /* issuerIconDrawableId */, CardType.UNKNOWN, @@ -418,7 +416,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testRecordAndLogProfileUse() throws InterruptedException, TimeoutException { + public void testRecordAndLogProfileUse() throws TimeoutException { String guid = mHelper.setProfile(createTestProfile()); // Set specific use stats for the profile. @@ -443,7 +441,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testRecordAndLogCreditCardUse() throws InterruptedException, TimeoutException { + public void testRecordAndLogCreditCardUse() throws TimeoutException { String guid = mHelper.setCreditCard(new CreditCard("" /* guid */, "" /* origin */, true /* isLocal */, false /* isCached */, "John Doe", "1234123412341234", "", "5", "2020", "Visa", 0 /* issuerIconDrawableId */, CardType.UNKNOWN, @@ -471,7 +469,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testGetProfilesToSuggest_NoName() throws InterruptedException, TimeoutException { + public void testGetProfilesToSuggest_NoName() throws TimeoutException { mHelper.setProfile(createTestProfile()); List<AutofillProfile> profiles = @@ -484,7 +482,7 @@ @SmallTest @Feature({"Autofill"}) @RetryOnFailure - public void testGetProfilesToSuggest_WithName() throws InterruptedException, TimeoutException { + public void testGetProfilesToSuggest_WithName() throws TimeoutException { mHelper.setProfile(createTestProfile()); List<AutofillProfile> profiles =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java index cfae0046f..d8adf28 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java
@@ -100,7 +100,7 @@ } @After - public void tearDown() throws TimeoutException { + public void tearDown() { if (mTestServer != null) mTestServer.stopAndDestroyServer(); } @@ -173,12 +173,12 @@ /** * Helper methods. */ - private String runJavaScript(String code) throws TimeoutException, InterruptedException { + private String runJavaScript(String code) throws TimeoutException { return mActivityTestRule.runJavaScriptCodeInCurrentTab(code); } @SuppressWarnings("MissingFail") - private void assertTitleBecomes(String expectedTitle) throws InterruptedException { + private void assertTitleBecomes(String expectedTitle) { Tab tab = mActivityTestRule.getActivity().getActivityTab(); TabTitleObserver titleObserver = new TabTitleObserver(tab, expectedTitle); try {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java index e241a024..31b49d9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java
@@ -195,7 +195,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -263,7 +263,7 @@ }); } - private void tapAndWaitForModalBanner(final Tab tab) throws Exception { + private void tapAndWaitForModalBanner(final Tab tab) { TouchCommon.singleClickView(tab.getView()); CriteriaHelper.pollUiThread(new Criteria() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java index 4407a272f..8c56530 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java
@@ -48,7 +48,7 @@ private BookmarkId mDesktopNode; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { Profile profile = Profile.getLastUsedProfile(); mBookmarkBridge = new BookmarkBridge(profile); @@ -67,7 +67,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testAddBookmarksAndFolders() throws Throwable { + public void testAddBookmarksAndFolders() { BookmarkId bookmarkA = mBookmarkBridge.addBookmark(mDesktopNode, 0, "a", "http://a.com"); verifyBookmark(bookmarkA, "a", "http://a.com/", false, mDesktopNode); BookmarkId bookmarkB = mBookmarkBridge.addBookmark(mOtherNode, 0, "b", "http://b.com"); @@ -100,7 +100,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testGetAllFoldersWithDepths() throws Throwable { + public void testGetAllFoldersWithDepths() { BookmarkId folderA = mBookmarkBridge.addFolder(mMobileNode, 0, "a"); BookmarkId folderB = mBookmarkBridge.addFolder(mDesktopNode, 0, "b"); BookmarkId folderC = mBookmarkBridge.addFolder(mOtherNode, 0, "c"); @@ -137,7 +137,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testGetMoveDestinations() throws Throwable { + public void testGetMoveDestinations() { BookmarkId folderA = mBookmarkBridge.addFolder(mMobileNode, 0, "a"); BookmarkId folderB = mBookmarkBridge.addFolder(mDesktopNode, 0, "b"); BookmarkId folderC = mBookmarkBridge.addFolder(mOtherNode, 0, "c");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkModelTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkModelTest.java index 34ed6ea..f23a1648 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkModelTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkModelTest.java
@@ -50,7 +50,7 @@ private BookmarkId mDesktopNode; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { Profile profile = Profile.getLastUsedProfile(); mBookmarkModel = new BookmarkModel(profile); @@ -69,7 +69,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testBookmarkPropertySetters() throws Throwable { + public void testBookmarkPropertySetters() { BookmarkId folderA = mBookmarkModel.addFolder(mMobileNode, 0, "a"); BookmarkId bookmarkA = addBookmark(mDesktopNode, 0, "a", "http://a.com"); @@ -101,7 +101,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testMoveBookmarks() throws Throwable { + public void testMoveBookmarks() { BookmarkId bookmarkA = addBookmark(mDesktopNode, 0, "a", "http://a.com"); BookmarkId bookmarkB = addBookmark(mOtherNode, 0, "b", "http://b.com"); BookmarkId bookmarkC = addBookmark(mMobileNode, 0, "c", "http://c.com"); @@ -128,7 +128,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testDeleteBookmarks() throws Throwable { + public void testDeleteBookmarks() { BookmarkId bookmarkA = addBookmark(mDesktopNode, 0, "a", "http://a.com"); BookmarkId bookmarkB = addBookmark(mOtherNode, 0, "b", "http://b.com"); BookmarkId bookmarkC = addBookmark(mMobileNode, 0, "c", "http://c.com"); @@ -160,7 +160,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testDeleteBookmarksRepeatedly() throws Throwable { + public void testDeleteBookmarksRepeatedly() { BookmarkId bookmarkA = addBookmark(mDesktopNode, 0, "a", "http://a.com"); BookmarkId bookmarkB = addBookmark(mOtherNode, 0, "b", "http://b.com"); BookmarkId bookmarkC = addBookmark(mMobileNode, 0, "c", "http://c.com"); @@ -186,7 +186,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testGetChildIDs() throws Throwable { + public void testGetChildIDs() { BookmarkId folderA = mBookmarkModel.addFolder(mMobileNode, 0, "fa"); HashSet<BookmarkId> expectedChildren = new HashSet<>(); expectedChildren.add(addBookmark(folderA, 0, "a", "http://a.com")); @@ -211,7 +211,7 @@ @SmallTest @UiThreadTest @Feature({"Bookmark"}) - public void testAddBookmarksAndFolders() throws Throwable { + public void testAddBookmarksAndFolders() { BookmarkId bookmarkA = addBookmark(mDesktopNode, 0, "a", "http://a.com"); verifyBookmark(bookmarkA, "a", "http://a.com/", false, mDesktopNode);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java index 8bb36bb..f73b528 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java
@@ -71,14 +71,14 @@ new AccountManagerTestRule(FakeAccountManagerDelegate.ENABLE_PROFILE_DATA_SOURCE); @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); } @Test @MediumTest @DisabledTest(message = "crbug.com/789531") - public void testManualDismissPromo() throws Exception { + public void testManualDismissPromo() { openBookmarkManager(); onView(withId(R.id.signin_promo_view_container)).check(matches(isDisplayed())); onView(withId(R.id.signin_promo_close_button)).perform(click()); @@ -89,7 +89,7 @@ @LargeTest @DisableIf.Device(type = {UiDisableIf.TABLET}) // https://crbug.com/776405. @DisabledTest(message = "crbug.com/789531") - public void testAutoDismissPromo() throws Exception { + public void testAutoDismissPromo() { int impressionCap = SigninPromoController.getMaxImpressionsBookmarksForTests(); for (int impression = 0; impression < impressionCap; impression++) { openBookmarkManager(); @@ -103,7 +103,7 @@ @Test @MediumTest @DisabledTest(message = "crbug.com/789531") - public void testSigninButtonDefaultAccount() throws Exception { + public void testSigninButtonDefaultAccount() { addTestAccount(); openBookmarkManager(); onView(withId(R.id.signin_promo_view_container)).check(matches(isDisplayed())); @@ -125,7 +125,7 @@ @Test @MediumTest @DisabledTest(message = "crbug.com/789531") - public void testSigninButtonNotDefaultAccount() throws Exception { + public void testSigninButtonNotDefaultAccount() { addTestAccount(); openBookmarkManager(); onView(withId(R.id.signin_promo_view_container)).check(matches(isDisplayed())); @@ -146,7 +146,7 @@ @Test @MediumTest @DisabledTest(message = "crbug.com/789531") - public void testSigninButtonNewAccount() throws Exception { + public void testSigninButtonNewAccount() { openBookmarkManager(); onView(withId(R.id.signin_promo_view_container)).check(matches(isDisplayed())); @@ -165,7 +165,7 @@ assertTrue(expectedIntent.filterEquals(startedIntents.get(0))); } - private void openBookmarkManager() throws InterruptedException { + private void openBookmarkManager() { TestThreadUtils.runOnUiThreadBlocking( () -> BookmarkUtils.showBookmarkManager(mActivityTestRule.getActivity())); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkReorderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkReorderTest.java index 01d74356..14e775a6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkReorderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkReorderTest.java
@@ -885,9 +885,8 @@ * Loads an empty partner bookmarks folder for testing. The partner bookmarks folder will appear * in the mobile bookmarks folder. * - * @throws InterruptedException If the loading process is interrupted. */ - private void loadEmptyPartnerBookmarksForTesting() throws InterruptedException { + private void loadEmptyPartnerBookmarksForTesting() { TestThreadUtils.runOnUiThreadBlocking( () -> { mBookmarkModel.loadEmptyPartnerBookmarkShimForTesting(); }); BookmarkTestUtil.waitForBookmarkModelLoaded(); @@ -899,11 +898,9 @@ * @param title The title of the bookmark to add. * @param url The url of the bookmark to add. * @return The BookmarkId of the added bookmark. - * @throws InterruptedException If this operation is interrupted. * @throws ExecutionException If something goes wrong while we are trying to add the bookmark. */ - private BookmarkId addBookmarkWithPartner(String title, String url) - throws InterruptedException, ExecutionException { + private BookmarkId addBookmarkWithPartner(String title, String url) throws ExecutionException { loadEmptyPartnerBookmarksForTesting(); return TestThreadUtils.runOnUiThreadBlocking( () -> mBookmarkModel.addBookmark(mBookmarkModel.getDefaultFolder(), 0, title, url)); @@ -914,11 +911,9 @@ * * @param title The title of the folder to add. * @return The BookmarkId of the added folder. - * @throws InterruptedException If this operation is interrupted. * @throws ExecutionException If something goes wrong while we are trying to add the bookmark. */ - private BookmarkId addFolderWithPartner(String title) - throws InterruptedException, ExecutionException { + private BookmarkId addFolderWithPartner(String title) throws ExecutionException { loadEmptyPartnerBookmarksForTesting(); return TestThreadUtils.runOnUiThreadBlocking( () -> mBookmarkModel.addFolder(mBookmarkModel.getDefaultFolder(), 0, title));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java index d2faf5a..38f48c4b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java
@@ -112,7 +112,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); TestThreadUtils.runOnUiThreadBlocking(() -> { mBookmarkModel = new BookmarkModel( @@ -123,7 +123,7 @@ mTestPageFoo = mTestServer.getURL(TEST_PAGE_URL_FOO); } - protected void readPartnerBookmarks() throws InterruptedException { + protected void readPartnerBookmarks() { // Do not read partner bookmarks in setUp(), so that the lazy reading is covered. TestThreadUtils.runOnUiThreadBlocking( () -> PartnerBookmarksShim.kickOffReading(mActivityTestRule.getActivity())); @@ -131,7 +131,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -164,7 +164,7 @@ protected boolean isItemPresentInBookmarkList(final String expectedTitle) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { for (int i = 0; i < mItemsContainer.getAdapter().getItemCount(); i++) { BookmarkId item = getIdByPosition(i); @@ -183,7 +183,7 @@ @Test @SmallTest @DisableIf.Build(sdk_is_less_than = 21, message = "crbug.com/807807") - public void testAddBookmark() throws InterruptedException { + public void testAddBookmark() { mActivityTestRule.loadUrl(mTestPage); // Check partner bookmarks are lazily loaded. Assert.assertFalse(mBookmarkModel.isBookmarkModelLoaded()); @@ -221,7 +221,7 @@ @Test @SmallTest - public void testUrlComposition() throws InterruptedException { + public void testUrlComposition() { readPartnerBookmarks(); BookmarkId mobileId = mBookmarkModel.getMobileFolderId(); BookmarkId bookmarkBarId = mBookmarkModel.getDesktopFolderId(); @@ -491,7 +491,7 @@ protected static View getViewWithText(final ViewGroup viewGroup, final String expectedText) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<View>() { @Override - public View call() throws Exception { + public View call() { ArrayList<View> outViews = new ArrayList<>(); ArrayList<View> matchingViews = new ArrayList<>(); viewGroup.findViewsWithText(outViews, expectedText, View.FIND_VIEWS_WITH_TEXT); @@ -518,14 +518,13 @@ } protected BookmarkId addBookmark(final String title, final String url) - throws InterruptedException, ExecutionException { + throws ExecutionException { readPartnerBookmarks(); return TestThreadUtils.runOnUiThreadBlocking( () -> mBookmarkModel.addBookmark(mBookmarkModel.getDefaultFolder(), 0, title, url)); } - protected BookmarkId addFolder(final String title) - throws InterruptedException, ExecutionException { + protected BookmarkId addFolder(final String title) throws ExecutionException { readPartnerBookmarks(); return TestThreadUtils.runOnUiThreadBlocking( () -> mBookmarkModel.addFolder(mBookmarkModel.getDefaultFolder(), 0, title));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java index 01eb2c82..8c5c266 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java
@@ -148,7 +148,7 @@ @Test @SmallTest - public void testWipedWithBrowsingData() throws InterruptedException, TimeoutException { + public void testWipedWithBrowsingData() throws TimeoutException { CallbackHelper callbackHelper = new CallbackHelper(); String relationship = "relationship1";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java index bc834522..dbfc7a3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java
@@ -123,7 +123,7 @@ } @Before - public void setUp() throws TimeoutException, RemoteException, InterruptedException { + public void setUp() throws TimeoutException, RemoteException { RecordHistogram.setDisabledForTests(true); mTargetContext = InstrumentationRegistry.getTargetContext(); mBuilder = new StandardNotificationBuilder(mTargetContext); @@ -162,8 +162,7 @@ */ @Test @SmallTest - public void clientCommunicatesWithServiceCorrectly() - throws TimeoutException, InterruptedException { + public void clientCommunicatesWithServiceCorrectly() throws TimeoutException { postNotification(); Assert.assertTrue(mResponseHandler.mGetSmallIconId.getCallCount() >= 1); @@ -176,9 +175,7 @@ R.string.notification_category_group_general)); } - - private void postNotification() - throws TimeoutException, InterruptedException { + private void postNotification() throws TimeoutException { PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { mClient.notifyNotification(SCOPE, NOTIFICATION_TAG, NOTIFICATION_ID, mBuilder, NotificationUmaTracker.getInstance()); @@ -193,7 +190,7 @@ */ @Test @SmallTest - public void testCancelNotification() throws TimeoutException, InterruptedException { + public void testCancelNotification() throws TimeoutException { PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> mClient.cancelNotification(SCOPE, NOTIFICATION_TAG, NOTIFICATION_ID)); @@ -202,5 +199,4 @@ Assert.assertEquals(mResponseHandler.mNotificationTag, NOTIFICATION_TAG); Assert.assertEquals(mResponseHandler.mNotificationId, NOTIFICATION_ID); } - }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityShareTargetTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityShareTargetTest.java index 5a1bc47..24cd6cf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityShareTargetTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityShareTargetTest.java
@@ -97,7 +97,7 @@ @Test @MediumTest - public void sharesDataWithGet_FromInitialIntent() throws Exception { + public void sharesDataWithGet_FromInitialIntent() { putShareData(mIntent, mGetShareTarget); mCustomTabActivityTestRule.startCustomTabActivityWithIntent(mIntent); assertGetRequestUrl(mExpectedGetRequestUrl); @@ -123,7 +123,7 @@ @Test @MediumTest - public void sharesDataWithGet_FromNewIntent() throws Exception { + public void sharesDataWithGet_FromNewIntent() { mCustomTabActivityTestRule.startCustomTabActivityWithIntent(mIntent); putShareData(mIntent, mGetShareTarget); @@ -146,14 +146,13 @@ intent.putExtra(TrustedWebActivityIntentBuilder.EXTRA_SHARE_TARGET, shareTarget.toBundle()); } - private void assertGetRequestUrl(final String expectedGetRequestUrl) - throws InterruptedException { + private void assertGetRequestUrl(final String expectedGetRequestUrl) { // startCustomTabActivityWithIntent waits for native, so the tab must be present already. Tab tab = mCustomTabActivityTestRule.getActivity().getActivityTab(); ChromeTabUtils.waitForTabPageLoaded(tab, expectedGetRequestUrl); } - private void assertPostNavigatorCalled() throws InterruptedException, TimeoutException { + private void assertPostNavigatorCalled() throws TimeoutException { // Constructing POST requests is unit-tested elsewhere. // Here we only care that the request reaches the native code. mPostNavigatorCallback.waitForCallback(0);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTest.java index 829e5e7..cd9ae06 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTest.java
@@ -65,7 +65,7 @@ private String mTestPage; @Before - public void setUp() throws InterruptedException { + public void setUp() { // Native needs to be initialized to start the test server. LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); @@ -75,7 +75,7 @@ @Test @MediumTest - public void launchesTwa() throws TimeoutException, InterruptedException { + public void launchesTwa() throws TimeoutException { Intent intent = createTrustedWebActivityIntent(mTestPage); spoofVerification(PACKAGE_NAME, mTestPage); createSession(intent, PACKAGE_NAME); @@ -87,7 +87,7 @@ @Test @MediumTest - public void doesntLaunchTwa_WithoutFlag() throws TimeoutException, InterruptedException { + public void doesntLaunchTwa_WithoutFlag() throws TimeoutException { Intent intent = createTrustedWebActivityIntent(mTestPage); spoofVerification(PACKAGE_NAME, mTestPage); createSession(intent, PACKAGE_NAME); @@ -101,7 +101,7 @@ @Test @MediumTest - public void leavesTwa_VerificationFailure() throws TimeoutException, InterruptedException { + public void leavesTwa_VerificationFailure() throws TimeoutException { Intent intent = createTrustedWebActivityIntent(mTestPage); createSession(intent, PACKAGE_NAME); @@ -119,7 +119,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP_MR1) @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE}) // Customizing status bar color is disallowed for tablets. - public void testStatusBarColorPrecedence() throws TimeoutException, InterruptedException { + public void testStatusBarColorPrecedence() throws TimeoutException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; final int intentToolbarColor = Color.GREEN;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTestUtil.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTestUtil.java index 36eb505c..e34dbdf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTestUtil.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityTestUtil.java
@@ -36,8 +36,7 @@ } /** Creates a Custom Tabs Session from the Intent, specifying the |packageName|. */ - public static void createSession(Intent intent, String packageName) - throws TimeoutException, InterruptedException { + public static void createSession(Intent intent, String packageName) throws TimeoutException { CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent); CustomTabsConnection connection = CustomTabsTestUtils.warmUpAndWait(); connection.newSession(token);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPermissionsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPermissionsTest.java index c76fb75..c97224c2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPermissionsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPermissionsTest.java
@@ -52,7 +52,7 @@ private TrustedWebActivityPermissionManager mPermissionManager; @Before - public void setUp() throws InterruptedException, TimeoutException { + public void setUp() throws TimeoutException { // Native needs to be initialized to start the test server. LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); @@ -74,14 +74,14 @@ } @After - public void tearDown() throws TimeoutException { + public void tearDown() { mPermissionManager.clearForTesting(); mTestServer.stopAndDestroyServer(); } @Test @MediumTest - public void allowNotifications() throws TimeoutException, InterruptedException { + public void allowNotifications() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking(() -> mPermissionManager.register(mOrigin, mPackage, true)); assertEquals("\"granted\"", getNotificationPermission()); @@ -89,7 +89,7 @@ @Test @MediumTest - public void blockNotifications() throws TimeoutException, InterruptedException { + public void blockNotifications() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking(() -> mPermissionManager.register(mOrigin, mPackage, false)); assertEquals("\"denied\"", getNotificationPermission()); @@ -97,7 +97,7 @@ @Test @MediumTest - public void unregisterTwa() throws TimeoutException, InterruptedException { + public void unregisterTwa() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking(() -> mPermissionManager.register(mOrigin, mPackage, true)); assertEquals("\"granted\"", getNotificationPermission()); @@ -110,7 +110,7 @@ @Test @SmallTest - public void detectTwa() throws TimeoutException, InterruptedException { + public void detectTwa() { TestThreadUtils.runOnUiThreadBlocking( () -> mPermissionManager.register(mOrigin, mPackage, true)); assertTrue(BackgroundSyncPwaDetector.isTwaInstalled(mOrigin.toString())); @@ -119,7 +119,7 @@ assertFalse(BackgroundSyncPwaDetector.isTwaInstalled(mOrigin.toString())); } - private String getNotificationPermission() throws TimeoutException, InterruptedException { + private String getNotificationPermission() throws TimeoutException { return mCustomTabActivityTestRule.runJavaScriptCodeInCurrentTab("Notification.permission"); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java index 6ecea73..c7052c6f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java
@@ -116,12 +116,11 @@ /** * Tests that registered sites show 'Managed by' in the title when viewing the details for a * single website. - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testWebsitePreferencesManagedBy() throws Exception { + public void testWebsitePreferencesManagedBy() { final String site = "http://example.com"; final Origin origin = new Origin(site);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBaseTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBaseTest.java index 7aa9182..5b2e544 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBaseTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBaseTest.java
@@ -96,7 +96,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { OverlayPanelManager panelManager = new OverlayPanelManager(); mExpandPanel = new MockOverlayPanel(InstrumentationRegistry.getTargetContext(), panelManager);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelEventFilterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelEventFilterTest.java index 901137a7..db57ad8f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelEventFilterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelEventFilterTest.java
@@ -206,7 +206,7 @@ // -------------------------------------------------------------------------------------------- @Before - public void setUp() throws Exception { + public void setUp() { Context context = InstrumentationRegistry.getTargetContext(); mDpToPx = context.getResources().getDisplayMetrics().density;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelManagerTest.java index 28cf1938..8ada6c68 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelManagerTest.java
@@ -343,7 +343,7 @@ @SmallTest @Feature({"OverlayPanel"}) @UiThreadTest - public void testManagerObserver() throws InterruptedException, TimeoutException { + public void testManagerObserver() throws TimeoutException { Context context = InstrumentationRegistry.getTargetContext(); final CallbackHelper shownHelper = new CallbackHelper();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java index 0a9ef748..b54a4eb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java
@@ -221,7 +221,7 @@ @UiThreadTest @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) @DisabledTest(message = "https://crbug.com/965250") - public void testStack() throws Exception { + public void testStack() { initializeLayoutManagerPhone(3, 0); mManagerPhone.showOverview(true); Assert.assertTrue( @@ -238,7 +238,7 @@ @Feature({"Android-TabSwitcher"}) @UiThreadTest @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) - public void testStackNoAnimation() throws Exception { + public void testStackNoAnimation() { initializeLayoutManagerPhone(1, 0); mManagerPhone.showOverview(false); Assert.assertTrue("The activate layout type is expected to be StackLayout", @@ -255,7 +255,7 @@ @Feature({"Android-TabSwitcher"}) @UiThreadTest @Restriction({UiRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) - public void testStackPinch() throws Exception { + public void testStackPinch() { initializeLayoutManagerPhone(5, 0); // Setting the index to the second to last element ensure the stack can be scrolled in both // directions. @@ -395,7 +395,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipeOnlyTab() throws Exception { + public void testToolbarSideSwipeOnlyTab() { initializeLayoutManagerPhone(1, 0, 0, TabModel.INVALID_TAB_INDEX, false); Assert.assertEquals(mTabModelSelector.getModel(false).index(), 0); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.LEFT, 0); @@ -407,7 +407,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipeOnlyTabIncognito() throws Exception { + public void testToolbarSideSwipeOnlyTabIncognito() { initializeLayoutManagerPhone(0, 1, TabModel.INVALID_TAB_INDEX, 0, true); Assert.assertEquals(mTabModelSelector.getModel(true).index(), 0); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.LEFT, 0); @@ -419,7 +419,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipeNextTab() throws Exception { + public void testToolbarSideSwipeNextTab() { initializeLayoutManagerPhone(2, 0, 0, TabModel.INVALID_TAB_INDEX, false); Assert.assertEquals(mTabModelSelector.getModel(false).index(), 0); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.LEFT, 1); @@ -430,7 +430,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipePrevTab() throws Exception { + public void testToolbarSideSwipePrevTab() { initializeLayoutManagerPhone(2, 0, 1, TabModel.INVALID_TAB_INDEX, false); Assert.assertEquals(mTabModelSelector.getModel(false).index(), 1); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.RIGHT, 0); @@ -441,7 +441,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipeNextTabNone() throws Exception { + public void testToolbarSideSwipeNextTabNone() { initializeLayoutManagerPhone(2, 0, 1, TabModel.INVALID_TAB_INDEX, false); Assert.assertEquals(mTabModelSelector.getModel(false).index(), 1); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.LEFT, 1); @@ -452,7 +452,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipePrevTabNone() throws Exception { + public void testToolbarSideSwipePrevTabNone() { initializeLayoutManagerPhone(2, 0, 0, TabModel.INVALID_TAB_INDEX, false); Assert.assertEquals(mTabModelSelector.getModel(false).index(), 0); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.RIGHT, 0); @@ -463,7 +463,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipeNextTabIncognito() throws Exception { + public void testToolbarSideSwipeNextTabIncognito() { initializeLayoutManagerPhone(0, 2, TabModel.INVALID_TAB_INDEX, 0, true); Assert.assertEquals(mTabModelSelector.getModel(true).index(), 0); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.LEFT, 1); @@ -474,7 +474,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipePrevTabIncognito() throws Exception { + public void testToolbarSideSwipePrevTabIncognito() { initializeLayoutManagerPhone(0, 2, TabModel.INVALID_TAB_INDEX, 1, true); Assert.assertEquals(mTabModelSelector.getModel(true).index(), 1); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.RIGHT, 0); @@ -485,7 +485,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipeNextTabNoneIncognito() throws Exception { + public void testToolbarSideSwipeNextTabNoneIncognito() { initializeLayoutManagerPhone(0, 2, TabModel.INVALID_TAB_INDEX, 1, true); Assert.assertEquals(mTabModelSelector.getModel(true).index(), 1); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.LEFT, 1); @@ -496,14 +496,14 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Feature({"Android-TabSwitcher"}) @UiThreadTest - public void testToolbarSideSwipePrevTabNoneIncognito() throws Exception { + public void testToolbarSideSwipePrevTabNoneIncognito() { initializeLayoutManagerPhone(0, 2, TabModel.INVALID_TAB_INDEX, 0, true); Assert.assertEquals(mTabModelSelector.getModel(true).index(), 0); runToolbarSideSwipeTestOnCurrentModel(ScrollDirection.RIGHT, 0); } @Before - public void setUp() throws Exception { + public void setUp() { // Load the browser process. TestThreadUtils.runOnUiThreadBlocking(() -> { ChromeBrowserInitializer.getInstance(InstrumentationRegistry.getTargetContext())
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java index 676574b4..149f035 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java
@@ -312,7 +312,7 @@ @LargeTest @Restriction(UiRestriction.RESTRICTION_TYPE_TABLET) @Feature({"TabStrip"}) - public void testCloseAllTabsFromTabMenuClosesAllTabs() throws Exception { + public void testCloseAllTabsFromTabMenuClosesAllTabs() { // 1. Create a second tab ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); @@ -353,7 +353,7 @@ @LargeTest @Restriction(UiRestriction.RESTRICTION_TYPE_TABLET) @Feature({"TabStrip"}) - public void testTabMenuDismissedOnOrientationChange() throws Exception { + public void testTabMenuDismissedOnOrientationChange() { // 1. Set orientation to portrait mActivityTestRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); @@ -417,7 +417,7 @@ @LargeTest @Feature({"TabStrip"}) @Restriction(UiRestriction.RESTRICTION_TYPE_TABLET) - public void testCloseLastIncognitoTab() throws Exception { + public void testCloseLastIncognitoTab() { InstrumentationRegistry.getInstrumentation().waitForIdleSync(); Assert.assertFalse("Expected normal strip to be selected", mActivityTestRule.getActivity().getTabModelSelector().isIncognitoSelected()); @@ -446,7 +446,7 @@ @LargeTest @Feature({"TabStrip"}) @Restriction(UiRestriction.RESTRICTION_TYPE_TABLET) - public void testCloseAllIncognitoTabsFromTabMenu() throws Exception { + public void testCloseAllIncognitoTabsFromTabMenu() { //1. Create two incognito tabs InstrumentationRegistry.getInstrumentation().waitForIdleSync(); Assert.assertFalse("Expected normal strip to be selected", @@ -493,7 +493,7 @@ @LargeTest @Restriction(UiRestriction.RESTRICTION_TYPE_TABLET) @Feature({"TabStrip"}) - public void testTabSelectionViewDoesNotBreakModelSwitch() throws Exception { + public void testTabSelectionViewDoesNotBreakModelSwitch() { InstrumentationRegistry.getInstrumentation().waitForIdleSync(); Assert.assertFalse("Expected normal strip to be selected", mActivityTestRule.getActivity().getTabModelSelector().isIncognitoSelected()); @@ -856,7 +856,7 @@ /** * Simulates a click to the incognito toggle button. */ - protected void clickIncognitoToggleButton() throws InterruptedException { + protected void clickIncognitoToggleButton() { final CallbackHelper tabModelSelectedCallback = new CallbackHelper(); TabModelSelectorObserver observer = new EmptyTabModelSelectorObserver() { @Override @@ -882,7 +882,7 @@ * @param incognito Whether or not this tab is in the incognito or normal stack. * @param id The id of the tab to click. */ - protected void selectTab(final boolean incognito, final int id) throws InterruptedException { + protected void selectTab(final boolean incognito, final int id) { ChromeTabUtils.selectTabWithAction(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), new Runnable() { @Override @@ -901,7 +901,7 @@ * @param incognito Whether or not this tab is in the incognito or normal stack. * @param id The id of the tab to click. */ - protected void closeTab(final boolean incognito, final int id) throws InterruptedException { + protected void closeTab(final boolean incognito, final int id) { ChromeTabUtils.closeTabWithAction(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), new Runnable() { @Override @@ -921,8 +921,7 @@ * @param incognito Whether or not this tab is in the incognito or normal stack. * @param id The id of the tab to click. */ - protected void longPressCloseTab(final boolean incognito, final int id) - throws InterruptedException { + protected void longPressCloseTab(final boolean incognito, final int id) { ChromeTabUtils.selectTabWithAction(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), new Runnable() { @Override @@ -1159,7 +1158,7 @@ // Only tabs that can currently be seen on the screen should be visible. Boolean shouldBeVisible = TestThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return (tabView.getDrawX() + tabView.getWidth()) >= 0 && tabView.getDrawX() <= tabStrip.getWidth(); } @@ -1176,7 +1175,7 @@ throws ExecutionException { Boolean isVisible = TestThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return tabView.isVisible(); } }); @@ -1196,7 +1195,7 @@ throws ExecutionException { Float tabDrawX = TestThreadUtils.runOnUiThreadBlocking(new Callable<Float>() { @Override - public Float call() throws Exception { + public Float call() { return tabView.getDrawX(); } });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contacts_picker/ContactsPickerDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contacts_picker/ContactsPickerDialogTest.java index 98da3635..b3a52bd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contacts_picker/ContactsPickerDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contacts_picker/ContactsPickerDialogTest.java
@@ -235,14 +235,14 @@ topView.notifyChipToggled(filter); } - private void toggleFilter(@PickerAdapter.FilterType int filter) throws Exception { + private void toggleFilter(@PickerAdapter.FilterType int filter) { RecyclerView recyclerView = getRecyclerView(); RecyclerViewTestUtils.waitForView(recyclerView, 0); TestThreadUtils.runOnUiThreadBlocking(() -> notifyChipToggled(filter)); } - private void clickSearchButton() throws Exception { + private void clickSearchButton() { ContactsPickerToolbar toolbar = (ContactsPickerToolbar) mDialog.findViewById(R.id.action_bar); View search = toolbar.findViewById(R.id.search); @@ -258,7 +258,7 @@ onActionCallback.waitForCallback(callCount, 1); } - private TopView getTopView() throws Exception { + private TopView getTopView() { RecyclerView recyclerView = getRecyclerView(); RecyclerViewTestUtils.waitForView(recyclerView, 0); View view = recyclerView.getLayoutManager().findViewByPosition(0);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java index 1b54e09..97a38f3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java
@@ -86,12 +86,12 @@ }; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(true)); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); deleteTestFiles(); @@ -100,7 +100,7 @@ } @Override - public void customMainActivityStart() throws InterruptedException { + public void customMainActivityStart() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mTestUrl = mTestServer.getURL(TEST_PATH); deleteTestFiles(); @@ -139,7 +139,7 @@ @MediumTest @Feature({"Browser"}) @EnableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) - public void testSearchWithGoogleLensFiresIntent() throws Throwable, IOException { + public void testSearchWithGoogleLensFiresIntent() throws Throwable { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); LensUtils.setFakePassableLensVersionForTesting(true); @@ -156,7 +156,7 @@ @MediumTest @Feature({"Browser"}) @RetryOnFailure - public void testLongPressOnImage() throws InterruptedException, TimeoutException { + public void testLongPressOnImage() throws TimeoutException { checkOpenImageInNewTab( "testImage", "/chrome/test/data/android/contextmenu/test_image.png"); } @@ -168,13 +168,13 @@ */ @Test @FlakyTest(message = "http://crbug.com/606939") - public void testLongPressOnImageLink() throws InterruptedException, TimeoutException { + public void testLongPressOnImageLink() throws TimeoutException { checkOpenImageInNewTab( "testImageLink", "/chrome/test/data/android/contextmenu/test_image.png"); } private void checkOpenImageInNewTab(String domId, final String expectedPath) - throws InterruptedException, TimeoutException { + throws TimeoutException { final Tab activityTab = mDownloadTestRule.getActivity().getActivityTab(); final CallbackHelper newTabCallback = new CallbackHelper(); @@ -219,7 +219,7 @@ @MediumTest @Feature({"Browser"}) @RetryOnFailure - public void testDismissContextMenuOnBack() throws InterruptedException, TimeoutException { + public void testDismissContextMenuOnBack() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); ContextMenu menu = ContextMenuUtils.openContextMenu(tab, "testImage"); Assert.assertNotNull("Context menu was not properly created", menu); @@ -243,7 +243,7 @@ @MediumTest @Feature({"Browser"}) @RetryOnFailure - public void testDismissContextMenuOnClick() throws InterruptedException, TimeoutException { + public void testDismissContextMenuOnClick() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); ContextMenu menu = ContextMenuUtils.openContextMenu(tab, "testImage"); Assert.assertNotNull("Context menu was not properly created", menu); @@ -294,8 +294,7 @@ @LargeTest @Feature({"Browser"}) @RetryOnFailure - public void testSaveDataUrl() - throws InterruptedException, TimeoutException, SecurityException, IOException { + public void testSaveDataUrl() throws TimeoutException, SecurityException, IOException { saveMediaFromContextMenu("dataUrlIcon", R.id.contextmenu_save_image, FILENAME_GIF); } @@ -303,8 +302,7 @@ @LargeTest @Feature({"Browser"}) @RetryOnFailure - public void testSaveImage() - throws InterruptedException, TimeoutException, SecurityException, IOException { + public void testSaveImage() throws TimeoutException, SecurityException, IOException { saveMediaFromContextMenu("testImage", R.id.contextmenu_save_image, FILENAME_PNG); } @@ -313,8 +311,7 @@ @Feature({"Browser"}) @RetryOnFailure @DisabledTest(message = "https://crbug.com/947695") - public void testSaveVideo() - throws InterruptedException, TimeoutException, SecurityException, IOException { + public void testSaveVideo() throws TimeoutException, SecurityException, IOException { // Click the video to enable playback DOMUtils.clickNode( mDownloadTestRule.getActivity().getCurrentWebContents(), "videoDOMElement"); @@ -332,8 +329,7 @@ @LargeTest @Feature({"Browser"}) @RetryOnFailure - public void testOpenLinksInNewTabsAndVerifyTabIndexOrdering() - throws InterruptedException, TimeoutException { + public void testOpenLinksInNewTabsAndVerifyTabIndexOrdering() throws TimeoutException { TabModel tabModel = mDownloadTestRule.getActivity().getCurrentTabModel(); int numOpenedTabs = tabModel.getCount(); Tab tab = mDownloadTestRule.getActivity().getActivityTab(); @@ -382,8 +378,7 @@ @SmallTest @Feature({"Browser", "ContextMenu"}) @RetryOnFailure - public void testContextMenuRetrievesLinkOptions() - throws TimeoutException, InterruptedException { + public void testContextMenuRetrievesLinkOptions() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); ContextMenu menu = ContextMenuUtils.openContextMenu(tab, "testLink"); @@ -402,8 +397,7 @@ @Feature({"Browser", "ContextMenu"}) @RetryOnFailure @DisableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) - public void testContextMenuRetrievesImageOptions() - throws TimeoutException, InterruptedException { + public void testContextMenuRetrievesImageOptions() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); ContextMenu menu = ContextMenuUtils.openContextMenu(tab, "testImage"); @@ -420,8 +414,7 @@ @SmallTest @Feature({"Browser", "ContextMenu"}) @EnableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) - public void testContextMenuRetrievesImageOptionsLensEnabled() - throws TimeoutException, InterruptedException { + public void testContextMenuRetrievesImageOptionsLensEnabled() throws TimeoutException { LensUtils.setFakePassableLensVersionForTesting(true); Tab tab = mDownloadTestRule.getActivity().getActivityTab(); @@ -443,7 +436,7 @@ @RetryOnFailure @DisableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) public void testContextMenuRetrievesImageOptions_NoDefaultSearchEngine() - throws TimeoutException, InterruptedException { + throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); ContextMenu menu = ContextMenuUtils.openContextMenu(tab, "testImage"); @@ -461,7 +454,7 @@ @Policies.Add({ @Policies.Item(key = "DefaultSearchProviderEnabled", string = "false") }) @EnableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) public void testContextMenuRetrievesImageOptions_NoDefaultSearchEngineLensEnabled() - throws TimeoutException, InterruptedException { + throws TimeoutException { LensUtils.setFakePassableLensVersionForTesting(true); Tab tab = mDownloadTestRule.getActivity().getActivityTab(); @@ -480,8 +473,7 @@ @SmallTest @Feature({"Browser", "ContextMenu"}) @DisableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) - public void testContextMenuRetrievesImageLinkOptions() - throws TimeoutException, InterruptedException { + public void testContextMenuRetrievesImageLinkOptions() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); ContextMenu menu = ContextMenuUtils.openContextMenu(tab, "testImageLink"); @@ -502,7 +494,7 @@ @Feature({"Browser", "ContextMenu"}) @EnableFeatures({ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS}) public void testContextMenuRetrievesImageLinkOptionsSearchLensEnabled() - throws TimeoutException, InterruptedException { + throws TimeoutException { LensUtils.setFakePassableLensVersionForTesting(true); Tab tab = mDownloadTestRule.getActivity().getActivityTab(); @@ -525,8 +517,7 @@ @Feature({"Browser", "ContextMenu"}) @RetryOnFailure @DisabledTest(message = "https://crbug.com/947695") - public void testContextMenuRetrievesVideoOptions() - throws TimeoutException, InterruptedException { + public void testContextMenuRetrievesVideoOptions() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); DOMUtils.clickNode( mDownloadTestRule.getActivity().getCurrentWebContents(), "videoDOMElement"); @@ -582,8 +573,7 @@ } private void saveMediaFromContextMenu(String mediaDOMElement, int saveMenuID, - String expectedFilename) throws InterruptedException, TimeoutException, - SecurityException, IOException { + String expectedFilename) throws TimeoutException, SecurityException, IOException { // Select "save [image/video]" in that menu. Tab tab = mDownloadTestRule.getActivity().getActivityTab(); int callCount = mDownloadTestRule.getChromeDownloadCallCount(); @@ -615,7 +605,7 @@ /** * Hardcode image bytes to non-null arbitrary data. */ - private void hardcodeTestImageForSharing() throws IOException { + private void hardcodeTestImageForSharing() { // This string just needs to be not empty in order for the code to accept it as valid // image data and generate the temp file for sharing. In the future we could explore // transcoding the actual test image from png to jpeg to make the test more realistic.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/RevampedContextMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/RevampedContextMenuTest.java index def3b35..6fbcf793 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/RevampedContextMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/RevampedContextMenuTest.java
@@ -71,12 +71,12 @@ new String[] {FILENAME_GIF, FILENAME_PNG, FILENAME_WEBM}; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(true)); } @Override - public void customMainActivityStart() throws InterruptedException { + public void customMainActivityStart() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mTestUrl = mTestServer.getURL(TEST_PATH); deleteTestFiles(); @@ -85,7 +85,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); deleteTestFiles(); @@ -104,7 +104,7 @@ @Test @MediumTest - public void testLongPressOnImage() throws InterruptedException, TimeoutException { + public void testLongPressOnImage() throws TimeoutException { final Tab activityTab = mDownloadTestRule.getActivity().getActivityTab(); final CallbackHelper newTabCallback = new CallbackHelper(); @@ -143,7 +143,7 @@ @Test @MediumTest - public void testDismissContextMenuOnBack() throws InterruptedException, TimeoutException { + public void testDismissContextMenuOnBack() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); RevampedContextMenuCoordinator menuCoordinator = RevampedContextMenuUtils.openContextMenu(tab, "testImage"); @@ -166,7 +166,7 @@ @Test @MediumTest - public void testDismissContextMenuOnClick() throws InterruptedException, TimeoutException { + public void testDismissContextMenuOnClick() throws TimeoutException { Tab tab = mDownloadTestRule.getActivity().getActivityTab(); RevampedContextMenuCoordinator menuCoordinator = RevampedContextMenuUtils.openContextMenu(tab, "testImage"); @@ -212,22 +212,19 @@ @Test @LargeTest - public void testSaveDataUrl() - throws InterruptedException, TimeoutException, SecurityException, IOException { + public void testSaveDataUrl() throws TimeoutException, SecurityException, IOException { saveMediaFromContextMenu("dataUrlIcon", R.id.contextmenu_save_image, FILENAME_GIF); } @Test @LargeTest - public void testSaveImage() - throws InterruptedException, TimeoutException, SecurityException, IOException { + public void testSaveImage() throws TimeoutException, SecurityException, IOException { saveMediaFromContextMenu("testImage", R.id.contextmenu_save_image, FILENAME_PNG); } @Test @LargeTest - public void testSaveVideo() - throws InterruptedException, TimeoutException, SecurityException, IOException { + public void testSaveVideo() throws TimeoutException, SecurityException, IOException { saveMediaFromContextMenu("videoDOMElement", R.id.contextmenu_save_video, FILENAME_WEBM); } @@ -240,8 +237,7 @@ */ @Test @LargeTest - public void testOpenLinksInNewTabsAndVerifyTabIndexOrdering() - throws InterruptedException, TimeoutException { + public void testOpenLinksInNewTabsAndVerifyTabIndexOrdering() throws TimeoutException { TabModel tabModel = mDownloadTestRule.getActivity().getCurrentTabModel(); int numOpenedTabs = tabModel.getCount(); Tab tab = mDownloadTestRule.getActivity().getActivityTab(); @@ -285,9 +281,8 @@ Assert.assertEquals(imageUrl, tabModel.getTabAt(indexOfLinkPage2).getUrl()); } - private void saveMediaFromContextMenu( - String mediaDOMElement, int saveMenuID, String expectedFilename) - throws InterruptedException, TimeoutException, SecurityException, IOException { + private void saveMediaFromContextMenu(String mediaDOMElement, int saveMenuID, + String expectedFilename) throws TimeoutException, SecurityException, IOException { // Select "save [image/video]" in that menu. Tab tab = mDownloadTestRule.getActivity().getActivityTab(); int callCount = mDownloadTestRule.getChromeDownloadCallCount();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index 011d20e..c29743b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -239,7 +239,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); } @@ -254,11 +254,8 @@ /** * Sets the online status and reloads the current Tab with our test URL. * @param isOnline Whether to go online. - * @throws InterruptedException - * @throws TimeoutException */ - private void setOnlineStatusAndReload(boolean isOnline) - throws InterruptedException, TimeoutException { + private void setOnlineStatusAndReload(boolean isOnline) { mFakeServer.setIsOnline(isOnline); final String testUrl = mTestServer.getURL(TEST_PAGE); final Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -275,8 +272,7 @@ * Simulates a long-press on the given node without waiting for the panel to respond. * @param nodeId A string containing the node ID. */ - public void longPressNodeWithoutWaiting(String nodeId) - throws InterruptedException, TimeoutException { + public void longPressNodeWithoutWaiting(String nodeId) throws TimeoutException { Tab tab = mActivityTestRule.getActivity().getActivityTab(); DOMUtils.longPressNode(tab.getWebContents(), nodeId); } @@ -285,7 +281,7 @@ * Simulates a long-press on the given node and waits for the panel to peek. * @param nodeId A string containing the node ID. */ - public void longPressNode(String nodeId) throws InterruptedException, TimeoutException { + public void longPressNode(String nodeId) throws TimeoutException { longPressNodeWithoutWaiting(nodeId); waitForPanelToPeek(); } @@ -294,7 +290,7 @@ * Simulates a click on the given node. * @param nodeId A string containing the node ID. */ - public void clickNode(String nodeId) throws InterruptedException, TimeoutException { + public void clickNode(String nodeId) throws TimeoutException { Tab tab = mActivityTestRule.getActivity().getActivityTab(); DOMUtils.clickNode(tab.getWebContents(), nodeId); } @@ -569,7 +565,7 @@ * Waits for the bar to peek. * @param nodeId A string containing the node ID. */ - private void clickWordNode(String nodeId) throws InterruptedException, TimeoutException { + private void clickWordNode(String nodeId) throws TimeoutException { clickNode(nodeId); waitForPanelToPeek(); } @@ -714,33 +710,29 @@ /** * Waits for the Search Panel (the Search Bar) to peek up from the bottom, and asserts that it * did peek. - * @throws InterruptedException */ - private void waitForPanelToPeek() throws InterruptedException { + private void waitForPanelToPeek() { waitForPanelToEnterState(PanelState.PEEKED); } /** * Waits for the Search Panel to expand, and asserts that it did expand. - * @throws InterruptedException */ - private void waitForPanelToExpand() throws InterruptedException { + private void waitForPanelToExpand() { waitForPanelToEnterState(PanelState.EXPANDED); } /** * Waits for the Search Panel to maximize, and asserts that it did maximize. - * @throws InterruptedException */ - private void waitForPanelToMaximize() throws InterruptedException { + private void waitForPanelToMaximize() { waitForPanelToEnterState(PanelState.MAXIMIZED); } /** * Waits for the Search Panel to close, and asserts that it did close. - * @throws InterruptedException */ - private void waitForPanelToClose() throws InterruptedException { + private void waitForPanelToClose() { waitForPanelToEnterState(PanelState.CLOSED); } @@ -789,9 +781,8 @@ * 1) Waits for gesture processing, * 2) Waits for the panel to close, * 3) Asserts that there is no selection and that the panel closed. - * @throws InterruptedException */ - private void waitForGestureToClosePanelAndAssertNoSelection() throws InterruptedException { + private void waitForGestureToClosePanelAndAssertNoSelection() { waitForPanelToClose(); assertPanelClosedOrUndefined(); Assert.assertTrue(TextUtils.isEmpty(getSelectedText())); @@ -816,7 +807,7 @@ /** * Waits for the panel to close and then waits for the selection to dissolve. */ - private void waitForPanelToCloseAndSelectionEmpty() throws InterruptedException { + private void waitForPanelToCloseAndSelectionEmpty() { waitForPanelToClose(); waitForSelectionEmpty(); } @@ -910,7 +901,7 @@ /** * Taps the base page near the top. */ - private void tapBasePageToClosePanel() throws InterruptedException { + private void tapBasePageToClosePanel() { // TODO(pedrosimonetti): This is not reliable. Find a better approach. // This taps on the panel in an area that will be selected if the "intelligence" node has // been tap-selected, and that will cause it to be long-press selected. @@ -942,7 +933,7 @@ /** * Click various places to cause the panel to show, expand, then close. */ - private void clickToExpandAndClosePanel() throws InterruptedException, TimeoutException { + private void clickToExpandAndClosePanel() throws TimeoutException { clickWordNode("states"); tapBarToExpandAndClosePanel(); waitForSelectionEmpty(); @@ -951,7 +942,7 @@ /** * Tap on the peeking Bar to expand the panel, then close it. */ - private void tapBarToExpandAndClosePanel() throws InterruptedException { + private void tapBarToExpandAndClosePanel() { tapPeekingBarToExpandAndAssert(); closePanel(); } @@ -971,7 +962,7 @@ /** * Taps the peeking bar to expand the panel */ - private void tapPeekingBarToExpandAndAssert() throws InterruptedException { + private void tapPeekingBarToExpandAndAssert() { clickPanelBar(); waitForPanelToExpand(); } @@ -992,7 +983,7 @@ /** * Simple sequence to click, resolve, and prefetch. Verifies a prefetch occurred. */ - private void clickToResolveAndAssertPrefetch() throws InterruptedException, TimeoutException { + private void clickToResolveAndAssertPrefetch() throws TimeoutException { clickWordNode("states"); assertLoadedNoUrl(); assertSearchTermRequested(); @@ -1019,9 +1010,8 @@ /** * Force the Panel to handle a click on open-in-a-new-tab icon. - * @throws InterruptedException */ - private void forceOpenTabIconClick() throws InterruptedException { + private void forceOpenTabIconClick() { assert ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPanel.handleBarClick(mPanel.getOpenTabIconX() + mPanel.getOpenTabIconDimension() / 2, @@ -1031,9 +1021,8 @@ /** * Force the Panel to handle a click in the Bar. - * @throws InterruptedException */ - private void forcePanelToHandleBarClick() throws InterruptedException { + private void forcePanelToHandleBarClick() { assert !ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override @@ -1046,9 +1035,8 @@ /** * Force the Panel to close. - * @throws InterruptedException */ - private void closePanel() throws InterruptedException { + private void closePanel() { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -1060,7 +1048,7 @@ /** * Waits for the Action Bar to be visible in response to a selection. */ - private void waitForSelectActionBarVisible() throws InterruptedException { + private void waitForSelectActionBarVisible() { assertWaitForSelectActionBarVisible(true); } @@ -1107,7 +1095,7 @@ //@Feature({"ContextualSearch"}) @Test @DisabledTest - public void testHidesWhenOmniboxFocused() throws InterruptedException, TimeoutException { + public void testHidesWhenOmniboxFocused() throws TimeoutException { clickWordNode("intelligence"); Assert.assertEquals("Intelligence", mFakeServer.getSearchTermRequested()); @@ -1187,7 +1175,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testLongPress() throws InterruptedException, TimeoutException { + public void testLongPress() throws TimeoutException { longPressNode("states"); Assert.assertNull(mFakeServer.getSearchTermRequested()); @@ -1204,7 +1192,7 @@ @Feature({"ContextualSearch"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @DisableIf.Build(supported_abis_includes = "arm64-v8a", message = "crbug.com/765403") - public void testSwipeExpand() throws InterruptedException, TimeoutException { + public void testSwipeExpand() throws TimeoutException { assertNoSearchesLoaded(); clickWordNode("intelligence"); assertNoSearchesLoaded(); @@ -1255,7 +1243,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testTapCausesOneLowPriorityRequest() throws InterruptedException, TimeoutException { + public void testTapCausesOneLowPriorityRequest() throws TimeoutException { mFakeServer.reset(); clickWordNode("states"); @@ -1284,8 +1272,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testPrefetchFailoverRequestMadeAfterOpen() - throws InterruptedException, TimeoutException { + public void testPrefetchFailoverRequestMadeAfterOpen() throws TimeoutException { mFakeServer.reset(); clickWordNode("states"); @@ -1346,7 +1333,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testTapDisablePreload() throws InterruptedException, TimeoutException { + public void testTapDisablePreload() throws TimeoutException { clickWordNode("intelligence"); assertSearchTermRequested(); @@ -1362,7 +1349,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testLongPressGestureSelects() throws InterruptedException, TimeoutException { + public void testLongPressGestureSelects() throws TimeoutException { longPressNode("intelligence"); Assert.assertEquals("Intelligence", getSelectedText()); fakeResponse(false, 200, "Intelligence", "Intelligence", "alternate-term", false); @@ -1381,7 +1368,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testTapGestureSelects() throws InterruptedException, TimeoutException { + public void testTapGestureSelects() throws TimeoutException { clickWordNode("intelligence"); Assert.assertEquals("Intelligence", getSelectedText()); fakeResponse(false, 200, "Intelligence", "Intelligence", "alternate-term", false); @@ -1399,8 +1386,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testTapGestureOnSpecialCharacterDoesntSelect() - throws InterruptedException, TimeoutException { + public void testTapGestureOnSpecialCharacterDoesntSelect() throws TimeoutException { clickNode("question-mark"); Assert.assertNull(getSelectedText()); assertPanelClosedOrUndefined(); @@ -1415,8 +1401,7 @@ Build(sdk_is_greater_than = Build.VERSION_CODES.LOLLIPOP, message = "crbug.com/841017") @SmallTest @Feature({"ContextualSearch"}) - public void testTapGestureFollowedByScrollClearsSelection() - throws InterruptedException, TimeoutException { + public void testTapGestureFollowedByScrollClearsSelection() throws TimeoutException { clickWordNode("intelligence"); fakeResponse(false, 200, "Intelligence", "Intelligence", "alternate-term", false); assertContainsParameters("Intelligence", "alternate-term"); @@ -1433,8 +1418,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testTapGestureFollowedByInvalidTextTapCloses() - throws InterruptedException, TimeoutException { + public void testTapGestureFollowedByInvalidTextTapCloses() throws TimeoutException { clickWordNode("states-far"); waitForPanelToPeek(); clickNode("question-mark"); @@ -1450,7 +1434,7 @@ */ @Test @DisabledTest - public void testTapGestureFollowedByNonTextTap() throws InterruptedException, TimeoutException { + public void testTapGestureFollowedByNonTextTap() throws TimeoutException { clickWordNode("states-far"); waitForPanelToPeek(); clickNode("button"); @@ -1463,8 +1447,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testTapGestureFarAwayTogglesSelecting() - throws InterruptedException, TimeoutException { + public void testTapGestureFarAwayTogglesSelecting() throws TimeoutException { clickWordNode("states"); Assert.assertEquals("States", getSelectedText()); waitForPanelToPeek(); @@ -1513,8 +1496,7 @@ @SmallTest @Feature({"ContextualSearch"}) @Features.DisableFeatures({ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE}) - public void testLongPressGestureFollowedByScrollMaintainsSelection() - throws InterruptedException, TimeoutException { + public void testLongPressGestureFollowedByScrollMaintainsSelection() throws TimeoutException { longPressNode("intelligence"); waitForPanelToPeek(); scrollBasePage(); @@ -1531,8 +1513,7 @@ @Feature({"ContextualSearch"}) @DisabledTest(message = "See https://crbug.com/837998") @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testLongPressGestureFollowedByTapDoesntSelect() - throws InterruptedException, TimeoutException { + public void testLongPressGestureFollowedByTapDoesntSelect() throws TimeoutException { longPressNode("intelligence"); waitForPanelToPeek(); clickWordNode("states-far"); @@ -1547,8 +1528,7 @@ @SmallTest @Feature({"ContextualSearch"}) @DisabledTest - public void testContextualSearchDismissedOnForegroundTabCrash() - throws InterruptedException, TimeoutException { + public void testContextualSearchDismissedOnForegroundTabCrash() throws TimeoutException { clickWordNode("states"); Assert.assertEquals("States", getSelectedText()); waitForPanelToPeek(); @@ -1577,8 +1557,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testContextualSearchNotDismissedOnBackgroundTabCrash() - throws InterruptedException, TimeoutException { + public void testContextualSearchNotDismissedOnBackgroundTabCrash() throws TimeoutException { ChromeTabUtils.newTabFromMenu(InstrumentationRegistry.getInstrumentation(), (ChromeTabbedActivity) mActivityTestRule.getActivity()); final Tab tab2 = @@ -1703,8 +1682,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testExpandBeforeSearchTermResolution() - throws InterruptedException, TimeoutException { + public void testExpandBeforeSearchTermResolution() throws TimeoutException { clickWordNode("states"); assertNoWebContents(); @@ -1728,7 +1706,7 @@ @SmallTest @Feature({"ContextualSearch"}) @DisableIf.Build(supported_abis_includes = "arm64-v8a", message = "crbug.com/765403") - public void testSearchTermResolutionError() throws InterruptedException, TimeoutException { + public void testSearchTermResolutionError() throws TimeoutException { clickWordNode("states"); assertSearchTermRequested(); fakeResponse(false, 403, "", "", "", false); @@ -1747,7 +1725,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testHttpsBeforeAcceptForOptOut() throws InterruptedException, TimeoutException { + public void testHttpsBeforeAcceptForOptOut() throws TimeoutException { mPolicy.overrideDecidedStateForTesting(false); mFakeServer.setShouldUseHttps(true); @@ -1762,7 +1740,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testHttpsAfterAcceptForOptOut() throws InterruptedException, TimeoutException { + public void testHttpsAfterAcceptForOptOut() throws TimeoutException { mPolicy.overrideDecidedStateForTesting(true); mFakeServer.setShouldUseHttps(true); @@ -1775,7 +1753,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testHttpBeforeAcceptForOptOut() throws InterruptedException, TimeoutException { + public void testHttpBeforeAcceptForOptOut() throws TimeoutException { mPolicy.overrideDecidedStateForTesting(false); clickToResolveAndAssertPrefetch(); @@ -1787,7 +1765,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testHttpAfterAcceptForOptOut() throws InterruptedException, TimeoutException { + public void testHttpAfterAcceptForOptOut() throws TimeoutException { mPolicy.overrideDecidedStateForTesting(true); clickToResolveAndAssertPrefetch(); @@ -1829,7 +1807,7 @@ @Feature({"ContextualSearch"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @DisableIf.Build(supported_abis_includes = "arm64-v8a", message = "crbug.com/596533") - public void testAppMenuSuppressedWhenExpanded() throws InterruptedException, TimeoutException { + public void testAppMenuSuppressedWhenExpanded() throws TimeoutException { clickWordNode("states"); tapPeekingBarToExpandAndAssert(); @@ -1848,7 +1826,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testAppMenuSuppressedWhenMaximized() throws InterruptedException, TimeoutException { + public void testAppMenuSuppressedWhenMaximized() throws TimeoutException { clickWordNode("states"); flingPanelUpToTop(); waitForPanelToMaximize(); @@ -1906,7 +1884,7 @@ @Feature({"ContextualSearch"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @DisableIf.Build(supported_abis_includes = "arm64-v8a", message = "crbug.com/596533") - public void testPromoOpenCountForDecided() throws InterruptedException, TimeoutException { + public void testPromoOpenCountForDecided() throws TimeoutException { mPolicy.overrideDecidedStateForTesting(true); // An open should not count for decided users. @@ -2013,7 +1991,7 @@ @SmallTest @Feature({"ContextualSearch"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testNotifyObserversAfterLongPress() throws InterruptedException, TimeoutException { + public void testNotifyObserversAfterLongPress() throws TimeoutException { TestContextualSearchObserver observer = new TestContextualSearchObserver(); mManager.addObserver(observer); longPressNode("states"); @@ -2034,8 +2012,7 @@ @SmallTest @Feature({"ContextualSearch"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testNotifyObserversAfterLongPressWithoutSurroundings() - throws InterruptedException, TimeoutException { + public void testNotifyObserversAfterLongPressWithoutSurroundings() throws TimeoutException { // Mark the user undecided so we won't allow sending surroundings. mPolicy.overrideDecidedStateForTesting(false); TestContextualSearchObserver observer = new TestContextualSearchObserver(); @@ -2060,7 +2037,7 @@ @SmallTest @Feature({"ContextualSearch"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testNotifyObserversAfterTap() throws InterruptedException, TimeoutException { + public void testNotifyObserversAfterTap() throws TimeoutException { TestContextualSearchObserver observer = new TestContextualSearchObserver(); mManager.addObserver(observer); clickWordNode("states"); @@ -2076,10 +2053,8 @@ /** * Asserts that the action bar does or does not become visible in response to a selection. * @param visible Whether the Action Bar must become visible or not. - * @throws InterruptedException */ - private void assertWaitForSelectActionBarVisible(final boolean visible) - throws InterruptedException { + private void assertWaitForSelectActionBarVisible(final boolean visible) { CriteriaHelper.pollUiThread(Criteria.equals(visible, new Callable<Boolean>() { @Override public Boolean call() { @@ -2099,8 +2074,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testNotifyObserversOnClearSelectionAfterTap() - throws InterruptedException, TimeoutException { + public void testNotifyObserversOnClearSelectionAfterTap() throws TimeoutException { TestContextualSearchObserver observer = new TestContextualSearchObserver(); mManager.addObserver(observer); longPressNode("states"); @@ -2252,8 +2226,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testSelectionExpansionOnSearchTermResolution() - throws InterruptedException, TimeoutException { + public void testSelectionExpansionOnSearchTermResolution() throws TimeoutException { mFakeServer.reset(); clickWordNode("intelligence"); waitForPanelToPeek(); @@ -2796,8 +2769,7 @@ // @Feature({"ContextualSearch"}) // // NOTE: Remove the flag so we will run just this test with onLine detection enabled. // @CommandLineFlags.Remove(ContextualSearchFieldTrial.ONLINE_DETECTION_DISABLED) - public void testNetworkDisconnectedDeactivatesSearch() - throws InterruptedException, TimeoutException { + public void testNetworkDisconnectedDeactivatesSearch() throws TimeoutException { setOnlineStatusAndReload(false); longPressNodeWithoutWaiting("states"); waitForSelectActionBarVisible(); @@ -2964,7 +2936,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testAccesibilityMode() throws InterruptedException, TimeoutException { + public void testAccesibilityMode() throws TimeoutException { mManager.onAccessibilityModeChanged(true); // Simulate a tap that resolves to show the Bar. @@ -3094,7 +3066,7 @@ @Test @SmallTest @Feature({"ContextualSearch"}) - public void testSecondTap() throws InterruptedException, TimeoutException { + public void testSecondTap() throws TimeoutException { TestContextualSearchObserver observer = new TestContextualSearchObserver(); mManager.addObserver(observer); @@ -3123,7 +3095,7 @@ @Feature({"ContextualSearch"}) @CommandLineFlags.Add(ChromeSwitches.DISABLE_TAB_MERGING_FOR_TESTING) @MinAndroidSdkLevel(Build.VERSION_CODES.N) - public void testTabReparenting() throws InterruptedException, TimeoutException { + public void testTabReparenting() throws TimeoutException { // Move our "tap_test" tab to another activity. final ChromeActivity ca = mActivityTestRule.getActivity(); int testTabId = ca.getActivityTab().getId(); @@ -3180,8 +3152,7 @@ @SmallTest @Feature({"ContextualSearch"}) @Features.EnableFeatures("ContextualSearchLongpressResolve") - public void testTapIsIgnoredWithLongpressResolveEnabled() - throws InterruptedException, TimeoutException { + public void testTapIsIgnoredWithLongpressResolveEnabled() throws TimeoutException { clickNode("states"); Assert.assertNull(getSelectedText()); assertPanelClosedOrUndefined(); @@ -3196,8 +3167,7 @@ "force-fieldtrial-params=FakeStudyName.FakeGroup:longpress_resolve_variation/" + ContextualSearchFieldTrial.LONGPRESS_RESOLVE_PRESERVE_TAP}) public void - testTapNotIgnoredWithLongpressResolveEnabledAndVariationPreserveTap() - throws InterruptedException, TimeoutException { + testTapNotIgnoredWithLongpressResolveEnabledAndVariationPreserveTap() throws TimeoutException { clickWordNode("states"); Assert.assertEquals("States", getSelectedText()); waitForPanelToPeek(); @@ -3212,7 +3182,7 @@ + ContextualSearchFieldTrial.LONGPRESS_RESOLVE_PRIVACY_AGGRESSIVE}) public void testLongpressResolvesWithLongpressResolveEnabledAndVariationPrivacyAggressive() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPolicy.overrideDecidedStateForTesting(false); mFakeServer.setShouldUseHttps(true); longPressNode("states");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java index 83549c8d..9e72afc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java
@@ -329,7 +329,7 @@ @Feature({"ContextualSearch"}) @Restriction(Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE) @Features.DisableFeatures("ContextualSearchLongpressResolve") - public void testTapProcessIsRobustWhenSelectionGetsCleared() throws InterruptedException { + public void testTapProcessIsRobustWhenSelectionGetsCleared() { Assert.assertEquals(mPanelManager.getRequestPanelShowCount(), 0); // Fake a Tap event.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnableTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnableTest.java index ed0c1b8..6c87dabb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnableTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnableTest.java
@@ -128,7 +128,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mCrashDir = new CrashFileManager(mTestRule.getCacheDir()).getCrashDirectory(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceTest.java index 8574f81..a878f82 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceTest.java
@@ -153,7 +153,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testUploadCrash() throws IOException, InterruptedException { + public void testUploadCrash() throws IOException { List<CountedMinidumpUploadCallable> callables = new ArrayList<CountedMinidumpUploadCallable>(); callables.add(new CountedMinidumpUploadCallable( @@ -164,7 +164,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testUploadCrashWithThreeFails() throws IOException, InterruptedException { + public void testUploadCrashWithThreeFails() throws IOException { // Create |MAX_TRIES_ALLOWED| callables. final List<CountedMinidumpUploadCallable> callables = new ArrayList<CountedMinidumpUploadCallable>(); @@ -178,7 +178,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testUploadCrashWithOneFailWithNetwork() throws IOException, InterruptedException { + public void testUploadCrashWithOneFailWithNetwork() throws IOException { List<CountedMinidumpUploadCallable> callables = new ArrayList<CountedMinidumpUploadCallable>(); callables.add(new CountedMinidumpUploadCallable( @@ -191,7 +191,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testUploadCrashWithOneFailNoNetwork() throws IOException, InterruptedException { + public void testUploadCrashWithOneFailNoNetwork() throws IOException { List<CountedMinidumpUploadCallable> callables = new ArrayList<CountedMinidumpUploadCallable>(); callables.add(new CountedMinidumpUploadCallable( @@ -200,7 +200,7 @@ } private void runUploadCrashTest(final List<CountedMinidumpUploadCallable> callables) - throws IOException, InterruptedException { + throws IOException { // The JobScheduler API is used on Android M+. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) return; @@ -498,7 +498,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testHandleForceUploadCrash_FileDoesntExist_WithJobScheduler() throws IOException { + public void testHandleForceUploadCrash_FileDoesntExist_WithJobScheduler() { // The JobScheduler API is only available as of Android M. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/crypto/CipherFactoryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/crypto/CipherFactoryTest.java index 6082506..841ff7b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/crypto/CipherFactoryTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/crypto/CipherFactoryTest.java
@@ -16,8 +16,6 @@ import org.chromium.chrome.browser.crypto.CipherFactory.CipherDataObserver; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import java.io.IOException; -import java.security.GeneralSecurityException; import java.util.Arrays; import javax.crypto.Cipher; @@ -36,7 +34,7 @@ /** Generates non-random byte[] for testing. */ private static class DeterministicParameterGenerator extends ByteArrayGenerator { @Override - public byte[] getBytes(int numBytes) throws IOException, GeneralSecurityException { + public byte[] getBytes(int numBytes) { return getBytes(numBytes, (byte) 0); } @@ -84,7 +82,7 @@ * deterministic results. */ @Before - public void setUp() throws Exception { + public void setUp() { mNumberProvider = new DeterministicParameterGenerator(); CipherFactory.getInstance().setRandomNumberProviderForTests(mNumberProvider); } @@ -171,7 +169,7 @@ */ @Test @MediumTest - public void testIncompleteBundleRestoration() throws Exception { + public void testIncompleteBundleRestoration() { // Make sure we handle the null case. Assert.assertFalse(CipherFactory.getInstance().restoreFromBundle(null)); @@ -195,7 +193,7 @@ */ @Test @MediumTest - public void testRestorationSucceedsBeforeCipherCreated() throws Exception { + public void testRestorationSucceedsBeforeCipherCreated() { byte[] iv = mNumberProvider.getBytes(CipherFactory.NUM_BYTES, (byte) 50); byte[] key = mNumberProvider.getBytes(CipherFactory.NUM_BYTES, (byte) 100); Bundle bundle = new Bundle(); @@ -235,7 +233,7 @@ */ @Test @MediumTest - public void testSavingToBundle() throws Exception { + public void testSavingToBundle() { // Nothing should get saved out before Cipher data exists. Bundle initialBundle = new Bundle(); CipherFactory.getInstance().saveToBundle(initialBundle); @@ -258,7 +256,7 @@ */ @Test @MediumTest - public void testCipherFactoryObserver() throws Exception { + public void testCipherFactoryObserver() { TestCipherDataObserver observer = new TestCipherDataObserver(); CipherFactory.getInstance().addCipherDataObserver(observer); Assert.assertEquals(0, observer.getTimesNotified()); @@ -280,7 +278,7 @@ */ @Test @MediumTest - public void testCipherFactoryObserverTooLate() throws Exception { + public void testCipherFactoryObserverTooLate() { CipherFactory.getInstance().getCipher(Cipher.DECRYPT_MODE); // Ensures that cipher finishes initializing before running the rest of the test. TestThreadUtils.runOnUiThreadBlocking(mEmptyRunnable);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java index b9fc507..451e70f2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java
@@ -48,7 +48,7 @@ private int mUid = Process.myUid(); @Before - public void setUp() throws Exception { + public void setUp() { Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index 063a571..064fe2e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -230,7 +230,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); mTestServer.stopAndDestroyServer(); @@ -402,7 +402,7 @@ */ @Test @DisabledTest - public void testContextMenuEntriesForImage() throws InterruptedException, TimeoutException { + public void testContextMenuEntriesForImage() throws TimeoutException { mCustomTabActivityTestRule.startCustomTabActivityWithIntent(createMinimalCustomTabIntent()); final int expectedMenuSize = 12; @@ -445,7 +445,7 @@ */ @Test @DisabledTest - public void testContextMenuEntriesForLink() throws InterruptedException, TimeoutException { + public void testContextMenuEntriesForLink() throws TimeoutException { mCustomTabActivityTestRule.startCustomTabActivityWithIntent(createMinimalCustomTabIntent()); final int expectedMenuSize = 12; @@ -487,7 +487,7 @@ */ @Test @DisabledTest - public void testContextMenuEntriesForMailto() throws InterruptedException, TimeoutException { + public void testContextMenuEntriesForMailto() throws TimeoutException { mCustomTabActivityTestRule.startCustomTabActivityWithIntent(createMinimalCustomTabIntent()); final int expectedMenuSize = 12; @@ -529,7 +529,7 @@ */ @Test @DisabledTest - public void testContextMenuEntriesForTel() throws InterruptedException, TimeoutException { + public void testContextMenuEntriesForTel() throws TimeoutException { mCustomTabActivityTestRule.startCustomTabActivityWithIntent(createMinimalCustomTabIntent()); final int expectedMenuSize = 12; @@ -603,7 +603,7 @@ @Test @SmallTest @RetryOnFailure - public void testAppMenuForMediaViewer() throws Exception { + public void testAppMenuForMediaViewer() { Intent intent = createMinimalCustomTabIntent(); intent.putExtra(CustomTabIntentDataProvider.EXTRA_UI_TYPE, CustomTabsUiType.MEDIA_VIEWER); IntentHandler.addTrustedIntentExtras(intent); @@ -721,7 +721,7 @@ @Test @SmallTest @RetryOnFailure - public void testCustomMenuEntry() throws InterruptedException, TimeoutException { + public void testCustomMenuEntry() throws TimeoutException { Intent customTabIntent = createMinimalCustomTabIntent(); Intent baseCallbackIntent = new Intent(); baseCallbackIntent.putExtra("FOO", 42); @@ -806,7 +806,7 @@ @Test @SmallTest @RetryOnFailure - public void testTabReparentingBasic() throws InterruptedException { + public void testTabReparentingBasic() { mCustomTabActivityTestRule.startCustomTabActivityWithIntent(createMinimalCustomTabIntent()); reparentAndVerifyTab(); } @@ -817,7 +817,7 @@ @Test @SmallTest @RetryOnFailure - public void testTabReparentingInfoBar() throws InterruptedException { + public void testTabReparentingInfoBar() { LocationSettingsTestUtil.setSystemLocationSettingEnabled(true); mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -844,7 +844,7 @@ // @RetryOnFailure @Test @DisabledTest // Disabled due to flakiness on browser_side_navigation apk - see crbug.com/707766 - public void testTabReparentingSelectPopup() throws InterruptedException, TimeoutException { + public void testTabReparentingSelectPopup() throws TimeoutException { LocationSettingsTestUtil.setSystemLocationSettingEnabled(true); mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -879,7 +879,7 @@ @Test @SmallTest @RetryOnFailure - public void testToolbarColor() throws InterruptedException { + public void testToolbarColor() { Intent intent = createMinimalCustomTabIntent(); final int expectedColor = Color.RED; addToolbarColorToIntent(intent, expectedColor); @@ -913,7 +913,7 @@ @SmallTest @Feature({"UiCatalogue"}) @RetryOnFailure - public void testActionButton() throws InterruptedException, TimeoutException { + public void testActionButton() throws TimeoutException { Bitmap expectedIcon = createVectorDrawableBitmap(R.drawable.ic_credit_card_black, 77, 48); Intent intent = createMinimalCustomTabIntent(); final PendingIntent pi = addActionButtonToIntent(intent, expectedIcon, "Good test"); @@ -952,7 +952,7 @@ @SmallTest @Feature({"UiCatalogue"}) @RetryOnFailure - public void testMultipleActionButtons() throws InterruptedException, TimeoutException { + public void testMultipleActionButtons() throws TimeoutException { Bitmap expectedIcon1 = createVectorDrawableBitmap(R.drawable.ic_content_copy_black, 48, 48); Bitmap expectedIcon2 = createVectorDrawableBitmap(R.drawable.ic_music_note_36dp, 48, 48); Intent intent = createMinimalCustomTabIntent(); @@ -1025,8 +1025,7 @@ @SmallTest @Feature({"UiCatalogue"}) @RetryOnFailure - public void testMultipleActionButtons_untrusted() - throws InterruptedException, TimeoutException { + public void testMultipleActionButtons_untrusted() { Bitmap expectedIcon1 = createVectorDrawableBitmap(R.drawable.ic_content_copy_black, 48, 48); Bitmap expectedIcon2 = createVectorDrawableBitmap(R.drawable.ic_music_note_36dp, 48, 48); Intent intent = createMinimalCustomTabIntent(); @@ -1060,7 +1059,7 @@ @Test @SmallTest @RetryOnFailure - public void testActionButtonBadRatio() throws InterruptedException { + public void testActionButtonBadRatio() { Bitmap expectedIcon = createTestBitmap(60, 20); Intent intent = createMinimalCustomTabIntent(); addActionButtonToIntent(intent, expectedIcon, "Good test"); @@ -1081,7 +1080,7 @@ @Test @SmallTest @RetryOnFailure - public void testBottomBar() throws InterruptedException { + public void testBottomBar() { final int numItems = 3; final Bitmap expectedIcon = createTestBitmap(48, 24); final int barColor = Color.GREEN; @@ -1121,7 +1120,7 @@ @Test @SmallTest @Feature({"UiCatalogue"}) - public void testRemoteViews() throws Exception { + public void testRemoteViews() { Intent intent = createMinimalCustomTabIntent(); Bitmap expectedIcon = createVectorDrawableBitmap(R.drawable.ic_credit_card_black, 77, 48); @@ -1836,7 +1835,7 @@ @Test @SmallTest @RetryOnFailure - public void testMayLaunchUrlWithoutWarmupNoSpeculation() throws InterruptedException { + public void testMayLaunchUrlWithoutWarmupNoSpeculation() { mayLaunchUrlWithoutWarmup(false); } @@ -1844,7 +1843,7 @@ @Test @SmallTest @RetryOnFailure - public void testMayLaunchUrlWithoutWarmupHiddenTab() throws InterruptedException { + public void testMayLaunchUrlWithoutWarmupHiddenTab() { mayLaunchUrlWithoutWarmup(true); } @@ -2133,7 +2132,7 @@ @SmallTest @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @RetryOnFailure - public void testAllocateChildConnectionNoWarmup() throws Exception { + public void testAllocateChildConnectionNoWarmup() { Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); @@ -2319,7 +2318,7 @@ @Test @SmallTest @DisableIf.Build(sdk_is_greater_than = 20) - public void testLaunchCustomTabWithColorSchemeDark_Kitkat() throws Exception { + public void testLaunchCustomTabWithColorSchemeDark_Kitkat() { FeatureUtilities.setNightModeForCustomTabsAvailableForTesting(true); Intent intent = createMinimalCustomTabIntent(); @@ -2339,7 +2338,7 @@ @Test @SmallTest @DisableIf.Build(sdk_is_less_than = 21) - public void testLaunchCustomTabWithColorSchemeDark_PostKitkat() throws Exception { + public void testLaunchCustomTabWithColorSchemeDark_PostKitkat() { FeatureUtilities.setNightModeForCustomTabsAvailableForTesting(true); Intent intent = createMinimalCustomTabIntent(); @@ -2359,7 +2358,7 @@ @Test @SmallTest - public void testLaunchCustomTabWithColorSchemeLight() throws Exception { + public void testLaunchCustomTabWithColorSchemeLight() { FeatureUtilities.setNightModeForCustomTabsAvailableForTesting(true); Intent intent = createMinimalCustomTabIntent(); @@ -2381,7 +2380,7 @@ @Test @MediumTest - public void testLaunchIncognitoCustomTabForPaymentRequest() throws Exception { + public void testLaunchIncognitoCustomTabForPaymentRequest() { Intent intent = createMinimalCustomTabIntent(); intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true); CustomTabIntentDataProvider.addPaymentRequestUIExtras(intent); @@ -2401,7 +2400,7 @@ {"DataReductionProxyDecidesTransform", "DataReductionProxyEnabledWithNetworkService"}) @RetryOnFailure public void - testLaunchWebLiteURL() throws Exception { + testLaunchWebLiteURL() { final String testUrl = WEBLITE_PREFIX + mTestPage; mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -2419,7 +2418,7 @@ @CommandLineFlags.Add("enable-spdy-proxy-auth") @DisableFeatures("DataReductionProxyDecidesTransform") @RetryOnFailure - public void testLaunchWebLiteURLDRPDecidesTransformDisabled() throws Exception { + public void testLaunchWebLiteURLDRPDecidesTransformDisabled() { final String testUrl = WEBLITE_PREFIX + mTestPage; mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -2440,7 +2439,7 @@ @DisableFeatures("Previews") @RetryOnFailure public void - testLaunchWebLiteURLNoPreviews() throws Exception { + testLaunchWebLiteURLNoPreviews() { final String testUrl = WEBLITE_PREFIX + mTestPage; mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -2459,7 +2458,7 @@ {"DataReductionProxyDecidesTransform", "DataReductionProxyEnabledWithNetworkService"}) @RetryOnFailure public void - testLaunchWebLiteURLNoDataReductionProxy() throws Exception { + testLaunchWebLiteURLNoDataReductionProxy() { final String testUrl = WEBLITE_PREFIX + mTestPage; mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -2477,7 +2476,7 @@ @CommandLineFlags.Add("enable-spdy-proxy-auth") @EnableFeatures("DataReductionProxyDecidesTransform") @RetryOnFailure - public void testLaunchNonWebLiteURL() throws Exception { + public void testLaunchNonWebLiteURL() { final String testUrl = mTestPage2 + "/?lite_url=" + mTestPage; mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( @@ -2561,7 +2560,7 @@ @Test @SmallTest - public void closeButton_navigatesToLandingPage() throws InterruptedException, TimeoutException { + public void closeButton_navigatesToLandingPage() throws TimeoutException { Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); @@ -2589,8 +2588,7 @@ @Test @SmallTest - public void closeButton_closesActivityIfNoLandingPage() - throws InterruptedException, TimeoutException { + public void closeButton_closesActivityIfNoLandingPage() throws TimeoutException { Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); @@ -2635,7 +2633,7 @@ assertEquals(navigationUrl, history.get(0).getUrl()); } - private void mayLaunchUrlWithoutWarmup(boolean useHiddenTab) throws InterruptedException { + private void mayLaunchUrlWithoutWarmup(boolean useHiddenTab) { Context context = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); @@ -2651,7 +2649,7 @@ assertEquals(mTestPage, tab.getUrl()); } - private ChromeActivity reparentAndVerifyTab() throws InterruptedException { + private ChromeActivity reparentAndVerifyTab() { final ActivityMonitor monitor = InstrumentationRegistry.getInstrumentation().addMonitor( ChromeTabbedActivity.class.getName(), /* result = */ null, false); final Tab tabToBeReparented = getActivity().getActivityTab(); @@ -2700,8 +2698,7 @@ return newActivity; } - private void checkPageLoadMetrics(boolean allowMetrics) - throws InterruptedException, TimeoutException { + private void checkPageLoadMetrics(boolean allowMetrics) throws TimeoutException { final AtomicReference<Long> firstContentfulPaintMs = new AtomicReference<>(-1L); final AtomicReference<Long> largestContentfulPaintMs = new AtomicReference<>(-1L); final AtomicReference<Long> activityStartTimeMs = new AtomicReference<>(-1L); @@ -2826,7 +2823,7 @@ } private static void ensureCompletedSpeculationForUrl( - final CustomTabsConnection connection, final String url) throws InterruptedException { + final CustomTabsConnection connection, final String url) { CriteriaHelper.pollUiThread(new Criteria("Tab was not created") { @Override public boolean isSatisfied() { @@ -2856,8 +2853,7 @@ return mCallbackIntent; } - public void waitForCallback(String failureReason) - throws TimeoutException, InterruptedException { + public void waitForCallback(String failureReason) throws TimeoutException { mCallbackHelper.waitForCallback(failureReason, 0); } @@ -2892,7 +2888,7 @@ mTab.getWebContents(), mJsFunction); if (jsonText.equalsIgnoreCase("null")) jsonText = ""; value = jsonText; - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { e.printStackTrace(); return false; } @@ -2904,7 +2900,7 @@ } } - private static List<HistoryItem> getHistory() throws TimeoutException, InterruptedException { + private static List<HistoryItem> getHistory() throws TimeoutException { final TestBrowsingHistoryObserver historyObserver = new TestBrowsingHistoryObserver(); TestThreadUtils.runOnUiThreadBlocking(() -> { BrowsingHistoryBridge historyService = new BrowsingHistoryBridge(false); @@ -2916,7 +2912,7 @@ return historyObserver.getHistoryQueryResults(); } - private void waitForTitle(String newTitle) throws InterruptedException { + private void waitForTitle(String newTitle) { Tab currentTab = getActivity().getActivityTab(); ChromeTabUtils.waitForTitle(currentTab, newTitle); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTestRule.java index 689c297..8d2d36b5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTestRule.java
@@ -54,7 +54,7 @@ * Start a {@link CustomTabActivity} with given {@link Intent}, and wait till a tab is * initialized. */ - public void startCustomTabActivityWithIntent(Intent intent) throws InterruptedException { + public void startCustomTabActivityWithIntent(Intent intent) { startActivityCompletely(intent); waitForActivityNativeInitializationComplete(); CriteriaHelper.pollUiThread(new Criteria("Tab never selected/initialized.") {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabExternalNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabExternalNavigationTest.java index 762aba9..c804865 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabExternalNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabExternalNavigationTest.java
@@ -86,7 +86,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java index eba257b..4e4ab38 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java
@@ -71,12 +71,12 @@ }); } - private void startCustomTabFromChrome(String url) throws InterruptedException { + private void startCustomTabFromChrome(String url) { Intent intent = getCustomTabFromChromeIntent(url, true); mActivityRule.startCustomTabActivityWithIntent(intent); } - private void startPaymentRequestUIFromChrome(String url) throws InterruptedException { + private void startPaymentRequestUIFromChrome(String url) { Intent intent = getCustomTabFromChromeIntent(url, false); CustomTabIntentDataProvider.addPaymentRequestUIExtras(intent); @@ -87,7 +87,7 @@ @Test @Feature("CustomTabFromChrome") @MediumTest - public void testUsingStandardExternalNavigationHandler() throws Exception { + public void testUsingStandardExternalNavigationHandler() { startCustomTabFromChrome("about:blank"); Tab tab = mActivityRule.getActivity().getActivityTab(); @@ -105,7 +105,7 @@ @DisableIf.Build(message = "Flaky on K, https://crbug.com/962974", sdk_is_less_than = Build.VERSION_CODES.LOLLIPOP) public void - testIntentWithRedirectToApp() throws Exception { + testIntentWithRedirectToApp() { final String redirectUrl = "https://maps.google.com/maps?q=1600+amphitheatre+parkway"; final String initialUrl = mServerRule.getServer().getURL("/chrome/test/data/android/redirect/js_redirect.html"
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java index 6f5f32a..9b809b9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java
@@ -35,7 +35,7 @@ public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); @Before - public void setUp() throws InterruptedException { + public void setUp() { mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( InstrumentationRegistry.getTargetContext(),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java index 2b0dea55..4ec78f2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java
@@ -68,7 +68,7 @@ public UiThreadTestRule mRule = new UiThreadTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { // CustomTabsConnection needs a true context, not the mock context set below. CustomTabsConnection.getInstance(); @@ -84,7 +84,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mMockDirectory.tearDown(); for (Activity activity : ApplicationStatus.getRunningActivities()) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java index ec03c34..f51e8e2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
@@ -61,13 +61,13 @@ private static final String INVALID_SCHEME_URL = "intent://www.google.com"; @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); mCustomTabsConnection = CustomTabsTestUtils.setUpConnection(); } @After - public void tearDown() throws Exception { + public void tearDown() { CustomTabsTestUtils.cleanupSessions(mCustomTabsConnection); TestThreadUtils.runOnUiThreadBlocking( () -> WarmupManager.getInstance().destroySpareWebContents());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java index 86e2116e..7d086aa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java
@@ -77,7 +77,7 @@ } public static ClientAndSession bindWithCallback(final CustomTabsCallback callback) - throws InterruptedException, TimeoutException { + throws TimeoutException { final AtomicReference<CustomTabsSession> sessionReference = new AtomicReference<>(); final AtomicReference<CustomTabsClient> clientReference = new AtomicReference<>(); final CallbackHelper waitForConnection = new CallbackHelper(); @@ -100,8 +100,7 @@ } /** Calls warmup() and waits for all the tasks to complete. Fails the test otherwise. */ - public static CustomTabsConnection warmUpAndWait() - throws InterruptedException, TimeoutException { + public static CustomTabsConnection warmUpAndWait() throws TimeoutException { CustomTabsConnection connection = setUpConnection(); final CallbackHelper startupCallbackHelper = new CallbackHelper(); CustomTabsSession session = bindWithCallback(new CustomTabsCallback() { @@ -128,7 +127,7 @@ } public static void setHideCctTopBarOnModuleManagedUrls(Intent intent, boolean hideCctTopBar) - throws InterruptedException, TimeoutException { + throws TimeoutException { CustomTabsConnection connection = warmUpAndWait(); CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent); connection.newSession(token);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java index e32f4d41..08f9ebe 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java
@@ -70,7 +70,7 @@ private static final int NET_OK = 0; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(true)); mConnection = CustomTabsTestUtils.setUpConnection(); mContext = InstrumentationRegistry.getInstrumentation() @@ -80,7 +80,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { CustomTabsTestUtils.cleanupSessions(mConnection); if (mServer != null) mServer.stopAndDestroyServer(); mServer = null; @@ -88,7 +88,7 @@ @Test @SmallTest - public void testCanDoParallelRequest() throws Exception { + public void testCanDoParallelRequest() { CustomTabsSessionToken session = CustomTabsSessionToken.createMockSessionTokenForTesting(); Assert.assertTrue(mConnection.newSession(session)); TestThreadUtils.runOnUiThreadBlocking( @@ -576,8 +576,7 @@ return token; } - private void setUpTestServerWithListener(EmbeddedTestServer.ConnectionListener listener) - throws InterruptedException { + private void setUpTestServerWithListener(EmbeddedTestServer.ConnectionListener listener) { mServer = new EmbeddedTestServer(); final CallbackHelper readFromSocketCallback = new CallbackHelper(); mServer.initializeNative(mContext, EmbeddedTestServer.ServerHTTPSSetting.USE_HTTP); @@ -587,7 +586,7 @@ } private CallbackHelper waitForDetachedRequest(CustomTabsSessionToken session, - String relativeUrl, boolean afterNative) throws InterruptedException, TimeoutException { + String relativeUrl, boolean afterNative) throws TimeoutException { // Count the number of times data is read from the socket. // We expect 1 for the detached request. // Cannot count connections as Chrome opens multiple sockets at page load time. @@ -656,21 +655,21 @@ } } - public void waitForRequest() throws InterruptedException, TimeoutException { + public void waitForRequest() throws TimeoutException { mRequestedWaiter.waitForFirst(); } public void waitForRequest(int currentCallCount, int numberOfCallsToWaitFor) - throws InterruptedException, TimeoutException { + throws TimeoutException { mRequestedWaiter.waitForCallback(currentCallCount, numberOfCallsToWaitFor); } - public void waitForCompletion() throws InterruptedException, TimeoutException { + public void waitForCompletion() throws TimeoutException { mCompletionWaiter.waitForFirst(); } public void waitForCompletion(int currentCallCount, int numberOfCallsToWaitFor) - throws InterruptedException, TimeoutException { + throws TimeoutException { mCompletionWaiter.waitForCallback(currentCallCount, numberOfCallsToWaitFor); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/RequestThrottlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/RequestThrottlerTest.java index fb22d69..e2868da7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/RequestThrottlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/RequestThrottlerTest.java
@@ -36,13 +36,13 @@ public UiThreadTestRule mRule = new UiThreadTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); RequestThrottler.purgeAllEntriesForTesting(); } @After - public void tearDown() throws Exception { + public void tearDown() { RequestThrottler.purgeAllEntriesForTesting(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java index 78bc9726..7106fa54 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java
@@ -122,7 +122,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); mWebServer.shutdown(); @@ -315,7 +315,7 @@ @Features.EnableFeatures(ChromeFeatureList.SHOW_TRUSTED_PUBLISHER_URL) @OverrideTrustedCdn @DisabledTest // Disabled for flakiness! See http://crbug.com/847341 - public void testOfflinePage() throws TimeoutException, InterruptedException { + public void testOfflinePage() throws TimeoutException { String publisherUrl = "https://example.com/test"; runTrustedCdnPublisherUrlTest( publisherUrl, "com.example.test", "example.com", R.drawable.omnibox_https_valid); @@ -371,8 +371,7 @@ } private void runTrustedCdnPublisherUrlTest(@Nullable String publisherUrl, String clientPackage, - @Nullable String expectedPublisher, int expectedSecurityIcon) - throws InterruptedException, TimeoutException { + @Nullable String expectedPublisher, int expectedSecurityIcon) throws TimeoutException { final List<Pair<String, String>> headers; if (publisherUrl != null) { headers = Collections.singletonList(Pair.create("X-AMP-Cache", publisherUrl));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleLoaderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleLoaderTest.java index 196660c4..6948be9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleLoaderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleLoaderTest.java
@@ -50,7 +50,7 @@ private ModuleLoader mModuleLoaderFromDex2; @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); mDexInputStreamProvider = new FakeDexInputStreamProvider(); mModuleLoaderFromApk = new ModuleLoader(FAKE_MODULE_COMPONENT_NAME, @@ -73,8 +73,7 @@ */ @Test @SmallTest - public void testModuleLoadingFromApk_loadsModuleEntryPoint() - throws TimeoutException, InterruptedException { + public void testModuleLoadingFromApk_loadsModuleEntryPoint() throws TimeoutException { CallbackHelper onLoaded = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -94,8 +93,7 @@ */ @Test @SmallTest - public void testModuleLoadingFromApk_doesNotCopyDexToDisk() - throws TimeoutException, InterruptedException { + public void testModuleLoadingFromApk_doesNotCopyDexToDisk() throws TimeoutException { CallbackHelper onLoaded = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -119,8 +117,7 @@ */ @Test @SmallTest - public void testModuleLoadingFromDex_loadsModuleEntryPoint() - throws TimeoutException, InterruptedException { + public void testModuleLoadingFromDex_loadsModuleEntryPoint() throws TimeoutException { CallbackHelper onLoaded = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -137,8 +134,7 @@ @Test @SmallTest - public void testModuleLoadingFromDex_hasNoLocalDex_copiesDexToDisk() - throws TimeoutException, InterruptedException { + public void testModuleLoadingFromDex_hasNoLocalDex_copiesDexToDisk() throws TimeoutException { CallbackHelper onLoaded = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -165,7 +161,7 @@ @Test @SmallTest public void testModuleLoadingFromDex_localDexHasSameUpdateTime_doesNotCopyDexToDisk() - throws TimeoutException, InterruptedException { + throws TimeoutException { CallbackHelper onLoaded1 = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -201,7 +197,7 @@ @Test @SmallTest public void testModuleLoadingFromDex_localDexHasDifferentUpdateTime_copiesDexToDisk() - throws TimeoutException, InterruptedException { + throws TimeoutException { CallbackHelper onLoaded = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -228,7 +224,7 @@ @Test @SmallTest public void testModuleLoadingFromDex_reloadingWithoutDex_cleansUpLocalDex() - throws TimeoutException, InterruptedException { + throws TimeoutException { CallbackHelper onLoadedWithDex = new CallbackHelper(); runOnUiThreadBlocking(() -> { @@ -262,7 +258,7 @@ */ @Test @SmallTest - public void testModuleUseCounter() throws TimeoutException, InterruptedException { + public void testModuleUseCounter() throws TimeoutException { final int callbacksNumber = 3; CallbackHelper onLoaded = new CallbackHelper(); List<Callback<ModuleEntryPoint>> unusedCallbacks = new ArrayList<>();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleNavigationTest.java index 12963bdf5..57414f1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleNavigationTest.java
@@ -84,7 +84,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); // Module managed hosts only work with HTTPS. @@ -112,7 +112,7 @@ @Test @SmallTest @EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testModuleNavigationNotification() throws TimeoutException, InterruptedException { + public void testModuleNavigationNotification() throws TimeoutException { Intent intent = new IntentBuilder(mTestPage).build(); mActivityRule.startCustomTabActivityWithIntent(intent);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModulePostMessageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModulePostMessageTest.java index 0f70779..0e5136f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModulePostMessageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModulePostMessageTest.java
@@ -96,7 +96,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mServer.shutdown(); } @@ -106,7 +106,7 @@ @Test @SmallTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE_POST_MESSAGE) - public void testPostMessageFromDynamicModuleReceivedInPage() throws Exception { + public void testPostMessageFromDynamicModuleReceivedInPage() { final String url = mServer.setResponse("/test.html", TITLE_FROM_POSTMESSAGE_TO_CHANNEL, null); @@ -184,9 +184,10 @@ */ @Test @SmallTest - @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE_POST_MESSAGE) - @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE) - public void testPostMessageFromDynamicModuleDisallowedBeforeModuleLoaded() throws Exception { + @Features + .EnableFeatures(ChromeFeatureList.CCT_MODULE_POST_MESSAGE) + @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE) + public void testPostMessageFromDynamicModuleDisallowedBeforeModuleLoaded() { final CallbackHelper messageChannelHelper = new CallbackHelper(); final CallbackHelper onPostMessageHelper = new CallbackHelper(); final String url = mServer.setResponse("/test.html", MESSAGE_FROM_PAGE_TO_CHANNEL, null); @@ -234,9 +235,10 @@ @Test @SmallTest - @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE_POST_MESSAGE) - public void testPostMessageFromDynamicModuleDisallowedWhenFeatureDisabled() throws Exception { + @Features + .EnableFeatures(ChromeFeatureList.CCT_MODULE) + @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE_POST_MESSAGE) + public void testPostMessageFromDynamicModuleDisallowedWhenFeatureDisabled() { final String url = mServer.setResponse("/test.html", MESSAGE_FROM_PAGE_TO_CHANNEL, null); Intent intent = new IntentBuilder(url).build();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleTestUtils.java index 682f2a8..3815a799 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleTestUtils.java
@@ -42,27 +42,27 @@ * related with CCT dynamic module testing. */ public class CustomTabsDynamicModuleTestUtils { - /* package */ final static String FAKE_MODULE_PACKAGE_NAME = + /* package */ static final String FAKE_MODULE_PACKAGE_NAME = InstrumentationRegistry.getInstrumentation().getContext().getPackageName(); - /* package */ final static String FAKE_MODULE_CLASS_NAME = FakeCCTDynamicModule.class.getName(); - /* package */ final static ComponentName FAKE_MODULE_COMPONENT_NAME = new ComponentName( - FAKE_MODULE_PACKAGE_NAME, FAKE_MODULE_CLASS_NAME); + /* package */ static final String FAKE_MODULE_CLASS_NAME = FakeCCTDynamicModule.class.getName(); + /* package */ static final ComponentName FAKE_MODULE_COMPONENT_NAME = + new ComponentName(FAKE_MODULE_PACKAGE_NAME, FAKE_MODULE_CLASS_NAME); /** * A asset name used to load {@link #FAKE_MODULE_DEX}. */ - /* package */ final static String FAKE_MODULE_DEX_ASSET_NAME = "R.strings.forty_two"; + /* package */ static final String FAKE_MODULE_DEX_ASSET_NAME = "R.strings.forty_two"; /** * A fake "dex file" that consists of couple of bytes. */ - /* package */ final static byte[] FAKE_MODULE_DEX = new byte[] {42, 42}; + /* package */ static final byte[] FAKE_MODULE_DEX = new byte[] {42, 42}; /** * A fake {@link ModuleLoader.DexClassLoaderProvider} that provides the {@link ClassLoader} of * {@link FakeCCTDynamicModule} which guarantees that it can always load the entry module. */ - /* package */ final static ModuleLoader.DexClassLoaderProvider FAKE_CLASS_LOADER_PROVIDER = + /* package */ static final ModuleLoader.DexClassLoaderProvider FAKE_CLASS_LOADER_PROVIDER = dexFile -> FakeCCTDynamicModule.class.getClassLoader(); private static int sModuleVersion = 1; @@ -223,7 +223,7 @@ * Waits for expected number of navigation events happen. */ /* package */ void waitForNavigationEvent(int navigationEvent, int currentCallCount, - int numberOfCallsToWaitFor) throws TimeoutException, InterruptedException { + int numberOfCallsToWaitFor) throws TimeoutException { if (sModuleVersion < ON_NAVIGATION_EVENT_MODULE_API_VERSION) return; if (navigationEvent == CustomTabsCallback.NAVIGATION_STARTED) { @@ -233,8 +233,8 @@ } } - /* package */ void waitForFirstContentfulPaint(int currentCallCount, - int numberOfCallsToWaitFor) throws TimeoutException, InterruptedException { + /* package */ void waitForFirstContentfulPaint( + int currentCallCount, int numberOfCallsToWaitFor) throws TimeoutException { if (sModuleVersion < ON_PAGE_LOAD_METRIC_API_VERSION) return; mOnFirstContentfulPaint.waitForCallback(currentCallCount, numberOfCallsToWaitFor);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleUITest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleUITest.java index b5378d0..9ab346a6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleUITest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/CustomTabsDynamicModuleUITest.java
@@ -56,7 +56,6 @@ import org.chromium.net.test.ServerCertificate; import org.chromium.ui.base.PageTransition; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; /** @@ -92,7 +91,7 @@ private String mModuleManagedPage2; @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); // Module managed hosts only work with HTTPS. @@ -110,7 +109,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { DynamicModuleCoordinator.setAllowNonStandardPortNumber(false); } @@ -122,7 +121,7 @@ @Test @SmallTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testModuleNotProvided() throws InterruptedException { + public void testModuleNotProvided() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModulePackageName(null).setModuleClassName(null) .setModuleManagedUrlRegex(getModuleManagedRegex()) @@ -144,7 +143,7 @@ @Test @SmallTest @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE) - public void testFeatureIsDisabled() throws InterruptedException { + public void testFeatureIsDisabled() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .build(); @@ -169,8 +168,7 @@ @SmallTest @DisabledTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testCloseButtonBehaviourWithDynamicModule() - throws InterruptedException, ExecutionException, TimeoutException { + public void testCloseButtonBehaviourWithDynamicModule() throws TimeoutException { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .build(); @@ -224,8 +222,7 @@ */ @Test @SmallTest - public void testCloseButtonBehaviourWithoutDynamicModule() - throws InterruptedException, ExecutionException, TimeoutException { + public void testCloseButtonBehaviourWithoutDynamicModule() throws TimeoutException { // Open CCT with moduleManagedUrl1 and navigate // moduleManagedUrl1 -> nav1.1 - nav1.2 -> modulemanagedUrl2 -> nav2.1 -> nav2.2 @@ -257,8 +254,7 @@ */ @Test @SmallTest - public void testCloseButtonBehaviourDynamicModuleLoadFails() - throws InterruptedException, ExecutionException, TimeoutException { + public void testCloseButtonBehaviourDynamicModuleLoadFails() throws TimeoutException { // Open CCT with moduleManagedUrl1 and navigate // moduleManagedUrl1 -> nav1.1 - nav1.2 Intent intent = new IntentBuilder(mModuleManagedPage) @@ -283,7 +279,7 @@ @Test @SmallTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testSetTopBarContentView() throws Exception { + public void testSetTopBarContentView() { Intent intent = new IntentBuilder(mModuleManagedPage) .build(); @@ -304,7 +300,7 @@ @Test @SmallTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testSetTopBarContentView_secondCallIsNoOp() throws Exception { + public void testSetTopBarContentView_secondCallIsNoOp() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .build(); @@ -324,7 +320,7 @@ @Test @SmallTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testSetTopBarContentView_moduleLoadingFailed_cctHeaderVisible() throws Exception { + public void testSetTopBarContentView_moduleLoadingFailed_cctHeaderVisible() { Intent intent = new IntentBuilder(mTestPage).setModuleFailToLoadComponentName().build(); mActivityRule.startCustomTabActivityWithIntent(intent); @@ -345,7 +341,7 @@ @Test @SmallTest @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE) - public void testSetTopBarContentView_withModuleAndManagedUrls_topBarVisible() throws Exception { + public void testSetTopBarContentView_withModuleAndManagedUrls_topBarVisible() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .build(); @@ -365,10 +361,11 @@ @Test @SmallTest - @Features.EnableFeatures({ - ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, + @Features. + EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarContentView_notModuleManagedHost_cctHeaderVisible() throws Exception { + public void + testSetTopBarContentView_notModuleManagedHost_cctHeaderVisible() { String url = mTestServer.getURLWithHostName("non-managed-domain", MODULE_MANAGED_PAGE); Intent intent = new IntentBuilder(url) .setModuleManagedUrlRegex(getModuleManagedRegex()) @@ -385,10 +382,11 @@ @Test @SmallTest - @Features.EnableFeatures({ - ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, + @Features. + EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarContentView_withModuleAndExtras_cctHeaderHidden() throws Exception { + public void + testSetTopBarContentView_withModuleAndExtras_cctHeaderHidden() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(true) @@ -412,9 +410,10 @@ @Test @SmallTest - @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS) - @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER) - public void testSetTopBarHeight_featureDisabled_heightNotChanged() throws Exception { + @Features + .EnableFeatures(ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS) + @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER) + public void testSetTopBarHeight_featureDisabled_heightNotChanged() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(true) @@ -433,10 +432,11 @@ @Test @SmallTest - @Features.EnableFeatures({ - ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, + @Features. + EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarHeight_cctHeaderNotHidden_heightNotChanged() throws Exception { + public void + testSetTopBarHeight_cctHeaderNotHidden_heightNotChanged() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(false) @@ -454,10 +454,11 @@ @Test @SmallTest - @Features.EnableFeatures({ - ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, + @Features. + EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarHeight_withModuleAndExtras_heightUpdated() throws Exception { + public void + testSetTopBarHeight_withModuleAndExtras_heightUpdated() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(true) @@ -475,10 +476,11 @@ @Test @SmallTest - @Features.EnableFeatures({ - ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, + @Features. + EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarHeight_zeroHeightHidesTopBar() throws Exception { + public void + testSetTopBarHeight_zeroHeightHidesTopBar() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .build(); @@ -496,9 +498,10 @@ @Test @SmallTest - @Features.EnableFeatures(ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS) - @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER) - public void testSetTopBarContentView_featureDisabled_progressBarNoChange() throws Exception { + @Features + .EnableFeatures(ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS) + @Features.DisableFeatures(ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER) + public void testSetTopBarContentView_featureDisabled_progressBarNoChange() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(true) @@ -512,8 +515,9 @@ @SmallTest @Features. EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, - ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarContentView_cctHeaderNotHidden_progressBarNoChange() throws Exception { + ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) + public void + testSetTopBarContentView_cctHeaderNotHidden_progressBarNoChange() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(false) @@ -527,8 +531,9 @@ @SmallTest @Features. EnableFeatures({ChromeFeatureList.CCT_MODULE, ChromeFeatureList.CCT_MODULE_CUSTOM_HEADER, - ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) - public void testSetTopBarContentView_withModuleAndExtras_progressBarChanged() throws Exception { + ChromeFeatureList.CCT_MODULE_USE_INTENT_EXTRAS}) + public void + testSetTopBarContentView_withModuleAndExtras_progressBarChanged() { Intent intent = new IntentBuilder(mModuleManagedPage) .setModuleManagedUrlRegex(getModuleManagedRegex()) .setHideCCTHeader(true) @@ -607,8 +612,7 @@ return "^(" + MODULE_MANAGED_PAGE + "|" + MODULE_MANAGED_PAGE_2 + ")$"; } - private void runAndWaitForActivityStopped(Runnable runnable) - throws TimeoutException, InterruptedException { + private void runAndWaitForActivityStopped(Runnable runnable) throws TimeoutException { CallbackHelper cctHiddenCallback = new CallbackHelper(); ApplicationStatus.ActivityStateListener listener = (activity, newState) -> { if (activity == getActivity() &&
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/ModuleMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/ModuleMetricsTest.java index a7262b9..5c8865f8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/ModuleMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/dynamicmodule/ModuleMetricsTest.java
@@ -32,7 +32,7 @@ "CustomTabs.DynamicModule.ResidentSet.OnModuleLoad"; @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java index 404e92a..4cd2f78 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java
@@ -44,7 +44,7 @@ private Context mContext; @Before - public void setUp() throws Exception { + public void setUp() { // Using an AdvancedMockContext allows us to use a fresh in-memory SharedPreference. mContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() .getTargetContext() @@ -62,7 +62,7 @@ "force-fieldtrials=DataCompressionProxyPromoVisibility/Enabled"}) @Feature({"DataReduction"}) public void - testCanShowPromos() throws Throwable { + testCanShowPromos() { if (DataReductionProxySettings.getInstance().isDataReductionProxyManaged()) return; Assert.assertFalse(DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); @@ -87,7 +87,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testFreOrSecondRunPromoDisplayed() throws Throwable { + public void testFreOrSecondRunPromoDisplayed() { AboutVersionStrings versionStrings = PrefServiceBridge.getInstance().getAboutVersionStrings(); @@ -110,7 +110,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testFrePromoOptOut() throws Throwable { + public void testFrePromoOptOut() { // Save that the user opted out of the first run experience. DataReductionPromoUtils.saveFrePromoOptOut(true); Assert.assertTrue(DataReductionPromoUtils.getOptedOutOnFrePromo()); @@ -128,7 +128,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testInfoBarPromoDisplayed() throws Throwable { + public void testInfoBarPromoDisplayed() { AboutVersionStrings versionStrings = PrefServiceBridge.getInstance().getAboutVersionStrings();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java index e240a05..f6bb3646 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java
@@ -119,7 +119,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { LocationUtils.setFactory(null); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java index ae681731..43760d4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java
@@ -76,7 +76,7 @@ @Test @LargeTest - public void testAddDevice() throws InterruptedException { + public void testAddDevice() { Dialog dialog = mPermissionDialog.getDialogForTesting(); final ListView items = (ListView) dialog.findViewById(R.id.items);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java index c5986a6..cf2ffb7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java
@@ -157,7 +157,7 @@ @Test @LargeTest - public void testAddItemsWithNoIcons() throws Throwable { + public void testAddItemsWithNoIcons() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -185,7 +185,7 @@ @Test @LargeTest - public void testAddItemsWithIcons() throws Throwable { + public void testAddItemsWithIcons() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -221,7 +221,7 @@ @Test @LargeTest - public void testAddItemWithIconAfterItemWithNoIcon() throws Throwable { + public void testAddItemWithIconAfterItemWithNoIcon() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -252,7 +252,7 @@ @Test @LargeTest - public void testAddItemWithNoIconAfterItemWithIcon() throws Throwable { + public void testAddItemWithNoIconAfterItemWithIcon() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -283,7 +283,7 @@ @Test @LargeTest - public void testRemoveItemWithIconNoItemsWithIconsLeft() throws Throwable { + public void testRemoveItemWithIconNoItemsWithIconsLeft() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -320,7 +320,7 @@ @Test @LargeTest - public void testRemoveItemWithIconOneItemWithIconLeft() throws Throwable { + public void testRemoveItemWithIconOneItemWithIconLeft() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -370,7 +370,7 @@ @Test @LargeTest - public void testUpdateItemWithIconToNoIcon() throws Throwable { + public void testUpdateItemWithIconToNoIcon() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -404,7 +404,7 @@ @Test @LargeTest - public void testUpdateItemWithNoIconToIcon() throws Throwable { + public void testUpdateItemWithNoIconToIcon() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -438,7 +438,7 @@ @Test @LargeTest - public void testUpdateItemIcon() throws Throwable { + public void testUpdateItemIcon() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -638,7 +638,7 @@ @Test @LargeTest - public void testUpdateItemAndRemoveItemFromList() throws Throwable { + public void testUpdateItemAndRemoveItemFromList() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -690,7 +690,7 @@ @Test @LargeTest - public void testAddItemAndRemoveItemFromList() throws Throwable { + public void testAddItemAndRemoveItemFromList() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing()); @@ -762,7 +762,7 @@ @Test @LargeTest - public void testAddItemWithSameNameToListAndRemoveItemFromList() throws Throwable { + public void testAddItemWithSameNameToListAndRemoveItemFromList() { TestThreadUtils.runOnUiThreadBlocking(() -> { Dialog dialog = mChooserDialog.getDialogForTesting(); Assert.assertTrue(dialog.isShowing());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java index 15c7a7a..67798eee 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java
@@ -146,7 +146,7 @@ @Test @LargeTest - public void testSelectItem() throws InterruptedException { + public void testSelectItem() { Dialog dialog = mChooserDialog.mItemChooserDialog.getDialogForTesting(); TextViewWithClickableSpans statusView =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java index dc8d139..6e560eee 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java
@@ -61,7 +61,7 @@ @Test @MediumTest @Feature({"DirectActions"}) - public void testCloseTabs() throws Exception { + public void testCloseTabs() { // Actions are available assertThat(getDirectActions(), Matchers.containsInAnyOrder("close_tab"));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java index 22d889b..5778dc8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java
@@ -56,7 +56,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mActionTester != null) mActionTester.tearDown(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java index bb2d0323..e851193e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java
@@ -64,7 +64,7 @@ @Test @MediumTest @Feature({"DirectActions"}) - public void testPerformDirectActionThroughActivity() throws Exception { + public void testPerformDirectActionThroughActivity() { mHandler.allowAllActions(); List<Bundle> results = new ArrayList<>(); @@ -84,7 +84,7 @@ @Test @SmallTest @Feature({"DirectActions"}) - public void testReportAvailableActions() throws Exception { + public void testReportAvailableActions() { mHandler.allowAllActions(); assertThat(getDirectActions(), @@ -103,7 +103,7 @@ @Test @MediumTest @Feature({"DirectActions"}) - public void testRestrictAvailableActions() throws Exception { + public void testRestrictAvailableActions() { // By default, MenuDirectActionHandler supports no actions. assertThat(getDirectActions(), Matchers.empty());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java index 4db1bb3..7ebd3d3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java
@@ -34,7 +34,7 @@ */ @Test @LargeTest - public void testViewportFitAuto() throws InterruptedException, TimeoutException { + public void testViewportFitAuto() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -51,7 +51,7 @@ */ @Test @LargeTest - public void testViewportFitContain() throws InterruptedException, TimeoutException { + public void testViewportFitContain() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -68,7 +68,7 @@ */ @Test @LargeTest - public void testViewportFitCover() throws InterruptedException, TimeoutException { + public void testViewportFitCover() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -91,7 +91,7 @@ */ @Test @LargeTest - public void testViewportFitCoverForced() throws InterruptedException, TimeoutException { + public void testViewportFitCoverForced() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -116,7 +116,7 @@ */ @Test @LargeTest - public void testViewportFitDefault() throws InterruptedException, TimeoutException { + public void testViewportFitDefault() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -138,7 +138,7 @@ */ @Test @LargeTest - public void testViewportFitDipScale() throws InterruptedException, TimeoutException { + public void testViewportFitDipScale() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -156,7 +156,7 @@ */ @Test @LargeTest - public void testViewportFitSubframe() throws InterruptedException, TimeoutException { + public void testViewportFitSubframe() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return; @@ -175,7 +175,7 @@ */ @Test @LargeTest - public void testViewportFitCoverNoCutout() throws InterruptedException, TimeoutException { + public void testViewportFitCoverNoCutout() throws TimeoutException { // Display Cutout API requires Android P+. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTestRule.java index cfb94d7..2d60525 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTestRule.java
@@ -163,7 +163,7 @@ }, description); } - protected String getTestURL() throws Exception { + protected String getTestURL() { if (mTestServer == null) { mTestServer = EmbeddedTestServer.createAndStartServer( InstrumentationRegistry.getInstrumentation().getContext()); @@ -171,7 +171,7 @@ return mTestServer.getURL(DEFAULT_TEST_PAGE); } - protected void setUp() throws Exception { + protected void setUp() { mTab = getActivity().getActivityTab(); mTestController = new TestDisplayCutoutController(mTab); TestThreadUtils.runOnUiThreadBlocking( @@ -182,7 +182,7 @@ mTab.addObserver(observer); } - protected void tearDown() throws Exception { + protected void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -202,12 +202,12 @@ } /** Enter fullscreen and wait for the tab to go fullscreen. */ - public void enterFullscreen() throws InterruptedException, TimeoutException { + public void enterFullscreen() throws TimeoutException { enterFullscreenUsingButton("fullscreen"); } /** Exit fullscreen and wait for the tab to exit fullscreen. */ - public void exitFullscreen() throws InterruptedException, TimeoutException { + public void exitFullscreen() { JavaScriptUtils.executeJavaScript(mTab.getWebContents(), "document.webkitExitFullscreen()"); CriteriaHelper.pollUiThread(Criteria.equals(false, () -> mIsTabFullscreen), TEST_TIMEOUT, @@ -236,22 +236,22 @@ } /** Enter fullscreen on the subframe and wait for the tab to go fullscreen. */ - public void enterFullscreenOnSubframe() throws InterruptedException, TimeoutException { + public void enterFullscreenOnSubframe() throws TimeoutException { enterFullscreenUsingButton("subframefull"); } /** Get the applied safe areas from the main frame. */ - public Rect getAppliedSafeArea() throws InterruptedException, TimeoutException { + public Rect getAppliedSafeArea() throws TimeoutException { return getSafeAreaUsingJavaScript("getSafeAreas()"); } /** Get the applied safe areas from the child frame. */ - public Rect getAppliedSafeAreaOnSubframe() throws InterruptedException, TimeoutException { + public Rect getAppliedSafeAreaOnSubframe() throws TimeoutException { return getSafeAreaUsingJavaScript("frameWindow.getSafeAreas()"); } /** Set the viewport-fit meta tag on the main frame. */ - public void setViewportFit(String value) throws InterruptedException, TimeoutException { + public void setViewportFit(String value) throws TimeoutException { JavaScriptUtils.executeJavaScriptAndWaitForResult( mTab.getWebContents(), "setViewportFit('" + value + "')"); } @@ -262,8 +262,7 @@ } /** Get the safe area using JS and parse the JSON result to a Rect. */ - private Rect getSafeAreaUsingJavaScript(String code) - throws InterruptedException, TimeoutException { + private Rect getSafeAreaUsingJavaScript(String code) throws TimeoutException { try { String result = JavaScriptUtils.executeJavaScriptAndWaitForResult(mTab.getWebContents(), code); @@ -280,8 +279,7 @@ /** * Enter fullscreen by clicking on the supplied button and wait for the tab to go fullscreen. */ - private void enterFullscreenUsingButton(String id) - throws InterruptedException, TimeoutException { + private void enterFullscreenUsingButton(String id) throws TimeoutException { Assert.assertTrue(DOMUtils.clickNode(mTab.getWebContents(), id)); CriteriaHelper.pollUiThread(Criteria.equals(true, () -> mIsTabFullscreen), TEST_TIMEOUT,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTest.java index c5def2d..96be3c2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTest.java
@@ -34,7 +34,7 @@ @LargeTest @FlakyTest(message = "crbug.com/862728") @WebappDisplayCutoutTestRule.TestConfiguration(displayMode = WebDisplayMode.UNDEFINED) - public void testViewportFitWebapp() throws InterruptedException, TimeoutException { + public void testViewportFitWebapp() throws TimeoutException { mTestRule.setViewportFit(DisplayCutoutTestRule.VIEWPORT_FIT_COVER); mTestRule.waitForSafeArea(DisplayCutoutTestRule.TEST_SAFE_AREA_WITHOUT_CUTOUT); @@ -49,7 +49,7 @@ @LargeTest @FlakyTest(message = "crbug.com/862728") @WebappDisplayCutoutTestRule.TestConfiguration(displayMode = WebDisplayMode.FULLSCREEN) - public void testViewportFitWebapp_Fullscreen() throws InterruptedException, TimeoutException { + public void testViewportFitWebapp_Fullscreen() throws TimeoutException { mTestRule.setViewportFit(DisplayCutoutTestRule.VIEWPORT_FIT_COVER); mTestRule.waitForSafeArea(DisplayCutoutTestRule.TEST_SAFE_AREA_WITH_CUTOUT); @@ -65,7 +65,7 @@ @LargeTest @FlakyTest(message = "crbug.com/862728") @WebappDisplayCutoutTestRule.TestConfiguration(displayMode = WebDisplayMode.MINIMAL_UI) - public void testViewportFitWebapp_MinimalUi() throws InterruptedException, TimeoutException { + public void testViewportFitWebapp_MinimalUi() throws TimeoutException { mTestRule.setViewportFit(DisplayCutoutTestRule.VIEWPORT_FIT_COVER); mTestRule.waitForSafeArea(DisplayCutoutTestRule.TEST_SAFE_AREA_WITHOUT_CUTOUT); @@ -81,7 +81,7 @@ @LargeTest @FlakyTest(message = "crbug.com/862728") @WebappDisplayCutoutTestRule.TestConfiguration(displayMode = WebDisplayMode.STANDALONE) - public void testViewportFitWebapp_Standalone() throws InterruptedException, TimeoutException { + public void testViewportFitWebapp_Standalone() throws TimeoutException { mTestRule.setViewportFit(DisplayCutoutTestRule.VIEWPORT_FIT_COVER); mTestRule.waitForSafeArea(DisplayCutoutTestRule.TEST_SAFE_AREA_WITHOUT_CUTOUT);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTestRule.java index 108a73e..fb92d18 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/WebappDisplayCutoutTestRule.java
@@ -64,7 +64,7 @@ }; } - private void startWebappActivity(@WebDisplayMode int displayMode) throws Exception { + private void startWebappActivity(@WebDisplayMode int displayMode) { Intent intent = new Intent(InstrumentationRegistry.getTargetContext(), WebappActivity0.class); intent.setData(Uri.parse(WebappActivity0.WEBAPP_SCHEME + "://" + WEBAPP_ID));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java index 9eb6506..e330d1e8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java
@@ -51,7 +51,7 @@ private static final long DEVICE_STARTUP_TIMEOUT_MS = 15000L; @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java index c2720644..fd9f6141 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java
@@ -59,7 +59,7 @@ @Feature({"Distillability-Service"}) @MediumTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testServiceAliveAfterNativePage() throws InterruptedException, TimeoutException { + public void testServiceAliveAfterNativePage() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java index 1bf00e4..5e1ac97 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java
@@ -41,7 +41,7 @@ private static final double EPSILON = 1e-5; @Before - public void setUp() throws Exception { + public void setUp() { getDistilledPagePrefs(); } @@ -57,7 +57,7 @@ @SmallTest @UiThreadTest @Feature({"DomDistiller"}) - public void testGetAndSetTheme() throws Throwable { + public void testGetAndSetTheme() { // Check the default theme. Assert.assertEquals(Theme.LIGHT, mDistilledPagePrefs.getTheme()); // Check that theme can be correctly set. @@ -112,7 +112,7 @@ @SmallTest @UiThreadTest @Feature({"DomDistiller"}) - public void testGetAndSetFontFamily() throws Throwable { + public void testGetAndSetFontFamily() { // Check the default font family. Assert.assertEquals(FontFamily.SANS_SERIF, mDistilledPagePrefs.getFontFamily()); // Check that font family can be correctly set. @@ -163,7 +163,7 @@ @SmallTest @UiThreadTest @Feature({"DomDistiller"}) - public void testGetAndSetFontScaling() throws Throwable { + public void testGetAndSetFontScaling() { // Check the default font scaling. Assert.assertEquals(1.0, mDistilledPagePrefs.getFontScaling(), EPSILON); // Check that font scaling can be correctly set. @@ -213,7 +213,7 @@ @Test @SmallTest @Feature({"DomDistiller"}) - public void testRepeatedAddAndDeleteObserver() throws InterruptedException { + public void testRepeatedAddAndDeleteObserver() { TestingObserver test = new TestingObserver(); // Should successfully add the observer the first time.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java index 44da9a8..86924ab 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java
@@ -62,7 +62,7 @@ @SmallTest @Feature({"Download"}) @RetryOnFailure - public void testShouldInterceptContextMenuDownload() throws InterruptedException { + public void testShouldInterceptContextMenuDownload() { final Tab tab = mActivityTestRule.getActivity().getActivityTab(); mActivityTestRule.loadUrl("about:blank"); ChromeDownloadDelegate delegate = TestThreadUtils.runOnUiThreadBlockingNoException(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadFileProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadFileProviderTest.java index c596840..349ce7d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadFileProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadFileProviderTest.java
@@ -51,7 +51,7 @@ private DownloadDirectoryProvider.Delegate mMockDirectoryDelegate; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); doReturn(new File(PRIMARY_STORAGE_DOWNLOAD_DIRECTORY_PATH)) .when(mMockDirectoryDelegate) @@ -63,9 +63,8 @@ * Verifies content URI generation. The URI result in the callback should match expected output. * @param filePath The file path of a file. * @param expected The expected content URI. - * @throws Exception */ - private void verifyContentUri(String filePath, Uri expected) throws Exception { + private void verifyContentUri(String filePath, Uri expected) { Assert.assertEquals( expected, DownloadFileProvider.createContentUri(filePath, mMockDirectoryDelegate)); } @@ -83,7 +82,7 @@ @Test @MediumTest @Feature({"Download"}) - public void testGenerateContentUri() throws Exception { + public void testGenerateContentUri() { String packageName = ContextUtils.getApplicationContext().getPackageName(); verifyContentUri(PRIMARY_STORAGE_DOWNLOAD_PATH, Uri.parse("content://" + packageName
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java index 582b433..41c6bc7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java
@@ -109,7 +109,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { Looper.prepare(); mContext = new AdvancedMockContext(InstrumentationRegistry.getTargetContext());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadLocationChangeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadLocationChangeTest.java index 1c97f56..5954e954 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadLocationChangeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadLocationChangeTest.java
@@ -52,7 +52,7 @@ private static final long STORAGE_SIZE = 1024000; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); // Show the location dialog for the first time. @@ -60,7 +60,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -72,13 +72,12 @@ /** * Ensures the default download location dialog is shown to the user with SD card inserted. - * @throws Exception */ @Test @MediumTest @Feature({"Downloads"}) @Features.EnableFeatures(ChromeFeatureList.DOWNLOADS_LOCATION_CHANGE) - public void testDefaultDialogPositiveButtonClickThrough() throws Exception { + public void testDefaultDialogPositiveButtonClickThrough() { TestThreadUtils.runOnUiThreadBlocking(() -> { Assert.assertEquals(DownloadPromptStatus.SHOW_INITIAL, PrefServiceBridge.getInstance().getPromptForDownloadAndroid()); @@ -108,13 +107,12 @@ /** * Ensures no default download location dialog is shown to the user without SD card inserted. - * @throws Exception */ @Test @MediumTest @Feature({"Downloads"}) @Features.EnableFeatures(ChromeFeatureList.DOWNLOADS_LOCATION_CHANGE) - public void testNoDialogWithoutSDCard() throws Exception { + public void testNoDialogWithoutSDCard() { int currentCallCount = mDownloadTestRule.getChromeDownloadCallCount(); TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java index 17ee83a..26288051 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java
@@ -245,12 +245,12 @@ private DownloadManagerServiceForTest mService; @Before - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); } @After - public void tearDown() throws Exception { + public void tearDown() { mService = null; RecordHistogram.setDisabledForTests(false); } @@ -383,7 +383,7 @@ @Test @MediumTest @Feature({"Download"}) - public void testDownloadFailedIsCalled() throws InterruptedException { + public void testDownloadFailedIsCalled() { MockDownloadNotifier notifier = new MockDownloadNotifier(); createDownloadManagerService(notifier, UPDATE_DELAY_FOR_TEST); TestThreadUtils.runOnUiThreadBlocking( @@ -400,7 +400,7 @@ @Test @MediumTest @Feature({"Download"}) - public void testDownloadPausedIsCalled() throws InterruptedException { + public void testDownloadPausedIsCalled() { MockDownloadNotifier notifier = new MockDownloadNotifier(); createDownloadManagerService(notifier, UPDATE_DELAY_FOR_TEST); DownloadManagerService.disableNetworkListenerForTest();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadMediaParserTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadMediaParserTest.java index 292291c..3fb17fe 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadMediaParserTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadMediaParserTest.java
@@ -53,7 +53,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mTestRule.loadNativeLibraryAndInitBrowserProcess(); } @@ -89,7 +89,7 @@ * Verify that the metadata from audio file can be retrieved correctly. * @throws InterruptedException */ - public void testParseAudioMetatadata() throws InterruptedException { + public void testParseAudioMetatadata() { String filePath = UrlUtils.getIsolatedTestRoot() + "/media/test/data/sfx.mp3"; MediaParserResult result = parseMediaFile(filePath, "audio/mp3"); Assert.assertTrue("Failed to parse audio metadata.", result.mediaData != null); @@ -104,7 +104,7 @@ * Verify metadata and thumbnail can be retrieved correctly from h264 video file. * @throws InterruptedException */ - public void testParseVideoH264() throws InterruptedException { + public void testParseVideoH264() { String filePath = UrlUtils.getIsolatedTestRoot() + "/media/test/data/bear.mp4"; MediaParserResult result = parseMediaFile(filePath, "video/mp4"); Assert.assertTrue("Failed to parse video file.", result.mediaData != null); @@ -121,7 +121,7 @@ * Verify metadata and thumbnail can be retrieved correctly from vp8 video file. * @throws InterruptedException */ - public void testParseVideoThumbnailVp8() throws InterruptedException { + public void testParseVideoThumbnailVp8() { String filePath = UrlUtils.getIsolatedTestRoot() + "/media/test/data/bear-vp8-webvtt.webm"; MediaParserResult result = parseMediaFile(filePath, "video/webm"); Assert.assertTrue("Failed to parse video file.", result.mediaData != null); @@ -139,7 +139,7 @@ * plane. * @throws InterruptedException */ - public void testParseVideoThumbnailVp8WithAlphaPlane() throws InterruptedException { + public void testParseVideoThumbnailVp8WithAlphaPlane() { String filePath = UrlUtils.getIsolatedTestRoot() + "/media/test/data/bear-vp8a.webm"; MediaParserResult result = parseMediaFile(filePath, "video/webm"); Assert.assertTrue("Failed to parse video file.", result.mediaData != null);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java index 73d72a4e..332d9ca 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java
@@ -107,13 +107,13 @@ } @Before - public void setUp() throws Exception { + public void setUp() { deleteTestFiles(); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); deleteTestFiles(); } @@ -236,7 +236,7 @@ @MediumTest @Feature({"Downloads"}) @DisabledTest(message = "crbug.com/597230") - public void testDuplicateHttpPostDownload_Cancel() throws Exception { + public void testDuplicateHttpPostDownload_Cancel() { // Download a file. mDownloadTestRule.loadUrl(mTestServer.getURL(TEST_DOWNLOAD_DIRECTORY + "post.html")); waitForFocus(); @@ -341,7 +341,7 @@ mDownloadTestRule.hasDownload(FILENAME_TEXT_2, SUPERBO_CONTENTS)); } - private void goToLastTab() throws Exception { + private void goToLastTab() { final TabModel model = mDownloadTestRule.getActivity().getCurrentTabModel(); final int count = model.getCount();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTestRule.java index 2920548..6dbd3c7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTestRule.java
@@ -177,7 +177,7 @@ return mHttpDownloadFinished.getCallCount(); } - public boolean waitForChromeDownloadToFinish(int currentCallCount) throws InterruptedException { + public boolean waitForChromeDownloadToFinish(int currentCallCount) { boolean eventReceived = true; try { mHttpDownloadFinished.waitForCallback(currentCallCount, 1, 5, TimeUnit.SECONDS); @@ -258,7 +258,7 @@ }); } - private void tearDown() throws Exception { + private void tearDown() { cleanUpAllDownloads(); TestThreadUtils.runOnUiThreadBlocking(() -> { DownloadManagerService.getDownloadManagerService().removeDownloadObserver(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadUtilsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadUtilsTest.java index 28e0521..0ff4daa8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadUtilsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadUtilsTest.java
@@ -39,7 +39,7 @@ private static final String ITEM_ID = "42"; @Before - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); HashMap<String, Boolean> features = new HashMap<String, Boolean>(); @@ -48,7 +48,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/OMADownloadHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/OMADownloadHandlerTest.java index 54ac075..f8ce318 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/OMADownloadHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/OMADownloadHandlerTest.java
@@ -358,7 +358,7 @@ @Test @MediumTest @Feature({"Download"}) - public void testEnqueueOMADownloads() throws InterruptedException { + public void testEnqueueOMADownloads() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); Context context = getTestContext();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ServicificationDownloadTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ServicificationDownloadTest.java index 8272eb3..d3fdf0b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ServicificationDownloadTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ServicificationDownloadTest.java
@@ -100,7 +100,7 @@ } @Before - public void setUp() throws InterruptedException { + public void setUp() { RecordHistogram.setDisabledForTests(true); TestThreadUtils.runOnUiThreadBlocking(() -> { mNotificationService = new MockDownloadNotificationService(); @@ -109,7 +109,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java index 1be287a..08fb5c4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java
@@ -36,7 +36,7 @@ private MockDownloadNotificationService mMockDownloadNotificationService; @Before - public void setUp() throws Exception { + public void setUp() { Looper.prepare(); mMockDownloadNotificationService = new MockDownloadNotificationService(); mSystemDownloadNotifier.setDownloadNotificationService(mMockDownloadNotificationService);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java index 34e2ab0..7b5f2f57 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java
@@ -114,7 +114,7 @@ @Test @MediumTest - public void testLaunchingActivity() throws Exception { + public void testLaunchingActivity() { TestThreadUtils.runOnUiThreadBlocking(() -> { setUpUi(); }); onView(withText("page 1")).check(matches(isDisplayed()));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridgeExperimentalTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridgeExperimentalTest.java index 48633551..19c8495 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridgeExperimentalTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridgeExperimentalTest.java
@@ -41,13 +41,13 @@ private Profile mProfile; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { mProfile = Profile.getLastUsedProfile(); }); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -59,8 +59,10 @@ // workaround, fall back to our own comparison logic if sameAs returns false. // See https://crbug.com/927014 for more tracking. if (expected.getConfig() != actual.getConfig()) return false; - if (expected.getWidth() != actual.getWidth() || expected.getHeight() != actual.getHeight()) + if (expected.getWidth() != actual.getWidth() + || expected.getHeight() != actual.getHeight()) { return false; + } for (int i = 0; i < expected.getWidth(); i++) { for (int j = 0; j < expected.getHeight(); j++) { if (expected.getPixel(i, j) != actual.getPixel(i, j)) return false;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleBottomTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleBottomTest.java index b8a0ac8..5829477f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleBottomTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleBottomTest.java
@@ -40,49 +40,49 @@ // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites=MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseBottomPerfectRow() throws Exception { + public void testTileQuantityDenseBottomPerfectRow() { runTileQuantityTest(5, 0, false, 1, 5); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites>MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseBottomImperfectRow() throws Exception { + public void testTileQuantityDenseBottomImperfectRow() { runTileQuantityTest(7, 0, true, 2, 7); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites=MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseBottomOneTileRow() throws Exception { + public void testTileQuantityDenseBottomOneTileRow() { runTileQuantityTest(6, 0, false, 1, 5); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites=MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - public void testTileQuantityDenseBottomOneTileRowAfterBlacklisted() throws Exception { + public void testTileQuantityDenseBottomOneTileRowAfterBlacklisted() { runTileQuantityTest(7, 1, true, 2, 6); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites=MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - public void testTileQuantityDenseBottomPerfectRowAfterBlacklisted() throws Exception { + public void testTileQuantityDenseBottomPerfectRowAfterBlacklisted() { runTileQuantityTest(6, 1, false, 1, 5); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites<MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - public void testTileQuantityDenseBottomTooFewTiles() throws Exception { + public void testTileQuantityDenseBottomTooFewTiles() { runTileQuantityTest(5, 4, true, 1, 1); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=5, numSites>MAX_TILE_COUNT, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseBottomTooManyTiles() throws Exception { + public void testTileQuantityDenseBottomTooManyTiles() { runTileQuantityTest(15, 0, false, 2, 10); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleRightTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleRightTest.java index ff7266f..25a2759 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleRightTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewDenseTitleRightTest.java
@@ -40,49 +40,49 @@ // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites=MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseRightPerfectRow() throws Exception { + public void testTileQuantityDenseRightPerfectRow() { runTileQuantityTest(3, 0, false, 1, 3); } // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites>MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseRightImperfectRow() throws Exception { + public void testTileQuantityDenseRightImperfectRow() { runTileQuantityTest(5, 0, true, 2, 5); } // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites=MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseRightOneTileRow() throws Exception { + public void testTileQuantityDenseRightOneTileRow() { runTileQuantityTest(4, 0, false, 1, 3); } // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites>MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - public void testTileQuantityDenseRightOneTileRowAfterBlacklisted() throws Exception { + public void testTileQuantityDenseRightOneTileRowAfterBlacklisted() { runTileQuantityTest(5, 1, true, 2, 4); } // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites=MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - public void testTileQuantityDenseRightPerfectRowAfterBlacklisted() throws Exception { + public void testTileQuantityDenseRightPerfectRowAfterBlacklisted() { runTileQuantityTest(4, 1, false, 1, 3); } // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites<MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - public void testTileQuantityDenseRightTooFewTiles() throws Exception { + public void testTileQuantityDenseRightTooFewTiles() { runTileQuantityTest(4, 3, true, 1, 1); } // Covers: IS_DENSE=true, MAX_ROWS=3, MAX_COLUMNS=3, numSites>MAX_TILE_COUNT, numBlacklisted=0 @Test @SmallTest - public void testTileQuantityDenseRightTooManyTiles() throws Exception { + public void testTileQuantityDenseRightTooManyTiles() { runTileQuantityTest(15, 0, false, 3, 9); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java index 5cdbb24..1f01efe 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java
@@ -77,7 +77,7 @@ new ChromeActivityTestRule<>(ChromeActivity.class); private Pair<ExploreSitesCategoryCardView, ExploreSitesCategory> initializeCategoryAndView( - int numSitesTotal, int numBlacklisted) throws Exception { + int numSitesTotal, int numBlacklisted) { ExploreSitesCategory category = createSyntheticCategory(numSitesTotal, numBlacklisted); ArrayList<ExploreSitesCategory> catalog = new ArrayList<>(); @@ -104,7 +104,7 @@ // package-private helper for running a tile quantity render tests. void runTileQuantityTest(int numSitesTotal, int numBlacklisted, boolean incompleteAllowed, - int expectedMaxRows, int expectedTilesToDisplay) throws Exception { + int expectedMaxRows, int expectedTilesToDisplay) { Pair<ExploreSitesCategoryCardView, ExploreSitesCategory> categoryState = initializeCategoryAndView(numSitesTotal, numBlacklisted); @@ -125,72 +125,72 @@ // Covers: IS_DENSE=false, MAX_ROWS=2, MAX_COLUMNS=4, numSites=MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - @CommandLineFlags.Add({"enable-features=ExploreSites<FakeStudyName", - "force-fieldtrials=FakeStudyName/Enabled", + @CommandLineFlags. + Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile/" + "denseVariation/original"}) public void - testTileQuantityOriginalPerfectRow() throws Exception { + testTileQuantityOriginalPerfectRow() { runTileQuantityTest(4, 0, false, 1, 4); } // Covers: IS_DENSE=false, MAX_ROWS=2, MAX_COLUMNS=4, numSites>MAX_COLUMNS, numBlacklisted=0 @Test @SmallTest - @CommandLineFlags.Add({"enable-features=ExploreSites<FakeStudyName", - "force-fieldtrials=FakeStudyName/Enabled", + @CommandLineFlags. + Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile/" + "denseVariation/original"}) public void - testTileQuantityOriginalImperfectRow() throws Exception { + testTileQuantityOriginalImperfectRow() { runTileQuantityTest(5, 0, false, 1, 4); } // Covers: IS_DENSE=false, MAX_ROWS=2, MAX_COLUMNS=4, numSites=MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - @CommandLineFlags.Add({"enable-features=ExploreSites<FakeStudyName", - "force-fieldtrials=FakeStudyName/Enabled", + @CommandLineFlags. + Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile/" + "denseVariation/original"}) public void - testTileQuantityOriginalPerfectRowAfterBlacklisted() throws Exception { + testTileQuantityOriginalPerfectRowAfterBlacklisted() { runTileQuantityTest(5, 1, false, 1, 4); } // Covers: IS_DENSE=false, MAX_ROWS=2, MAX_COLUMNS=4, numSites>MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - @CommandLineFlags.Add({"enable-features=ExploreSites<FakeStudyName", - "force-fieldtrials=FakeStudyName/Enabled", + @CommandLineFlags. + Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile/" + "denseVariation/original"}) public void - testTileQuantityOriginalImperfectRowAfterBlacklisted() throws Exception { + testTileQuantityOriginalImperfectRowAfterBlacklisted() { runTileQuantityTest(8, 2, false, 2, 6); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=4, numSites<MAX_COLUMNS, numBlacklisted>0 @Test @SmallTest - @CommandLineFlags.Add({"enable-features=ExploreSites<FakeStudyName", - "force-fieldtrials=FakeStudyName/Enabled", + @CommandLineFlags. + Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile/" + "denseVariation/original"}) public void - testTileQuantityOriginalTooFewTilesAfterBlacklisted() throws Exception { + testTileQuantityOriginalTooFewTilesAfterBlacklisted() { runTileQuantityTest(5, 4, false, 1, 1); } // Covers: IS_DENSE=true, MAX_ROWS=2, MAX_COLUMNS=4, numSites>MAX_TILE_COUNT, numBlacklisted=0 @Test @SmallTest - @CommandLineFlags.Add({"enable-features=ExploreSites<FakeStudyName", - "force-fieldtrials=FakeStudyName/Enabled", + @CommandLineFlags. + Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile/" + "denseVariation/original"}) public void - testTileQuantityOriginalTooManyTiles() throws Exception { + testTileQuantityOriginalTooManyTiles() { runTileQuantityTest(15, 0, false, 2, 8); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java index cd542d76..bc59f29b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java
@@ -102,7 +102,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { ExploreSitesBridge.setCatalogForTesting(getTestingCatalog()); mActivityTestRule.startMainActivityWithURL("about:blank"); @@ -116,7 +116,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { ExploreSitesBridge.setCatalogForTesting(null); } @@ -224,7 +224,7 @@ @SmallTest @Feature({"ExploreSites"}) @Features.EnableFeatures(ChromeFeatureList.EXPLORE_SITES) - public void testRecordTimestamp() throws Exception { + public void testRecordTimestamp() { int histogramCount = RecordHistogram.getHistogramTotalCountForTesting("ExploreSites.NavBackTime");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java index 108e43f6b..2224d352 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java
@@ -175,7 +175,7 @@ @Test @SmallTest - public void testIsDownload_noSystemDownloadManager() throws Exception { + public void testIsDownload_noSystemDownloadManager() { ExternalNavigationDelegateImpl delegate = new ExternalNavigationDelegateImpl( mActivityTestRule.getActivity().getActivityTab()); Assert.assertTrue("pdf should be a download, no viewer in Android Chrome",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/IntentWithGesturesHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/IntentWithGesturesHandlerTest.java index 5d455d1d..b5f3f03 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/IntentWithGesturesHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/IntentWithGesturesHandlerTest.java
@@ -21,7 +21,7 @@ @RunWith(ChromeJUnit4ClassRunner.class) public class IntentWithGesturesHandlerTest { @After - public void tearDown() throws Exception { + public void tearDown() { IntentWithGesturesHandler.getInstance().clear(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java index bf71b0b..0a4937de 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java
@@ -49,7 +49,6 @@ import org.chromium.net.test.EmbeddedTestServer; import org.chromium.ui.base.PageTransition; -import java.io.UnsupportedEncodingException; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -140,27 +139,26 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } - private void loadUrlAndWaitForIntentUrl(final String url, boolean needClick, - boolean shouldLaunchExternalIntent) throws InterruptedException { + private void loadUrlAndWaitForIntentUrl( + final String url, boolean needClick, boolean shouldLaunchExternalIntent) { loadUrlAndWaitForIntentUrl(url, needClick, false, shouldLaunchExternalIntent, url, true); } private void loadUrlAndWaitForIntentUrl(final String url, boolean needClick, boolean createsNewTab, final boolean shouldLaunchExternalIntent, - final String expectedFinalUrl, final boolean shouldFailNavigation) - throws InterruptedException { + final String expectedFinalUrl, final boolean shouldFailNavigation) { loadUrlAndWaitForIntentUrl(url, needClick, createsNewTab, shouldLaunchExternalIntent, expectedFinalUrl, shouldFailNavigation, null); } private void loadUrlAndWaitForIntentUrl(final String url, boolean needClick, boolean createsNewTab, final boolean shouldLaunchExternalIntent, - final String expectedFinalUrl, final boolean shouldFailNavigation, String clickTargetId) - throws InterruptedException { + final String expectedFinalUrl, final boolean shouldFailNavigation, + String clickTargetId) { final CallbackHelper finishCallback = new CallbackHelper(); final CallbackHelper failCallback = new CallbackHelper(); final CallbackHelper destroyedCallback = new CallbackHelper(); @@ -295,14 +293,14 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationFromTimer() throws InterruptedException { + public void testNavigationFromTimer() { loadUrlAndWaitForIntentUrl(mTestServer.getURL(NAVIGATION_FROM_TIMEOUT_PAGE), false, false); } @Test @SmallTest @RetryOnFailure - public void testNavigationFromTimerInSubFrame() throws InterruptedException { + public void testNavigationFromTimerInSubFrame() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_TIMEOUT_PARENT_FRAME_PAGE), false, false); } @@ -310,14 +308,14 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationFromUserGesture() throws InterruptedException { + public void testNavigationFromUserGesture() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_USER_GESTURE_PAGE), true, true); } @Test @SmallTest - public void testNavigationFromUserGestureInSubFrame() throws InterruptedException { + public void testNavigationFromUserGestureInSubFrame() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_USER_GESTURE_PARENT_FRAME_PAGE), true, true); } @@ -325,7 +323,7 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationFromXHRCallback() throws InterruptedException { + public void testNavigationFromXHRCallback() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_PAGE), true, true); } @@ -333,7 +331,7 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationFromXHRCallbackInSubFrame() throws InterruptedException { + public void testNavigationFromXHRCallbackInSubFrame() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_PARENT_FRAME_PAGE), true, true); } @@ -341,7 +339,7 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationFromXHRCallbackAndShortTimeout() throws InterruptedException { + public void testNavigationFromXHRCallbackAndShortTimeout() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_AND_SHORT_TIMEOUT_PAGE), true, true); @@ -350,7 +348,7 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationFromXHRCallbackAndLongTimeout() throws InterruptedException { + public void testNavigationFromXHRCallbackAndLongTimeout() { loadUrlAndWaitForIntentUrl( mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_AND_LONG_TIMEOUT_PAGE), true, false); @@ -359,8 +357,7 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationWithFallbackURL() - throws InterruptedException, UnsupportedEncodingException { + public void testNavigationWithFallbackURL() { String fallbackUrl = mTestServer.getURL(FALLBACK_LANDING_PATH); String originalUrl = mTestServer.getURL(NAVIGATION_WITH_FALLBACK_URL_PAGE + "?replace_text=" + Base64.encodeToString( @@ -374,8 +371,7 @@ @Test @SmallTest @RetryOnFailure - public void testNavigationWithFallbackURLInSubFrame() - throws InterruptedException, UnsupportedEncodingException { + public void testNavigationWithFallbackURLInSubFrame() { // The replace_text parameters for NAVIGATION_WITH_FALLBACK_URL_PAGE, which is loaded in // the iframe in NAVIGATION_WITH_FALLBACK_URL_PARENT_FRAME_PAGE, have to go through the // embedded test server twice and, as such, have to be base64-encoded twice. @@ -403,7 +399,7 @@ @Test @SmallTest @RetryOnFailure - public void testOpenWindowFromUserGesture() throws InterruptedException { + public void testOpenWindowFromUserGesture() { boolean opensNewTab = !(mActivityTestRule.getActivity().getCurrentTabModel() instanceof SingleTabModel); loadUrlAndWaitForIntentUrl(mTestServer.getURL(OPEN_WINDOW_FROM_USER_GESTURE_PAGE), true, @@ -413,7 +409,7 @@ @Test @SmallTest @RetryOnFailure - public void testOpenWindowFromLinkUserGesture() throws InterruptedException { + public void testOpenWindowFromLinkUserGesture() { boolean opensNewTab = !(mActivityTestRule.getActivity().getCurrentTabModel() instanceof SingleTabModel); loadUrlAndWaitForIntentUrl(mTestServer.getURL(OPEN_WINDOW_FROM_LINK_USER_GESTURE_PAGE), @@ -423,7 +419,7 @@ @Test @SmallTest @RetryOnFailure - public void testOpenWindowFromSvgUserGesture() throws InterruptedException { + public void testOpenWindowFromSvgUserGesture() { boolean opensNewTab = !(mActivityTestRule.getActivity().getCurrentTabModel() instanceof SingleTabModel); loadUrlAndWaitForIntentUrl(mTestServer.getURL(OPEN_WINDOW_FROM_SVG_USER_GESTURE_PAGE), true,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotMonitorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotMonitorTest.java index 16b8a9f..c69bbff 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotMonitorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotMonitorTest.java
@@ -49,7 +49,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mTestScreenshotMonitorDelegate = new TestScreenshotMonitorDelegate(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -66,7 +66,7 @@ @Test @SmallTest @Feature({"FeatureEngagement", "Screenshot"}) - public void testDelegateCalledOnEvent() throws Throwable { + public void testDelegateCalledOnEvent() { startMonitoringOnUiThreadBlocking(); Assert.assertEquals(0, mTestScreenshotMonitorDelegate.screenshotShowUiCount.get()); @@ -82,7 +82,7 @@ @Test @SmallTest @Feature({"FeatureEngagement", "Screenshot"}) - public void testRestartShouldTriggerDelegate() throws Throwable { + public void testRestartShouldTriggerDelegate() { startMonitoringOnUiThreadBlocking(); Assert.assertEquals(0, mTestScreenshotMonitorDelegate.screenshotShowUiCount.get()); @@ -105,7 +105,7 @@ @Test @SmallTest @Feature({"FeatureEngagement", "Screenshot"}) - public void testStopMonitoringShouldNotTriggerDelegate() throws Throwable { + public void testStopMonitoringShouldNotTriggerDelegate() { startMonitoringOnUiThreadBlocking(); Assert.assertEquals(0, mTestScreenshotMonitorDelegate.screenshotShowUiCount.get()); @@ -121,7 +121,7 @@ @Test @SmallTest @Feature({"FeatureEngagement", "Screenshot"}) - public void testNoMonitoringShouldNotTriggerDelegate() throws Throwable { + public void testNoMonitoringShouldNotTriggerDelegate() { Assert.assertEquals(0, mTestScreenshotMonitorDelegate.screenshotShowUiCount.get()); mContentObserver.onChange(true, TEST_URI);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedAppLifecycleTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedAppLifecycleTest.java index 138a71e..4b75dd0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedAppLifecycleTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedAppLifecycleTest.java
@@ -134,8 +134,7 @@ @Test @SmallTest @Feature({"Feed"}) - public void testActivityStateChangesIncrementStateCounters() - throws InterruptedException, TimeoutException { + public void testActivityStateChangesIncrementStateCounters() throws TimeoutException { verifyHistogram(mHistogramAppLifecycleEvents, AppLifecycleEvent.ENTER_BACKGROUND, 0); verify(mAppLifecycleListener, times(1)).onEnterForeground(); signalActivityStop(mActivity); @@ -151,7 +150,7 @@ @SmallTest @Feature({"Feed"}) @EnableFeatures({ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS}) - public void testNtpOpeningTriggersInitializeOnlyOnce() throws InterruptedException { + public void testNtpOpeningTriggersInitializeOnlyOnce() { // We open to about:blank initially so we shouldn't have called initialize() yet. verify(mAppLifecycleListener, times(0)).initialize(); mActivityTestRule.loadUrl(UrlConstants.NTP_URL); @@ -256,8 +255,7 @@ @Test @SmallTest @Feature({"Feed"}) - public void testSecondWindowDoesNotTriggerForegroundOrBackground() - throws InterruptedException, TimeoutException { + public void testSecondWindowDoesNotTriggerForegroundOrBackground() throws TimeoutException { verify(mAppLifecycleListener, times(1)).onEnterForeground(); MultiWindowUtils.getInstance().setIsInMultiWindowModeForTesting(true); @@ -282,7 +280,7 @@ @SmallTest @Feature({"Feed"}) @EnableFeatures({ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS}) - public void testMultiWindowDoesNotCauseMultipleInitialize() throws InterruptedException { + public void testMultiWindowDoesNotCauseMultipleInitialize() { mActivityTestRule.loadUrl(UrlConstants.NTP_URL); verify(mAppLifecycleListener, times(1)).initialize(); @@ -296,8 +294,7 @@ @Test @SmallTest @Feature({"Feed"}) - public void testResumeTriggersSchedulerForegrounded() - throws InterruptedException, TimeoutException { + public void testResumeTriggersSchedulerForegrounded() throws TimeoutException { verify(mFeedScheduler, times(1)).onForegrounded(); signalActivityResume(mActivity); verify(mFeedScheduler, times(2)).onForegrounded(); @@ -364,23 +361,20 @@ verify(mAppLifecycleListener, times(0)).initialize(); } - private void signalActivityStart(Activity activity) - throws InterruptedException, TimeoutException { + private void signalActivityStart(Activity activity) throws TimeoutException { signalActivityState(activity, ActivityState.STARTED); } - private void signalActivityResume(Activity activity) - throws InterruptedException, TimeoutException { + private void signalActivityResume(Activity activity) throws TimeoutException { signalActivityState(activity, ActivityState.RESUMED); } - private void signalActivityStop(Activity activity) - throws InterruptedException, TimeoutException { + private void signalActivityStop(Activity activity) throws TimeoutException { signalActivityState(activity, ActivityState.STOPPED); } private void signalActivityState(final Activity activity, - final @ActivityState int activityState) throws InterruptedException, TimeoutException { + final @ActivityState int activityState) throws TimeoutException { final CallbackHelper waitForStateChangeHelper = new CallbackHelper(); PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { ApplicationStatus.onStateChangeForTesting(activity, activityState);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedContentStorageConformanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedContentStorageConformanceTest.java index 62b05d2b..dd047ed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedContentStorageConformanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedContentStorageConformanceTest.java
@@ -73,7 +73,7 @@ public final ChromeBrowserTestRule mRule = new ChromeBrowserTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { // storage is declared and tested in ContentStorageConformanceTest. storage = new ContentStorageWrapper(Profile.getLastUsedProfile());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedJournalStorageConformanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedJournalStorageConformanceTest.java index 6153931..57e6670 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedJournalStorageConformanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedJournalStorageConformanceTest.java
@@ -83,7 +83,7 @@ public final ChromeBrowserTestRule mRule = new ChromeBrowserTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { // journalStorage is declared and tested in JournalStorageConformanceTest. journalStorage = new JournalStorageWrapper(Profile.getLastUsedProfile());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNetworkBridgeConformanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNetworkBridgeConformanceTest.java index bc911d2..d23c59e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNetworkBridgeConformanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNetworkBridgeConformanceTest.java
@@ -109,7 +109,7 @@ networkClient = null; } - private void createAndStartTestServer() throws InterruptedException { + private void createAndStartTestServer() { Context c = InstrumentationRegistry.getContext(); mTestServer = EmbeddedTestServer.createAndStartServer(c); } @@ -120,7 +120,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { createAndStartTestServer(); TestThreadUtils.runOnUiThreadBlocking(() -> createNetworkClient()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageTest.java index d6d3ef5..d565874 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageTest.java
@@ -100,7 +100,7 @@ private List<SiteSuggestion> mSiteSuggestions; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityWithURL("about:blank"); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedSchedulerBridgeConformanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedSchedulerBridgeConformanceTest.java index 439e43d..697433b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedSchedulerBridgeConformanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/FeedSchedulerBridgeConformanceTest.java
@@ -64,7 +64,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { // The scheduler is declared and tested in SchedulerConformanceTest. scheduler = new FeedSchedulerBridge(Profile.getLastUsedProfile()); if (mUseRequestManager) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/tooltip/FeedTooltipTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/tooltip/FeedTooltipTest.java index d91ed3d..bb8171c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feed/tooltip/FeedTooltipTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feed/tooltip/FeedTooltipTest.java
@@ -87,7 +87,7 @@ private RecyclerView.Adapter mRecyclerViewAdapter; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityWithURL("about:blank"); mActivityTestRule.loadUrl(UrlConstants.NTP_URL); final Tab tab = mActivityTestRule.getActivity().getActivityTab();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feedback/ConnectivityCheckerTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feedback/ConnectivityCheckerTestRule.java index e0eeaed..3eca831 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feedback/ConnectivityCheckerTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feedback/ConnectivityCheckerTestRule.java
@@ -59,7 +59,7 @@ return mGeneratedSlowUrl; } - private void setUp() throws Exception { + private void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mGenerated200Url = mTestServer.getURL("/echo?status=200"); mGenerated204Url = mTestServer.getURL("/echo?status=204"); @@ -68,7 +68,7 @@ mGeneratedSlowUrl = mTestServer.getURL("/slow?5"); } - private void tearDown() throws Exception { + private void tearDown() { mTestServer.stopAndDestroyServer(); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/findinpage/FindTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/findinpage/FindTest.java index fd724c71..17f55c8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/findinpage/FindTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/findinpage/FindTest.java
@@ -71,7 +71,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) mTestServer.stopAndDestroyServer(); } @@ -95,9 +95,8 @@ /** * Find in page by invoking the 'find in page' menu item. * - * @throws InterruptedException */ - private void findInPageFromMenu() throws InterruptedException { + private void findInPageFromMenu() { MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), R.id.find_in_page_id); @@ -118,8 +117,7 @@ }); } - private String findStringInPage(final String query, String expectedResult) - throws InterruptedException { + private String findStringInPage(final String query, String expectedResult) { findInPageFromMenu(); // FindToolbar should automatically get focus. final TextView findQueryText = getFindQueryText(); @@ -139,8 +137,7 @@ return waitForFindResults(expectedResult); } - private void loadTestAndVerifyFindInPage(String query, String expectedResult) - throws InterruptedException { + private void loadTestAndVerifyFindInPage(String query, String expectedResult) { mActivityTestRule.loadUrl(mTestServer.getURL(FILEPATH)); String findResults = findStringInPage(query, expectedResult); Assert.assertTrue("Expected: " + expectedResult + " Got: " + findResults @@ -169,7 +166,7 @@ @MediumTest @Feature({"FindInPage", "Main"}) @RetryOnFailure - public void testFind() throws InterruptedException { + public void testFind() { loadTestAndVerifyFindInPage("pitts", "1/7"); } @@ -180,7 +177,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFind101() throws InterruptedException { + public void testFind101() { loadTestAndVerifyFindInPage("it", "1/101"); } @@ -191,7 +188,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFindMultiLine() throws InterruptedException { + public void testFindMultiLine() { String multiLineSearchTerm = "This is the text of this document.\n" + " I am going to write the word \'Pitts\' 7 times. (That was one.)"; loadTestAndVerifyFindInPage(multiLineSearchTerm, "1/1"); @@ -205,7 +202,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFindMultiLineFalse() throws InterruptedException { + public void testFindMultiLineFalse() { String multiLineSearchTerm = "aThis is the text of this document.\n" + " I am going to write the word \'Pitts\' 7 times. (That was one.)"; loadTestAndVerifyFindInPage(multiLineSearchTerm, "0/0"); @@ -218,7 +215,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFindNext() throws InterruptedException { + public void testFindNext() { String query = "pitts"; loadTestAndVerifyFindInPage(query, "1/7"); // TODO(jaydeepmehta): Verify number of results and match against boxes drawn. @@ -239,7 +236,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFindNextPrevious() throws InterruptedException { + public void testFindNextPrevious() { String query = "pitts"; loadTestAndVerifyFindInPage(query, "1/7"); // TODO(jaydeepmehta): Verify number of results and match against boxes drawn. @@ -258,7 +255,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFullscreen() throws InterruptedException { + public void testFullscreen() { loadTestAndVerifyFindInPage("pitts", "1/7"); Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -275,7 +272,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testResultsBarInitiallyVisible() throws InterruptedException { + public void testResultsBarInitiallyVisible() { mActivityTestRule.loadUrl(mTestServer.getURL(FILEPATH)); findInPageFromMenu(); final FindToolbar findToolbar = getFindToolbar(); @@ -288,7 +285,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testResultsBarVisibleAfterTypingText() throws InterruptedException { + public void testResultsBarVisibleAfterTypingText() { mActivityTestRule.loadUrl(mTestServer.getURL(FILEPATH)); findInPageFromMenu(); final FindToolbar findToolbar = getFindToolbar(); @@ -311,7 +308,7 @@ @Test @MediumTest @Feature({"FindInPage"}) - public void testFindDismissOnEmptyString() throws InterruptedException { + public void testFindDismissOnEmptyString() { mActivityTestRule.loadUrl(mTestServer.getURL(FILEPATH)); findInPageFromMenu(); @@ -338,7 +335,7 @@ @SmallTest @Feature({"FindInPage"}) @RetryOnFailure - public void testFindNextPreviousIncognitoTab() throws InterruptedException { + public void testFindNextPreviousIncognitoTab() { String query = "pitts"; mActivityTestRule.newIncognitoTabFromMenu(); loadTestAndVerifyFindInPage(query, "1/7"); @@ -382,7 +379,7 @@ @SmallTest @Feature({"FindInPage"}) @RetryOnFailure - public void testPastedTextStylingRemoved() throws InterruptedException { + public void testPastedTextStylingRemoved() { mActivityTestRule.loadUrl(mTestServer.getURL(FILEPATH)); findInPageFromMenu(); @@ -417,7 +414,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testBackKeyDoesNotDismissFindWhenImeIsPresent() throws InterruptedException { + public void testBackKeyDoesNotDismissFindWhenImeIsPresent() { mActivityTestRule.loadUrl(mTestServer.getURL(FILEPATH)); findInPageFromMenu(); final TextView findQueryText = getFindQueryText(); @@ -440,7 +437,7 @@ @MediumTest @Feature({"FindInPage"}) @RetryOnFailure - public void testBackKeyDismissesFind() throws InterruptedException { + public void testBackKeyDismissesFind() { loadTestAndVerifyFindInPage("pitts", "1/7"); waitForIME(true); // Hide IME by clicking next button from find tool bar.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java index 88189c8..8b157e2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java
@@ -54,12 +54,12 @@ private Activity mActivity; @Before - public void setUp() throws Exception { + public void setUp() { FirstRunActivity.setObserverForTest(mTestObserver); } @After - public void tearDown() throws Exception { + public void tearDown() { if (mActivity != null) mActivity.finish(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java index ea6e69e..0adad2c2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java
@@ -139,7 +139,7 @@ + "</html>"); @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking( () -> TabStateBrowserControlsVisibilityDelegate.disablePageLoadDelayForTests()); } @@ -147,7 +147,7 @@ @Test @MediumTest @Feature({"Fullscreen"}) - public void testTogglePersistentFullscreen() throws InterruptedException { + public void testTogglePersistentFullscreen() { mActivityTestRule.startMainActivityWithURL(LONG_HTML_TEST_PAGE); Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -198,7 +198,7 @@ @Test @LargeTest @Feature({"Fullscreen"}) - public void testExitPersistentFullscreenAllowsManualFullscreen() throws InterruptedException { + public void testExitPersistentFullscreenAllowsManualFullscreen() { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(LONG_FULLSCREEN_API_HTML_TEST_PAGE); @@ -230,7 +230,7 @@ //@LargeTest //@Feature({"Fullscreen"}) @DisabledTest(message = "crbug.com/901280") - public void testManualHidingShowingBrowserControls() throws InterruptedException { + public void testManualHidingShowingBrowserControls() { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(LONG_HTML_TEST_PAGE); @@ -251,7 +251,7 @@ //@LargeTest //@RetryOnFailure @DisabledTest(message = "crbug.com/901280") - public void testHideBrowserControlsAfterFlingBoosting() throws InterruptedException { + public void testHideBrowserControlsAfterFlingBoosting() { // Test that fling boosting doesn't break the scroll state management // that's used by the FullscreenManager to dispatch URL bar based // resizes to the renderer. @@ -348,8 +348,7 @@ @LargeTest @Feature({"Fullscreen"}) @Features.DisableFeatures({ChromeFeatureList.OFFLINE_INDICATOR}) - public void testHidingBrowserControlsRemovesSurfaceFlingerOverlay() - throws InterruptedException { + public void testHidingBrowserControlsRemovesSurfaceFlingerOverlay() { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(LONG_HTML_TEST_PAGE); @@ -405,7 +404,7 @@ @LargeTest @Feature({"Fullscreen"}) @DisabledTest(message = "Flaky. crbug.com/936252") - public void testManualFullscreenDisabledForChromePages() throws InterruptedException { + public void testManualFullscreenDisabledForChromePages() { FullscreenManagerTestUtils.disableBrowserOverrides(); // The credits page was chosen as it is a chrome:// page that is long and would support // manual fullscreen if it were supported. @@ -433,7 +432,7 @@ @Test @LargeTest @Feature({"Fullscreen"}) - public void testControlsShownOnUnresponsiveRenderer() throws InterruptedException { + public void testControlsShownOnUnresponsiveRenderer() { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(LONG_HTML_TEST_PAGE); @@ -494,8 +493,7 @@ */ @Test @DisabledTest(message = "crbug.com/698413") - public void testBrowserControlsShownWhenInputIsFocused() - throws InterruptedException, TimeoutException { + public void testBrowserControlsShownWhenInputIsFocused() throws TimeoutException { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(LONG_HTML_WITH_AUTO_FOCUS_INPUT_TEST_PAGE); @@ -528,7 +526,7 @@ @LargeTest @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT) @Feature({"Fullscreen"}) - public void testPersistentFullscreenWithOptions() throws InterruptedException { + public void testPersistentFullscreenWithOptions() { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(LONG_FULLSCREEN_API_HTML_WITH_OPTIONS_TEST_PAGE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTestUtils.java index 83360ff..6dcef438 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTestUtils.java
@@ -106,7 +106,7 @@ * @param tab The current activity tab. */ public static void waitForBrowserControlsToBeMoveable( - ChromeActivityTestRule testRule, final Tab tab) throws InterruptedException { + ChromeActivityTestRule testRule, final Tab tab) { waitForBrowserControlsPosition(testRule, 0); final CallbackHelper contentMovedCallback = new CallbackHelper();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/gcore/MockConnectedTaskTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/gcore/MockConnectedTaskTest.java index 9d49dac..5723e2ad 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/gcore/MockConnectedTaskTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/gcore/MockConnectedTaskTest.java
@@ -21,7 +21,7 @@ private MockConnectedTask<MockChromeGoogleApiClient> mTask; @Before - public void setUp() throws Exception { + public void setUp() { mClient = new MockChromeGoogleApiClient(); mTask = new MockConnectedTask<>(mClient); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java index 4252f510..19a1644 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java
@@ -34,8 +34,6 @@ import org.chromium.content_public.common.ContentUrlConstants; import org.chromium.net.test.EmbeddedTestServer; -import java.util.concurrent.TimeoutException; - /** * Tests {@link NavigationHandler} navigating back/forward using overscroll history navigation. * TODO(jinsukkim): Add more tests (right swipe, tab switcher, etc). @@ -66,7 +64,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) mTestServer.stopAndDestroyServer(); } @@ -74,13 +72,12 @@ return mActivityTestRule.getActivity().getActivityTabProvider().get(); } - private void loadNewTabPage() throws InterruptedException, TimeoutException { + private void loadNewTabPage() { ChromeTabUtils.newTabFromMenu(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), false, true); } - private void assertNavigateOnSwipeFrom(boolean edge, String toUrl) - throws InterruptedException, TimeoutException { + private void assertNavigateOnSwipeFrom(boolean edge, String toUrl) { ChromeTabUtils.waitForTabPageLoaded(currentTab(), toUrl, () -> swipeFromEdge(edge), 10); CriteriaHelper.pollUiThread(Criteria.equals(toUrl, () -> currentTab().getUrl())); Assert.assertEquals("Didn't navigate back", toUrl, currentTab().getUrl()); @@ -105,7 +102,7 @@ @Test @SmallTest - public void testCloseChromeAtHistoryStackHead() throws InterruptedException, TimeoutException { + public void testCloseChromeAtHistoryStackHead() { loadNewTabPage(); final Activity activity = mActivityTestRule.getActivity(); swipeFromEdge(LEFT_EDGE); @@ -117,8 +114,7 @@ @Test @SmallTest - public void testLeftSwipeNavigateBackOnNativePage() - throws InterruptedException, TimeoutException { + public void testLeftSwipeNavigateBackOnNativePage() { ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), UrlConstants.RECENT_TABS_URL, false); @@ -127,8 +123,7 @@ @Test @SmallTest - public void testRightSwipeNavigateForwardOnNativePage() - throws InterruptedException, TimeoutException { + public void testRightSwipeNavigateForwardOnNativePage() { ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), UrlConstants.RECENT_TABS_URL, false); @@ -139,8 +134,7 @@ @Test @SmallTest @RetryOnFailure - public void testLeftSwipeNavigateBackOnRenderedPage() - throws InterruptedException, TimeoutException { + public void testLeftSwipeNavigateBackOnRenderedPage() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), mTestServer.getURL(RENDERED_PAGE), false); @@ -150,8 +144,7 @@ @Test @SmallTest - public void testRightSwipeNavigateForwardOnRenderedPage() - throws InterruptedException, TimeoutException { + public void testRightSwipeNavigateForwardOnRenderedPage() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), mTestServer.getURL(RENDERED_PAGE), false);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationSheetTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationSheetTest.java index 1207ab1..856f7a7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationSheetTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationSheetTest.java
@@ -152,7 +152,7 @@ "force-fieldtrial-params=GestureNavigation.Enabled:" + "overscroll_history_navigation_bottom_sheet/true"}) public void - testLongPressBackTriggering() throws ExecutionException { + testLongPressBackTriggering() { KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); ChromeTabbedActivity activity = mActivityTestRule.getActivity(); TestThreadUtils.runOnUiThreadBlocking(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java index d24eee8a..30a45968 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java
@@ -28,13 +28,13 @@ private static final String PERMISSION = "permission.you.dont.have"; @Before - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); } @Test(expected = AssertionError.class) @SmallTest - public void testReceivesBroadcastIntents() throws Exception { + public void testReceivesBroadcastIntents() { final Context context = InstrumentationRegistry.getTargetContext(); BroadcastReceiver receiver = new GSAAccountChangeListener.AccountChangeBroadcastReceiver(); context.registerReceiver(receiver,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/ToastHWATest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/ToastHWATest.java index 2fc49d6..61c9013 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/ToastHWATest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/ToastHWATest.java
@@ -62,7 +62,7 @@ private static final String[] TEST_FILES = {IMAGE_NAME}; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(true)); mDownloadTestRule.deleteFilesInDownloadDirectory(TEST_FILES); @@ -70,7 +70,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> FirstRunStatus.setFirstRunFlowComplete(false)); mTestServer.stopAndDestroyServer(); @@ -87,7 +87,7 @@ @SmallTest @CommandLineFlags.Add(BaseSwitches.ENABLE_LOW_END_DEVICE_MODE) @FlakyTest(message = "crbug.com/668217") - public void testNoRenderThread() throws Exception { + public void testNoRenderThread() { Utils.assertNoRenderThread(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/WebappActivityHWATest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/WebappActivityHWATest.java index 64b0573..c0243e2f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/WebappActivityHWATest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/hardware_acceleration/WebappActivityHWATest.java
@@ -27,7 +27,7 @@ public final WebappActivityTestRule mActivityTestRule = new WebappActivityTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startWebappActivity(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java index 94b4366..84b9378 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
@@ -172,7 +172,7 @@ SigninTestUtil.tearDownAuthForTest(); } - private void launchHistoryActivity() throws Exception { + private void launchHistoryActivity() { HistoryActivity activity = mActivityTestRule.launchActivity(null); mHistoryManager = activity.getHistoryManagerForTests(); mAdapter = mHistoryManager.getAdapterForTests(); @@ -521,7 +521,7 @@ @Test @SmallTest - public void testInvisibleHeader() throws Exception { + public void testInvisibleHeader() { Assert.assertTrue(mAdapter.hasListHeader()); // Not sign in and set clear browsing data button to invisible
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryAdapterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryAdapterTest.java index 7bef315..aef757ff 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryAdapterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryAdapterTest.java
@@ -30,7 +30,7 @@ private HistoryAdapter mAdapter; @Before - public void setUp() throws Exception { + public void setUp() { mHistoryProvider = new StubbedHistoryProvider(); mAdapter = new HistoryAdapter(new SelectionDelegate<HistoryItem>(), null, mHistoryProvider); mAdapter.generateHeaderItemsForTest(); @@ -201,7 +201,7 @@ @Test @SmallTest - public void testOnHistoryDeleted() throws Exception { + public void testOnHistoryDeleted() { Date today = new Date(); long timestamp = today.getTime(); HistoryItem item1 = StubbedHistoryProvider.createHistoryItem(0, timestamp);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/identity/UuidBasedUniqueIdentificationGeneratorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/identity/UuidBasedUniqueIdentificationGeneratorTest.java index 21e727f..13a7368 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/identity/UuidBasedUniqueIdentificationGeneratorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/identity/UuidBasedUniqueIdentificationGeneratorTest.java
@@ -23,7 +23,7 @@ private AdvancedMockContext mContext; @Before - public void setUp() throws Exception { + public void setUp() { mContext = new AdvancedMockContext(InstrumentationRegistry.getTargetContext()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoNotificationServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoNotificationServiceTest.java index 4874c52..0f128a9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoNotificationServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoNotificationServiceTest.java
@@ -73,7 +73,7 @@ CriteriaHelper.pollUiThread(Criteria.equals(2, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return mActivityTestRule.getActivity() .getTabModelSelector() .getModel(true) @@ -84,7 +84,7 @@ final Profile incognitoProfile = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Profile>() { @Override - public Profile call() throws Exception { + public Profile call() { return mActivityTestRule.getActivity() .getTabModelSelector() .getModel(true) @@ -100,7 +100,7 @@ CriteriaHelper.pollUiThread(Criteria.equals(0, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return mActivityTestRule.getActivity() .getTabModelSelector() .getModel(true) @@ -163,7 +163,7 @@ CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { File[] tabbedModeFiles = tabbedModeDirectory.getDataDirectory().listFiles(); if (tabbedModeFiles == null) return 0; int incognitoCount = 0; @@ -178,7 +178,7 @@ CriteriaHelper.pollInstrumentationThread(Criteria.equals(2, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { File[] tabbedModeFiles = tabbedModeDirectory.getDataDirectory().listFiles(); if (tabbedModeFiles == null) return 0; int normalCount = 0;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java index 3450e35..462664c7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java
@@ -97,7 +97,7 @@ @Test @MediumTest @Feature("InfoBars") - public void testFramebustBlockInfoBarUrlTapped() throws TimeoutException, InterruptedException { + public void testFramebustBlockInfoBarUrlTapped() throws TimeoutException { String url = "http://very.evil.biz"; CallbackHelper callbackHelper = new CallbackHelper(); @@ -130,8 +130,7 @@ @Test @MediumTest @Feature("InfoBars") - public void testFramebustBlockInfoBarButtonTapped() - throws TimeoutException, InterruptedException { + public void testFramebustBlockInfoBarButtonTapped() { String url = "http://very.evil.biz"; TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -159,15 +158,14 @@ @Test @MediumTest @Feature({"InfoBars", "UiCatalogue"}) - public void testOomInfoBar() throws TimeoutException, InterruptedException { + public void testOomInfoBar() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking( () -> InfoBarContainer.get(mTab).addInfoBarForTesting(new NearOomInfoBar())); mListener.addInfoBarAnimationFinished("InfoBar was not added."); mScreenShooter.shoot("oom_infobar"); } - private void captureMiniAndRegularInfobar(InfoBar infobar) - throws TimeoutException, InterruptedException { + private void captureMiniAndRegularInfobar(InfoBar infobar) throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking( () -> InfoBarContainer.get(mTab).addInfoBarForTesting(infobar)); mListener.addInfoBarAnimationFinished("InfoBar was not added.");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java index a62c507e..02477d9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java
@@ -98,13 +98,12 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } // Adds an infobar to the currrent tab. Blocks until the infobar has been added. - private TestListener addInfoBarToCurrentTab(final boolean expires) - throws InterruptedException, TimeoutException { + private TestListener addInfoBarToCurrentTab(final boolean expires) throws TimeoutException { List<InfoBar> infoBars = mActivityTestRule.getInfoBars(); int previousCount = infoBars.size();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarControlLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarControlLayoutTest.java index 61bc51c..87859d5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarControlLayoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarControlLayoutTest.java
@@ -42,7 +42,7 @@ public UiThreadTestRule mRule = new UiThreadTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); mContext.setTheme(R.style.Theme_Chromium_WithWindowAnimation); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java index 336d89b..fe73f177 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java
@@ -135,7 +135,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) { mTestServer.stopAndDestroyServer(); } @@ -228,7 +228,7 @@ @MediumTest @Feature({"Browser", "Main"}) @DisabledTest(message = "crbug.com/593003") - public void testInfoBarForPopUp() throws InterruptedException, TimeoutException { + public void testInfoBarForPopUp() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(POPUP_PAGE)); mListener.addInfoBarAnimationFinished("InfoBar not added"); @@ -253,8 +253,7 @@ @MediumTest @Feature({"Browser"}) @RetryOnFailure - public void testInfoBarForGeolocationDisappearsOnBack() - throws InterruptedException, TimeoutException { + public void testInfoBarForGeolocationDisappearsOnBack() throws TimeoutException { LocationSettingsTestUtil.setSystemLocationSettingEnabled(true); mActivityTestRule.loadUrl(HELLO_WORLD_URL); mActivityTestRule.loadUrl(mTestServer.getURL(POPUP_PAGE)); @@ -458,7 +457,7 @@ @MediumTest @Feature({"Browser", "Main"}) @RetryOnFailure - public void testInfoBarForHungRenderer() throws InterruptedException, TimeoutException { + public void testInfoBarForHungRenderer() throws TimeoutException { mActivityTestRule.loadUrl(HELLO_WORLD_URL); // Fake an unresponsive renderer signal. @@ -495,8 +494,7 @@ @MediumTest @Feature({"Browser", "Main"}) @RetryOnFailure - public void testInfoBarForHungRendererCanKillRenderer() - throws InterruptedException, TimeoutException { + public void testInfoBarForHungRendererCanKillRenderer() throws TimeoutException { mActivityTestRule.loadUrl(HELLO_WORLD_URL); // Fake an unresponsive renderer signal. @@ -537,8 +535,7 @@ @MediumTest @Feature({"Browser", "Main"}) @RetryOnFailure - public void testInfoBarContainerSwapsWebContents() - throws InterruptedException, TimeoutException { + public void testInfoBarContainerSwapsWebContents() throws TimeoutException { // Add an infobar. LocationSettingsTestUtil.setSystemLocationSettingEnabled(true); mActivityTestRule.loadUrl(mTestServer.getURL(POPUP_PAGE));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfobarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfobarTest.java index e9844c2d..ca02fbc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfobarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfobarTest.java
@@ -64,7 +64,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -73,7 +73,7 @@ @Test @MediumTest public void testInfobarShutsDownCleanlyForGeolocation() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); @@ -110,7 +110,7 @@ final WebContents webContents = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<WebContents>() { @Override - public WebContents call() throws Exception { + public WebContents call() { return mActivityTestRule.getActivity() .getActivityTab() .getWebContents();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java index 09a0499d..d0f2529 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java
@@ -56,14 +56,14 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) mTestServer.stopAndDestroyServer(); } @Test @SmallTest @Feature({"Browser", "Main"}) - public void testInfoBarAppears() throws InterruptedException, TimeoutException { + public void testInfoBarAppears() throws TimeoutException { SearchGeolocationDisclosureTabHelper.setIgnoreUrlChecksForTesting(); Assert.assertEquals( "Wrong starting infobar count", 0, mActivityTestRule.getInfoBars().size()); @@ -139,7 +139,7 @@ @Test @SmallTest @Feature({"Browser", "Main"}) - public void testInfoBarDismiss() throws InterruptedException, TimeoutException { + public void testInfoBarDismiss() throws TimeoutException { SearchGeolocationDisclosureTabHelper.setIgnoreUrlChecksForTesting(); Assert.assertEquals( "Wrong starting infobar count", 0, mActivityTestRule.getInfoBars().size()); @@ -172,7 +172,7 @@ @Test @SmallTest @Feature({"Browser", "Main"}) - public void testNoInfoBarForRandomUrl() throws InterruptedException, TimeoutException { + public void testNoInfoBarForRandomUrl() { Assert.assertEquals( "Wrong starting infobar count", 0, mActivityTestRule.getInfoBars().size()); @@ -184,7 +184,7 @@ @Test @SmallTest @Feature({"Browser", "Main"}) - public void testNoInfoBarInIncognito() throws InterruptedException, TimeoutException { + public void testNoInfoBarInIncognito() { SearchGeolocationDisclosureTabHelper.setIgnoreUrlChecksForTesting(); mActivityTestRule.newIncognitoTabFromMenu(); Assert.assertEquals(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/init/ChainedTasksTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/init/ChainedTasksTest.java index fc07634d..2609cadb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/init/ChainedTasksTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/init/ChainedTasksTest.java
@@ -197,7 +197,7 @@ @Test @SmallTest - public void testThreadRestrictions() throws Exception { + public void testThreadRestrictions() { ChainedTasks tasks = new ChainedTasks(); tasks.start(false); try {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java index 106fa43d..b1e80fb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java
@@ -88,8 +88,7 @@ @LargeTest @Feature({"Browser"}) @RetryOnFailure - public void testPopupNotClosedByOtherContentView() - throws InterruptedException, Exception, Throwable { + public void testPopupNotClosedByOtherContentView() throws Exception, Throwable { // Load the test page. mActivityTestRule.startMainActivityWithURL(SELECT_URL);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/interstitials/LookalikeInterstitialTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/interstitials/LookalikeInterstitialTest.java index 9bc88faa..8828f61 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/interstitials/LookalikeInterstitialTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/interstitials/LookalikeInterstitialTest.java
@@ -45,13 +45,13 @@ public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); mServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptAppModalDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptAppModalDialogTest.java index 0bcd38b..12f39a8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptAppModalDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptAppModalDialogTest.java
@@ -63,7 +63,7 @@ + "};</script></head></html>"); @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityWithURL(EMPTY_PAGE); } @@ -74,8 +74,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testBeforeUnloadDialog() - throws InterruptedException, TimeoutException, ExecutionException { + public void testBeforeUnloadDialog() throws TimeoutException, ExecutionException { mActivityTestRule.loadUrl(BEFORE_UNLOAD_URL); // JavaScript onbeforeunload dialogs require a user gesture. tapViewAndWait(); @@ -110,8 +109,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testBeforeUnloadOnReloadDialog() - throws InterruptedException, TimeoutException, ExecutionException { + public void testBeforeUnloadOnReloadDialog() throws TimeoutException, ExecutionException { mActivityTestRule.loadUrl(BEFORE_UNLOAD_URL); // JavaScript onbeforeunload dialogs require a user gesture. tapViewAndWait(); @@ -131,8 +129,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testDisableRepeatedDialogs() - throws InterruptedException, TimeoutException, ExecutionException { + public void testDisableRepeatedDialogs() throws TimeoutException, ExecutionException { mActivityTestRule.loadUrl(BEFORE_UNLOAD_URL); // JavaScript onbeforeunload dialogs require a user gesture. tapViewAndWait(); @@ -173,8 +170,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testDialogDismissedAfterClosingTab() - throws InterruptedException, TimeoutException, ExecutionException { + public void testDialogDismissedAfterClosingTab() throws TimeoutException { mActivityTestRule.loadUrl(BEFORE_UNLOAD_URL); // JavaScript onbeforeunload dialogs require a user gesture. tapViewAndWait(); @@ -193,7 +189,7 @@ /** * Taps on a view and waits for a callback. */ - private void tapViewAndWait() throws InterruptedException, TimeoutException { + private void tapViewAndWait() throws TimeoutException { final TapGestureStateListener tapGestureStateListener = new TapGestureStateListener(); int callCount = tapGestureStateListener.getCallCount(); WebContentsUtils.getGestureListenerManager(mActivityTestRule.getWebContents()) @@ -240,7 +236,7 @@ return mCallbackHelper.getCallCount(); } - public void waitForTap(int currentCallCount) throws InterruptedException, TimeoutException { + public void waitForTap(int currentCallCount) throws TimeoutException { mCallbackHelper.waitForCallback(currentCallCount); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialogTest.java index 1531697..770e091 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialogTest.java
@@ -64,7 +64,7 @@ private ChromeTabbedActivity mActivity; @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityWithURL(EMPTY_PAGE); mActivity = mActivityTestRule.getActivity(); } @@ -76,8 +76,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testAlertModalDialog() - throws InterruptedException, TimeoutException, ExecutionException { + public void testAlertModalDialog() throws TimeoutException, ExecutionException { final OnEvaluateJavaScriptResultHelper scriptEvent = executeJavaScriptAndWaitForDialog("alert('Hello Android!');"); @@ -95,8 +94,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testAlertModalDialogWithTwoClicks() - throws InterruptedException, TimeoutException, ExecutionException { + public void testAlertModalDialogWithTwoClicks() throws TimeoutException, ExecutionException { OnEvaluateJavaScriptResultHelper scriptEvent = executeJavaScriptAndWaitForDialog("alert('Hello Android');"); JavascriptTabModalDialog jsDialog = getCurrentDialog(); @@ -119,8 +117,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testConfirmModalDialog() - throws InterruptedException, TimeoutException, ExecutionException { + public void testConfirmModalDialog() throws TimeoutException, ExecutionException { OnEvaluateJavaScriptResultHelper scriptEvent = executeJavaScriptAndWaitForDialog("confirm('Android');"); @@ -156,8 +153,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testPromptModalDialog() - throws InterruptedException, TimeoutException, ExecutionException { + public void testPromptModalDialog() throws TimeoutException, ExecutionException { final String promptText = "Hello Android!"; final OnEvaluateJavaScriptResultHelper scriptEvent = executeJavaScriptAndWaitForDialog("prompt('Android', 'default');"); @@ -183,8 +179,7 @@ @Test @MediumTest @Feature({"Browser", "Main"}) - public void testAlertModalDialogMessageFocus() - throws InterruptedException, TimeoutException, ExecutionException { + public void testAlertModalDialogMessageFocus() throws TimeoutException, ExecutionException { assertScrollViewFocusabilityInAlertDialog("alert('Short message!');", false); // Test on landscape mode so that the message is long enough to make scroll view scrollable @@ -197,9 +192,8 @@ mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } - private void assertScrollViewFocusabilityInAlertDialog( - final String jsAlertScript, final boolean expectedFocusability) - throws InterruptedException, TimeoutException, ExecutionException { + private void assertScrollViewFocusabilityInAlertDialog(final String jsAlertScript, + final boolean expectedFocusability) throws TimeoutException, ExecutionException { final OnEvaluateJavaScriptResultHelper scriptEvent = executeJavaScriptAndWaitForDialog(jsAlertScript);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEngineDialogHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEngineDialogHelperTest.java index 9a4b09a..f6c71d7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEngineDialogHelperTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEngineDialogHelperTest.java
@@ -115,7 +115,7 @@ private @SearchEnginePromoType int mDialogType; @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); mTemplateUrls.clear();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEnginePromoDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEnginePromoDialogTest.java index e8911dd6..a533d31 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEnginePromoDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/DefaultSearchEnginePromoDialogTest.java
@@ -87,14 +87,14 @@ CriteriaHelper.pollUiThread(Criteria.equals(false, new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return searchDialog.isShowing(); } })); CriteriaHelper.pollUiThread(Criteria.equals(true, new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return searchActivity.isFinishing(); } })); @@ -113,7 +113,7 @@ return TestThreadUtils.runOnUiThreadBlocking( new Callable<DefaultSearchEnginePromoDialog>() { @Override - public DefaultSearchEnginePromoDialog call() throws Exception { + public DefaultSearchEnginePromoDialog call() { DefaultSearchEnginePromoDialog dialog = new DefaultSearchEnginePromoDialog( activity, LocaleManager.SearchEnginePromoType.SHOW_EXISTING, null); dialog.show();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerReferralTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerReferralTest.java index d11a50d5..9f361bfe3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerReferralTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerReferralTest.java
@@ -65,7 +65,7 @@ @SmallTest @Test - public void testYandexReferralId() throws InterruptedException, TimeoutException { + public void testYandexReferralId() throws TimeoutException { final CallbackHelper templateUrlServiceLoaded = new CallbackHelper(); TestThreadUtils.runOnUiThreadBlocking(() -> { TemplateUrlService templateUrlService = TemplateUrlServiceFactory.get();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerTest.java index 333b20d9..e5acf72 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/locale/LocaleManagerTest.java
@@ -48,8 +48,7 @@ @Policies.Add({ @Policies.Item(key = "DefaultSearchProviderEnabled", string = "false") }) @SmallTest @Test - public void testShowSearchEnginePromoDseDisabled() - throws InterruptedException, TimeoutException { + public void testShowSearchEnginePromoDseDisabled() throws TimeoutException { final CallbackHelper getShowTypeCallback = new CallbackHelper(); LocaleManager.setInstanceForTest(new LocaleManager() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java index d45eea0..fdb92b3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java
@@ -57,7 +57,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTestServer != null) mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java index b154591..2ad1de4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java
@@ -89,7 +89,7 @@ @Test @SmallTest - public void testFilterURI() throws Exception { + public void testFilterURI() { List<Pair<String, String>> testCases = CollectionUtil.newArrayList( new Pair<>("file:///test.jpg", "file:///test.jpg"), new Pair<>("file:///test.jp!g", "file:///test.jp!g"), @@ -133,7 +133,7 @@ CriteriaHelper.pollUiThread(Criteria.equals(expectedUrl, new Callable<String>() { @Override - public String call() throws Exception { + public String call() { Tab tab = cta.getActivityTab(); if (tab == null) return null;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java index 335f9e9..d07f36b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java
@@ -72,7 +72,7 @@ return mAudioFocusState; } - public void requestAudioFocus(int focusType) throws Exception { + public void requestAudioFocus(int focusType) { int result = getAudioManager().requestAudioFocus( this, AudioManager.STREAM_MUSIC, focusType); if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { @@ -86,14 +86,14 @@ private MockAudioFocusChangeListener mAudioFocusChangeListener; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mAudioFocusChangeListener = new MockAudioFocusChangeListener(); mActivityTestRule.startMainActivityWithURL(mTestServer.getURL(TEST_PATH)); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PauseOnHeadsetUnplugTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PauseOnHeadsetUnplugTest.java index b1d5122..d16c5b0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PauseOnHeadsetUnplugTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PauseOnHeadsetUnplugTest.java
@@ -52,8 +52,7 @@ @Test @SmallTest @RetryOnFailure - public void testPause() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testPause() throws IllegalArgumentException, TimeoutException { Tab tab = mActivityTestRule.getActivity().getActivityTab(); Assert.assertTrue(DOMUtils.isMediaPaused(tab.getWebContents(), VIDEO_ID)); @@ -66,13 +65,13 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mActivityTestRule.startMainActivityWithURL(mTestServer.getURL(TEST_PATH)); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PictureInPictureControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PictureInPictureControllerTest.java index 6e8400a..0dccf55 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PictureInPictureControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/PictureInPictureControllerTest.java
@@ -58,7 +58,7 @@ private ChromeTabbedActivity mActivity; @Before - public void setUp() throws InterruptedException { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer( InstrumentationRegistry.getInstrumentation().getContext()); mActivityTestRule.startMainActivityWithURL(mTestServer.getURL(TEST_PATH));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/BackgroundMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/BackgroundMetricsTest.java index 1ee3e6a..16091f9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/BackgroundMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/BackgroundMetricsTest.java
@@ -42,13 +42,13 @@ @Before public void setUp() {} - private void waitForHistogram(String name, int count) throws Throwable { + private void waitForHistogram(String name, int count) { CriteriaHelper.pollUiThread(() -> { return RecordHistogram.getHistogramTotalCountForTesting(name) >= count; }, "waitForHistogram timeout", 10000, 200); } - public void pressHome() throws Throwable { + public void pressHome() { UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.pressHome(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/MainIntentBehaviorMetricsIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/MainIntentBehaviorMetricsIntegrationTest.java index e8d0b104..8d99b58 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/MainIntentBehaviorMetricsIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/MainIntentBehaviorMetricsIntegrationTest.java
@@ -101,7 +101,7 @@ TabLaunchType.FROM_RESTORE, null)); CriteriaHelper.pollUiThread(Criteria.equals(2, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return mActivityTestRule.getActivity().getTabModelSelector().getTotalTabCount(); } })); @@ -198,7 +198,7 @@ @MediumTest @Test - public void testLaunch_Duration_MoreThan_1Day() throws Exception { + public void testLaunch_Duration_MoreThan_1Day() { long timestamp = System.currentTimeMillis() - 25 * HOURS_IN_MS; ContextUtils.getAppSharedPreferences() .edit() @@ -226,7 +226,7 @@ @MediumTest @Test - public void testLaunch_Duration_LessThan_1Day() throws Exception { + public void testLaunch_Duration_LessThan_1Day() { long timestamp = System.currentTimeMillis() - 12 * HOURS_IN_MS; ContextUtils.getAppSharedPreferences() .edit() @@ -254,7 +254,7 @@ @MediumTest @DisabledTest(message = "crbug.com/879165") @Test - public void testLaunch_From_InAppActivities() throws Exception { + public void testLaunch_From_InAppActivities() { try { MainIntentBehaviorMetrics.setTimeoutDurationMsForTesting(0); long timestamp = System.currentTimeMillis() - 12 * HOURS_IN_MS; @@ -349,7 +349,7 @@ private void assertMainIntentBehavior(Integer expected) { CriteriaHelper.pollUiThread(Criteria.equals(expected, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { MainIntentBehaviorMetrics behaviorMetrics = mActivityTestRule.getActivity().getMainIntentBehaviorMetricsForTesting(); Integer actual = behaviorMetrics.getLastMainIntentBehaviorForTesting();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java index 3d9ab79..efa76ed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java
@@ -56,7 +56,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java index 3ac3aab..0a4ca70 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java
@@ -75,7 +75,7 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws InterruptedException { + public void setUp() { Context appContext = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); @@ -120,7 +120,7 @@ FIRST_CONTENTFUL_PAINT_HISTOGRAM + histogramSuffix)); } - private void startWebApkActivity(final String startUrl) throws InterruptedException { + private void startWebApkActivity(final String startUrl) { Intent intent = new Intent(InstrumentationRegistry.getTargetContext(), WebApkActivity.class); intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, "org.chromium.webapk.test");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/UkmTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/UkmTest.java index f818552..6258d99 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/UkmTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/UkmTest.java
@@ -45,18 +45,18 @@ * Closes the current tab. * @param incognito Whether to close an incognito or non-incognito tab. */ - protected void closeCurrentTab(final boolean incognito) throws InterruptedException { + protected void closeCurrentTab(final boolean incognito) { TestThreadUtils.runOnUiThreadBlocking( () -> mActivityTestRule.getActivity().getTabModelSelector().selectModel(incognito)); ChromeTabUtils.closeCurrentTab( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); } - protected void closeRegularTab() throws InterruptedException { + protected void closeRegularTab() { closeCurrentTab(false); } - protected void closeIncognitoTab() throws InterruptedException { + protected void closeIncognitoTab() { closeCurrentTab(true); } @@ -111,7 +111,7 @@ @Test @SmallTest - public void testIncognitoPlusRegularCheck() throws Exception { + public void testIncognitoPlusRegularCheck() { // Keep in sync with UkmBrowserTest.IncognitoPlusRegularCheck in // chrome/browser/metrics/ukm_browsertest.cc.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowIntegrationTest.java index 114c37f..781e3de 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowIntegrationTest.java
@@ -59,7 +59,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -68,7 +68,7 @@ @Feature("MultiWindow") @TargetApi(Build.VERSION_CODES.N) @CommandLineFlags.Add(ChromeSwitches.DISABLE_TAB_MERGING_FOR_TESTING) - public void testIncognitoNtpHandledCorrectly() throws InterruptedException { + public void testIncognitoNtpHandledCorrectly() { try { TestThreadUtils.runOnUiThreadBlocking( () -> FirstRunStatus.setFirstRunFlowComplete(true)); @@ -82,13 +82,12 @@ final ChromeTabbedActivity2 cta2 = waitForSecondChromeTabbedActivity(); - CriteriaHelper.pollUiThread(Criteria.equals(1, - new Callable<Integer>() { - @Override - public Integer call() throws Exception { - return cta2.getTabModelSelector().getModel(true).getCount(); - } - })); + CriteriaHelper.pollUiThread(Criteria.equals(1, new Callable<Integer>() { + @Override + public Integer call() { + return cta2.getTabModelSelector().getModel(true).getCount(); + } + })); TestThreadUtils.runOnUiThreadBlocking(() -> { Assert.assertEquals(1, TabWindowManager.getInstance().getIncognitoTabCount()); @@ -108,7 +107,8 @@ @TargetApi(Build.VERSION_CODES.N) @CommandLineFlags.Add({ChromeSwitches.DISABLE_TAB_MERGING_FOR_TESTING, ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) - public void testMoveTabTwice() throws InterruptedException { + public void + testMoveTabTwice() { // Load 'google' in separate tab. int googleTabId = mActivityTestRule .loadUrlInNewTab(mTestServer.getURL(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowTestHelper.java b/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowTestHelper.java index 2c14c2a..016e6fa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowTestHelper.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/multiwindow/MultiWindowTestHelper.java
@@ -117,7 +117,7 @@ private static void waitUntilActivityResumed(final Activity activity) { CriteriaHelper.pollUiThread(Criteria.equals(ActivityState.RESUMED, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return ApplicationStatus.getStateForActivity(activity); } }));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/ChromeNotificationBuilderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/ChromeNotificationBuilderTest.java index 41a4eb1..ad20d549 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/ChromeNotificationBuilderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/ChromeNotificationBuilderTest.java
@@ -45,7 +45,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { // Let's leave things in a clean state. mNotificationManager.cancelAll(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java index 5851d84..78bfa4cd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java
@@ -54,7 +54,7 @@ public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.loadNativeLibraryNoBrowserProcess(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java index 7419e709..7774c2d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java
@@ -37,7 +37,7 @@ public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { // Not initializing the browser process is safe because GetDomainAndRegistry() is // stand-alone. mActivityTestRule.loadNativeLibraryNoBrowserProcess(); @@ -52,7 +52,7 @@ @Test @MediumTest @Feature({"Browser", "Notifications"}) - public void testEnsureNormalizedIconBehavior() throws Exception { + public void testEnsureNormalizedIconBehavior() { // Get the dimensions of the notification icon that will be presented to the user. Context appContext = InstrumentationRegistry.getInstrumentation() .getTargetContext() @@ -100,7 +100,7 @@ @Test @SmallTest @Feature({"Browser", "Notifications"}) - public void testHiddenIconReturnsNull() throws Exception { + public void testHiddenIconReturnsNull() { NotificationBuilderBase notificationBuilder = new NotificationBuilderBase(InstrumentationRegistry.getInstrumentation() .getTargetContext()
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java index a07d5ec..bab8ca3c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
@@ -79,14 +79,14 @@ private static final int TITLE_UPDATE_TIMEOUT_SECONDS = (int) 5L; @Before - public void setUp() throws Exception { + public void setUp() { SiteEngagementService.setParamValuesForTesting(); mNotificationTestRule.loadUrl(mPermissionTestRule.getURL(NOTIFICATION_TEST_PAGE)); mPermissionTestRule.setActivity(mNotificationTestRule.getActivity()); } @SuppressWarnings("MissingFail") - private void waitForTitle(String expectedTitle) throws InterruptedException { + private void waitForTitle(String expectedTitle) { Tab tab = mNotificationTestRule.getActivity().getActivityTab(); TabTitleObserver titleObserver = new TabTitleObserver(tab, expectedTitle); try { @@ -112,7 +112,7 @@ try { return TestThreadUtils.runOnUiThreadBlocking(new Callable<Double>() { @Override - public Double call() throws Exception { + public Double call() { return SiteEngagementService.getForProfile(Profile.getLastUsedProfile()) .getScore(mPermissionTestRule.getOrigin()); } @@ -838,19 +838,18 @@ * @return The Android Notification object, as shown in the framework. */ private Notification showAndGetNotification(String title, String options) - throws TimeoutException, InterruptedException { + throws TimeoutException { showNotification(title, options); return mNotificationTestRule.waitForNotification().notification; } - private void showNotification(String title, String options) - throws TimeoutException, InterruptedException { + private void showNotification(String title, String options) throws TimeoutException { runJavaScript("GetActivatedServiceWorkerForTest()" + ".then(reg => reg.showNotification('" + title + "', " + options + "))" + ".catch(sendToTest)"); } - private String runJavaScript(String code) throws TimeoutException, InterruptedException { + private String runJavaScript(String code) throws TimeoutException { return mNotificationTestRule.runJavaScriptCodeInCurrentTab(code); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationTestRule.java index 0ab71bf3..736f01e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationTestRule.java
@@ -34,22 +34,22 @@ private MockNotificationManagerProxy mMockNotificationManager; - private void setUp() throws Exception { + private void setUp() { // The NotificationPlatformBridge must be overriden prior to the browser process starting. mMockNotificationManager = new MockNotificationManagerProxy(); NotificationPlatformBridge.overrideNotificationManagerForTesting(mMockNotificationManager); startMainActivityFromLauncher(); } - private void tearDown() throws Exception { + private void tearDown() { NotificationPlatformBridge.overrideNotificationManagerForTesting(null); } /** * Sets the permission to use Web Notifications for the test HTTP server's origin to |setting|. */ - public void setNotificationContentSettingForOrigin(final @ContentSettingValues int setting, - String origin) throws InterruptedException, TimeoutException { + public void setNotificationContentSettingForOrigin( + final @ContentSettingValues int setting, String origin) throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking(() -> { // The notification content setting does not consider the embedder origin. PermissionInfo notificationInfo =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java index 84bb1a49..6f67160 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java
@@ -51,7 +51,7 @@ public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { // Not initializing the browser process is safe because GetDomainAndRegistry() is // stand-alone. mActivityTestRule.loadNativeLibraryNoBrowserProcess();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java index 506e60f..e77bbc4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java
@@ -61,7 +61,7 @@ @Before @TargetApi(Build.VERSION_CODES.O) - public void setUp() throws Exception { + public void setUp() { // Not initializing the browser process is safe because // UrlFormatter.formatUrlForSecurityDisplay() is stand-alone. mNativeLibraryTestRule.loadNativeLibraryNoBrowserProcess(); @@ -90,7 +90,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testDeleteLegacyChannels_noopOnCurrentDefinitions() throws Exception { + public void testDeleteLegacyChannels_noopOnCurrentDefinitions() { assertThat(getChannelsIgnoringDefault(), is(empty())); mChannelsInitializer.deleteLegacyChannels(); @@ -109,7 +109,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testInitializeStartupChannels() throws Exception { + public void testInitializeStartupChannels() { mChannelsInitializer.initializeStartupChannels(); List<String> notificationChannelIds = new ArrayList<>(); for (NotificationChannel channel : getChannelsIgnoringDefault()) { @@ -127,7 +127,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testInitializeStartupChannels_groupCreated() throws Exception { + public void testInitializeStartupChannels_groupCreated() { mChannelsInitializer.initializeStartupChannels(); assertThat(mNotificationManagerProxy.getNotificationChannelGroups(), hasSize(1)); assertThat(mNotificationManagerProxy.getNotificationChannelGroups().get(0).getId(), @@ -139,7 +139,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testUpdateLocale_otherChannelsDoNotThrowException() throws Exception { + public void testUpdateLocale_otherChannelsDoNotThrowException() { NotificationChannelGroup group = ChannelDefinitions.getChannelGroup(ChannelDefinitions.ChannelGroupId.GENERAL) .toNotificationChannelGroup(mContext.getResources()); @@ -157,7 +157,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_browserChannel() throws Exception { + public void testEnsureInitialized_browserChannel() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.BROWSER); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -174,7 +174,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_downloadsChannel() throws Exception { + public void testEnsureInitialized_downloadsChannel() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.DOWNLOADS); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -192,7 +192,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_incognitoChannel() throws Exception { + public void testEnsureInitialized_incognitoChannel() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.INCOGNITO); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -210,7 +210,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_mediaChannel() throws Exception { + public void testEnsureInitialized_mediaChannel() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.MEDIA); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -227,7 +227,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_sitesChannel() throws Exception { + public void testEnsureInitialized_sitesChannel() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.SITES); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -245,7 +245,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_contentSuggestionsDisabled() throws Exception { + public void testEnsureInitialized_contentSuggestionsDisabled() { // This test does not cover ensureInitialized() with ChannelId.CONTENT_SUGGESTIONS, because // channels ignore construction parameters when re-created. If one test created the channel // enabled, and the other disabled, the second test would fail. @@ -268,7 +268,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_webappActions() throws Exception { + public void testEnsureInitialized_webappActions() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.WEBAPP_ACTIONS); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -287,7 +287,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_singleOriginSiteChannel() throws Exception { + public void testEnsureInitialized_singleOriginSiteChannel() { String origin = "https://example.com"; long creationTime = 621046800000L; NotificationSettingsBridge.SiteChannel siteChannel = @@ -307,7 +307,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_multipleCalls() throws Exception { + public void testEnsureInitialized_multipleCalls() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.SITES); mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.BROWSER); assertThat(getChannelsIgnoringDefault(), hasSize(2)); @@ -318,7 +318,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_multipleIds() throws Exception { + public void testEnsureInitialized_multipleIds() { Collection<String> groupIds = CollectionUtil.newHashSet( ChannelDefinitions.ChannelGroupId.SITES, ChannelDefinitions.ChannelGroupId.GENERAL); Collection<String> channelIds = CollectionUtil.newHashSet( @@ -332,7 +332,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_permissionRequests() throws Exception { + public void testEnsureInitialized_permissionRequests() { mChannelsInitializer.ensureInitialized(ChannelDefinitions.ChannelId.PERMISSION_REQUESTS); assertThat(getChannelsIgnoringDefault(), hasSize(1)); @@ -350,7 +350,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @Feature({"Browser", "Notifications"}) - public void testEnsureInitialized_permissionRequestsHigh() throws Exception { + public void testEnsureInitialized_permissionRequestsHigh() { mChannelsInitializer.ensureInitialized( ChannelDefinitions.ChannelId.PERMISSION_REQUESTS_HIGH);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java index 4a53227c..cc3e2325 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java
@@ -55,7 +55,7 @@ public NativeLibraryTestRule mNativeLibraryTestRule = new NativeLibraryTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { // Not initializing the browser process is safe because // UrlFormatter.formatUrlForSecurityDisplay() is stand-alone. mNativeLibraryTestRule.loadNativeLibraryNoBrowserProcess(); @@ -82,7 +82,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testShouldUpdateChannels_returnsFalsePreO() throws Exception { + public void testShouldUpdateChannels_returnsFalsePreO() { ChannelsUpdater updater = new ChannelsUpdater( false /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 0); assertThat(updater.shouldUpdateChannels(), is(false)); @@ -92,7 +92,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testShouldUpdateChannels_returnsTrueIfOAndNoSavedVersionInPrefs() throws Exception { + public void testShouldUpdateChannels_returnsTrueIfOAndNoSavedVersionInPrefs() { ChannelsUpdater updater = new ChannelsUpdater( true /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 0); assertThat(updater.shouldUpdateChannels(), is(true)); @@ -102,8 +102,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testShouldUpdateChannels_returnsTrueIfOAndDifferentVersionInPrefs() - throws Exception { + public void testShouldUpdateChannels_returnsTrueIfOAndDifferentVersionInPrefs() { mMockSharedPreferences.edit().putInt(ChannelsUpdater.CHANNELS_VERSION_KEY, 4).apply(); ChannelsUpdater updater = new ChannelsUpdater( true /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 5); @@ -114,7 +113,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testShouldUpdateChannels_returnsFalseIfOAndSameVersionInPrefs() throws Exception { + public void testShouldUpdateChannels_returnsFalseIfOAndSameVersionInPrefs() { mMockSharedPreferences.edit().putInt(ChannelsUpdater.CHANNELS_VERSION_KEY, 3).apply(); ChannelsUpdater updater = new ChannelsUpdater( true /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 3); @@ -125,7 +124,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testUpdateChannels_noopPreO() throws Exception { + public void testUpdateChannels_noopPreO() { ChannelsUpdater updater = new ChannelsUpdater( false /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 21); updater.updateChannels(); @@ -138,7 +137,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testUpdateChannels_createsExpectedChannelsAndUpdatesPref() throws Exception { + public void testUpdateChannels_createsExpectedChannelsAndUpdatesPref() { ChannelsUpdater updater = new ChannelsUpdater( true /* isAtLeastO */, mMockSharedPreferences, mChannelsInitializer, 21); updater.updateChannels(); @@ -156,7 +155,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testUpdateChannels_deletesLegacyChannelsAndCreatesExpectedOnes() throws Exception { + public void testUpdateChannels_deletesLegacyChannelsAndCreatesExpectedOnes() { // Set up any legacy channels. mNotificationManagerProxy.createNotificationChannelGroup( ChannelDefinitions.getChannelGroup(ChannelDefinitions.ChannelGroupId.GENERAL)
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/SiteChannelsManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/SiteChannelsManagerTest.java index 5b6f003..6b0f22d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/SiteChannelsManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/SiteChannelsManagerTest.java
@@ -57,7 +57,7 @@ public ChromeBrowserTestRule mChromeBrowserTestRule = new ChromeBrowserTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mChromeBrowserTestRule.loadNativeLibraryAndInitBrowserProcess(); Context mContext = InstrumentationRegistry.getTargetContext(); @@ -82,7 +82,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testCreateSiteChannel_enabled() throws Exception { + public void testCreateSiteChannel_enabled() { mSiteChannelsManager.createSiteChannel("https://example-enabled.org", 62102180000L, true); assertThat(Arrays.asList(mSiteChannelsManager.getSiteChannels()), hasSize(1)); NotificationSettingsBridge.SiteChannel channel = mSiteChannelsManager.getSiteChannels()[0]; @@ -94,7 +94,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testCreateSiteChannel_stripsSchemaForChannelName() throws Exception { + public void testCreateSiteChannel_stripsSchemaForChannelName() { mSiteChannelsManager.createSiteChannel("http://127.0.0.1", 0L, true); mSiteChannelsManager.createSiteChannel("https://example.com", 0L, true); mSiteChannelsManager.createSiteChannel("ftp://127.0.0.1", 0L, true); @@ -110,7 +110,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) @SmallTest - public void testCreateSiteChannel_disabled() throws Exception { + public void testCreateSiteChannel_disabled() { mSiteChannelsManager.createSiteChannel("https://example-blocked.org", 0L, false); assertThat(Arrays.asList(mSiteChannelsManager.getSiteChannels()), hasSize(1)); NotificationSettingsBridge.SiteChannel channel = mSiteChannelsManager.getSiteChannels()[0]; @@ -121,7 +121,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testDeleteSiteChannel_channelExists() throws Exception { + public void testDeleteSiteChannel_channelExists() { NotificationSettingsBridge.SiteChannel channel = mSiteChannelsManager.createSiteChannel("https://chromium.org", 0L, true); mSiteChannelsManager.deleteSiteChannel(channel.getId()); @@ -131,7 +131,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testDeleteAllSiteChannels() throws Exception { + public void testDeleteAllSiteChannels() { mSiteChannelsManager.createSiteChannel("https://chromium.org", 0L, true); mSiteChannelsManager.createSiteChannel("https://tests.peter.sh", 0L, true); mSiteChannelsManager.deleteAllSiteChannels(); @@ -141,7 +141,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testDeleteSiteChannel_channelDoesNotExist() throws Exception { + public void testDeleteSiteChannel_channelDoesNotExist() { mSiteChannelsManager.createSiteChannel("https://chromium.org", 0L, true); mSiteChannelsManager.deleteSiteChannel("https://some-other-origin.org"); assertThat(Arrays.asList(mSiteChannelsManager.getSiteChannels()), hasSize(1)); @@ -150,7 +150,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testGetChannelStatus_channelCreatedAsEnabled() throws Exception { + public void testGetChannelStatus_channelCreatedAsEnabled() { NotificationSettingsBridge.SiteChannel channel = mSiteChannelsManager.createSiteChannel("https://example-enabled.org", 0L, true); assertThat(mSiteChannelsManager.getChannelStatus(channel.getId()), @@ -160,7 +160,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testGetChannelStatus_channelCreatedAsBlocked() throws Exception { + public void testGetChannelStatus_channelCreatedAsBlocked() { assertThat(mSiteChannelsManager.getChannelStatus("https://example-blocked.com"), matchesChannelStatus(NotificationChannelStatus.UNAVAILABLE)); NotificationSettingsBridge.SiteChannel channel = @@ -172,7 +172,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testGetChannelStatus_channelNotCreated() throws Exception { + public void testGetChannelStatus_channelNotCreated() { assertThat(mSiteChannelsManager.getChannelStatus("invalid-channel-id"), matchesChannelStatus(NotificationChannelStatus.UNAVAILABLE)); } @@ -180,7 +180,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testGetChannelStatus_channelCreatedThenDeleted() throws Exception { + public void testGetChannelStatus_channelCreatedThenDeleted() { NotificationSettingsBridge.SiteChannel channel = mSiteChannelsManager.createSiteChannel("https://chromium.org", 0L, true); mSiteChannelsManager.deleteSiteChannel(channel.getId()); @@ -191,7 +191,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @SmallTest - public void testBlockingPermissionInIncognitoCreatesNoChannels() throws Exception { + public void testBlockingPermissionInIncognitoCreatesNoChannels() { PermissionInfo info = new PermissionInfo( PermissionInfo.Type.NOTIFICATION, "https://example-incognito.com", null, true); TestThreadUtils.runOnUiThreadBlocking( @@ -235,7 +235,7 @@ @Test @MinAndroidSdkLevel(Build.VERSION_CODES.O) @MediumTest - public void testGetChannelIdForOrigin_unknownOrigin() throws Exception { + public void testGetChannelIdForOrigin_unknownOrigin() { String channelId = mSiteChannelsManager.getChannelIdForOrigin("https://unknown.com"); assertThat(channelId, is(ChannelDefinitions.ChannelId.SITES));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageLoadTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageLoadTest.java index a3edb257..bc83c7a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageLoadTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageLoadTest.java
@@ -34,8 +34,6 @@ import org.chromium.chrome.test.util.browser.suggestions.mostvisited.FakeMostVisitedSites; import org.chromium.net.test.EmbeddedTestServer; -import java.io.IOException; - /** * Tests for events around the loading of a New Tab Page. */ @@ -67,13 +65,13 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @Test @SmallTest - public void testTilesTypeInitialisedWhenPageLoaded() throws IOException, InterruptedException { + public void testTilesTypeInitialisedWhenPageLoaded() { mActivityTestRule.loadUrl(UrlConstants.NTP_URL); NewTabPageTestUtils.waitForNtpLoaded(mTab); assertTrue(mMostVisitedSites.pageImpressionRecorded);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageNavigationTest.java index d990354d..c54354f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageNavigationTest.java
@@ -38,13 +38,13 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityWithURL(null); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -70,7 +70,7 @@ @Test @LargeTest @Feature({"NewTabPage"}) - public void testNavigatingFromNTP() throws InterruptedException { + public void testNavigatingFromNTP() { String url = mTestServer.getURL("/chrome/test/data/android/google.html"); mActivityTestRule.loadUrl(url); Assert.assertEquals(url, mActivityTestRule.getActivity().getActivityTab().getUrl()); @@ -82,7 +82,7 @@ @Test @MediumTest @Feature({"NewTabPage"}) - public void testNavigateBackToNTPViaUrl() throws InterruptedException { + public void testNavigateBackToNTPViaUrl() { String url = mTestServer.getURL("/chrome/test/data/android/google.html"); mActivityTestRule.loadUrl(url); Assert.assertEquals(url, mActivityTestRule.getActivity().getActivityTab().getUrl());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java index e7e90a4..977cc6e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java
@@ -189,7 +189,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); if (mInterestFeedEnabled) { FeedProcessScopeFactory.setTestNetworkClient(null); @@ -330,9 +330,10 @@ @Test @SmallTest @Feature({"NewTabPage", "FeedNewTabPage"}) - @DisableIf.Build(sdk_is_greater_than = 22, message = "crbug.com/593007") - @ParameterAnnotations.UseMethodParameter(InterestFeedParams.class) - public void testSearchFromFakebox(boolean interestFeedEnabled) throws InterruptedException { + @DisableIf + .Build(sdk_is_greater_than = 22, message = "crbug.com/593007") + @ParameterAnnotations.UseMethodParameter(InterestFeedParams.class) + public void testSearchFromFakebox(boolean interestFeedEnabled) { TouchCommon.singleClickView(mFakebox); waitForFakeboxFocusAnimationComplete(mNtp); final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar); @@ -359,7 +360,7 @@ @SmallTest @Feature({"NewTabPage", "FeedNewTabPage"}) @ParameterAnnotations.UseMethodParameter(InterestFeedParams.class) - public void testClickMostVisitedItem(boolean interestFeedEnabled) throws InterruptedException { + public void testClickMostVisitedItem(boolean interestFeedEnabled) { ChromeTabUtils.waitForTabPageLoaded(mTab, mSiteSuggestions.get(0).url, new Runnable() { @Override public void run() { @@ -379,7 +380,7 @@ @Feature({"NewTabPage", "FeedNewTabPage"}) @ParameterAnnotations.UseMethodParameter(InterestFeedParams.class) public void testOpenMostVisitedItemInNewTab(boolean interestFeedEnabled) - throws InterruptedException, ExecutionException { + throws ExecutionException { ChromeTabUtils.invokeContextMenuAndOpenInANewTab(mActivityTestRule, mTileGridLayout.getChildAt(0), ContextMenuManager.ContextMenuItemId.OPEN_IN_NEW_TAB, false, mSiteSuggestions.get(0).url); @@ -393,7 +394,7 @@ @Feature({"NewTabPage", "FeedNewTabPage"}) @ParameterAnnotations.UseMethodParameter(InterestFeedParams.class) public void testOpenMostVisitedItemInIncognitoTab(boolean interestFeedEnabled) - throws InterruptedException, ExecutionException { + throws ExecutionException { ChromeTabUtils.invokeContextMenuAndOpenInANewTab(mActivityTestRule, mTileGridLayout.getChildAt(0), ContextMenuManager.ContextMenuItemId.OPEN_IN_INCOGNITO_TAB, true, @@ -426,8 +427,7 @@ @MediumTest @Feature({"NewTabPage", "FeedNewTabPage"}) @ParameterAnnotations.UseMethodParameter(InterestFeedParams.class) - public void testUrlFocusAnimationsDisabledOnLoad(boolean interestFeedEnabled) - throws InterruptedException { + public void testUrlFocusAnimationsDisabledOnLoad(boolean interestFeedEnabled) { Assert.assertFalse(getUrlFocusAnimationsDisabled()); ChromeTabUtils.waitForTabPageLoaded(mTab, mTestServer.getURL(TEST_PAGE), new Runnable() { @Override @@ -688,7 +688,7 @@ private boolean getUrlFocusAnimationsDisabled() { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return mNtp.getNewTabPageLayout().urlFocusAnimationsDisabled(); } }); @@ -757,7 +757,7 @@ })); } - private SuggestionsSection getArticleSectionOnNewTab() throws Exception { + private SuggestionsSection getArticleSectionOnNewTab() { Tab tab = mActivityTestRule.loadUrlInNewTab(UrlConstants.NTP_URL); NewTabPage ntp = (NewTabPage) tab.getNativePage(); NewTabPageAdapter adapter =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageUiCaptureTest.java index 537656b0..29aa8b8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageUiCaptureTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageUiCaptureTest.java
@@ -56,7 +56,7 @@ private NewTabPage mNtp; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityWithURL(UrlConstants.NTP_URL); // TODO(aberent): this sequence or similar is used in a number of tests, extract to common // test method?
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/RecentTabsPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/RecentTabsPageTest.java index 1f79feb..2455613 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/RecentTabsPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/RecentTabsPageTest.java
@@ -57,7 +57,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { leaveRecentTabsPage(); RecentTabsManager.setRecentlyClosedTabManagerForTests(null); } @@ -65,7 +65,7 @@ @Test @MediumTest @Feature({"RecentTabsPage"}) - public void testRecentlyClosedTabs() throws InterruptedException, ExecutionException { + public void testRecentlyClosedTabs() throws ExecutionException { // Set a recently closed tab and confirm a view is rendered for it. List<RecentlyClosedTab> tabs = setRecentlyClosedTabs(1); Assert.assertEquals(1, mManager.getRecentlyClosedTabs(1).size()); @@ -93,7 +93,7 @@ return tabs; } - private RecentTabsPage loadRecentTabsPage() throws InterruptedException { + private RecentTabsPage loadRecentTabsPage() { mActivityTestRule.loadUrl(UrlConstants.RECENT_TABS_URL); CriteriaHelper.pollUiThread(new Criteria("RecentTabsPage never fully loaded") { @Override @@ -108,7 +108,7 @@ /** * Leaves and destroys the {@link RecentTabsPage} by navigating the tab to {@code about:blank}. */ - private void leaveRecentTabsPage() throws InterruptedException { + private void leaveRecentTabsPage() { mActivityTestRule.loadUrl(ContentUrlConstants.ABOUT_BLANK_DISPLAY_URL); CriteriaHelper.pollUiThread(new Criteria("RecentTabsPage is still there") { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerViewTest.java index da8708d..5125213 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerViewTest.java
@@ -94,8 +94,7 @@ private FakeSuggestionsSource mSource; @Before - public void setUp() throws Exception { - + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); FakeMostVisitedSites mostVisitedSites = new FakeMostVisitedSites(); @@ -135,15 +134,14 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); - } @Test @MediumTest @Feature({"NewTabPage"}) - public void testClickSuggestion() throws InterruptedException { + public void testClickSuggestion() { setSuggestionsAndWaitForUpdate(10); List<SnippetArticle> suggestions = mSource.getSuggestionsForCategory(TEST_CATEGORY); @@ -161,7 +159,7 @@ @Test @MediumTest @Feature({"NewTabPage"}) - public void testAllDismissed() throws InterruptedException, TimeoutException { + public void testAllDismissed() throws TimeoutException { setSuggestionsAndWaitForUpdate(3); assertEquals(3, mSource.getSuggestionsForCategory(TEST_CATEGORY).size()); assertEquals(1, mSource.getCategories().length); @@ -321,10 +319,9 @@ * Dismiss the item at the given {@code position} and wait until it has been removed from the * {@link RecyclerView}. * @param position the adapter position to remove. - * @throws InterruptedException * @throws TimeoutException */ - private void dismissItemAtPosition(int position) throws InterruptedException, TimeoutException { + private void dismissItemAtPosition(int position) throws TimeoutException { final ViewHolder viewHolder = getViewHolderAtPosition(position); TestThreadUtils.runOnUiThreadBlocking( () -> { getRecyclerView().dismissItemWithAnimation(viewHolder); });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/MHTMLPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/MHTMLPageTest.java index b4d7428..5190c78 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/MHTMLPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/MHTMLPageTest.java
@@ -99,13 +99,13 @@ } @Before - public void setUp() throws Exception { + public void setUp() { deleteTestFiles(); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); deleteTestFiles(); } @@ -160,7 +160,7 @@ @Test @SmallTest @RetryOnFailure - public void testLoadMultipartRelatedPageFromLocalFile() throws Exception { + public void testLoadMultipartRelatedPageFromLocalFile() { // .mhtml file is mapped to "multipart/related" by the test server. String url = UrlUtils.getIsolatedTestFileUrl("chrome/test/data/android/hello.mhtml"); mDownloadTestRule.loadUrl(url); @@ -169,7 +169,7 @@ @Test @SmallTest @RetryOnFailure - public void testLoadMessageRfc822PageFromLocalFile() throws Exception { + public void testLoadMessageRfc822PageFromLocalFile() { // .mht file is mapped to "message/rfc822" by the test server. String url = UrlUtils.getIsolatedTestFileUrl("chrome/test/data/android/test.mht"); mDownloadTestRule.loadUrl(url);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java index 889bba9..74efb77e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java
@@ -97,7 +97,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java index 1a8fd25..70e9c23 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java
@@ -169,7 +169,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { OfflineTestUtil.clearIntercepts(); if (mWebServer != null) { mWebServer.shutdown(); @@ -179,7 +179,7 @@ @Test @MediumTest @Feature({"OfflineAutoFetch"}) - public void testAutoFetchTriggersOnDNSErrorWhenOffline() throws Exception { + public void testAutoFetchTriggersOnDNSErrorWhenOffline() { attemptLoadPage("http://does.not.resolve.com"); waitForRequestCount(1); } @@ -187,7 +187,7 @@ @Test @MediumTest @Feature({"OfflineAutoFetch"}) - public void testAutoFetchDoesNotTriggerOnDNSErrorWhenOnline() throws Exception { + public void testAutoFetchDoesNotTriggerOnDNSErrorWhenOnline() { forceConnectivityState(true); attemptLoadPage("http://does.not.resolve.com"); waitForRequestCount(0); @@ -427,7 +427,7 @@ } // Wait until at least one auto-fetch request has shown an in-progress notification. - private void waitForInProgressNotification() throws Exception { + private void waitForInProgressNotification() { waitForHistogram("OfflinePages.AutoFetch.InProgressNotificationAction:SHOWN", 1); } @@ -559,7 +559,7 @@ try { Log.d(TAG, "Request Coordinator state:" + OfflineTestUtil.dumpRequestCoordinatorState()); - } catch (TimeoutException | InterruptedException e) { + } catch (TimeoutException e) { } } private void pollInstrumentationThread(final Callable<Boolean> criteria) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java index 962d1a7e..f895e37 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java
@@ -144,7 +144,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -515,7 +515,7 @@ } private Set<String> getUrlsExistOfflineFromSet(final Set<String> query) - throws InterruptedException, TimeoutException { + throws TimeoutException { final Set<String> result = new HashSet<>(); final List<OfflinePageItem> pages = OfflineTestUtil.getAllPages(); for (String url : query) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java index 492d949..607a362c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java
@@ -316,8 +316,7 @@ * @param url The url to be saved. * @param namespace The namespace this request belongs to. */ - private void savePageLater(final String url, final String namespace) - throws InterruptedException { + private void savePageLater(final String url, final String namespace) { PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { mBridge.savePageLater(url, namespace, mIsUserRequested); }); } @@ -342,8 +341,7 @@ log(TAG_PROGRESS, "Urls processing DONE."); } - private void getUrlListFromInputFile(String inputFilePath) - throws IOException, InterruptedException { + private void getUrlListFromInputFile(String inputFilePath) throws IOException { mUrls = new ArrayList<String>(); try { BufferedReader bufferedReader = getInputStream(inputFilePath); @@ -396,7 +394,7 @@ /** * Get saved offline pages and align them with the metadata we got from testing. */ - private void loadSavedPages() throws TimeoutException, InterruptedException { + private void loadSavedPages() throws TimeoutException { for (OfflinePageItem page : OfflineTestUtil.getAllPages()) { mRequestMetadata.get(page.getOfflineId()).mPage = page; } @@ -434,7 +432,7 @@ * At the end of the file there will be a summary: * Total requested URLs: XX, Completed: XX, Failed: XX, Failure Rate: XX.XX% */ - private void writeResults() throws IOException, InterruptedException { + private void writeResults() throws IOException { loadSavedPages(); OutputStreamWriter output = getOutputStream(RESULT_OUTPUT_FILE_PATH); try {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java index b8fc295..f382f5a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java
@@ -127,7 +127,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { turnOffServer(); } @@ -138,7 +138,7 @@ /** We must turn off the server only once, since stopAndDestroyServer() assumes the server is * on, and will wait indefinitely for it, timing out the unit test otherwise. */ - public void turnOffServer() throws Exception { + public void turnOffServer() { if (mServerTurnedOn) { mTestServer.stopAndDestroyServer(); mServerTurnedOn = false; @@ -323,7 +323,7 @@ @Test @MediumTest - public void testIsOfflinePageSharable() throws Exception { + public void testIsOfflinePageSharable() { // This test needs the sharing command line flag turned on. so we do not override the // default. final String privatePath = activity().getApplicationContext().getCacheDir().getPath(); @@ -370,7 +370,7 @@ */ @Test @SmallTest - public void testMhtmlPropertiesFromRenderer() throws Exception { + public void testMhtmlPropertiesFromRenderer() { String testUrl = UrlUtils.getTestFileUrl("offline_pages/hello.mhtml"); mActivityTestRule.loadUrl(testUrl); @@ -409,7 +409,7 @@ */ @Test @SmallTest - public void testInvalidMhtmlMainResourceMimeType() throws Exception { + public void testInvalidMhtmlMainResourceMimeType() { HistogramDelta histogramDelta = new HistogramDelta( MHTML_LOAD_RESULT_UMA_NAME_UNTRUSTED, MhtmlLoadResult.MISSING_MAIN_RESOURCE); String testUrl = UrlUtils.getTestFileUrl("offline_pages/invalid_main_resource.mhtml"); @@ -433,7 +433,7 @@ */ @Test @SmallTest - public void testEmptyMhtml() throws Exception { + public void testEmptyMhtml() { HistogramDelta histogramDelta = new HistogramDelta( MHTML_LOAD_RESULT_UMA_NAME_UNTRUSTED, MhtmlLoadResult.EMPTY_FILE); String testUrl = UrlUtils.getTestFileUrl("offline_pages/empty.mhtml"); @@ -455,7 +455,7 @@ */ @Test @SmallTest - public void testMhtmlWithNoResources() throws Exception { + public void testMhtmlWithNoResources() { HistogramDelta histogramDelta = new HistogramDelta( MHTML_LOAD_RESULT_UMA_NAME_UNTRUSTED, MhtmlLoadResult.INVALID_ARCHIVE); String testUrl = UrlUtils.getTestFileUrl("offline_pages/no_resources.mhtml");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java index 396d86a..3a4a6ac 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java
@@ -35,8 +35,7 @@ } // Gets all the URLs in the request queue. - public static SavePageRequest[] getRequestsInQueue() - throws TimeoutException, InterruptedException { + public static SavePageRequest[] getRequestsInQueue() throws TimeoutException { final AtomicReference<SavePageRequest[]> result = new AtomicReference<>(); final CallbackHelper callbackHelper = new CallbackHelper(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -50,8 +49,7 @@ } // Gets all available offline pages. - public static List<OfflinePageItem> getAllPages() - throws TimeoutException, InterruptedException { + public static List<OfflinePageItem> getAllPages() throws TimeoutException { final AtomicReference<List<OfflinePageItem>> result = new AtomicReference<List<OfflinePageItem>>(); final CallbackHelper callbackHelper = new CallbackHelper(); @@ -67,8 +65,7 @@ // Returns a string representation of the requests contained in the RequestCoordinator. // For logging out to debug test failures. - public static String dumpRequestCoordinatorState() - throws TimeoutException, InterruptedException { + public static String dumpRequestCoordinatorState() throws TimeoutException { final CallbackHelper callbackHelper = new CallbackHelper(); final AtomicReference<String> result = new AtomicReference<String>(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -83,7 +80,7 @@ // Returns the OfflinePageItem with the given clientId, or null if one doesn't exist. public static @Nullable OfflinePageItem getPageByClientId(ClientId clientId) - throws TimeoutException, InterruptedException { + throws TimeoutException { ArrayList<OfflinePageItem> result = new ArrayList<OfflinePageItem>(); for (OfflinePageItem item : getAllPages()) { if (item.getClientId().equals(clientId)) { @@ -94,8 +91,7 @@ } // Returns all OfflineItems provided by the OfflineContentProvider. - public static List<OfflineItem> getOfflineItems() - throws TimeoutException, InterruptedException { + public static List<OfflineItem> getOfflineItems() throws TimeoutException { CallbackHelper finished = new CallbackHelper(); final AtomicReference<ArrayList<OfflineItem>> result = new AtomicReference<ArrayList<OfflineItem>>(); @@ -109,8 +105,7 @@ return result.get(); } - public static byte[] getRawThumbnail(long offlineId) - throws TimeoutException, InterruptedException { + public static byte[] getRawThumbnail(long offlineId) throws TimeoutException { final AtomicReference<byte[]> result = new AtomicReference<>(); final CallbackHelper callbackHelper = new CallbackHelper(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -124,8 +119,7 @@ } // Waits for the offline model to initialize and returns an OfflinePageBridge. - public static OfflinePageBridge getOfflinePageBridge() - throws TimeoutException, InterruptedException { + public static OfflinePageBridge getOfflinePageBridge() throws TimeoutException { final CallbackHelper ready = new CallbackHelper(); final AtomicReference<OfflinePageBridge> result = new AtomicReference<OfflinePageBridge>(); PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { @@ -151,8 +145,7 @@ } // Intercepts future HTTP requests for |url| with an offline net error. - public static void interceptWithOfflineError(String url) - throws TimeoutException, InterruptedException { + public static void interceptWithOfflineError(String url) throws TimeoutException { final CallbackHelper callbackHelper = new CallbackHelper(); TestThreadUtils.runOnUiThreadBlocking(() -> { nativeInterceptWithOfflineError(url, () -> callbackHelper.notifyCalled());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RecentTabsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RecentTabsTest.java index 43ceed1..ca08f7f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RecentTabsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RecentTabsTest.java
@@ -28,7 +28,6 @@ import org.chromium.net.test.EmbeddedTestServer; import java.util.concurrent.Callable; -import java.util.concurrent.TimeoutException; /** Integration tests for the Last 1 feature of Offline Pages. */ @RunWith(ChromeJUnit4ClassRunner.class) @@ -61,7 +60,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -146,8 +145,7 @@ waitForPageWithClientId(firstTabClientId); } - private void waitForPageWithClientId(final ClientId clientId) - throws TimeoutException, InterruptedException { + private void waitForPageWithClientId(final ClientId clientId) { CriteriaHelper.pollInstrumentationThread( () -> { return OfflineTestUtil.getPageByClientId(clientId) != null; }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/ConnectivityDetectorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/ConnectivityDetectorTest.java index c6c19ac..f7e572f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/ConnectivityDetectorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/ConnectivityDetectorTest.java
@@ -350,8 +350,7 @@ Assert.assertTrue(mSemaphore.tryAcquire(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } - private void setConnectionState(@ConnectivityDetector.ConnectionState int connectionState) - throws Exception { + private void setConnectionState(@ConnectivityDetector.ConnectionState int connectionState) { TestThreadUtils.runOnUiThreadBlocking( () -> { mConnectivityDetector.forceConnectionStateForTesting(connectionState); }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java index 9c8cbd5e..415047d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java
@@ -88,7 +88,7 @@ @Test @MediumTest - public void testShowOfflineIndicatorOnNTPWhenOffline() throws Exception { + public void testShowOfflineIndicatorOnNTPWhenOffline() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -105,7 +105,7 @@ @Test @MediumTest - public void testShowOfflineIndicatorOnRegularPageWhenOffline() throws Exception { + public void testShowOfflineIndicatorOnRegularPageWhenOffline() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -122,7 +122,7 @@ @Test @MediumTest - public void testHideOfflineIndicatorWhenBackToOnline() throws Exception { + public void testHideOfflineIndicatorWhenBackToOnline() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -145,7 +145,7 @@ @Test @MediumTest - public void testDoNotShowSubsequentOfflineIndicatorWhenFlaky() throws Exception { + public void testDoNotShowSubsequentOfflineIndicatorWhenFlaky() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -182,7 +182,7 @@ @Test @MediumTest - public void testDoNotShowOfflineIndicatorOnErrorPageWhenOffline() throws Exception { + public void testDoNotShowOfflineIndicatorOnErrorPageWhenOffline() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -233,7 +233,7 @@ @Test @MediumTest - public void testDoNotShowOfflineIndicatorOnDownloadsWhenOffline() throws Exception { + public void testDoNotShowOfflineIndicatorOnDownloadsWhenOffline() { if (mActivityTestRule.getActivity().isTablet()) return; DownloadActivity downloadActivity = ActivityUtils.waitForActivity( @@ -250,7 +250,7 @@ @Test @MediumTest - public void testDoNotShowOfflineIndicatorOnPageLoadingWhenOffline() throws Exception { + public void testDoNotShowOfflineIndicatorOnPageLoadingWhenOffline() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL("/slow?1"); @@ -273,7 +273,7 @@ @Test @MediumTest - public void testReshowOfflineIndicatorWhenResumed() throws Exception { + public void testReshowOfflineIndicatorWhenResumed() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -300,7 +300,7 @@ @Test @MediumTest - public void testDoNotShowOfflineIndicatorWhenTemporarilyPaused() throws Exception { + public void testDoNotShowOfflineIndicatorWhenTemporarilyPaused() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE); @@ -345,7 +345,7 @@ }); } - private void loadPage(String pageUrl) throws Exception { + private void loadPage(String pageUrl) { Tab tab = mActivityTestRule.getActivity().getActivityTab(); mActivityTestRule.loadUrl(pageUrl); @@ -358,7 +358,7 @@ } } - private void loadPageWithoutWaiting(String pageUrl, String headers) throws Exception { + private void loadPageWithoutWaiting(String pageUrl, String headers) { Tab tab = mActivityTestRule.getActivity().getActivityTab(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -371,7 +371,7 @@ }); } - private void waitForPageLoaded(String pageUrl) throws Exception { + private void waitForPageLoaded(String pageUrl) { Tab tab = mActivityTestRule.getActivity().getActivityTab(); ChromeTabUtils.waitForTabPageLoaded(tab, pageUrl); ChromeTabUtils.waitForInteractable(tab);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskTest.java index 6a87d72..3f07fd4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskTest.java
@@ -180,7 +180,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { mScheduler = new TestBackgroundTaskScheduler(); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mScheduler);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java index 0a254f1..8f33291 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java
@@ -144,7 +144,7 @@ } } - private void forceLoadSnippets() throws Throwable { + private void forceLoadSnippets() { if (mUseReducedMode) { // NTP suggestions require a connection. TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -263,7 +263,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { FakeInstanceIDWithSubtype.clearDataAndSetEnabled(false); mServer.shutdown(); } @@ -272,7 +272,7 @@ return OfflineContentAggregatorFactory.get(); } - private OfflineItem findItemByUrl(String url) throws InterruptedException, TimeoutException { + private OfflineItem findItemByUrl(String url) throws TimeoutException { for (OfflineItem item : OfflineTestUtil.getOfflineItems()) { if (item.pageUrl.equals(url)) { return item; @@ -281,8 +281,7 @@ return null; } - private OfflinePageItem findPageByUrl(String url) - throws InterruptedException, TimeoutException { + private OfflinePageItem findPageByUrl(String url) throws TimeoutException { for (OfflinePageItem page : OfflineTestUtil.getAllPages()) { if (page.getUrl().equals(url)) { return page; @@ -291,7 +290,7 @@ return null; } - private Bitmap findVisuals(ContentId id) throws InterruptedException, TimeoutException { + private Bitmap findVisuals(ContentId id) throws TimeoutException { final CallbackHelper finished = new CallbackHelper(); final AtomicReference<Bitmap> result = new AtomicReference<>(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -432,7 +431,7 @@ /** * Check that a server-enabled check can enable prefetching. */ - public void doTestPrefetchBecomesEnabledByServer() throws Throwable { + public void doTestPrefetchBecomesEnabledByServer() { OfflineTestUtil.setPrefetchingEnabledByServer(false); Assert.assertFalse(isEnabledByServer()); @@ -447,7 +446,7 @@ * Check that prefetching remains disabled by the server after receiving a forbidden * response. */ - public void doTestPrefetchRemainsDisabledByServer() throws Throwable { + public void doTestPrefetchRemainsDisabledByServer() { OfflineTestUtil.setPrefetchingEnabledByServer(false); mOPS.setForbidGeneratePageBundle(true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFlowTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFlowTest.java index b804f4f1..84a0047 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFlowTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFlowTest.java
@@ -141,7 +141,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { FakeInstanceIDWithSubtype.clearDataAndSetEnabled(false); mServer.shutdown(); } @@ -203,7 +203,7 @@ } /** Trigger conditions required to load NTP snippets. */ - private void forceLoadSnippets() throws Throwable { + private void forceLoadSnippets() { // NTP suggestions require a connection and an accepted EULA. TestThreadUtils.runOnUiThreadBlocking(() -> { NetworkChangeNotifier.forceConnectivityState(true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/TestOfflinePageService.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/TestOfflinePageService.java index 655d3b6..0b7162d2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/TestOfflinePageService.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/TestOfflinePageService.java
@@ -35,7 +35,6 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; -import java.util.concurrent.TimeoutException; /** * A fake OfflinePageService. @@ -250,7 +249,7 @@ * This method is typically not called on the server thread, so access to members should be * synchronized. */ - public String sendPushMessage() throws InterruptedException, TimeoutException { + public String sendPushMessage() { CriteriaHelper.pollInstrumentationThread(() -> { Boolean result; synchronized (mIncompleteOperations) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/OmahaBaseTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/OmahaBaseTest.java index da17c3a2..a6e94c6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/OmahaBaseTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/OmahaBaseTest.java
@@ -199,14 +199,14 @@ } @Before - public void setUp() throws Exception { + public void setUp() { Context targetContext = InstrumentationRegistry.getTargetContext(); OmahaBase.setIsDisabledForTesting(false); mContext = new AdvancedMockContext(targetContext); } @After - public void tearDown() throws Exception { + public void tearDown() { OmahaBase.setIsDisabledForTesting(true); } @@ -255,7 +255,7 @@ } @Override - protected HttpURLConnection createConnection() throws RequestFailureException { + protected HttpURLConnection createConnection() { MockConnection connection = null; try { URL url = new URL(mDelegate.getRequestGenerator().getServerUrl());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelperTest.java index b9d93bd..12b50c3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelperTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelperTest.java
@@ -99,7 +99,7 @@ private MockMarketURLGetter mMockMarketURLGetter; @Before - public void setUp() throws Exception { + public void setUp() { // This test explicitly tests for the menu item, so turn it on. VersionNumberGetter.setEnableUpdateDetection(true); } @@ -110,8 +110,7 @@ * @param currentVersion Version to report as the current version of Chrome * @param latestVersion Version to report is available by Omaha */ - private void prepareAndStartMainActivity(String currentVersion, String latestVersion) - throws Exception { + private void prepareAndStartMainActivity(String currentVersion, String latestVersion) { // Report fake versions back to Main when it asks. mMockVersionNumberGetter = new MockVersionNumberGetter(currentVersion, latestVersion); VersionNumberGetter.setInstanceForTests(mMockVersionNumberGetter); @@ -128,7 +127,7 @@ versionNumbersQueried(); } - private void versionNumbersQueried() throws Exception { + private void versionNumbersQueried() { CriteriaHelper.pollInstrumentationThread( new Criteria() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java index 88f80e1..8b8f064 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java
@@ -121,7 +121,7 @@ setupTabForTests(false); } - private void setupTabForTests(boolean isIncognito) throws InterruptedException { + private void setupTabForTests(boolean isIncognito) { if (isIncognito) mActivityTestRule.loadUrlInNewTab(UrlConstants.NTP_URL, isIncognito); mTestLocationBarModel = new TestLocationBarModel(); mTestLocationBarModel.setTab(mActivityTestRule.getActivity().getActivityTab(), isIncognito); @@ -162,8 +162,7 @@ return mActivityTestRule.getActivity().findViewById(R.id.security_button); } - private void setUrlBarTextAndFocus(String text) - throws ExecutionException, InterruptedException { + private void setUrlBarTextAndFocus(String text) throws ExecutionException { TestThreadUtils.runOnUiThreadBlocking(new Callable<Void>() { @Override public Void call() throws InterruptedException { @@ -177,8 +176,7 @@ @Test @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testNotShowingVoiceSearchButtonIfUrlBarContainsText() - throws ExecutionException, InterruptedException { + public void testNotShowingVoiceSearchButtonIfUrlBarContainsText() throws ExecutionException { setUrlBarTextAndFocus("testing"); Assert.assertEquals(getDeleteButton().getVisibility(), VISIBLE); @@ -188,8 +186,7 @@ @Test @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) - public void testShowingVoiceSearchButtonIfUrlBarIsEmpty() - throws ExecutionException, InterruptedException { + public void testShowingVoiceSearchButtonIfUrlBarIsEmpty() throws ExecutionException { setUrlBarTextAndFocus(""); Assert.assertNotEquals(getDeleteButton().getVisibility(), VISIBLE); @@ -244,7 +241,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @EnableFeatures(ChromeFeatureList.OMNIBOX_SEARCH_ENGINE_LOGO) @Feature({"OmniboxSearchEngineLogo"}) - public void testOmniboxSearchEngineLogo_goneWhenIncognito() throws Exception { + public void testOmniboxSearchEngineLogo_goneWhenIncognito() { final LocationBarLayout locationBar = getLocationBar(); final View iconView = locationBar.getSecurityIconView(); onView(withId(R.id.location_bar_status))
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java index d824f2c4..93cfabbf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java
@@ -136,7 +136,7 @@ @MediumTest @Feature({"Omnibox"}) @RetryOnFailure - public void testFocusChangingSoftInputMode() throws InterruptedException { + public void testFocusChangingSoftInputMode() { final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar); OmniboxTestUtils.toggleUrlBarFocus(urlBar, true); @@ -171,7 +171,7 @@ @MediumTest @Feature({"Omnibox"}) @RetryOnFailure - public void testRequestZeroSuggestOnFocus() throws Exception { + public void testRequestZeroSuggestOnFocus() { final LocationBarLayout locationBar = (LocationBarLayout) mActivityTestRule.getActivity().findViewById(R.id.location_bar); final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar); @@ -253,7 +253,7 @@ @MediumTest @Feature({"Omnibox"}) @RetryOnFailure - public void testRequestZeroSuggestTypeAndBackspace() throws InterruptedException { + public void testRequestZeroSuggestTypeAndBackspace() { final LocationBarLayout locationBar = (LocationBarLayout) mActivityTestRule.getActivity().findViewById(R.id.location_bar); final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar); @@ -287,7 +287,7 @@ @MediumTest @Feature({"Omnibox"}) @RetryOnFailure - public void testDefaultText() throws InterruptedException { + public void testDefaultText() { mActivityTestRule.startMainActivityWithURL(UrlConstants.NTP_URL); final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar); @@ -528,7 +528,7 @@ CharSequence urlText = TestThreadUtils.runOnUiThreadBlocking(new Callable<CharSequence>() { @Override - public CharSequence call() throws Exception { + public CharSequence call() { return urlBarView.getText(); } }); @@ -586,7 +586,7 @@ @Test @MediumTest @SkipCommandLineParameterization - public void testSecurityIconOnHTTP() throws InterruptedException { + public void testSecurityIconOnHTTP() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); try { @@ -726,7 +726,7 @@ @Feature({"Omnibox"}) @RetryOnFailure @DisabledTest // https://crbug.com/950556 - public void testSuggestionDirectionSwitching() throws InterruptedException { + public void testSuggestionDirectionSwitching() { final TextView urlBarView = (TextView) mActivityTestRule.getActivity().findViewById(R.id.url_bar); TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java index 98ba9e8b..bc90814 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java
@@ -48,7 +48,7 @@ private Resources mResources; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { mProfile = Profile.getLastUsedProfile().getOriginalProfile(); mResources = @@ -145,7 +145,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testShortSecureHTTPSUrl() throws Throwable { + public void testShortSecureHTTPSUrl() { Spannable url = new SpannableStringBuilder("https://www.google.com/"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.SECURE, false, true, true); @@ -173,7 +173,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testShortSecureHTTPSUrlWithLightColors() throws Throwable { + public void testShortSecureHTTPSUrlWithLightColors() { Spannable url = new SpannableStringBuilder("https://www.google.com/"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.SECURE, false, false, false); @@ -202,7 +202,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testLongInsecureHTTPSUrl() throws Throwable { + public void testLongInsecureHTTPSUrl() { Spannable url = new SpannableStringBuilder("https://www.google.com/q?query=abc123&results=1"); OmniboxUrlEmphasizer.emphasizeUrl( @@ -232,7 +232,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testVeryShortHTTPWarningUrl() throws Throwable { + public void testVeryShortHTTPWarningUrl() { Spannable url = new SpannableStringBuilder("m.w.co/p"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.WARNING, false, true, false); @@ -255,7 +255,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testAboutPageUrl() throws Throwable { + public void testAboutPageUrl() { Spannable url = new SpannableStringBuilder("about:blank"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.NONE, true, true, true); @@ -281,7 +281,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testDataUrl() throws Throwable { + public void testDataUrl() { Spannable url = new SpannableStringBuilder("data:text/plain;charset=utf-8;base64,VGVzdCBVUkw="); OmniboxUrlEmphasizer.emphasizeUrl( @@ -304,7 +304,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testInternalChromePageUrl() throws Throwable { + public void testInternalChromePageUrl() { Spannable url = new SpannableStringBuilder("chrome://bookmarks"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.NONE, true, true, true); @@ -330,7 +330,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testInternalChromeNativePageUrl() throws Throwable { + public void testInternalChromeNativePageUrl() { Spannable url = new SpannableStringBuilder("chrome-native://bookmarks"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.NONE, true, true, true); @@ -356,7 +356,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testInvalidUrl() throws Throwable { + public void testInvalidUrl() { Spannable url = new SpannableStringBuilder("invalidurl"); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.NONE, true, true, true); @@ -376,7 +376,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testEmptyUrl() throws Throwable { + public void testEmptyUrl() { Spannable url = new SpannableStringBuilder(""); OmniboxUrlEmphasizer.emphasizeUrl( url, mResources, mProfile, ConnectionSecurityLevel.NONE, false, true, true); @@ -393,7 +393,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testHTTPAndHTTPSUrlsOriginEndIndex() throws Throwable { + public void testHTTPAndHTTPSUrlsOriginEndIndex() { String url; url = "http://www.google.com/"; @@ -425,7 +425,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testDataUrlsOriginEndIndex() throws Throwable { + public void testDataUrlsOriginEndIndex() { String url; // Data URLs have no origin. @@ -450,7 +450,7 @@ @MediumTest @UiThreadTest @Feature({"Browser", "Main"}) - public void testOtherUrlsOriginEndIndex() throws Throwable { + public void testOtherUrlsOriginEndIndex() { String url; // In non-HTTP/HTTPS/data URLs, the whole URL is considered the origin.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java index 0e2693f4..4bd30c9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java
@@ -106,7 +106,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testCopyHuge() throws InterruptedException { + public void testCopyHuge() { mActivityTestRule.startMainActivityWithURL(HUGE_URL); OmniboxTestUtils.toggleUrlBarFocus(getUrlBar(), true); Assert.assertEquals(HUGE_URL, copyUrlToClipboard(android.R.id.copy)); @@ -116,7 +116,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testCutHuge() throws InterruptedException { + public void testCutHuge() { mActivityTestRule.startMainActivityWithURL(HUGE_URL); OmniboxTestUtils.toggleUrlBarFocus(getUrlBar(), true); Assert.assertEquals(HUGE_URL, copyUrlToClipboard(android.R.id.cut)); @@ -151,7 +151,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testLongPress() throws InterruptedException { + public void testLongPress() { // This is a more realistic test than HUGE_URL because ita's full of separator characters // which have historically been known to trigger odd behavior with long-pressing. final String longPressUrl = "data:text/plain,hi.hi.hi.hi.hi.hi.hi.hi.hi.hi/hi/hi/hi/hi/hi/";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java index 972072e..6334778 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java
@@ -51,7 +51,6 @@ import java.util.List; import java.util.Map; import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -205,7 +204,7 @@ @Feature({"Omnibox"}) @RetryOnFailure @DisabledTest - public void testRefocusing() throws InterruptedException { + public void testRefocusing() { Assert.assertFalse(OmniboxTestUtils.doesUrlBarHaveFocus(mUrlBar)); OmniboxTestUtils.checkUrlBarRefocus(mUrlBar, 5); } @@ -214,7 +213,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testAutocompleteUpdatedOnSetText() throws InterruptedException { + public void testAutocompleteUpdatedOnSetText() { toggleFocusAndIgnoreImeOperations(mUrlBar, true); // Verify that setting a new string will clear the autocomplete. @@ -259,12 +258,11 @@ } } - private void verifySelectionState( - String text, String inlineAutocomplete, int selectionStart, int selectionEnd, - boolean expectedHasAutocomplete, String expectedTextWithoutAutocomplete, - String expectedTextWithAutocomplete, boolean expectedPreventInline, - String expectedRequestedAutocompleteText) - throws InterruptedException, TimeoutException { + private void verifySelectionState(String text, String inlineAutocomplete, int selectionStart, + int selectionEnd, boolean expectedHasAutocomplete, + String expectedTextWithoutAutocomplete, String expectedTextWithAutocomplete, + boolean expectedPreventInline, String expectedRequestedAutocompleteText) + throws TimeoutException { setTextAndVerifyNoAutocomplete(text); setAutocomplete(text, inlineAutocomplete); @@ -296,7 +294,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testAutocompleteUpdatedOnSelection() throws InterruptedException, TimeoutException { + public void testAutocompleteUpdatedOnSelection() throws TimeoutException { toggleFocusAndIgnoreImeOperations(mUrlBar, true); // Verify that setting a selection before the autocomplete clears it. @@ -375,7 +373,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testSendCursorPosition() throws InterruptedException, TimeoutException { + public void testSendCursorPosition() throws TimeoutException { final CallbackHelper autocompleteHelper = new CallbackHelper(); final AtomicInteger cursorPositionUsed = new AtomicInteger(); mUrlBar.setUrlTextChangeListener((textWithoutAutocomplete, textWithAutocomplete) -> { @@ -450,8 +448,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testAutocompleteAllowedWhenReplacingText() - throws InterruptedException, TimeoutException { + public void testAutocompleteAllowedWhenReplacingText() throws TimeoutException { final String textToBeEntered = "c"; final CallbackHelper autocompleteHelper = new CallbackHelper(); @@ -480,8 +477,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testSuggestionsUpdatedWhenDeletingInlineAutocomplete() - throws InterruptedException, TimeoutException { + public void testSuggestionsUpdatedWhenDeletingInlineAutocomplete() throws TimeoutException { toggleFocusAndIgnoreImeOperations(mUrlBar, true); setTextAndVerifyNoAutocomplete("test"); @@ -506,7 +502,7 @@ CriteriaHelper.pollUiThread(Criteria.equals("test", new Callable<String>() { @Override - public String call() throws Exception { + public String call() { return mUrlBar.getText().toString(); } })); @@ -520,7 +516,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testSelectionChangesIgnoredInBatchMode() throws InterruptedException { + public void testSelectionChangesIgnoredInBatchMode() { if (ChromeFeatureList.isEnabled(ChromeFeatureList.SPANNABLE_INLINE_AUTOCOMPLETE)) { // Note: with the new model, we remove autocomplete text at the beginning of a batch // edit and add it at the end of a batch edit. @@ -552,7 +548,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testBatchModeChangesTriggerCorrectSuggestions() throws InterruptedException { + public void testBatchModeChangesTriggerCorrectSuggestions() { final AtomicReference<String> requestedAutocompleteText = new AtomicReference<String>(); mUrlBar.setUrlTextChangeListener( (textWithoutAutocomplete, textWithAutocomplete) @@ -584,7 +580,7 @@ @SmallTest @Feature("Omnibox") @RetryOnFailure - public void testAutocompleteCorrectlyPerservedOnBatchMode() throws InterruptedException { + public void testAutocompleteCorrectlyPerservedOnBatchMode() { toggleFocusAndIgnoreImeOperations(mUrlBar, true); OmniboxTestUtils.waitForFocusAndKeyboardActive(mUrlBar, true); @@ -656,7 +652,7 @@ @SmallTest @Feature("Omnibox") @RetryOnFailure - public void testAutocompleteSpanClearedOnNonMatchingCommitText() throws InterruptedException { + public void testAutocompleteSpanClearedOnNonMatchingCommitText() { toggleFocusAndIgnoreImeOperations(mUrlBar, true); OmniboxTestUtils.waitForFocusAndKeyboardActive(mUrlBar, true); @@ -682,8 +678,7 @@ @SmallTest @Feature({"Omnibox"}) @RetryOnFailure - public void testAutocompleteClearedOnComposition() - throws InterruptedException, ExecutionException { + public void testAutocompleteClearedOnComposition() { toggleFocusAndIgnoreImeOperations(mUrlBar, true); OmniboxTestUtils.waitForFocusAndKeyboardActive(mUrlBar, true); @@ -711,8 +706,7 @@ @Feature("Omnibox") @RetryOnFailure @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) // crbug.com/635714 - public void testDelayedCompositionCorrectedWithAutocomplete() - throws InterruptedException, ExecutionException { + public void testDelayedCompositionCorrectedWithAutocomplete() { toggleFocusAndIgnoreImeOperations(mUrlBar, true); OmniboxTestUtils.waitForFocusAndKeyboardActive(mUrlBar, true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java index 41afaf3e..3aa3843 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java
@@ -197,25 +197,17 @@ } private void assertNullHeader(final String url, final boolean isIncognito) { - try { - final Tab tab = mActivityTestRule.loadUrlInNewTab("about:blank", isIncognito); - TestThreadUtils.runOnUiThreadBlocking( - () -> { Assert.assertNull(GeolocationHeader.getGeoHeader(url, tab)); }); - } catch (InterruptedException e) { - Assert.fail(e.getMessage()); - } + final Tab tab = mActivityTestRule.loadUrlInNewTab("about:blank", isIncognito); + TestThreadUtils.runOnUiThreadBlocking( + () -> { Assert.assertNull(GeolocationHeader.getGeoHeader(url, tab)); }); } private void assertNonNullHeader( final String url, final boolean isIncognito, final long locationTime) { - try { - final Tab tab = mActivityTestRule.loadUrlInNewTab("about:blank", isIncognito); - TestThreadUtils.runOnUiThreadBlocking(() -> { - assertHeaderEquals(locationTime, GeolocationHeader.getGeoHeader(url, tab)); - }); - } catch (InterruptedException e) { - Assert.fail(e.getMessage()); - } + final Tab tab = mActivityTestRule.loadUrlInNewTab("about:blank", isIncognito); + TestThreadUtils.runOnUiThreadBlocking(() -> { + assertHeaderEquals(locationTime, GeolocationHeader.getGeoHeader(url, tab)); + }); } private void assertHeaderEquals(long locationTime, String header) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java index 1a36daca..3ef043a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java
@@ -47,7 +47,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -58,7 +58,7 @@ @MediumTest @Feature({"PageInfoController"}) @RetryOnFailure - public void testShow() throws InterruptedException { + public void testShow() { TestThreadUtils.runOnUiThreadBlocking(() -> { PageInfoController.show(mActivityTestRule.getActivity(), mActivityTestRule.getActivity().getActivityTab(), null, @@ -73,7 +73,7 @@ @MediumTest @Feature({"PageInfoController"}) @RetryOnFailure - public void testPageInfoUrl() throws InterruptedException { + public void testPageInfoUrl() { String testUrl = mTestServer.getURLWithHostName("xn--allestrungen-9ib.ch", "/"); mActivityTestRule.loadUrlInTab( testUrl, PageTransition.TYPED, mActivityTestRule.getActivity().getActivityTab());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableBookmarksEditingUnitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableBookmarksEditingUnitTest.java index 3d341c3..5894429 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableBookmarksEditingUnitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableBookmarksEditingUnitTest.java
@@ -45,7 +45,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { PartnerBrowserCustomizations.ignoreBrowserProviderSystemPackageCheckForTests(true); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeIntegrationTest.java index abe38185..a1585c83 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeIntegrationTest.java
@@ -57,7 +57,7 @@ private void assertIncognitoMenuItemEnabled(boolean enabled) throws ExecutionException { Menu menu = TestThreadUtils.runOnUiThreadBlocking(new Callable<Menu>() { @Override - public Menu call() throws Exception { + public Menu call() { // PopupMenu is a convenient way of building a temp menu. PopupMenu tempMenu = new PopupMenu(mActivityTestRule.getActivity(), mActivityTestRule.getActivity().findViewById(R.id.menu_anchor_stub));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeUnitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeUnitTest.java index 324cf389..a482573 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeUnitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerDisableIncognitoModeUnitTest.java
@@ -45,7 +45,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { PartnerBrowserCustomizations.ignoreBrowserProviderSystemPackageCheckForTests(true); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java index 75ebd87..65d9a77 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageIntegrationTest.java
@@ -57,7 +57,7 @@ private static final String TEST_PAGE = "/chrome/test/data/android/about.html"; @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); } @@ -144,7 +144,7 @@ @MediumTest @Feature({"Homepage"}) @RetryOnFailure - public void testPreferenceCustomUriFixup() throws InterruptedException { + public void testPreferenceCustomUriFixup() { // Change home page custom URI on hompage edit screen. final Preferences editHomepagePreferenceActivity = mActivityTestRule.startPreferences(HomepageEditor.class.getName()); @@ -178,7 +178,7 @@ @MediumTest @Feature({"Homepage"}) @RetryOnFailure - public void testLastTabClosed() throws InterruptedException { + public void testLastTabClosed() { ChromeTabUtils.closeCurrentTab(InstrumentationRegistry.getInstrumentation(), (ChromeTabbedActivity) mActivityTestRule.getActivity()); Assert.assertTrue("Activity was not closed.", @@ -192,7 +192,7 @@ @Test @MediumTest @Feature({"Homepage"}) - public void testCloseAllTabs() throws InterruptedException { + public void testCloseAllTabs() { final CallbackHelper tabClosed = new CallbackHelper(); final TabModel tabModel = mActivityTestRule.getActivity().getCurrentTabModel(); mActivityTestRule.getActivity().getCurrentTabModel().addObserver(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageUnitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageUnitTest.java index c9d0595..13fac27 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageUnitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/partnercustomizations/PartnerHomepageUnitTest.java
@@ -49,7 +49,7 @@ private HomepageManager mHomepageManager; @Before - public void setUp() throws Exception { + public void setUp() { mHomepageManager = HomepageManager.getInstance(); RecordHistogram.setDisabledForTests(true); Assert.assertNotNull(mHomepageManager); @@ -60,7 +60,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/OnboardingDialogIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/OnboardingDialogIntegrationTest.java index 21c866c..8a234da7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/OnboardingDialogIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/OnboardingDialogIntegrationTest.java
@@ -57,7 +57,7 @@ private EmbeddedTestServer mEmbeddedTestServer; private final AtomicReference<WebContents> mWebContentsRef = new AtomicReference<>(); - public void loadTestPage() throws InterruptedException { + public void loadTestPage() { mEmbeddedTestServer = EmbeddedTestServer.createAndStartHTTPSServer( InstrumentationRegistry.getInstrumentation().getContext(), CERT_OK); mSyncTestRule.startMainActivityWithURL(mEmbeddedTestServer.getURL(FORM_URL)); @@ -70,7 +70,7 @@ } @Before - public void setUp() throws InterruptedException { + public void setUp() { mSyncTestRule.setUpTestAccountAndSignIn(); TestThreadUtils.runOnUiThreadBlocking(() -> { PrefServiceBridge.getInstance().setInteger( @@ -86,14 +86,14 @@ @Test @IntegrationTest - public void testOnboardingIsShown() throws InterruptedException, TimeoutException { + public void testOnboardingIsShown() throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), SUBMIT_NODE_ID); waitForView(R.id.password_manager_dialog); } @Test @IntegrationTest - public void testOnboardingAccepted() throws InterruptedException, TimeoutException { + public void testOnboardingAccepted() throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), SUBMIT_NODE_ID); waitForView(R.id.password_manager_dialog); clickOnView(R.id.positive_button); @@ -105,7 +105,7 @@ @Test @IntegrationTest - public void testOnboardingRejected() throws InterruptedException, TimeoutException { + public void testOnboardingRejected() throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), SUBMIT_NODE_ID); waitForView(R.id.password_manager_dialog); clickOnView(R.id.negative_button); @@ -114,7 +114,7 @@ @Test @IntegrationTest - public void testOnboardingDismissedPressedBack() throws InterruptedException, TimeoutException { + public void testOnboardingDismissedPressedBack() throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), SUBMIT_NODE_ID); waitForView(R.id.password_manager_dialog); pressBack();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java index 127ae5b..d878001 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java
@@ -113,7 +113,7 @@ } @After - public void tearDown() throws Throwable { + public void tearDown() { if (mServer != null) mServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyFormatterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyFormatterTest.java index 5c41ff4..3e18af0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyFormatterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyFormatterTest.java
@@ -35,7 +35,7 @@ private static final String NarrowNBSP = "\u202F"; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.loadNativeLibraryAndInitBrowserProcess(); } @@ -49,7 +49,7 @@ @Test @MediumTest - public void testMultipleConversions() throws Exception { + public void testMultipleConversions() { // Note, all spaces are expected to be unicode non-breaking spaces. Here they are shown as // normal spaces. List<Object[]> testCases = Arrays.asList(new Object[][] {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentHandlerChangePaymentMethodTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentHandlerChangePaymentMethodTest.java index 36e6855..58be437 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentHandlerChangePaymentMethodTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentHandlerChangePaymentMethodTest.java
@@ -59,7 +59,7 @@ } @After - public void tearDown() throws Throwable { + public void tearDown() { mServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestAbortTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestAbortTest.java index a9b2669b..b2cf472 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestAbortTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestAbortTest.java
@@ -41,7 +41,7 @@ new PaymentRequestTestRule("payment_request_abort_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -56,7 +56,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testAbortBeforePayClicked() throws InterruptedException, TimeoutException { + public void testAbortBeforePayClicked() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickNodeAndWait("abort", mPaymentRequestTestRule.getDismissed()); mPaymentRequestTestRule.expectResultContains(new String[] {"Aborted"}); @@ -67,7 +67,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testAbortWhileUnmaskingCard() throws InterruptedException, TimeoutException { + public void testAbortWhileUnmaskingCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java index dca3094..1d987096 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java
@@ -57,7 +57,7 @@ private static final int BILLING_ADDRESS_DROPDOWN_INDEX = 2; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String profile1 = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", @@ -118,7 +118,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNewCardBillingAddressFormat() throws InterruptedException, TimeoutException { + public void testNewCardBillingAddressFormat() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -144,8 +144,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfBillingAddressSuggestions() - throws InterruptedException, TimeoutException { + public void testNumberOfBillingAddressSuggestions() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -167,7 +166,7 @@ @MediumTest @Feature({"Payments"}) public void testNumberOfBillingAddressSuggestions_AfterCancellingNewBillingAddress() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add a payment method and add a new billing address. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -197,7 +196,7 @@ @MediumTest @Feature({"Payments"}) public void testAddBillingAddressOnCardAndCancel_MaintainsPreviousSelection() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Edit the only card. mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -233,7 +232,7 @@ @MediumTest @Feature({"Payments"}) public void testAddBillingAddressOnCardWithNoBillingAndCancel_MaintainsPreviousSelection() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Edit the second card. mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -267,7 +266,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testBillingAddressSortedByFrecency() throws InterruptedException, TimeoutException { + public void testBillingAddressSortedByFrecency() throws TimeoutException { // Add a payment method. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -306,8 +305,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testBillingAddressSortedByFrecency_AddNewAddress() - throws InterruptedException, TimeoutException { + public void testBillingAddressSortedByFrecency_AddNewAddress() throws TimeoutException { // Add a payment method. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -362,8 +360,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNewShippingAddressSuggestedFirst() - throws InterruptedException, TimeoutException { + public void testNewShippingAddressSuggestedFirst() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Add a shipping address. @@ -400,8 +397,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSelectIncompleteBillingAddress_EditComplete() - throws InterruptedException, TimeoutException { + public void testSelectIncompleteBillingAddress_EditComplete() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Edit the second card. mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -450,8 +446,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSelectIncompleteBillingAddress_EditCancel() - throws InterruptedException, TimeoutException { + public void testSelectIncompleteBillingAddress_EditCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Edit the only complete card. mPaymentRequestTestRule.clickInPaymentMethodAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressWithoutPhoneTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressWithoutPhoneTest.java index b61de89..5fa6523 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressWithoutPhoneTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressWithoutPhoneTest.java
@@ -55,7 +55,7 @@ private static final int BILLING_ADDRESS_DROPDOWN_INDEX = 2; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String address_without_phone = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon NoPhone", "Google", "340 Main St", "CA", @@ -75,7 +75,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanPayWithBillingNoPhone() throws InterruptedException, TimeoutException { + public void testCanPayWithBillingNoPhone() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -89,8 +89,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanSelectBillingAddressWithoutPhone() - throws InterruptedException, TimeoutException { + public void testCanSelectBillingAddressWithoutPhone() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Go edit the credit card. @@ -117,8 +116,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCantSelectShippingAddressWithoutPhone() - throws InterruptedException, TimeoutException { + public void testCantSelectShippingAddressWithoutPhone() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -140,8 +138,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCantAddNewBillingAddressWithoutPhone() - throws InterruptedException, TimeoutException { + public void testCantAddNewBillingAddressWithoutPhone() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBlobUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBlobUrlTest.java index e388d7a2..a378f590 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBlobUrlTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBlobUrlTest.java
@@ -28,7 +28,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void test() throws InterruptedException, TimeoutException { + public void test() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNode("buy"); mPaymentRequestTestRule.assertWaitForPageScaleFactorMatch(2); mPaymentRequestTestRule.expectResultContains(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java index 96f80a4..e4f203e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentGooglePayTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_can_make_payment_query_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { // The user has a valid server credit card with a billing address on file. This is // sufficient for canMakePayment() to return true. AutofillTestHelper helper = new AutofillTestHelper(); @@ -60,7 +60,7 @@ @Feature({"Payments"}) @CommandLineFlags. Add("enable-features=" + ChromeFeatureList.WEB_PAYMENTS_RETURN_GOOGLE_PAY_IN_BASIC_CARD) - public void testGooglePayServerCardsAllowed() throws InterruptedException, TimeoutException { + public void testGooglePayServerCardsAllowed() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -75,7 +75,7 @@ @Feature({"Payments"}) @CommandLineFlags. Add("disable-features=" + ChromeFeatureList.WEB_PAYMENTS_RETURN_GOOGLE_PAY_IN_BASIC_CARD) - public void testGooglePayServerCardsNotAllowed() throws InterruptedException, TimeoutException { + public void testGooglePayServerCardsNotAllowed() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java index e223ea3..41fda92 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java
@@ -50,7 +50,7 @@ new PaymentRequestTestRule("payment_request_can_make_payment_metrics_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "310-310-6000", @@ -66,7 +66,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testCannotMakePayment_UserAbort() throws InterruptedException, TimeoutException { + public void testCannotMakePayment_UserAbort() throws TimeoutException { // Initiate a payment request. mPaymentRequestTestRule.triggerUIAndWait( "queryShow", mPaymentRequestTestRule.getReadyForInput()); @@ -98,7 +98,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testCannotMakePayment_Complete() throws InterruptedException, TimeoutException { + public void testCannotMakePayment_Complete() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait( "queryShow", mPaymentRequestTestRule.getReadyForInput()); @@ -141,7 +141,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePayment_MerchantAbort() throws InterruptedException, TimeoutException { + public void testCanMakePayment_MerchantAbort() throws TimeoutException { // Install the app so CanMakePayment returns true. mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); @@ -171,7 +171,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePayment_Complete() throws InterruptedException, TimeoutException { + public void testCanMakePayment_Complete() throws TimeoutException { // Install the app so CanMakePayment returns true. mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); @@ -200,8 +200,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePaymentDisabled_Complete() - throws InterruptedException, TimeoutException { + public void testCanMakePaymentDisabled_Complete() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking((Runnable) () -> { PrefServiceBridge.getInstance().setBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED, false); }); @@ -234,7 +233,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testNoQuery_UserAbort() throws InterruptedException, TimeoutException { + public void testNoQuery_UserAbort() throws TimeoutException { // Initiate a payment request. mPaymentRequestTestRule.triggerUIAndWait( "noQueryShow", mPaymentRequestTestRule.getReadyForInput()); @@ -263,7 +262,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoQuery_Complete() throws InterruptedException, TimeoutException { + public void testNoQuery_Complete() throws TimeoutException { // Install the app so the user can complete the Payment Request. mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java index 9d332832..ee087fe 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java
@@ -45,7 +45,7 @@ new PaymentRequestTestRule("payment_request_can_make_payment_query_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { // The user has an incomplete credit card on file. This is not sufficient for // canMakePayment() to return true. new AutofillTestHelper().setCreditCard( @@ -57,7 +57,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoBobPayInstalled() throws InterruptedException, TimeoutException { + public void testNoBobPayInstalled() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -70,7 +70,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInFastBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); @@ -84,7 +84,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInSlowBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); @@ -98,7 +98,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); @@ -108,7 +108,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java index eb18a351..d052792a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java
@@ -45,7 +45,7 @@ new PaymentRequestTestRule("payment_request_can_make_payment_query_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { // The user has a valid credit card without a billing address on file. This is sufficient // for canMakePayment() to return true. new AutofillTestHelper().setCreditCard(new CreditCard("", "https://example.com", true, true, @@ -56,7 +56,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoBobPayInstalled() throws InterruptedException, TimeoutException { + public void testNoBobPayInstalled() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -65,7 +65,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInFastBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); @@ -75,7 +75,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInSlowBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); @@ -85,7 +85,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); @@ -95,7 +95,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCardEditorAutoAdvanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCardEditorAutoAdvanceTest.java index bd0a761..5e00aa5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCardEditorAutoAdvanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCardEditorAutoAdvanceTest.java
@@ -46,7 +46,7 @@ new PaymentRequestTestRule("payment_request_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // Set user has a shipping address and valid credit card on disk to make it easy to click in // to the payment section. @@ -61,7 +61,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void test14DigitsCreditCard() throws InterruptedException, TimeoutException { + public void test14DigitsCreditCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -95,7 +95,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void test15DigitsCreditCard() throws InterruptedException, TimeoutException { + public void test15DigitsCreditCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -129,7 +129,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void test16DigitsCreditCard() throws InterruptedException, TimeoutException { + public void test16DigitsCreditCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( @@ -173,7 +173,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void test19DigitsCreditCard() throws InterruptedException, TimeoutException { + public void test19DigitsCreditCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryNoCardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryNoCardTest.java index 1a91df02..0036b3b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryNoCardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryNoCardTest.java
@@ -34,7 +34,7 @@ new PaymentRequestTestRule("payment_request_can_make_payment_query_cc_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { // The user has an incomplete credit card on file. This is not sufficient for // canMakePayment() to return true. new AutofillTestHelper().setCreditCard( @@ -46,7 +46,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePayment() throws InterruptedException, TimeoutException { + public void testCanMakePayment() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -55,7 +55,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHasEnrolledInstrument() throws InterruptedException, TimeoutException { + public void testHasEnrolledInstrument() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait("has-enrolled-instrument-visa", mPaymentRequestTestRule.getHasEnrolledInstrumentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"false"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryTest.java index e029ff9..c9d70ff3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryTest.java
@@ -43,7 +43,7 @@ } @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { // The user has a valid credit card without a billing address on file. This is sufficient // for canMakePayment() to return true. new AutofillTestHelper().setCreditCard(new CreditCard("", "https://example.com", true, true, @@ -54,7 +54,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePayment() throws InterruptedException, TimeoutException { + public void testCanMakePayment() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait( mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -92,7 +92,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePaymentDisabled() throws InterruptedException, TimeoutException { + public void testCanMakePaymentDisabled() throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking((Runnable) () -> { PrefServiceBridge.getInstance().setBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED, false); });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsAndFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsAndFreeShippingTest.java index 33a4a7c..fa7204a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsAndFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsAndFreeShippingTest.java
@@ -44,7 +44,7 @@ "payment_request_contact_details_and_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address with a valid email address and a valid phone number on // disk. @@ -63,7 +63,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -85,7 +85,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and complete the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java index de2aaaf..b43c2d0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_contact_details_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has valid payer name, phone number and email address on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -78,7 +78,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getDismissed()); @@ -90,7 +90,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidContactAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidContactAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -112,7 +112,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddContactAndPay() throws InterruptedException, TimeoutException { + public void testAddContactAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -134,8 +134,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddContactAndCloseShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddContactAndCloseShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -166,8 +165,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCloseAndAddContactShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCloseAndAddContactShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -194,8 +192,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditContactAndCancelEditorShouldKeepContactSelected() - throws InterruptedException, TimeoutException { + public void testEditContactAndCancelEditorShouldKeepContactSelected() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -215,8 +212,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddContactAndCancelEditorShouldKeepContactSelected() - throws InterruptedException, TimeoutException { + public void testAddContactAndCancelEditorShouldKeepContactSelected() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -236,8 +232,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddContactAndCancelShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddContactAndCancelShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -268,8 +263,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCancelAndAddContactShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCancelAndAddContactShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -299,7 +293,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSuggestionsDeduped() throws InterruptedException, TimeoutException { + public void testSuggestionsDeduped() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -313,7 +307,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and complete the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java index cb066b3..09d2331 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java
@@ -36,12 +36,12 @@ this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Test @MediumTest @Feature({"Payments"}) - public void test() throws InterruptedException, TimeoutException { + public void test() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNode("buy"); mPaymentRequestTestRule.expectResultContains( new String[] {"PaymentRequest is not defined"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDebitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDebitTest.java index 5f0057b..22f62bb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDebitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDebitTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_debit_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -73,7 +73,7 @@ @MediumTest @Feature({"Payments"}) public void testDebitCardTypeIsPreselectedAndUnknownCardTypeIsAvailable() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); Assert.assertTrue(mPaymentRequestTestRule.getPaymentInstrumentLabel(0).contains("Visa")); @@ -93,7 +93,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePaymentWithDebitCard() throws InterruptedException, TimeoutException { + public void testCanMakePaymentWithDebitCard() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "canMakePayment", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDontHaveDebitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDontHaveDebitTest.java index 506cafe..46ccf429 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDontHaveDebitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDontHaveDebitTest.java
@@ -46,7 +46,7 @@ new PaymentRequestTestRule("payment_request_debit_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -69,8 +69,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUnknownCardTypeIsNotPreselectedButAvailable() - throws InterruptedException, TimeoutException { + public void testUnknownCardTypeIsNotPreselectedButAvailable() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); Assert.assertTrue( @@ -95,8 +94,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanMakePaymentWithUnknownCardType() - throws InterruptedException, TimeoutException { + public void testCanMakePaymentWithUnknownCardType() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "canMakePayment", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingMultipleAddressesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingMultipleAddressesTest.java index a79b79d..836cb9a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingMultipleAddressesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingMultipleAddressesTest.java
@@ -91,7 +91,7 @@ private int[] mDatesToSet; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // Add the profiles. @@ -119,8 +119,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressSuggestionOrdering() - throws InterruptedException, TimeoutException { + public void testShippingAddressSuggestionOrdering() throws TimeoutException { // Create two complete and two incomplete profiles. Values are set so that complete profiles // are ordered by frecency, incomplete profiles are sorted by their completeness score. mProfilesToAdd = new AutofillProfile[] { @@ -158,8 +157,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEquallyIncompleteSuggestionsOrdering() - throws InterruptedException, TimeoutException { + public void testEquallyIncompleteSuggestionsOrdering() throws TimeoutException { // Create two profiles both with missing phone numbers. mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[0], AUTOFILL_PROFILES[7]}; mCountsToSet = new int[] {20, 30}; @@ -183,7 +181,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressSuggestionLimit() throws InterruptedException, TimeoutException { + public void testShippingAddressSuggestionLimit() throws TimeoutException { // Create five profiles that can be suggested to the user. mProfilesToAdd = new AutofillProfile[] { AUTOFILL_PROFILES[0], AUTOFILL_PROFILES[2], AUTOFILL_PROFILES[3], @@ -224,7 +222,7 @@ @MediumTest @Feature({"Payments"}) public void testShippingAddressSuggestion_OnlyIncludeProfilesWithStreetAddress() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Create two complete profiles and two incomplete profiles, one of which has no street // address. mProfilesToAdd = new AutofillProfile[] { @@ -255,8 +253,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddresNotAcceptedByMerchant() - throws InterruptedException, TimeoutException { + public void testShippingAddresNotAcceptedByMerchant() throws TimeoutException { // Add a profile that is not accepted by the website. mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[3]}; mCountsToSet = new int[] {5}; @@ -284,8 +281,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressEditRequiredMessage() - throws InterruptedException, TimeoutException { + public void testShippingAddressEditRequiredMessage() throws TimeoutException { // Create four incomplete profiles with different missing information. Profiles will be // sorted based on their missing fields. mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[0], AUTOFILL_PROFILES[4], @@ -323,8 +319,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testMissingShippingAddressFieldRecorded() - throws InterruptedException, TimeoutException { + public void testMissingShippingAddressFieldRecorded() throws TimeoutException { // Add a profile with invalid shipping address, and another one with both missing name and // address. mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[4], AUTOFILL_PROFILES[6]}; @@ -350,7 +345,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testMissingNameFieldRecorded() throws InterruptedException, TimeoutException { + public void testMissingNameFieldRecorded() throws TimeoutException { // Add a profile with invalid shipping address, and another one with missing name. mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[4], AUTOFILL_PROFILES[5]}; mCountsToSet = new int[] {5, 5}; @@ -375,7 +370,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testAllMissingFieldsRecorded() throws InterruptedException, TimeoutException { + public void testAllMissingFieldsRecorded() throws TimeoutException { // Don't add any profiles mProfilesToAdd = new AutofillProfile[] {}; mCountsToSet = new int[] {};
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java index 980d5392..f562d09aed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java
@@ -46,7 +46,7 @@ new PaymentRequestTestRule("payment_request_dynamic_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -61,7 +61,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddressNotSelected() throws InterruptedException, TimeoutException { + public void testAddressNotSelected() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); Assert.assertEquals(PaymentRequestSection.EDIT_BUTTON_CHOOSE, mPaymentRequestTestRule.getShippingAddressSectionButtonState()); @@ -71,7 +71,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSelectValidAddressAndPay() throws InterruptedException, TimeoutException { + public void testSelectValidAddressAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because // of the Shipping Address). @@ -95,7 +95,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSelectValidAddressEditItAndPay() throws InterruptedException, TimeoutException { + public void testSelectValidAddressEditItAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because // of the Shipping Address). @@ -128,8 +128,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSelectValidAddressEditItAndCancelAndPay() - throws InterruptedException, TimeoutException { + public void testSelectValidAddressEditItAndCancelAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because // of the Shipping Address). @@ -163,7 +162,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidAddressAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidAddressAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because // of the Shipping Address). @@ -191,7 +190,7 @@ @Test @FlakyTest(message = "crbug.com/626289") @Feature({"Payments"}) - public void testAddAddressAndPay() throws InterruptedException, TimeoutException { + public void testAddAddressAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -217,8 +216,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddAddressAndCloseShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddAddressAndCloseShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -249,8 +247,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCloseAndAddAddressShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCloseAndAddAddressShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -277,8 +274,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddAddressAndCancelShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddAddressAndCancelShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -309,8 +305,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCancelAndAddAddressShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCancelAndAddAddressShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndFreeShippingTest.java index 8da1ff10..d3635aa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndFreeShippingTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_email_and_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address with a valid email on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -59,7 +59,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -79,7 +79,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and cancel the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( @@ -102,7 +102,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddAddressNoCrash() throws InterruptedException, TimeoutException { + public void testAddAddressNoCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndPhoneTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndPhoneTest.java index cd72b71f..99a70176 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndPhoneTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailAndPhoneTest.java
@@ -43,7 +43,7 @@ new PaymentRequestTestRule("payment_request_email_and_phone_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a valid email address and phone number on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -77,7 +77,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getDismissed()); @@ -89,7 +89,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidEmailAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidEmailAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -111,7 +111,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddEmailAndPhoneAndPay() throws InterruptedException, TimeoutException { + public void testAddEmailAndPhoneAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -135,7 +135,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSuggestionsDeduped() throws InterruptedException, TimeoutException { + public void testSuggestionsDeduped() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -149,7 +149,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and cancel the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailTest.java index c0aabb6..7999984f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmailTest.java
@@ -43,7 +43,7 @@ new PaymentRequestTestRule("payment_request_email_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a valid email address on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -77,7 +77,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getDismissed()); @@ -88,7 +88,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidEmailAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidEmailAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -110,7 +110,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddEmailAndPay() throws InterruptedException, TimeoutException { + public void testAddEmailAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -133,7 +133,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSuggestionsDeduped() throws InterruptedException, TimeoutException { + public void testSuggestionsDeduped() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -147,7 +147,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and complete the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmptyUpdateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmptyUpdateTest.java index f410f10..698a696 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmptyUpdateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestEmptyUpdateTest.java
@@ -41,7 +41,7 @@ new PaymentRequestTestRule("payment_request_empty_update_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java index 8ee42958..544b858 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java
@@ -48,7 +48,7 @@ String mCreditCardId; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { mHelper = new AutofillTestHelper(); // The user has a shipping address on disk. String billingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -68,8 +68,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayWithExpiredCard_ValidExpiration() - throws InterruptedException, TimeoutException { + public void testPayWithExpiredCard_ValidExpiration() throws TimeoutException { mRule.triggerUIAndWait(mRule.getReadyToPay()); mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); mRule.setTextInExpiredCardUnmaskDialogAndWait( @@ -89,8 +88,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayWithExpiredCard_NewExpirationSaved() - throws InterruptedException, TimeoutException { + public void testPayWithExpiredCard_NewExpirationSaved() throws TimeoutException { mRule.triggerUIAndWait(mRule.getReadyToPay()); mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); mRule.setTextInExpiredCardUnmaskDialogAndWait( @@ -111,7 +109,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCannotAddExpiredCard() throws InterruptedException, TimeoutException { + public void testCannotAddExpiredCard() throws TimeoutException { // If the current date is in January skip this test. It is not possible to select an expired // date in the card editor in January. Calendar now = Calendar.getInstance(); @@ -145,7 +143,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPromptErrorMessages() throws InterruptedException, TimeoutException { + public void testPromptErrorMessages() throws TimeoutException { // Click pay to get to the card unmask prompt. mRule.triggerUIAndWait(mRule.getReadyToPay()); mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); @@ -203,8 +201,7 @@ @MediumTest @Feature({"Payments"}) @Test - public void testSoftwareKeyboardSubmitInCvcNumberField() - throws InterruptedException, TimeoutException { + public void testSoftwareKeyboardSubmitInCvcNumberField() throws TimeoutException { mRule.triggerUIAndWait(mRule.getReadyToPay()); mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); @@ -223,8 +220,7 @@ @MediumTest @Feature({"Payments"}) @Test - public void testNoSoftwareKeyboardSubmitInCvcNumberFieldIfInvalid() - throws InterruptedException, TimeoutException { + public void testNoSoftwareKeyboardSubmitInCvcNumberFieldIfInvalid() throws TimeoutException { mRule.triggerUIAndWait(mRule.getReadyToPay()); mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExtraShippingOptionsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExtraShippingOptionsTest.java index de089b5..5fabeb2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExtraShippingOptionsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExtraShippingOptionsTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_extra_shipping_options_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -59,7 +59,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFailCompleteTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFailCompleteTest.java index f19901e..8c178ed9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFailCompleteTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFailCompleteTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_fail_complete_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -55,7 +55,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java index c7c5250..b08b683 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java
@@ -40,7 +40,7 @@ new PaymentRequestTestRule("payment_request_bobpay_and_cards_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address on disk but no credit card. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -56,7 +56,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("enable-features=NoCreditCardAbort") - public void testAbortIfNoCard_Enabled_NoApp() throws InterruptedException, TimeoutException { + public void testAbortIfNoCard_Enabled_NoApp() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getShowFailed()); mPaymentRequestTestRule.expectResultContains( new String[] {"Payment method not supported"}); @@ -70,7 +70,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("enable-features=NoCreditCardAbort") - public void testAbortIfNoCard_Enabled_WithApp() throws InterruptedException, TimeoutException { + public void testAbortIfNoCard_Enabled_WithApp() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); } @@ -83,7 +83,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testAbortIfNoCard_Disabled() throws InterruptedException, TimeoutException { + public void testAbortIfNoCard_Disabled() throws TimeoutException { // Check that the Payment Request UI is shown. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java index 7bf37b8..f6a2032 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java
@@ -68,7 +68,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mPaymentRequestTestRule.startMainActivity(); } @@ -78,7 +78,7 @@ } @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -114,7 +114,7 @@ @MediumTest @FlakyTest(message = "crbug.com/673371") @Feature({"Payments"}) - public void testAddInvalidAddressAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidAddressAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -134,7 +134,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddAddressAndPay() throws InterruptedException, TimeoutException { + public void testAddAddressAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -160,7 +160,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testChangeCountryAddAddressAndPay() throws InterruptedException, TimeoutException { + public void testChangeCountryAddAddressAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -188,8 +188,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddAddressAndCloseShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddAddressAndCloseShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -220,8 +219,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCloseAndAddAddressShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCloseAndAddAddressShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -249,8 +247,7 @@ @MediumTest @FlakyTest(message = "crbug.com/673371") @Feature({"Payments"}) - public void testQuickAddAddressAndCancelShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddAddressAndCancelShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -281,8 +278,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCancelAndAddAddressShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCancelAndAddAddressShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -312,7 +308,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and abort the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIdTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIdTest.java index 5633e56..c4d69b2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIdTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIdTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_id_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -59,7 +59,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentResponse() throws InterruptedException, TimeoutException { + public void testPaymentResponse() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsAndFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsAndFreeShippingTest.java index 86122e70..11da6ae0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsAndFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsAndFreeShippingTest.java
@@ -45,7 +45,7 @@ "payment_request_contact_details_and_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address with a valid email address on disk. However the phone // number is invalid. @@ -60,7 +60,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompleteShippingAndPay() throws InterruptedException, TimeoutException { + public void testEditIncompleteShippingAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -97,8 +97,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompleteShippingAndContactAndPay() - throws InterruptedException, TimeoutException { + public void testEditIncompleteShippingAndContactAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java index 4c60fc8..55b5192 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_contact_details_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has an invalid email address on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -58,7 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompleteContactAndCancel() throws InterruptedException, TimeoutException { + public void testEditIncompleteContactAndCancel() throws TimeoutException { // Not ready to pay since Contact email is invalid. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because @@ -90,7 +90,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddIncompleteContactAndCancel() throws InterruptedException, TimeoutException { + public void testAddIncompleteContactAndCancel() throws TimeoutException { // Not ready to pay since Contact email is invalid. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because @@ -122,7 +122,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompleteContactAndPay() throws InterruptedException, TimeoutException { + public void testEditIncompleteContactAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java index 4c5b123..924a955 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_email_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has an invalid email address on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -58,7 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompleteEmailAndCancel() throws InterruptedException, TimeoutException { + public void testEditIncompleteEmailAndCancel() throws TimeoutException { // Not ready to pay since Contact email is invalid. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because @@ -89,7 +89,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddIncompleteEmailAndCancel() throws InterruptedException, TimeoutException { + public void testAddIncompleteEmailAndCancel() throws TimeoutException { // Not ready to pay since Contact email is invalid. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because @@ -121,7 +121,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompleteEmailAndPay() throws InterruptedException, TimeoutException { + public void testEditIncompleteEmailAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompletePhoneTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompletePhoneTest.java index 0407185..a8cf4bb2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompletePhoneTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompletePhoneTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_phone_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has an invalid phone number on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -58,7 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompletePhoneAndCancel() throws InterruptedException, TimeoutException { + public void testEditIncompletePhoneAndCancel() throws TimeoutException { // Not ready to pay since Contact phone is invalid. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because @@ -89,7 +89,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddIncompletePhoneAndCancel() throws InterruptedException, TimeoutException { + public void testAddIncompletePhoneAndCancel() throws TimeoutException { // Not ready to pay since Contact phone is invalid. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Check that there is a selected payment method (makes sure we are not ready to pay because @@ -121,7 +121,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditIncompletePhoneAndPay() throws InterruptedException, TimeoutException { + public void testEditIncompletePhoneAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteServerCardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteServerCardTest.java index 200c980..bb94c94 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteServerCardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteServerCardTest.java
@@ -45,7 +45,7 @@ new PaymentRequestTestRule("payment_request_no_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -60,7 +60,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayAndDontUnmask() throws InterruptedException, TimeoutException { + public void testPayAndDontUnmask() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java index 11a8c07..7fc1cf1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java
@@ -54,7 +54,7 @@ @Override public void onMainActivityStarted() {} - private void createTestData() throws InterruptedException, TimeoutException { + private void createTestData() throws TimeoutException { AutofillTestHelper mHelper = new AutofillTestHelper(); // The user has a shipping address and a credit card associated with that address on disk. String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -79,8 +79,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testNumberOfSuggestionsShown_ShippingAddress_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSuggestionsShown_ShippingAddress_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -166,8 +165,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSelectionEdits_ShippingAddress_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSelectionEdits_ShippingAddress_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -212,8 +210,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSelectionAdds_ShippingAddress_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSelectionAdds_ShippingAddress_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -261,8 +258,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSuggestionsShown_PaymentMethod_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSuggestionsShown_PaymentMethod_Completed() throws TimeoutException { // Add two credit cards. createTestData(); @@ -368,8 +364,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSelectionAdds_PaymentMethod_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSelectionAdds_PaymentMethod_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -417,8 +412,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSuggestionsShown_ContactInfo_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSuggestionsShown_ContactInfo_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -490,8 +484,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSelectionEdits_ContactInfo_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSelectionEdits_ContactInfo_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -537,8 +530,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNumberOfSelectionAdds_ContactInfo_Completed() - throws InterruptedException, TimeoutException { + public void testNumberOfSelectionAdds_ContactInfo_Completed() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -585,8 +577,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUserHadCompleteSuggestions_ShippingAndPayment() - throws InterruptedException, TimeoutException { + public void testUserHadCompleteSuggestions_ShippingAndPayment() throws TimeoutException { // Add two addresses and two cards. createTestData(); @@ -614,7 +605,7 @@ @MediumTest @Feature({"Payments"}) public void testUserDidNotHaveCompleteSuggestions_ShippingAndPayment_IncompleteShipping() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add a card and an incomplete address (no region). AutofillTestHelper mHelper = new AutofillTestHelper(); String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -650,7 +641,7 @@ @MediumTest @Feature({"Payments"}) public void testUserDidNotHaveCompleteSuggestions_ShippingAndPayment_IncompleteCard() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an incomplete card (no exp date) and an complete address. AutofillTestHelper mHelper = new AutofillTestHelper(); String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -686,7 +677,7 @@ @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") public void testUserDidNotHaveCompleteSuggestions_ShippingAndPayment_UnsupportedCard() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an unsupported card (mastercard) and an complete address. AutofillTestHelper mHelper = new AutofillTestHelper(); String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -721,7 +712,7 @@ @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") public void testUserDidNotHaveCompleteSuggestions_ShippingAndPayment_OnlyPaymentApp() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add a complete address and a working payment app. AutofillTestHelper mHelper = new AutofillTestHelper(); mHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -754,7 +745,7 @@ @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") public void testUserDidNotHaveCompleteSuggestions_PaymentApp_NoInstruments() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an address and a payment app without instruments on file. AutofillTestHelper mHelper = new AutofillTestHelper(); mHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -787,7 +778,7 @@ @MediumTest @Feature({"Payments"}) public void testUserHadCompleteSuggestions_PaymentApp_HasValidPaymentApp() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an address and a payment app on file. AutofillTestHelper mHelper = new AutofillTestHelper(); mHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -820,7 +811,7 @@ @MediumTest @Feature({"Payments"}) public void testUserHadCompleteSuggestions_ShippingAndPaymentApp_HasInvalidShipping() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add a card and an incomplete address (no region). AutofillTestHelper mHelper = new AutofillTestHelper(); String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -857,7 +848,7 @@ @MediumTest @Feature({"Payments"}) public void testUserHadCompleteSuggestions_AcceptsCardsAndApps_UserHasOnlyCard() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an address and a credit card on file. AutofillTestHelper mHelper = new AutofillTestHelper(); String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -893,7 +884,7 @@ @MediumTest @Feature({"Payments"}) public void testUserHadCompleteSuggestions_AcceptsCardsAndApps_UserHasOnlyPaymentApp() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an address and a payment app on file. AutofillTestHelper mHelper = new AutofillTestHelper(); mHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -927,7 +918,7 @@ @MediumTest @Feature({"Payments"}) public void testUserHadCompleteSuggestions_AcceptsCardsAndApps_UserHasCardAndPaymentApp() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an address, a credit card and a payment app on file. AutofillTestHelper mHelper = new AutofillTestHelper(); String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -965,7 +956,7 @@ @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") public void testUserDidNotHaveCompleteSuggestions_AcceptsCardsAndApps_NoCardOrPaymentApp() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Add an address on file. new AutofillTestHelper().setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", @@ -995,7 +986,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoContactInfoHistogram() throws InterruptedException, TimeoutException { + public void testNoContactInfoHistogram() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -1029,7 +1020,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testTwoTimes() throws InterruptedException, TimeoutException { + public void testTwoTimes() throws TimeoutException { createTestData(); // Complete a Payment Request with a credit card. @@ -1100,7 +1091,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoShow() throws InterruptedException, TimeoutException { + public void testNoShow() throws TimeoutException { // Android Pay is supported but no instruments are present. mPaymentRequestTestRule.installPaymentApp( "https://android.com/pay", NO_INSTRUMENTS, DELAYED_RESPONSE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestLongIdTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestLongIdTest.java index 4454b41..d5a66f3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestLongIdTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestLongIdTest.java
@@ -27,12 +27,12 @@ new PaymentRequestTestRule("payment_request_long_id_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Test @MediumTest @Feature({"Payments"}) - public void testNoCrash() throws InterruptedException, TimeoutException { + public void testNoCrash() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNode("buy"); mPaymentRequestTestRule.expectResultContains( new String[] {"ID cannot be longer than 1024 characters"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java index 2a7a171..d5f1285 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java
@@ -54,7 +54,7 @@ new PaymentRequestTestRule("payment_request_metrics_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper mHelper = new AutofillTestHelper(); // The user has a shipping address and a credit card associated with that address on disk. String mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -75,7 +75,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testSuccessCheckoutFunnel() throws InterruptedException, TimeoutException { + public void testSuccessCheckoutFunnel() throws TimeoutException { // Initiate a payment request. mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); @@ -115,8 +115,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testAbortMetrics_AbortedByUser_CancelButton() - throws InterruptedException, TimeoutException { + public void testAbortMetrics_AbortedByUser_CancelButton() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -161,8 +160,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testAbortMetrics_AbortedByUser_XButton() - throws InterruptedException, TimeoutException { + public void testAbortMetrics_AbortedByUser_XButton() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -202,8 +200,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testAbortMetrics_AbortedByUser_BackButton() - throws InterruptedException, TimeoutException { + public void testAbortMetrics_AbortedByUser_BackButton() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -248,8 +245,7 @@ @Feature({"Payments"}) @RetryOnFailure @DisabledTest(message = "Test is flaky, see crbug.com/968797") - public void testAbortMetrics_OtherAborted_TabClosed() - throws InterruptedException, TimeoutException { + public void testAbortMetrics_OtherAborted_TabClosed() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -288,7 +284,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testAbortMetrics_AbortedByMerchant() throws InterruptedException, TimeoutException { + public void testAbortMetrics_AbortedByMerchant() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); Assert.assertEquals(1, @@ -328,8 +324,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testMetrics_NoMatchingPaymentMethod() - throws InterruptedException, TimeoutException { + public void testMetrics_NoMatchingPaymentMethod() throws TimeoutException { // Android Pay is supported but no instruments are present. mPaymentRequestTestRule.installPaymentApp( "https://android.com/pay", NO_INSTRUMENTS, DELAYED_RESPONSE); @@ -373,8 +368,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testMetrics_NoSupportedPaymentMethod() - throws InterruptedException, TimeoutException { + public void testMetrics_NoSupportedPaymentMethod() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "noSupported", mPaymentRequestTestRule.getShowFailed()); mPaymentRequestTestRule.expectResultContains( @@ -413,8 +407,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testSelectedPaymentMethod_CreditCard() - throws InterruptedException, TimeoutException { + public void testSelectedPaymentMethod_CreditCard() throws TimeoutException { // Complete a Payment Request with a credit card. mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( @@ -442,8 +435,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testSelectedPaymentMethod_AndroidPay() - throws InterruptedException, TimeoutException { + public void testSelectedPaymentMethod_AndroidPay() throws TimeoutException { // Complete a Payment Request with Android Pay. mPaymentRequestTestRule.installPaymentApp( "https://android.com/pay", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); @@ -470,7 +462,7 @@ @MediumTest @Feature({"Payments"}) @RetryOnFailure - public void testMetrics_SkippedShow() throws InterruptedException, TimeoutException { + public void testMetrics_SkippedShow() throws TimeoutException { // Complete a Payment Request with Android Pay. mPaymentRequestTestRule.installPaymentApp( "https://android.com/pay", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); @@ -505,7 +497,7 @@ @Feature({"Payments"}) @RetryOnFailure @CommandLineFlags.Add({"disable-features=" + ChromeFeatureList.WEB_PAYMENTS_SINGLE_APP_UI_SKIP}) - public void testMetrics_SkippedShow_Disabled() throws InterruptedException, TimeoutException { + public void testMetrics_SkippedShow_Disabled() throws TimeoutException { // Complete a Payment Request with Android Pay. mPaymentRequestTestRule.installPaymentApp( "https://android.com/pay", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); @@ -533,7 +525,7 @@ @MediumTest @Feature({"Payments"}) @DisabledTest(message = "Flaky. See crbug.com/727558") - public void testShownLoggedOnlyOnce() throws InterruptedException, TimeoutException { + public void testShownLoggedOnlyOnce() throws TimeoutException { // Initiate a payment request. mPaymentRequestTestRule.triggerUIAndWait("ccBuy", mPaymentRequestTestRule.getReadyToPay());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestModifierTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestModifierTest.java index 196cc58..e0af8f8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestModifierTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestModifierTest.java
@@ -27,13 +27,13 @@ new PaymentRequestTestRule("payment_request_modifier_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} /** Using modifiers should not crash. */ @Test @MediumTest @Feature({"Payments"}) - public void testNoCrash() throws InterruptedException, TimeoutException { + public void testNoCrash() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getShowFailed()); mPaymentRequestTestRule.expectResultContains( new String[] {"Payment method not supported"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultipleContactDetailsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultipleContactDetailsTest.java index 2b8e492..61f2166 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultipleContactDetailsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultipleContactDetailsTest.java
@@ -115,7 +115,7 @@ private int[] mDatesToSet; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // Add the profiles. @@ -140,8 +140,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testContactDetailsSuggestionOrdering() - throws InterruptedException, TimeoutException { + public void testContactDetailsSuggestionOrdering() throws TimeoutException { // Set the use stats so that profile[0] has the highest frecency score, profile[1] the // second highest, profile[2] the third lowest, profile[3] the second lowest and profile[4] // the lowest. @@ -177,8 +176,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testContactDetailsEditRequiredMessage() - throws InterruptedException, TimeoutException { + public void testContactDetailsEditRequiredMessage() throws TimeoutException { mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[0], AUTOFILL_PROFILES[1], AUTOFILL_PROFILES[4], AUTOFILL_PROFILES[5]}; mCountsToSet = new int[] {15, 10, 5, 1}; @@ -209,8 +207,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testContactDetailsDedupe_EmptyFields() - throws InterruptedException, TimeoutException { + public void testContactDetailsDedupe_EmptyFields() throws TimeoutException { // Add the original profile and a bunch of similar profiles with missing fields. // Make sure the original profile is suggested last, to test that the suggestions are // sorted by completeness. @@ -238,8 +235,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testContactDetailsDedupe_Capitalization() - throws InterruptedException, TimeoutException { + public void testContactDetailsDedupe_Capitalization() throws TimeoutException { // Add the original profile and the one where the the name is not capitalized. // Make sure the original profile is suggested first (no particular reason). mProfilesToAdd = new AutofillProfile[] {AUTOFILL_PROFILES[2], AUTOFILL_PROFILES[11]}; @@ -261,8 +257,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testContactDetailsDontDedupe_FieldSubset() - throws InterruptedException, TimeoutException { + public void testContactDetailsDontDedupe_FieldSubset() throws TimeoutException { // Add the original profile and the one where the email is a superset of the original. // Make sure the one with the superset is suggested first, because to test the subset one // needs to be added after. @@ -286,8 +281,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testContactDetailsAllMissingFieldsRecorded() - throws InterruptedException, TimeoutException { + public void testContactDetailsAllMissingFieldsRecorded() throws TimeoutException { // Don't add any profiles. mProfilesToAdd = new AutofillProfile[] {}; mCountsToSet = new int[] {};
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultiplePaymentInstrumentsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultiplePaymentInstrumentsTest.java index dc3a3aa..e0937d11 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultiplePaymentInstrumentsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultiplePaymentInstrumentsTest.java
@@ -87,7 +87,7 @@ private int[] mDatesToSet; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a complete autofill profile. @@ -96,8 +96,9 @@ ArrayList<String> guids = new ArrayList<>(); for (int i = 0; i < mCreditCardsToAdd.length; i++) { // CREDIT_CARDS[0] has no billing address. - if (mCreditCardsToAdd[i] != CREDIT_CARDS[0]) + if (mCreditCardsToAdd[i] != CREDIT_CARDS[0]) { mCreditCardsToAdd[i].setBillingAddressId(billingAddressId); + } String creditCardId = helper.setCreditCard(mCreditCardsToAdd[i]); guids.add(creditCardId); } @@ -116,7 +117,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCreditCardSuggestionOrdering() throws InterruptedException, TimeoutException { + public void testCreditCardSuggestionOrdering() throws TimeoutException { mCreditCardsToAdd = new CreditCard[] {CREDIT_CARDS[0], CREDIT_CARDS[3], CREDIT_CARDS[2], CREDIT_CARDS[1], CREDIT_CARDS[4]}; mCountsToSet = new int[] {20, 15, 10, 25, 30}; @@ -155,7 +156,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testMissingNameFieldRecorded() throws InterruptedException, TimeoutException { + public void testMissingNameFieldRecorded() throws TimeoutException { // Add a card with invalid billing address and another one with missing name. mCreditCardsToAdd = new CreditCard[] {CREDIT_CARDS[4], CREDIT_CARDS[0]}; mCountsToSet = new int[] {5, 5}; @@ -180,8 +181,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testMissingBillingAddressFieldRecorded() - throws InterruptedException, TimeoutException { + public void testMissingBillingAddressFieldRecorded() throws TimeoutException { // Add a card with invalid billing address. mCreditCardsToAdd = new CreditCard[] {CREDIT_CARDS[0]}; mCountsToSet = new int[] {5}; @@ -206,7 +206,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testAllMissingFieldsRecorded() throws InterruptedException, TimeoutException { + public void testAllMissingFieldsRecorded() throws TimeoutException { // Don't add any cards mCreditCardsToAdd = new CreditCard[] {}; mCountsToSet = new int[] {};
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameAndFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameAndFreeShippingTest.java index f368f6c..a5d497f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameAndFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameAndFreeShippingTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_name_and_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address with a valid payer name on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -59,7 +59,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -79,7 +79,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and cancel the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameTest.java index 32f41a1f..d5e69f54 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNameTest.java
@@ -43,7 +43,7 @@ new PaymentRequestTestRule("payment_request_name_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a valid payer name on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -78,7 +78,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -93,7 +93,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidNameAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidNameAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -115,7 +115,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddNameAndPay() throws InterruptedException, TimeoutException { + public void testAddNameAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -141,7 +141,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSuggestionsDeduped() throws InterruptedException, TimeoutException { + public void testSuggestionsDeduped() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -155,7 +155,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and complete the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java index 729c6c6..ff2bf6c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java
@@ -50,7 +50,7 @@ new PaymentRequestTestRule("payment_request_no_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -64,7 +64,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCloseDialog() throws InterruptedException, TimeoutException { + public void testCloseDialog() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.close_button, mPaymentRequestTestRule.getDismissed()); @@ -76,7 +76,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditAndCloseDialog() throws InterruptedException, TimeoutException { + public void testEditAndCloseDialog() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_secondary, mPaymentRequestTestRule.getReadyForInput()); @@ -90,7 +90,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testEditAndCancelDialog() throws InterruptedException, TimeoutException { + public void testEditAndCancelDialog() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_secondary, mPaymentRequestTestRule.getReadyForInput()); @@ -104,7 +104,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -120,7 +120,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCancelUnmaskAndRetry() throws InterruptedException, TimeoutException { + public void testCancelUnmaskAndRetry() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -140,7 +140,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidCardNumberAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidCardNumberAndCancel() throws TimeoutException { // Attempting to add an invalid card and cancelling out of the flow will result in the user // still being ready to pay with the previously selected credit card. fillNewCardForm("123", "Bob", DECEMBER, NEXT_YEAR, FIRST_BILLING_ADDRESS); @@ -159,7 +159,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // crbug.com/678983 @Feature({"Payments"}) - public void testAddEmptyNameOnCardAndCancel() throws InterruptedException, TimeoutException { + public void testAddEmptyNameOnCardAndCancel() throws TimeoutException { fillNewCardForm("5454-5454-5454-5454", "", DECEMBER, NEXT_YEAR, FIRST_BILLING_ADDRESS); mPaymentRequestTestRule.clickInCardEditorAndWait( R.id.editor_dialog_done_button, mPaymentRequestTestRule.getEditorValidationError()); @@ -175,7 +175,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSaveNewCardAndPay() throws InterruptedException, TimeoutException { + public void testSaveNewCardAndPay() throws TimeoutException { fillNewCardForm("5454-5454-5454-5454", "Bob", DECEMBER, NEXT_YEAR, FIRST_BILLING_ADDRESS); mPaymentRequestTestRule.clickInCardEditorAndWait( R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToPay()); @@ -193,7 +193,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddTemporaryCardAndPay() throws InterruptedException, TimeoutException { + public void testAddTemporaryCardAndPay() throws TimeoutException { fillNewCardForm("5454-5454-5454-5454", "Bob", DECEMBER, NEXT_YEAR, FIRST_BILLING_ADDRESS); // Uncheck the "Save this card on this device" checkbox, so the card is temporary. @@ -213,7 +213,7 @@ } private void fillNewCardForm(String cardNumber, String nameOnCard, int month, int year, - int billingAddress) throws InterruptedException, TimeoutException { + int billingAddress) throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -230,8 +230,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSaveNewCardAndNewBillingAddressAndPay() - throws InterruptedException, TimeoutException { + public void testSaveNewCardAndNewBillingAddressAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -271,8 +270,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddCardAndCloseShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddCardAndCloseShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -303,8 +301,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCloseAndAddCardShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCloseAndAddCardShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -331,8 +328,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickAddCardAndCancelShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickAddCardAndCancelShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -363,8 +359,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCancelAndAddCardShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCancelAndAddCardShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -394,8 +389,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickDismissAndPayShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickDismissAndPayShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Quickly dismiss and then press on "pay." @@ -420,8 +414,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickDismissAndCloseShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickDismissAndCloseShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Quickly dismiss and then press on [X]. @@ -446,8 +439,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testQuickCloseAndDismissShouldNotCrash() - throws InterruptedException, TimeoutException { + public void testQuickCloseAndDismissShouldNotCrash() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Quickly press on [X] and then dismiss. @@ -473,7 +465,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and cancel the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java index 8a405980..3134da1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_no_update_with_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); helper.setProfile(new AutofillProfile("" /* guid */, "https://www.example.com" /* origin */, "Lisa Simpson", "Acme Inc.", "123 Main", "California", "Los Angeles", "", "90210",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPayerDetailChangeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPayerDetailChangeTest.java index 38aaa8f..cc77441 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPayerDetailChangeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPayerDetailChangeTest.java
@@ -45,7 +45,7 @@ new PaymentRequestTestRule("payment_request_onpayerdetailchange.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billing_address_id = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -65,7 +65,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayerDetailChangeEvent() throws InterruptedException, TimeoutException { + public void testPayerDetailChangeEvent() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndBasicCardWithModifiersTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndBasicCardWithModifiersTest.java index d1b1698..08f1be0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndBasicCardWithModifiersTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndBasicCardWithModifiersTest.java
@@ -76,8 +76,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUpdateTotalAndInstrumentLabelWithBobPayModifiers() - throws InterruptedException, TimeoutException { + public void testUpdateTotalAndInstrumentLabelWithBobPayModifiers() throws TimeoutException { // Mastercard card with complete set of information and unknown type. mHelper.setCreditCard(new CreditCard("", "https://example.com", true /* isLocal */, true /* isCached */, "Jon Doe", "5555555555554444", "" /* obfuscatedNumber */, "12", @@ -105,8 +104,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUpdateTotalAndInstrumentLabelWithCreditModifiers() - throws InterruptedException, TimeoutException { + public void testUpdateTotalAndInstrumentLabelWithCreditModifiers() throws TimeoutException { // Credit mastercard card with complete set of information. mHelper.addServerCreditCard(new CreditCard("guid_1", "https://example.com", false /* isLocal */, true /* isCached */, "Jon Doe", "5454545454545454", @@ -140,8 +138,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUpdateTotalAndInstrumentLabelWithDebitModifiers() - throws InterruptedException, TimeoutException { + public void testUpdateTotalAndInstrumentLabelWithDebitModifiers() throws TimeoutException { // Debit mastercard card with complete set of information. mHelper.addServerCreditCard(new CreditCard("guid_1", "https://example.com", false /* isLocal */, true /* isCached */, "Jon Doe", "5200828282828210", @@ -175,8 +172,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUpdateTotalAndInstrumentLabelWithCreditVisaModifiers() - throws InterruptedException, TimeoutException { + public void testUpdateTotalAndInstrumentLabelWithCreditVisaModifiers() throws TimeoutException { // Credit visa card with complete set of information. mHelper.addServerCreditCard(new CreditCard("guid_1", "https://example.com", false /* isLocal */, true /* isCached */, "Jon Doe", "4111111111111111", @@ -210,7 +206,7 @@ @MediumTest @Feature({"Payments"}) public void testUpdateTotalAndInstrumentLabelWithMasterCreditModifiers() - throws InterruptedException, TimeoutException { + throws TimeoutException { // Credit mastercard with complete set of information. mHelper.addServerCreditCard(new CreditCard("guid_1", "https://example.com", false /* isLocal */, true /* isCached */, "Jon Doe", "5200828282828210", @@ -243,8 +239,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testUpdateTotalAndInstrumentLabelWithMastercardModifiers() - throws InterruptedException, TimeoutException { + public void testUpdateTotalAndInstrumentLabelWithMastercardModifiers() throws TimeoutException { // Mastercard card with complete set of information and unknown type. String guid = mHelper.setCreditCard(new CreditCard("", "https://example.com", true /* isLocal */, true /* isCached */, "Jon Doe", "5555555555554444", @@ -292,7 +287,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentAppCanPayWithModifiers() throws InterruptedException, TimeoutException { + public void testPaymentAppCanPayWithModifiers() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.triggerUIAndWait( "buy_with_bobpay_discount", mPaymentRequestTestRule.getReadyToPay()); @@ -316,7 +311,7 @@ @MediumTest @Feature({"Payments"}) public void testUpdateTotalWithCreditVisaModifiersForServiceWorkerPaymentApp() - throws InterruptedException, TimeoutException { + throws TimeoutException { String[] bobpayMethodNames = {"https://bobpay.com", "basic-card"}; int[] bobpayNetworks = {BasicCardNetwork.VISA}; int[] bobPayTypes = {BasicCardType.CREDIT};
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsTest.java index 1490fcd4..3f1dc8f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsTest.java
@@ -47,7 +47,7 @@ new PaymentRequestTestRule("payment_request_bobpay_and_cards_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -69,7 +69,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInFastBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInFastBobPay() throws TimeoutException { runTest(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); } @@ -80,7 +80,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInSlowBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInSlowBobPay() throws TimeoutException { runTest(NO_INSTRUMENTS, DELAYED_RESPONSE); } @@ -91,7 +91,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHaveInstrumentsInFastBobPay() throws InterruptedException, TimeoutException { + public void testHaveInstrumentsInFastBobPay() throws TimeoutException { runTest(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); } @@ -102,7 +102,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHaveInstrumentsInSlowBobPay() throws InterruptedException, TimeoutException { + public void testHaveInstrumentsInSlowBobPay() throws TimeoutException { runTest(HAVE_INSTRUMENTS, DELAYED_RESPONSE); } @@ -111,7 +111,7 @@ @MediumTest @Feature({"Payments"}) public void testEditPaymentMethodAndCancelEditorShouldKeepCardSelected() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -132,7 +132,7 @@ @MediumTest @Feature({"Payments"}) public void testAddPaymentMethodAndCancelEditorShouldKeepExistingCardSelected() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -148,8 +148,7 @@ mPaymentRequestTestRule.expectPaymentMethodRowIsSelected(0); } - private void runTest(int instrumentPresence, int responseSpeed) - throws InterruptedException, TimeoutException { + private void runTest(int instrumentPresence, int responseSpeed) throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(instrumentPresence, responseSpeed); mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppCanMakePaymentQueryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppCanMakePaymentQueryTest.java index d045e389..a8b3641 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppCanMakePaymentQueryTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppCanMakePaymentQueryTest.java
@@ -43,7 +43,7 @@ "payment_request_can_make_payment_query_bobpay_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Before public void setUp() { @@ -71,7 +71,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInFastBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); // canMakePayment returns true for BobPay and false for AlicePay. @@ -89,7 +89,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInSlowBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInSlowBobPay() throws TimeoutException { // Install BobPay. mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); @@ -108,7 +108,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaFastBobPay() throws TimeoutException { // Install BobPay. mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); @@ -126,7 +126,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaSlowBobPay() throws TimeoutException { // Install BobPay. mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java index 372e9c8ec..14a895a3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java
@@ -47,7 +47,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoSupportedPaymentMethods() throws InterruptedException, TimeoutException { + public void testNoSupportedPaymentMethods() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getShowFailed()); mPaymentRequestTestRule.expectResultContains( new String[] {"show() rejected", "Payment method not supported"}); @@ -60,7 +60,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInFastBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getShowFailed()); mPaymentRequestTestRule.expectResultContains( @@ -74,7 +74,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoInstrumentsInSlowBobPay() throws InterruptedException, TimeoutException { + public void testNoInstrumentsInSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getShowFailed()); mPaymentRequestTestRule.expectResultContains( @@ -89,7 +89,7 @@ @MediumTest @Feature({"Payments"}) public void testPaymentWithInstrumentsAppResponseAfterDismissShouldNotCrash() - throws InterruptedException, TimeoutException { + throws TimeoutException { final TestPay app = new TestPay("https://bobpay.com", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); PaymentAppFactory.getInstance().addAdditionalFactory( (webContents, methodNames, mayCrawlUnused, callback) -> { @@ -112,7 +112,7 @@ @FlakyTest(message = "https://crbug.com/769851") @Feature({"Payments"}) public void testPaymentAppNoInstrumentsResponseAfterDismissShouldNotCrash() - throws InterruptedException, TimeoutException { + throws TimeoutException { final TestPay app = new TestPay("https://bobpay.com", NO_INSTRUMENTS, IMMEDIATE_RESPONSE); PaymentAppFactory.getInstance().addAdditionalFactory( (webContents, methodNames, mayCrawlUnused, callback) -> { @@ -132,7 +132,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( @@ -148,7 +148,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( @@ -164,7 +164,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaDelayedFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaDelayedFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE, DELAYED_CREATION); mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); @@ -181,7 +181,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaDelayedSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaDelayedSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, DELAYED_RESPONSE, DELAYED_CREATION); mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipPreloadTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipPreloadTest.java index 43a50b6..207270f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipPreloadTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipPreloadTest.java
@@ -58,7 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); mPaymentRequestTestRule.expectResultContains( @@ -72,7 +72,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); mPaymentRequestTestRule.expectResultContains( @@ -86,7 +86,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaDelayedFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaDelayedFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE, DELAYED_CREATION); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); @@ -102,7 +102,7 @@ // @MediumTest // @Feature({"Payments"}) @DisabledTest - public void testPayViaDelayedSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaDelayedSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, DELAYED_RESPONSE, DELAYED_CREATION); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); @@ -120,8 +120,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testTwoPaymentsAppsWithTheSamePaymentMethodName() - throws InterruptedException, TimeoutException { + public void testTwoPaymentsAppsWithTheSamePaymentMethodName() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE, IMMEDIATE_CREATION); mPaymentRequestTestRule.installPaymentApp(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipTest.java index 2585ecc4..418d937 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppUiSkipTest.java
@@ -51,7 +51,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testFail() throws InterruptedException, TimeoutException { + public void testFail() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); // Wait for the error message overlay. @@ -72,7 +72,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); mPaymentRequestTestRule.expectResultContains( @@ -86,7 +86,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); mPaymentRequestTestRule.expectResultContains( @@ -100,7 +100,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaDelayedFastBobPay() throws InterruptedException, TimeoutException { + public void testPayViaDelayedFastBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE, DELAYED_CREATION); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); @@ -115,7 +115,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayViaDelayedSlowBobPay() throws InterruptedException, TimeoutException { + public void testPayViaDelayedSlowBobPay() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, DELAYED_RESPONSE, DELAYED_CREATION); mPaymentRequestTestRule.openPageAndClickBuyAndWait(mPaymentRequestTestRule.getDismissed()); @@ -133,8 +133,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testTwoPaymentsAppsWithTheSamePaymentMethodName() - throws InterruptedException, TimeoutException { + public void testTwoPaymentsAppsWithTheSamePaymentMethodName() throws TimeoutException { mPaymentRequestTestRule.installPaymentApp( "https://bobpay.com", HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE, IMMEDIATE_CREATION); mPaymentRequestTestRule.installPaymentApp(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppsSortingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppsSortingTest.java index 4dc7b9e7..023c30803 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppsSortingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppsSortingTest.java
@@ -43,7 +43,7 @@ "payment_request_alicepay_bobpay_charliepay_and_cards_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -58,7 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentAppsSortingByFrecency() throws InterruptedException, TimeoutException { + public void testPaymentAppsSortingByFrecency() throws TimeoutException { // Install a payment app with Bob Pay and Alice Pay, and another payment app with Charlie // Pay. final TestPay appA =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentMethodIdentifierTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentMethodIdentifierTest.java index 7a1834e..d161796 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentMethodIdentifierTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentMethodIdentifierTest.java
@@ -51,7 +51,7 @@ } @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { // The user has a valid "visa" card. AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -65,7 +65,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanPayWithBasicCard() throws InterruptedException, TimeoutException { + public void testCanPayWithBasicCard() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "checkBasicCard", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -77,7 +77,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testIgnoreCardType() throws InterruptedException, TimeoutException { + public void testIgnoreCardType() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "checkBasicDebit", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -90,8 +90,7 @@ @MediumTest @Feature({"Payments"}) @CommandLineFlags.Add("disable-features=NoCreditCardAbort") - public void testCannotMakeActivePaymentWithBasicMasterCard() - throws InterruptedException, TimeoutException { + public void testCannotMakeActivePaymentWithBasicMasterCard() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "checkBasicMasterCard", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -103,8 +102,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSupportedNetworksMustMatchForCanMakePayment() - throws InterruptedException, TimeoutException { + public void testSupportedNetworksMustMatchForCanMakePayment() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "checkBasicVisa", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -121,8 +119,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSupportedTypesMustMatchForCanMakePayment() - throws InterruptedException, TimeoutException { + public void testSupportedTypesMustMatchForCanMakePayment() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "checkBasicVisa", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -144,7 +141,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayWithBasicCard() throws InterruptedException, TimeoutException { + public void testPayWithBasicCard() throws TimeoutException { mPaymentRequestTestRule.openPageAndClickNodeAndWait( "checkBasicVisa", mPaymentRequestTestRule.getCanMakePaymentQueryResponded()); mPaymentRequestTestRule.expectResultContains(new String[] {"true"}); @@ -168,7 +165,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddMasterCard() throws InterruptedException, TimeoutException { + public void testAddMasterCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -200,7 +197,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddBasicCard() throws InterruptedException, TimeoutException { + public void testAddBasicCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInPaymentMethodAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneAndFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneAndFreeShippingTest.java index f241595d..498bf4ac 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneAndFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneAndFreeShippingTest.java
@@ -44,7 +44,7 @@ new PaymentRequestTestRule("payment_request_phone_and_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address with a valid phone number on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -59,7 +59,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -79,7 +79,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and complete the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java index 7b7f369..1e85ccb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java
@@ -43,7 +43,7 @@ new PaymentRequestTestRule("payment_request_phone_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a valid phone number on disk. helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", @@ -77,7 +77,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPay() throws InterruptedException, TimeoutException { + public void testPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getDismissed()); @@ -88,7 +88,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddInvalidPhoneAndCancel() throws InterruptedException, TimeoutException { + public void testAddInvalidPhoneAndCancel() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -110,7 +110,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddPhoneAndPay() throws InterruptedException, TimeoutException { + public void testAddPhoneAndPay() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -133,7 +133,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSuggestionsDeduped() throws InterruptedException, TimeoutException { + public void testSuggestionsDeduped() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInContactInfoAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -147,7 +147,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPaymentRequestEventsMetric() throws InterruptedException, TimeoutException { + public void testPaymentRequestEventsMetric() throws TimeoutException { // Start and abort the Payment Request. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRemoveBillingAddressTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRemoveBillingAddressTest.java index 0e68b78..77831754 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRemoveBillingAddressTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRemoveBillingAddressTest.java
@@ -45,7 +45,7 @@ new PaymentRequestTestRule("payment_request_no_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jane Smith", "Google", "1600 Amphitheatre Pkwy", "CA", "Mountain View", "", "94043", "", "US", @@ -66,7 +66,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayWithCard() throws InterruptedException, TimeoutException { + public void testPayWithCard() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); // Expand the payment section.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRetryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRetryTest.java index 43540f1a..5513828 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRetryTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestRetryTest.java
@@ -54,7 +54,7 @@ new RenderTestRule("components/test/data/payments/render_tests"); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billing_address_id = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -74,7 +74,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testRetryWithDefaultError() throws InterruptedException, TimeoutException { + public void testRetryWithDefaultError() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -97,7 +97,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testRetryWithCustomError() throws InterruptedException, TimeoutException { + public void testRetryWithCustomError() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -216,8 +216,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testRetryWithShippingAddressErrorsAndPayerErrors() - throws InterruptedException, TimeoutException { + public void testRetryWithShippingAddressErrorsAndPayerErrors() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -259,7 +258,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testRetryAndPayerDetailChangeEvent() throws InterruptedException, TimeoutException { + public void testRetryAndPayerDetailChangeEvent() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput()); @@ -298,7 +297,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testRetryAndReselectContactDetail() throws InterruptedException, TimeoutException { + public void testRetryAndReselectContactDetail() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServerCardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServerCardTest.java index ce408c9..0e1b7a20 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServerCardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServerCardTest.java
@@ -43,7 +43,7 @@ new PaymentRequestTestRule("payment_request_no_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -58,7 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testPayAndDontUnmask() throws InterruptedException, TimeoutException { + public void testPayAndDontUnmask() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickAndWait( R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServiceWorkerPaymentAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServiceWorkerPaymentAppTest.java index 34f39a5..b46eef6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServiceWorkerPaymentAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestServiceWorkerPaymentAppTest.java
@@ -79,7 +79,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoSupportedPaymentMethods() throws InterruptedException, TimeoutException { + public void testNoSupportedPaymentMethods() throws TimeoutException { installMockServiceWorkerPaymentApp( new String[0], new ServiceWorkerPaymentApp.Capabilities[0], true, true); @@ -93,7 +93,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHasSupportedPaymentMethods() throws InterruptedException, TimeoutException { + public void testHasSupportedPaymentMethods() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], true, true); @@ -107,7 +107,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testNoCapabilities() throws InterruptedException, TimeoutException { + public void testNoCapabilities() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com", "basic-card"}; ServiceWorkerPaymentApp.Capabilities[] capabilities = {}; installMockServiceWorkerPaymentApp(supportedMethodNames, capabilities, true, true); @@ -163,7 +163,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHasVisaCreditCapabilities() throws InterruptedException, TimeoutException { + public void testHasVisaCreditCapabilities() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com", "basic-card"}; int[] networks = {BasicCardNetwork.VISA}; int[] types = {BasicCardType.CREDIT}; @@ -214,8 +214,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHasMastercardCreditCapabilities() - throws InterruptedException, TimeoutException { + public void testHasMastercardCreditCapabilities() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com", "basic-card"}; int[] networks = {BasicCardNetwork.MASTERCARD}; int[] types = {BasicCardType.CREDIT}; @@ -267,8 +266,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testHasVisaCreditAndDebitCapabilities() - throws InterruptedException, TimeoutException { + public void testHasVisaCreditAndDebitCapabilities() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com", "basic-card"}; int[] networks = {BasicCardNetwork.VISA}; int[] types = {BasicCardType.CREDIT, BasicCardType.DEBIT}; @@ -320,7 +318,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testDoNotCallCanMakePayment() throws InterruptedException, TimeoutException { + public void testDoNotCallCanMakePayment() throws TimeoutException { String[] supportedMethodNames = {"basic-card"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], true, true); @@ -337,7 +335,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCallCanMakePayment() throws InterruptedException, TimeoutException { + public void testCallCanMakePayment() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com", "basic-card"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], true, true); @@ -355,7 +353,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanPreselect() throws InterruptedException, TimeoutException { + public void testCanPreselect() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], true, true); @@ -369,7 +367,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanNotPreselectWithoutName() throws InterruptedException, TimeoutException { + public void testCanNotPreselectWithoutName() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], false, true); @@ -383,7 +381,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanNotPreselectWithoutIcon() throws InterruptedException, TimeoutException { + public void testCanNotPreselectWithoutIcon() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], true, false); @@ -397,8 +395,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanNotPreselectWithoutNameAndIcon() - throws InterruptedException, TimeoutException { + public void testCanNotPreselectWithoutNameAndIcon() throws TimeoutException { String[] supportedMethodNames = {"https://bobpay.com"}; installMockServiceWorkerPaymentApp( supportedMethodNames, new ServiceWorkerPaymentApp.Capabilities[0], false, false);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressAndOptionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressAndOptionTest.java index 371c1e1..4a9f444 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressAndOptionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressAndOptionTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_free_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address associated with a credit card. String firstAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -66,8 +66,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressFormat_BottomSheet() - throws InterruptedException, TimeoutException { + public void testShippingAddressFormat_BottomSheet() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Make sure that the shipping label on the bottomsheet does not include the country. @@ -88,8 +87,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressFormat_FullSheet() - throws InterruptedException, TimeoutException { + public void testShippingAddressFormat_FullSheet() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Focus on a section other that shipping addresses to enter fullsheet mode. @@ -112,7 +110,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressFormat_Expanded() throws InterruptedException, TimeoutException { + public void testShippingAddressFormat_Expanded() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Focus on the shipping addresses section to enter expanded mode. @@ -142,8 +140,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testShippingAddressFormat_NewAddress() - throws InterruptedException, TimeoutException { + public void testShippingAddressFormat_NewAddress() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Add a shipping address. @@ -175,7 +172,7 @@ @MediumTest @Feature({"Payments"}) public void testEditShippingAddressAndCancelEditorShouldKeepAddressSelected() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -199,7 +196,7 @@ @MediumTest @Feature({"Payments"}) public void testEditShippingAddressAndClickAndroidBackButtonShouldKeepAddressSelected() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -223,7 +220,7 @@ @MediumTest @Feature({"Payments"}) public void testAddShippingAddressAndCancelEditorShouldKeepAddressSelected() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput()); @@ -247,7 +244,7 @@ @MediumTest @Feature({"Payments"}) public void testAddShippingAddressAndClickAndroidBackButtonShouldKeepAddressSelected() - throws InterruptedException, TimeoutException { + throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.clickInShippingAddressAndWait( R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressChangeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressChangeTest.java index 8bf5194..0125f79 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressChangeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShippingAddressChangeTest.java
@@ -40,7 +40,7 @@ new PaymentRequestTestRule("payment_request_shipping_address_change_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); // The user has a shipping address on disk. String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", @@ -58,8 +58,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testAddressRedactionInShippingAddressChange() - throws InterruptedException, TimeoutException { + public void testAddressRedactionInShippingAddressChange() throws TimeoutException { // Select a shipping address and cancel out. mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); mPaymentRequestTestRule.clickInShippingAddressAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseDigitalGoodsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseDigitalGoodsTest.java index ebf51938..86622ed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseDigitalGoodsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseDigitalGoodsTest.java
@@ -38,7 +38,7 @@ new PaymentRequestTestRule("show_promise/digital_goods.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} // The initial total in digital_goods.js is 99.99 while the final total is 1.00. Transaction // amount metrics must record the final total rather than the initial one. The final total falls @@ -48,7 +48,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testDigitalGoodsFastApp() throws InterruptedException, TimeoutException { + public void testDigitalGoodsFastApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.openPage(); @@ -71,7 +71,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testDigitalGoodsSlowApp() throws InterruptedException, TimeoutException { + public void testDigitalGoodsSlowApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.DELAYED_RESPONSE, PaymentRequestTestRule.DELAYED_CREATION); mRule.openPage(); @@ -94,7 +94,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSkipUIFastApp() throws InterruptedException, TimeoutException { + public void testSkipUIFastApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.openPage(); @@ -109,7 +109,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSkipUISlowApp() throws InterruptedException, TimeoutException { + public void testSkipUISlowApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.DELAYED_RESPONSE, PaymentRequestTestRule.DELAYED_CREATION); mRule.openPage();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyListsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyListsTest.java index f904429..d748a49 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyListsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyListsTest.java
@@ -40,7 +40,7 @@ new PaymentRequestTestRule("show_promise/resolve_with_empty_lists.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { new AutofillTestHelper().setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "650-253-0000", "", "en-US")); @@ -49,7 +49,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testResolveWithEmptyLists() throws InterruptedException, TimeoutException { + public void testResolveWithEmptyLists() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.triggerUIAndWait(mRule.getReadyForInput());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyTest.java index 5dbe9e3..c7158a8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseEmptyTest.java
@@ -39,7 +39,7 @@ new PaymentRequestTestRule("show_promise/resolve_with_empty_dictionary.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { new AutofillTestHelper().setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "650-253-0000", "", "en-US")); @@ -48,7 +48,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testResolveWithEmptyDictionary() throws InterruptedException, TimeoutException { + public void testResolveWithEmptyDictionary() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.triggerUIAndWait(mRule.getReadyToPay());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseInvalidDetailsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseInvalidDetailsTest.java index d93a9cd..4746ee4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseInvalidDetailsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseInvalidDetailsTest.java
@@ -35,12 +35,12 @@ new PaymentRequestTestRule("show_promise/invalid_details.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Test @MediumTest @Feature({"Payments"}) - public void testReject() throws InterruptedException, TimeoutException { + public void testReject() throws TimeoutException { mRule.openPageAndClickNodeAndWait("buy", mRule.getDismissed()); mRule.expectResultContains(new String[] {"Total amount value should be non-negative"}); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseRejectTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseRejectTest.java index d12b73a..82d8164 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseRejectTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseRejectTest.java
@@ -35,12 +35,12 @@ new PaymentRequestTestRule("show_promise/reject.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Test @MediumTest @Feature({"Payments"}) - public void testReject() throws InterruptedException, TimeoutException { + public void testReject() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.openPageAndClickNodeAndWait("buy", mRule.getDismissed());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingTest.java index 6ee8927f..698e050 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingTest.java
@@ -41,7 +41,7 @@ new PaymentRequestTestRule("show_promise/single_option_shipping.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper autofillTestHelper = new AutofillTestHelper(); autofillTestHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "California", "Los Angeles", "", "90291", "", @@ -54,7 +54,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testFastApp() throws InterruptedException, TimeoutException { + public void testFastApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.triggerUIAndWait(mRule.getReadyToPay()); @@ -69,7 +69,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSlowApp() throws InterruptedException, TimeoutException { + public void testSlowApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.DELAYED_RESPONSE, PaymentRequestTestRule.DELAYED_CREATION); mRule.triggerUIAndWait(mRule.getReadyToPay());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingWithUpdateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingWithUpdateTest.java index d5eb35a..d8d7da2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingWithUpdateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseSingleOptionShippingWithUpdateTest.java
@@ -41,7 +41,7 @@ "show_promise/single_option_shipping_with_update.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper autofillTestHelper = new AutofillTestHelper(); autofillTestHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "California", "Los Angeles", "", "90291", "", @@ -54,7 +54,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testFastApp() throws InterruptedException, TimeoutException { + public void testFastApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); mRule.triggerUIAndWait(mRule.getReadyToPay()); @@ -69,7 +69,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSlowApp() throws InterruptedException, TimeoutException { + public void testSlowApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.DELAYED_RESPONSE, PaymentRequestTestRule.DELAYED_CREATION); mRule.triggerUIAndWait(mRule.getReadyToPay());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUSOnlyShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUSOnlyShippingTest.java index 216cfa8e..e5dbe48 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUSOnlyShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUSOnlyShippingTest.java
@@ -39,12 +39,12 @@ new PaymentRequestTestRule("show_promise/us_only_shipping.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Test @MediumTest @Feature({"Payments"}) - public void testCannotShipWithFastApp() throws InterruptedException, TimeoutException { + public void testCannotShipWithFastApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); runCannotShipTest(); @@ -53,13 +53,13 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCannotShipWithSlowApp() throws InterruptedException, TimeoutException { + public void testCannotShipWithSlowApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.DELAYED_RESPONSE, PaymentRequestTestRule.DELAYED_CREATION); runCannotShipTest(); } - private void runCannotShipTest() throws InterruptedException, TimeoutException { + private void runCannotShipTest() throws TimeoutException { AutofillTestHelper autofillTestHelper = new AutofillTestHelper(); autofillTestHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "51 Breithaupt St", "ON", "Kitchener", "", "N2H 5G5", "", "CA", @@ -79,7 +79,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanShipWithFastApp() throws InterruptedException, TimeoutException { + public void testCanShipWithFastApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.IMMEDIATE_RESPONSE); runCanShipTest(); @@ -88,13 +88,13 @@ @Test @MediumTest @Feature({"Payments"}) - public void testCanShipWithSlowApp() throws InterruptedException, TimeoutException { + public void testCanShipWithSlowApp() throws TimeoutException { mRule.installPaymentApp("basic-card", PaymentRequestTestRule.HAVE_INSTRUMENTS, PaymentRequestTestRule.DELAYED_RESPONSE, PaymentRequestTestRule.DELAYED_CREATION); runCanShipTest(); } - private void runCanShipTest() throws InterruptedException, TimeoutException { + private void runCanShipTest() throws TimeoutException { AutofillTestHelper autofillTestHelper = new AutofillTestHelper(); autofillTestHelper.setProfile(new AutofillProfile("", "https://example.com", true, "Jane Smith", "Google", "340 Main St", "California", "Los Angeles", "", "90291", "",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUnsupportedTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUnsupportedTest.java index 90c089c4..94533f2b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUnsupportedTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowPromiseUnsupportedTest.java
@@ -35,12 +35,12 @@ new PaymentRequestTestRule("show_promise/unsupported.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException {} + public void onMainActivityStarted() {} @Test @MediumTest @Feature({"Payments"}) - public void testReject() throws InterruptedException, TimeoutException { + public void testReject() throws TimeoutException { mRule.openPageAndClickNodeAndWait("buy", mRule.getDismissed()); mRule.expectResultContains( new String[] {"NotSupportedError: Payment method not supported"});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowTwiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowTwiceTest.java index 66bb514..0e6f0e7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowTwiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestShowTwiceTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_show_twice_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -55,7 +55,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testSecondShowRequestCancelled() throws InterruptedException, TimeoutException { + public void testSecondShowRequestCancelled() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mPaymentRequestTestRule.expectResultContains(new String[] { "Second request: AbortError: Another PaymentRequest UI is already showing in a "
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTabTest.java index a6e4880..2e71f1b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTabTest.java
@@ -48,7 +48,7 @@ new PaymentRequestTestRule("payment_request_dynamic_shipping_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", @@ -62,7 +62,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testDismissOnTabSwitch() throws InterruptedException, TimeoutException { + public void testDismissOnTabSwitch() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); Assert.assertEquals(0, mPaymentRequestTestRule.getDismissed().getCallCount()); TestThreadUtils.runOnUiThreadBlocking( @@ -78,7 +78,7 @@ // Disabled due to recent flakiness: crbug.com/661450. @Test @DisabledTest - public void testDismissOnTabClose() throws InterruptedException, TimeoutException { + public void testDismissOnTabClose() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); Assert.assertEquals(0, mPaymentRequestTestRule.getDismissed().getCallCount()); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -92,7 +92,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testDismissOnTabNavigate() throws InterruptedException, TimeoutException { + public void testDismissOnTabNavigate() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyForInput()); Assert.assertEquals(0, mPaymentRequestTestRule.getDismissed().getCallCount()); TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java index 8b46bb02..8bb534c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java
@@ -171,11 +171,11 @@ this(testFileName, null); } - public void startMainActivity() throws InterruptedException { + public void startMainActivity() { startMainActivityWithURL(mTestFilePath); } - protected void openPage() throws InterruptedException, TimeoutException { + protected void openPage() throws TimeoutException { onMainActivityStarted(); ThreadUtils.runOnUiThreadBlocking(() -> { mWebContentsRef.set(getActivity().getCurrentWebContents()); @@ -252,70 +252,64 @@ } protected void triggerUIAndWait(PaymentsCallbackHelper<PaymentRequestUI> helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { openPageAndClickNodeAndWait("buy", helper); mUI = helper.getTarget(); } protected void openPageAndClickNodeAndWait(String nodeId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { openPage(); clickNodeAndWait(nodeId, helper); } - protected void openPageAndClickBuyAndWait(CallbackHelper helper) - throws InterruptedException, TimeoutException { + protected void openPageAndClickBuyAndWait(CallbackHelper helper) throws TimeoutException { openPageAndClickNodeAndWait("buy", helper); } - protected void openPageAndClickNode(String nodeId) - throws InterruptedException, TimeoutException { + protected void openPageAndClickNode(String nodeId) throws TimeoutException { openPage(); clickNode(nodeId); } protected void triggerUIAndWait(String nodeId, PaymentsCallbackHelper<PaymentRequestUI> helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { openPageAndClickNodeAndWait(nodeId, helper); mUI = helper.getTarget(); } - protected void reTriggerUIAndWait( - String nodeId, PaymentsCallbackHelper<PaymentRequestUI> helper) - throws InterruptedException, TimeoutException { + protected void reTriggerUIAndWait(String nodeId, + PaymentsCallbackHelper<PaymentRequestUI> helper) throws TimeoutException { clickNodeAndWait(nodeId, helper); mUI = helper.getTarget(); } protected void retryPaymentRequest(String validationErrors, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); JavaScriptUtils.executeJavaScriptAndWaitForResult( mWebContentsRef.get(), "retry(" + validationErrors + ");"); helper.waitForCallback(callCount); } - protected String executeJavaScriptAndWaitForResult(String script) - throws InterruptedException, TimeoutException { + protected String executeJavaScriptAndWaitForResult(String script) throws TimeoutException { return JavaScriptUtils.executeJavaScriptAndWaitForResult(mWebContentsRef.get(), script); } /** Clicks on an HTML node. */ - protected void clickNodeAndWait(String nodeId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + protected void clickNodeAndWait(String nodeId, CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); clickNode(nodeId); helper.waitForCallback(callCount); } /** Clicks on an HTML node. */ - protected void clickNode(String nodeId) throws InterruptedException, TimeoutException { + protected void clickNode(String nodeId) throws TimeoutException { DOMUtils.clickNode(mWebContentsRef.get(), nodeId); } /** Clicks on an element in the payments UI. */ - protected void clickAndWait(int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + protected void clickAndWait(int resourceId, CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); CriteriaHelper.pollUiThread(new Criteria() { @Override @@ -330,7 +324,7 @@ /** Clicks on an element in the error overlay. */ protected void clickErrorOverlayAndWait(int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { // Error overlay always allows clicks and is not taken into account in @@ -341,8 +335,7 @@ } /** Clicks on an element in the "Order summary" section of the payments UI. */ - protected void clickInOrderSummaryAndWait(CallbackHelper helper) - throws InterruptedException, TimeoutException { + protected void clickInOrderSummaryAndWait(CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { mUI.getOrderSummarySectionForTest().findViewById(R.id.payments_section).performClick(); @@ -352,7 +345,7 @@ /** Clicks on an element in the "Shipping address" section of the payments UI. */ protected void clickInShippingAddressAndWait(final int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { mUI.getShippingAddressSectionForTest().findViewById(resourceId).performClick(); @@ -362,7 +355,7 @@ /** Clicks on an element in the "Payment" section of the payments UI. */ protected void clickInPaymentMethodAndWait(final int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { mUI.getPaymentMethodSectionForTest().findViewById(resourceId).performClick(); @@ -372,7 +365,7 @@ /** Clicks on an element in the "Contact Info" section of the payments UI. */ protected void clickInContactInfoAndWait(final int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { mUI.getContactDetailsSectionForTest().findViewById(resourceId).performClick(); @@ -382,7 +375,7 @@ /** Clicks on an element in the editor UI for credit cards. */ protected void clickInCardEditorAndWait(final int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking( () -> { mUI.getCardEditorDialog().findViewById(resourceId).performClick(); }); @@ -391,7 +384,7 @@ /** Clicks on an element in the editor UI. */ protected void clickInEditorAndWait(final int resourceId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking( () -> { mUI.getEditorDialog().findViewById(resourceId).performClick(); }); @@ -399,7 +392,7 @@ } protected void clickAndroidBackButtonInEditorAndWait(CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { mUI.getEditorDialog().dispatchKeyEvent( @@ -412,7 +405,7 @@ /** Clicks on a button in the card unmask UI. */ protected void clickCardUnmaskButtonAndWait(final int dialogButtonId, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { PropertyModel model = mCardUnmaskPrompt.getDialogForTest(); @@ -601,10 +594,9 @@ /** * Clicks on the label corresponding to the shipping address suggestion at the specified * |suggestionIndex|. - * @throws InterruptedException */ - protected void clickOnShippingAddressSuggestionOptionAndWait(final int suggestionIndex, - CallbackHelper helper) throws TimeoutException, InterruptedException { + protected void clickOnShippingAddressSuggestionOptionAndWait( + final int suggestionIndex, CallbackHelper helper) throws TimeoutException { Assert.assertTrue(suggestionIndex < getNumberOfShippingAddressSuggestions()); int callCount = helper.getCallCount(); @@ -619,10 +611,9 @@ /** * Clicks on the label corresponding to the payment method suggestion at the specified * |suggestionIndex|. - * @throws InterruptedException */ - protected void clickOnPaymentMethodSuggestionOptionAndWait(final int suggestionIndex, - CallbackHelper helper) throws TimeoutException, InterruptedException { + protected void clickOnPaymentMethodSuggestionOptionAndWait( + final int suggestionIndex, CallbackHelper helper) throws TimeoutException { Assert.assertTrue(suggestionIndex < getNumberOfPaymentInstruments()); int callCount = helper.getCallCount(); @@ -637,10 +628,9 @@ /** * Clicks on the label corresponding to the contact info suggestion at the specified * |suggestionIndex|. - * @throws InterruptedException */ - protected void clickOnContactInfoSuggestionOptionAndWait(final int suggestionIndex, - CallbackHelper helper) throws TimeoutException, InterruptedException { + protected void clickOnContactInfoSuggestionOptionAndWait( + final int suggestionIndex, CallbackHelper helper) throws TimeoutException { Assert.assertTrue(suggestionIndex < getNumberOfContactDetailSuggestions()); int callCount = helper.getCallCount(); @@ -656,8 +646,8 @@ * Clicks on the edit icon corresponding to the payment method suggestion at the specified * |suggestionIndex|. */ - protected void clickOnPaymentMethodSuggestionEditIconAndWait(final int suggestionIndex, - CallbackHelper helper) throws TimeoutException, InterruptedException { + protected void clickOnPaymentMethodSuggestionEditIconAndWait( + final int suggestionIndex, CallbackHelper helper) throws TimeoutException { Assert.assertTrue(suggestionIndex < getNumberOfPaymentInstruments()); int callCount = helper.getCallCount(); @@ -748,8 +738,8 @@ } /** Selects the spinner value in the editor UI for credit cards. */ - protected void setSpinnerSelectionsInCardEditorAndWait(final int[] selections, - CallbackHelper helper) throws InterruptedException, TimeoutException { + protected void setSpinnerSelectionsInCardEditorAndWait( + final int[] selections, CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { List<Spinner> fields = mUI.getCardEditorDialog().getDropdownFieldsForTest(); @@ -762,7 +752,7 @@ /** Selects the spinner value in the editor UI. */ protected void setSpinnerSelectionInEditorAndWait(final int selection, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking( () @@ -773,7 +763,7 @@ /** Directly sets the text in the editor UI for credit cards. */ protected void setTextInCardEditorAndWait(final String[] values, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { ViewGroup contents = @@ -791,7 +781,7 @@ /** Directly sets the text in the editor UI. */ protected void setTextInEditorAndWait(final String[] values, CallbackHelper helper) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { List<EditText> fields = mUI.getEditorDialog().getEditableTextFieldsForTest(); @@ -805,7 +795,7 @@ /** Directly sets the checkbox selection in the editor UI for credit cards. */ protected void selectCheckboxAndWait(final int resourceId, final boolean isChecked, - CallbackHelper helper) throws InterruptedException, TimeoutException { + CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking( () @@ -816,7 +806,7 @@ /** Directly sets the text in the card unmask UI. */ protected void setTextInCardUnmaskDialogAndWait(final int resourceId, final String input, - CallbackHelper helper) throws InterruptedException, TimeoutException { + CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { EditText editText = mCardUnmaskPrompt.getDialogForTest() @@ -829,9 +819,8 @@ } /** Directly sets the text in the expired card unmask UI. */ - protected void setTextInExpiredCardUnmaskDialogAndWait( - final int[] resourceIds, final String[] values, CallbackHelper helper) - throws InterruptedException, TimeoutException { + protected void setTextInExpiredCardUnmaskDialogAndWait(final int[] resourceIds, + final String[] values, CallbackHelper helper) throws TimeoutException { assert resourceIds.length == values.length; int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { @@ -847,8 +836,8 @@ } /** Focues a view and hits the "submit" button on the software keyboard. */ - /* package */ void hitSoftwareKeyboardSubmitButtonAndWait(final int resourceId, - CallbackHelper helper) throws InterruptedException, TimeoutException { + /* package */ void hitSoftwareKeyboardSubmitButtonAndWait( + final int resourceId, CallbackHelper helper) throws TimeoutException { int callCount = helper.getCallCount(); ThreadUtils.runOnUiThreadBlocking(() -> { EditText editText = mCardUnmaskPrompt.getDialogForTest() @@ -879,9 +868,6 @@ } } return true; - } catch (InterruptedException e1) { - updateFailureReason(e1.getMessage()); - return false; } catch (TimeoutException e2) { updateFailureReason(e2.getMessage()); return false; @@ -953,7 +939,7 @@ } } - /* package */ View getPaymentRequestView() throws Throwable { + /* package */ View getPaymentRequestView() { return ThreadUtils.runOnUiThreadBlockingNoException( () -> mUI.getDialogForTest().findViewById(R.id.payment_request)); } @@ -1276,7 +1262,7 @@ public void dismissInstrument() {} } - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { if (mCallback != null) { mCallback.onMainActivityStarted(); } @@ -1296,6 +1282,6 @@ /** The interface for being notified of the main activity startup. */ public interface MainActivityStartCallback { /** Called when the main activity has started up. */ - void onMainActivityStarted() throws InterruptedException, TimeoutException; + void onMainActivityStarted() throws TimeoutException; } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUpdateWithTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUpdateWithTest.java index 6c14cf9..e81b871 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUpdateWithTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUpdateWithTest.java
@@ -42,7 +42,7 @@ new PaymentRequestTestRule("payment_request_update_with_test.html", this); @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); helper.setProfile(new AutofillProfile("" /* guid */, "https://www.example.com" /* origin */, "Lisa Simpson", "Acme Inc.", "123 Main", "California", "Los Angeles", "", "90210",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUseStatsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUseStatsTest.java index eb723a49..70ac3f15 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUseStatsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestUseStatsTest.java
@@ -47,7 +47,7 @@ String mCreditCardId; @Override - public void onMainActivityStarted() throws InterruptedException, TimeoutException { + public void onMainActivityStarted() throws TimeoutException { mHelper = new AutofillTestHelper(); // The user has a shipping address and a credit card associated with that address on disk. mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https://example.com", @@ -65,7 +65,7 @@ @Test @MediumTest @Feature({"Payments"}) - public void testLogProfileAndCreditCardUse() throws InterruptedException, TimeoutException { + public void testLogProfileAndCreditCardUse() throws TimeoutException { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); // Get the current date value just before the start of the Payment Request.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/micro/MicrotransactionRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/micro/MicrotransactionRenderTest.java new file mode 100644 index 0000000..7a13b52 --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/micro/MicrotransactionRenderTest.java
@@ -0,0 +1,348 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.payments.micro; + +import android.support.annotation.Nullable; +import android.support.graphics.drawable.VectorDrawableCompat; +import android.support.test.filters.SmallTest; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.R; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ui.DummyUiActivityTestCase; +import org.chromium.chrome.test.util.RenderTestRule; +import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.modelutil.PropertyModel; +import org.chromium.ui.modelutil.PropertyModelChangeProcessor; + +/** Tests for the microtransaction view binder. */ +@RunWith(ChromeJUnit4ClassRunner.class) +public class MicrotransactionRenderTest extends DummyUiActivityTestCase { + @Rule + public RenderTestRule mRenderTestRule = + new RenderTestRule("components/test/data/payments/render_tests"); + + private PropertyModel mModel; + private MicrotransactionView mView; + private RelativeLayout mLayout; + private PropertyModelChangeProcessor mProcessor; + + @Override + public void setUpTest() throws Exception { + super.setUpTest(); + // Initial button state: + mModel = + new PropertyModel.Builder(MicrotransactionProperties.ALL_KEYS) + .with(MicrotransactionProperties.ACCOUNT_BALANCE, "$18.00") + .with(MicrotransactionProperties.AMOUNT, "$1.00") + .with(MicrotransactionProperties.CURRENCY, "USD") + .with(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, true) + .with(MicrotransactionProperties.IS_SHOWING_PAY_BUTTON, true) + .with(MicrotransactionProperties.IS_SHOWING_PROCESSING_SPINNER, false) + .with(MicrotransactionProperties.PAYMENT_APP_ICON, + VectorDrawableCompat.create(getActivity().getResources(), + R.drawable.ic_done_googblue_36dp, getActivity().getTheme())) + .with(MicrotransactionProperties.PAYMENT_APP_NAME, "App Name") + .with(MicrotransactionProperties.STATUS_TEXT_RESOURCE, + R.string.payment_request_payment_method_section_name) + .build(); + + mView = new MicrotransactionView(getActivity()); + mProcessor = PropertyModelChangeProcessor.create( + mModel, mView, MicrotransactionViewBinder::bind); + + mLayout = new RelativeLayout(getActivity()); + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + mLayout.addView(mView.getContentView(), params); + mLayout.addView(mView.getToolbarView(), params); + + TestThreadUtils.runOnUiThreadBlocking(() -> { + getActivity().setContentView(mLayout, + new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + }); + } + + @Override + public void tearDownTest() { + mProcessor.destroy(); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonInitial() throws Throwable { + mRenderTestRule.render(mLayout, "button_initial"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonInitialExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking( + () -> mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f)); + mRenderTestRule.render(mLayout, "button_initial_expanded"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonProcessing() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> showButtonProcessing()); + mRenderTestRule.render(mLayout, "button_processing"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonProcessingExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showButtonProcessing(); + }); + mRenderTestRule.render(mLayout, "button_processing_expanded"); + } + + private void showButtonProcessing() { + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + mModel.set(MicrotransactionProperties.IS_SHOWING_PAY_BUTTON, false); + mModel.set(MicrotransactionProperties.IS_SHOWING_PROCESSING_SPINNER, true); + mModel.set(MicrotransactionProperties.STATUS_TEXT, null); + mModel.set(MicrotransactionProperties.STATUS_TEXT_RESOURCE, + R.string.payments_processing_message); + + stopSpinner(mView.mToolbarProcessingSpinner); + stopSpinner(mView.mContentProcessingSpinner); + } + + private void stopSpinner(View view) { + ProgressBar spinner = (ProgressBar) view; + spinner.setIndeterminate(false); + spinner.setMax(2); + spinner.setProgress(1); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonErrorResource() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + showEmphasizedStatus(R.string.payment_fingerprint_not_recognized, null, + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + }); + mRenderTestRule.render(mLayout, "button_error_resource"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonErrorResourceExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showEmphasizedStatus(R.string.payment_fingerprint_not_recognized, null, + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + }); + mRenderTestRule.render(mLayout, "button_error_resource_expanded"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonErrorString() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + showEmphasizedStatus(null, "Finger moved too fast. Try again.", + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + }); + mRenderTestRule.render(mLayout, "button_error_string"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonErrorStringExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showEmphasizedStatus(null, "Finger moved too fast. Try again.", + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + }); + mRenderTestRule.render(mLayout, "button_error_string_expanded"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonSuccess() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + showEmphasizedStatus(R.string.payment_complete_message, null, + R.drawable.ic_done_googblue_36dp, R.color.microtransaction_emphasis_tint); + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + }); + mRenderTestRule.render(mLayout, "button_success"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testButtonSuccessExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showEmphasizedStatus(R.string.payment_complete_message, null, + R.drawable.ic_done_googblue_36dp, R.color.microtransaction_emphasis_tint); + mModel.set(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, false); + }); + mRenderTestRule.render(mLayout, "button_success_expanded"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintInitial() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> showFingerprintInitial()); + mRenderTestRule.render(mLayout, "fingerprint_initial"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintInitialExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showFingerprintInitial(); + }); + mRenderTestRule.render(mLayout, "fingerprint_initial_expanded"); + } + + private void showFingerprintInitial() { + mModel.set(MicrotransactionProperties.IS_SHOWING_PAY_BUTTON, false); + mModel.set(MicrotransactionProperties.STATUS_ICON, R.drawable.ic_fingerprint_grey500_36dp); + mModel.set( + MicrotransactionProperties.STATUS_ICON_TINT, R.color.microtransaction_default_tint); + mModel.set(MicrotransactionProperties.STATUS_TEXT_RESOURCE, + R.string.payment_touch_sensor_to_pay); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintProcessing() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> showFingerprintProcessing()); + mRenderTestRule.render(mLayout, "fingerprint_processing"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintProcessingExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showFingerprintProcessing(); + }); + mRenderTestRule.render(mLayout, "fingerprint_processing_expanded"); + } + + private void showFingerprintProcessing() { + mModel.set(MicrotransactionProperties.IS_SHOWING_PAY_BUTTON, false); + mModel.set(MicrotransactionProperties.STATUS_TEXT, null); + mModel.set(MicrotransactionProperties.STATUS_TEXT_RESOURCE, + R.string.payments_processing_message); + mModel.set(MicrotransactionProperties.STATUS_ICON, R.drawable.ic_fingerprint_grey500_36dp); + mModel.set(MicrotransactionProperties.STATUS_ICON_TINT, + R.color.microtransaction_emphasis_tint); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintErrorResource() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + showEmphasizedStatus(R.string.payment_fingerprint_not_recognized, null, + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + }); + mRenderTestRule.render(mLayout, "fingerprint_error_resource"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintErrorResourceExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showEmphasizedStatus(R.string.payment_fingerprint_not_recognized, null, + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + }); + mRenderTestRule.render(mLayout, "fingerprint_error_resource_expanded"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintErrorString() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + showEmphasizedStatus(null, "Finger moved too fast. Try again.", + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + }); + mRenderTestRule.render(mLayout, "fingerprint_error_string"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintErrorStringExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showEmphasizedStatus(null, "Finger moved too fast. Try again.", + R.drawable.ic_error_googred_36dp, R.color.microtransaction_error_tint); + }); + mRenderTestRule.render(mLayout, "fingerprint_error_string_expanded"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintSuccess() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + showEmphasizedStatus(R.string.payment_complete_message, null, + R.drawable.ic_done_googblue_36dp, R.color.microtransaction_emphasis_tint); + }); + mRenderTestRule.render(mLayout, "fingerprint_success"); + } + + @Test + @SmallTest + @Feature({"Microtransaction", "RenderTest"}) + public void testFingerprintSuccessExpanded() throws Throwable { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.set(MicrotransactionProperties.PAYMENT_APP_NAME_ALPHA, 1f); + showEmphasizedStatus(R.string.payment_complete_message, null, + R.drawable.ic_done_googblue_36dp, R.color.microtransaction_emphasis_tint); + }); + mRenderTestRule.render(mLayout, "fingerprint_success_expanded"); + } + + private void showEmphasizedStatus(@Nullable Integer messageResourceId, + @Nullable CharSequence message, @Nullable Integer iconResourceId, + @Nullable Integer iconTint) { + mModel.set(MicrotransactionProperties.IS_SHOWING_PAY_BUTTON, false); + mModel.set(MicrotransactionProperties.STATUS_TEXT, message); + mModel.set(MicrotransactionProperties.STATUS_TEXT_RESOURCE, messageResourceId); + mModel.set(MicrotransactionProperties.IS_STATUS_EMPHASIZED, true); + mModel.set(MicrotransactionProperties.STATUS_ICON, iconResourceId); + mModel.set(MicrotransactionProperties.STATUS_ICON_TINT, iconTint); + mModel.set(MicrotransactionProperties.IS_SHOWING_PROCESSING_SPINNER, false); + } +}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java index e8663bd..3ff81c5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java
@@ -116,9 +116,10 @@ public Boolean call() { boolean isDialogShownForTest = PermissionDialogController.getInstance().isDialogShownForTest(); - if (isDialogShownForTest) + if (isDialogShownForTest) { ModalDialogTestUtils.checkCurrentPresenter( mModalDialogManager, ModalDialogType.TAB); + } return isDialogShownForTest == mExpectDialog; } }); @@ -132,7 +133,7 @@ super(ChromeActivity.class); } - private void ruleSetUp() throws Throwable { + private void ruleSetUp() { // TODO(https://crbug.com/867446): Refactor to use EmbeddedTestServerRule. mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @@ -146,11 +147,11 @@ getInfoBarContainer().addAnimationListener(mListener); } - private void ruleTearDown() throws Exception { + private void ruleTearDown() { mTestServer.stopAndDestroyServer(); } - protected void setUpUrl(final String url) throws InterruptedException { + protected void setUpUrl(final String url) { loadUrl(getURL(url)); } @@ -223,7 +224,7 @@ } private void runJavaScriptCodeInCurrentTabWithGesture(String javascript) - throws InterruptedException, java.util.concurrent.TimeoutException { + throws java.util.concurrent.TimeoutException { runJavaScriptCodeInCurrentTab("functionToRun = '" + javascript + "'"); TouchCommon.singleClickView(getActivity().getActivityTab().getView()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java index f488209..a9dfbbd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java
@@ -47,7 +47,7 @@ @Feature({"Policy"}) @SmallTest @RetryOnFailure - public void testTerminateIncognitoSon() throws InterruptedException { + public void testTerminateIncognitoSon() { final boolean incognitoMode = true; TabModel incognitoTabModel =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java index 1895462..5735a50b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java
@@ -44,12 +44,12 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java index 00addb3..ae4b7210 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java
@@ -53,7 +53,7 @@ private Account mAccount; @Before - public void setUp() throws Exception { + public void setUp() { setupTestAccount(); mSyncContentResolverDelegate = new MockSyncContentResolverDelegate(); mContext = InstrumentationRegistry.getTargetContext(); @@ -75,7 +75,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> ProfileSyncService.resetForTests()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PreferencesTest.java index 89a1bd20..968627e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PreferencesTest.java
@@ -167,7 +167,7 @@ ensureTemplateUrlServiceLoaded(); CriteriaHelper.pollUiThread(Criteria.equals(true, new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return TemplateUrlServiceFactory.get().isDefaultSearchManaged(); } })); @@ -183,7 +183,7 @@ CriteriaHelper.pollUiThread(Criteria.equals(null, new Callable<Object>() { @Override - public Object call() throws Exception { + public Object call() { return searchEnginePref.getFragment(); } })); @@ -337,7 +337,7 @@ @Test @SmallTest @Feature({"Accessibility"}) - public void testCaptionPreferences() throws Exception { + public void testCaptionPreferences() { String accessibilityPrefClassname = AccessibilityPreferences.class.getName(); AccessibilityPreferences accessibilityPref = (AccessibilityPreferences) startPreferences( InstrumentationRegistry.getInstrumentation(), accessibilityPrefClassname) @@ -360,7 +360,7 @@ @Test @SmallTest @Policies.Add({ @Policies.Item(key = "PasswordManagerEnabled", string = "false") }) - public void testSavePasswordsPreferences_ManagedAndDisabled() throws ExecutionException { + public void testSavePasswordsPreferences_ManagedAndDisabled() { TestThreadUtils.runOnUiThreadBlocking( () -> { ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); }); @@ -413,7 +413,7 @@ return TestThreadUtils.runOnUiThreadBlocking( new Callable<android.support.v7.preference.Preference>() { @Override - public android.support.v7.preference.Preference call() throws Exception { + public android.support.v7.preference.Preference call() { return prefFragment.findPreference(preferenceKey); } });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfilesFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfilesFragmentTest.java index 46594813..24f5ede 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfilesFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfilesFragmentTest.java
@@ -30,7 +30,6 @@ import org.chromium.ui.KeyboardVisibilityDelegate; import java.util.List; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; /** @@ -43,7 +42,7 @@ public final AutofillTestRule rule = new AutofillTestRule(); @Before - public void setUp() throws InterruptedException, ExecutionException, TimeoutException { + public void setUp() throws TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); helper.setProfile(new AutofillProfile("", "https://example.com", true, "Seb Doe", "Google", "111 First St", "CA", "Los Angeles", "", "90291", "", "US", "650-253-0000", @@ -266,7 +265,7 @@ @Test @MediumTest @Feature({"Preferences"}) - public void testKeyboardShownOnDpadCenter() throws TimeoutException, InterruptedException { + public void testKeyboardShownOnDpadCenter() throws TimeoutException { Preferences activity = PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), AutofillProfilesFragment.class.getName()); @@ -316,7 +315,7 @@ private void updatePreferencesAndWait(AutofillProfilesFragment profileFragment, AutofillProfileEditorPreference profile, String[] values, int buttonId, - boolean waitForError) throws TimeoutException, InterruptedException { + boolean waitForError) throws TimeoutException { TestThreadUtils.runOnUiThreadBlocking(profile::performClick); rule.setEditorDialogAndWait(profile.getEditorDialog());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillTestRule.java index b5b4cdd..d71a193 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill/AutofillTestRule.java
@@ -36,8 +36,7 @@ AutofillProfilesFragment.setObserverForTest(AutofillTestRule.this); } - protected void setTextInEditorAndWait(final String[] values) - throws InterruptedException, TimeoutException { + protected void setTextInEditorAndWait(final String[] values) throws TimeoutException { int callCount = mEditorTextUpdate.getCallCount(); TestThreadUtils.runOnUiThreadBlocking(() -> { List<EditText> fields = mEditorDialog.getEditableTextFieldsForTest(); @@ -48,8 +47,7 @@ mEditorTextUpdate.waitForCallback(callCount); } - protected void clickInEditorAndWait(final int resourceId) - throws InterruptedException, TimeoutException { + protected void clickInEditorAndWait(final int resourceId) throws TimeoutException { int callCount = mClickUpdate.getCallCount(); TestThreadUtils.runOnUiThreadBlockingNoException( () -> mEditorDialog.findViewById(resourceId).performClick()); @@ -57,15 +55,15 @@ } protected void clickInEditorAndWaitForValidationError(final int resourceId) - throws InterruptedException, TimeoutException { + throws TimeoutException { int callCount = mValidationUpdate.getCallCount(); TestThreadUtils.runOnUiThreadBlockingNoException( () -> mEditorDialog.findViewById(resourceId).performClick()); mValidationUpdate.waitForCallback(callCount); } - protected void sendKeycodeToTextFieldInEditorAndWait(final int keycode, - final int textFieldIndex) throws InterruptedException, TimeoutException { + protected void sendKeycodeToTextFieldInEditorAndWait( + final int keycode, final int textFieldIndex) throws TimeoutException { int callCount = mClickUpdate.getCallCount(); TestThreadUtils.runOnUiThreadBlocking(() -> { List<EditText> fields = mEditorDialog.getEditableTextFieldsForTest(); @@ -76,13 +74,12 @@ mClickUpdate.waitForCallback(callCount); } - protected void waitForThePreferenceUpdate() throws InterruptedException, TimeoutException { + protected void waitForThePreferenceUpdate() throws TimeoutException { int callCount = mPreferenceUpdate.getCallCount(); mPreferenceUpdate.waitForCallback(callCount); } - protected void setEditorDialogAndWait(EditorDialog editorDialog) - throws TimeoutException, InterruptedException { + protected void setEditorDialogAndWait(EditorDialog editorDialog) throws TimeoutException { int callCount = mClickUpdate.getCallCount(); mEditorDialog = editorDialog; mClickUpdate.waitForCallback(callCount);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java index 046d07ee..3752717 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/autofill_assistant/AutofillAssistantPreferencesTest.java
@@ -76,7 +76,7 @@ @SmallTest @Feature({"Preferences"}) @EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) - public void testAutofillAssistantSwitch() throws Exception { + public void testAutofillAssistantSwitch() { TestThreadUtils.runOnUiThreadBlocking(() -> { setAutofillAssistantSwitch(true); }); final Preferences preferences = @@ -123,7 +123,7 @@ @SmallTest @Feature({"Preferences"}) @EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) - public void testAutofillAssistantNoPreferenceIfOnboardingNeverShown() throws Exception { + public void testAutofillAssistantNoPreferenceIfOnboardingNeverShown() { // Note: |PREF_AUTOFILL_ASSISTANT_SWITCH| is cleared in setUp(). final Preferences preferences = PreferencesTest.startPreferences( InstrumentationRegistry.getInstrumentation(), MainPreferences.class.getName()); @@ -144,7 +144,7 @@ @SmallTest @Feature({"Preferences"}) @EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) - public void testAutofillAssistantPreferenceShownIfOnboardingShown() throws Exception { + public void testAutofillAssistantPreferenceShownIfOnboardingShown() { setAutofillAssistantSwitch(false); final Preferences preferences = PreferencesTest.startPreferences( InstrumentationRegistry.getInstrumentation(), MainPreferences.class.getName()); @@ -162,7 +162,7 @@ @SmallTest @Feature({"Preferences"}) @DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT) - public void testAutofillAssistantNoPreferenceIfFeatureDisabled() throws Exception { + public void testAutofillAssistantNoPreferenceIfFeatureDisabled() { final Preferences preferences = PreferencesTest.startPreferences( InstrumentationRegistry.getInstrumentation(), MainPreferences.class.getName());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreferenceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreferenceTest.java index 4788293d..fdcf88f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreferenceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreferenceTest.java
@@ -82,7 +82,7 @@ } @Before - public void setUp() throws Exception, Throwable { + public void setUp() { // Using an AdvancedMockContext allows us to use a fresh in-memory SharedPreference. mContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() .getTargetContext() @@ -99,7 +99,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testInitializeSiteBreakdownPrefNow() throws Throwable { + public void testInitializeSiteBreakdownPrefNow() { long beforeTime = System.currentTimeMillis(); DataReductionStatsPreference.initializeDataReductionSiteBreakdownPref(); long afterTime = System.currentTimeMillis(); @@ -132,7 +132,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testInitializeSiteBreakdownPrefHistoricalStats() throws Throwable { + public void testInitializeSiteBreakdownPrefHistoricalStats() { // Make the last update one day ago. long lastUpdateInDays = 1; mSettings.setDataReductionLastUpdateTime( @@ -153,7 +153,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testInitializeSiteBreakdownPrefOldHistoricalStats() throws Throwable { + public void testInitializeSiteBreakdownPrefOldHistoricalStats() { mSettings.setDataReductionLastUpdateTime( System.currentTimeMillis() - DAYS_IN_CHART * DateUtils.DAY_IN_MILLIS); long beforeTime = System.currentTimeMillis(); @@ -175,7 +175,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testUpdateReductionStatisticsEnabledToday() throws Throwable { + public void testUpdateReductionStatisticsEnabledToday() { DataReductionStatsPreference pref = new DataReductionStatsPreference(mContext, null); long now = System.currentTimeMillis(); long lastUpdateTime = now - DateUtils.DAY_IN_MILLIS; @@ -198,7 +198,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testUpdateReductionStatisticsEnabledYesterday() throws Throwable { + public void testUpdateReductionStatisticsEnabledYesterday() { DataReductionStatsPreference pref = new DataReductionStatsPreference(mContext, null); long now = System.currentTimeMillis(); long lastUpdateTime = now - DateUtils.DAY_IN_MILLIS; @@ -221,7 +221,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testUpdateReductionStatisticsEnabled31DaysAgo() throws Throwable { + public void testUpdateReductionStatisticsEnabled31DaysAgo() { DataReductionStatsPreference pref = new DataReductionStatsPreference(mContext, null); long now = System.currentTimeMillis(); long lastUpdateTime = now - DateUtils.DAY_IN_MILLIS; @@ -245,7 +245,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testUpdateReductionStatisticsStatsNotUpdatedRecently() throws Throwable { + public void testUpdateReductionStatisticsStatsNotUpdatedRecently() { DataReductionStatsPreference pref = new DataReductionStatsPreference(mContext, null); long now = System.currentTimeMillis(); long lastUpdateTime = now - 7 * DateUtils.DAY_IN_MILLIS; @@ -266,7 +266,7 @@ @SmallTest @UiThreadTest @Feature({"DataReduction"}) - public void testShouldShowRealDataWhenEnoughDataIsUsed() throws Throwable { + public void testShouldShowRealDataWhenEnoughDataIsUsed() { DataReductionStatsPreference pref = new DataReductionStatsPreference(mContext, null); long now = System.currentTimeMillis(); long lastUpdateTime = now - DateUtils.DAY_IN_MILLIS;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java index 0d70176..dc9e263b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java
@@ -64,13 +64,13 @@ private MockNotificationManagerProxy mMockNotificationManager; @Before - public void setUp() throws Exception { + public void setUp() { mMockNotificationManager = new MockNotificationManagerProxy(); TracingNotificationManager.overrideNotificationManagerForTesting(mMockNotificationManager); } @After - public void tearDown() throws Exception { + public void tearDown() { TracingNotificationManager.overrideNotificationManagerForTesting(null); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferencesTest.java index 9e548ed..09b1b9a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferencesTest.java
@@ -275,7 +275,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> ProfileSyncService.resetForTests()); } @@ -283,7 +283,7 @@ * Helper to set up a fake source of displayed passwords. * @param entry An entry to be added to saved passwords. Can be null. */ - private void setPasswordSource(SavedPasswordEntry entry) throws Exception { + private void setPasswordSource(SavedPasswordEntry entry) { SavedPasswordEntry[] entries = {}; if (entry != null) { entries = new SavedPasswordEntry[] {entry}; @@ -295,8 +295,7 @@ * Helper to set up a fake source of displayed passwords with multiple initial passwords. * @param initialEntries All entries to be added to saved passwords. Can not be null. */ - private void setPasswordSourceWithMultipleEntries(SavedPasswordEntry[] initialEntries) - throws Exception { + private void setPasswordSourceWithMultipleEntries(SavedPasswordEntry[] initialEntries) { if (mHandler == null) { mHandler = new FakePasswordManagerHandler(PasswordManagerHandlerProvider.getInstance()); } @@ -312,7 +311,7 @@ * Helper to set up a fake source of displayed passwords without passwords but with exceptions. * @param exceptions All exceptions to be added to saved exceptions. Can not be null. */ - private void setPasswordExceptions(String[] exceptions) throws Exception { + private void setPasswordExceptions(String[] exceptions) { if (mHandler == null) { mHandler = new FakePasswordManagerHandler(PasswordManagerHandlerProvider.getInstance()); } @@ -513,7 +512,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testResetListEmpty() throws Exception { + public void testResetListEmpty() { // Load the preferences, they should show the empty list. final Preferences preferences = PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), @@ -534,7 +533,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSavePasswordsSwitch() throws Exception { + public void testSavePasswordsSwitch() { TestThreadUtils.runOnUiThreadBlocking( () -> { PrefServiceBridge.getInstance().setRememberPasswordsEnabled(true); }); @@ -580,7 +579,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testManageAccountLinkNotSignedIn() throws Exception { + public void testManageAccountLinkNotSignedIn() { // Add a password entry, because the link is only displayed if the password list is not // empty. setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); @@ -600,7 +599,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testManageAccountLinkSignedInNotSyncing() throws Exception { + public void testManageAccountLinkSignedInNotSyncing() { // Add a password entry, because the link is only displayed if the password list is not // empty. setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); @@ -624,7 +623,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testManageAccountLinkSyncing() throws Exception { + public void testManageAccountLinkSyncing() { // Add a password entry, because the link is only displayed if the password list is not // empty. setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); @@ -648,7 +647,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testManageAccountLinkSyncingWithPassphrase() throws Exception { + public void testManageAccountLinkSyncingWithPassphrase() { // Add a password entry, because the link is only displayed if the password list is not // empty. setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); @@ -672,7 +671,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testAutoSignInCheckbox() throws Exception { + public void testAutoSignInCheckbox() { TestThreadUtils.runOnUiThreadBlocking(() -> { PrefServiceBridge.getInstance().setPasswordManagerAutoSigninEnabled(true); }); @@ -721,8 +720,7 @@ @SmallTest @Feature({"Preferences"}) @Features.EnableFeatures(ChromeFeatureList.PASSWORD_EDITING_ANDROID) - public void testSelectedStoredPasswordIndexIsSameAsInShowPasswordEntryEditingView() - throws Exception { + public void testSelectedStoredPasswordIndexIsSameAsInShowPasswordEntryEditingView() { setPasswordSourceWithMultipleEntries( // Initialize preferences new SavedPasswordEntry[] {new SavedPasswordEntry("https://example.com", "example user", "example password"), @@ -745,7 +743,7 @@ @SmallTest @Feature({"Preferences"}) @Features.EnableFeatures(ChromeFeatureList.PASSWORD_EDITING_ANDROID) - public void testPasswordDataDisplayedInEditingActivity() throws Exception { + public void testPasswordDataDisplayedInEditingActivity() { Bundle fragmentArgs = new Bundle(); fragmentArgs.putString(PasswordEntryEditor.CREDENTIAL_URL, "https://example.com"); fragmentArgs.putString(PasswordEntryEditor.CREDENTIAL_NAME, "test user"); @@ -769,7 +767,7 @@ @SmallTest @Feature({"Preferences"}) @Features.EnableFeatures(ChromeFeatureList.PASSWORD_EDITING_ANDROID) - public void testChangeOfStoredPasswordDataIsPreserved() throws Exception { + public void testChangeOfStoredPasswordDataIsPreserved() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), @@ -799,7 +797,7 @@ @SmallTest @Feature({"Preferences"}) @Features.EnableFeatures(ChromeFeatureList.PASSWORD_EDITING_ANDROID) - public void testStoredPasswordCanBeUnmaskedAndMaskedAgain() throws Exception { + public void testStoredPasswordCanBeUnmaskedAndMaskedAgain() { Bundle fragmentArgs = new Bundle(); fragmentArgs.putString(SavePasswordsPreferences.PASSWORD_LIST_NAME, "test user"); fragmentArgs.putString(SavePasswordsPreferences.PASSWORD_LIST_URL, "https://example.com"); @@ -829,7 +827,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportMenuDisabled() throws Exception { + public void testExportMenuDisabled() { // Ensure there are no saved passwords reported to settings. setPasswordSource(null); @@ -848,7 +846,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportMenuEnabled() throws Exception { + public void testExportMenuEnabled() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -866,7 +864,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportTriggersSerialization() throws Exception { + public void testExportTriggersSerialization() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -897,7 +895,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportMenuItem() throws Exception { + public void testExportMenuItem() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -922,7 +920,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportReauthAfterCancel() throws Exception { + public void testExportReauthAfterCancel() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -971,7 +969,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportMenuItemNoLock() throws Exception { + public void testExportMenuItemNoLock() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -999,7 +997,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportMenuItemReenabledNoLock() throws Exception { + public void testExportMenuItemReenabledNoLock() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1027,7 +1025,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportMenuItemReenabledReauthFailure() throws Exception { + public void testExportMenuItemReenabledReauthFailure() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1054,7 +1052,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportRequiresReauth() throws Exception { + public void testExportRequiresReauth() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1184,7 +1182,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportCancelOnWarning() throws Exception { + public void testExportCancelOnWarning() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1211,7 +1209,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportWarningOnResume() throws Exception { + public void testExportWarningOnResume() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1246,7 +1244,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportWarningTimeoutOnResume() throws Exception { + public void testExportWarningTimeoutOnResume() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1288,7 +1286,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportCancelOnWarningDismissal() throws Exception { + public void testExportCancelOnWarningDismissal() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1434,7 +1432,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportCancelOnProgress() throws Exception { + public void testExportCancelOnProgress() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1473,7 +1471,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportCancelOnError() throws Exception { + public void testExportCancelOnError() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1514,7 +1512,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportRetry() throws Exception { + public void testExportRetry() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1551,7 +1549,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportHelpSite() throws Exception { + public void testExportHelpSite() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1599,7 +1597,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testExportErrorUiAfterConfirmation() throws Exception { + public void testExportErrorUiAfterConfirmation() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1640,7 +1638,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testViewPasswordNoLock() throws Exception { + public void testViewPasswordNoLock() { setPasswordSource(new SavedPasswordEntry("https://example.com", "test user", "password")); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE); @@ -1666,7 +1664,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testViewPassword() throws Exception { + public void testViewPassword() { setPasswordSource( new SavedPasswordEntry("https://example.com", "test user", "test password")); @@ -1696,7 +1694,7 @@ @SmallTest @Feature({"Preferences"}) @SuppressWarnings("AlwaysShowAction") // We need to ensure the icon is in the action bar. - public void testSearchIconVisibleInActionBarWithFeature() throws Exception { + public void testSearchIconVisibleInActionBarWithFeature() { setPasswordSource(null); // Initialize empty preferences. SavePasswordsPreferences f = (SavePasswordsPreferences) PreferencesTest @@ -1721,7 +1719,7 @@ @SmallTest @Feature({"Preferences"}) @Features.EnableFeatures(ChromeFeatureList.PASSWORD_EDITING_ANDROID) - public void testEditSavedPasswordIconVisibleInActionBarWithFeature() throws Exception { + public void testEditSavedPasswordIconVisibleInActionBarWithFeature() { setPasswordSource( // Initialize preferences new SavedPasswordEntry("https://example.com", "test user", "test password")); @@ -1739,7 +1737,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchTextInOverflowMenuVisibleWithFeature() throws Exception { + public void testSearchTextInOverflowMenuVisibleWithFeature() { setPasswordSource(null); // Initialize empty preferences. SavePasswordsPreferences f = (SavePasswordsPreferences) PreferencesTest @@ -1768,7 +1766,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testTriggeringSearchRestoresHelpIcon() throws Exception { + public void testTriggeringSearchRestoresHelpIcon() { setPasswordSource(null); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), SavePasswordsPreferences.class.getName()); @@ -1819,7 +1817,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchFiltersByUserName() throws Exception { + public void testSearchFiltersByUserName() { setPasswordSourceWithMultipleEntries(GREEK_GODS); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), SavePasswordsPreferences.class.getName()); @@ -1842,7 +1840,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchFiltersByUrl() throws Exception { + public void testSearchFiltersByUrl() { setPasswordSourceWithMultipleEntries(GREEK_GODS); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), SavePasswordsPreferences.class.getName()); @@ -1865,7 +1863,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchDisplaysBlankPageIfSearchTurnsUpEmpty() throws Exception { + public void testSearchDisplaysBlankPageIfSearchTurnsUpEmpty() { setPasswordSourceWithMultipleEntries(GREEK_GODS); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), SavePasswordsPreferences.class.getName()); @@ -1896,7 +1894,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchIconClickedHidesExceptionsTemporarily() throws Exception { + public void testSearchIconClickedHidesExceptionsTemporarily() { setPasswordExceptions(new String[] {"http://exclu.de", "http://not-inclu.de"}); final SavePasswordsPreferences savePasswordPreferences = (SavePasswordsPreferences) PreferencesTest @@ -1927,7 +1925,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchIconClickedHidesGeneralPrefs() throws Exception { + public void testSearchIconClickedHidesGeneralPrefs() { setPasswordSource(ZEUS_ON_EARTH); final SavePasswordsPreferences prefs = (SavePasswordsPreferences) PreferencesTest @@ -1972,7 +1970,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchBarBackButtonRestoresGeneralPrefs() throws Exception { + public void testSearchBarBackButtonRestoresGeneralPrefs() { setPasswordSourceWithMultipleEntries(GREEK_GODS); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), SavePasswordsPreferences.class.getName()); @@ -1998,7 +1996,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchViewCloseIconExistsOnlyToClearQueries() throws Exception { + public void testSearchViewCloseIconExistsOnlyToClearQueries() { setPasswordSourceWithMultipleEntries(GREEK_GODS); PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), SavePasswordsPreferences.class.getName()); @@ -2032,7 +2030,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchIconColorAffectsOnlyLocalSearchDrawable() throws Exception { + public void testSearchIconColorAffectsOnlyLocalSearchDrawable() { // Open the password preferences and remember the applied color filter. final SavePasswordsPreferences f = (SavePasswordsPreferences) PreferencesTest @@ -2081,7 +2079,7 @@ @Test @SmallTest @Feature({"Preferences"}) - public void testSearchResultsPersistAfterEntryInspection() throws Exception { + public void testSearchResultsPersistAfterEntryInspection() { setPasswordSourceWithMultipleEntries(GREEK_GODS); setPasswordExceptions(new String[] {"http://exclu.de", "http://not-inclu.de"}); ReauthenticationManager.setApiOverride(ReauthenticationManager.OverrideState.AVAILABLE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataBridgeTest.java index af5c5c2..3817ba7a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataBridgeTest.java
@@ -59,7 +59,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mActionTester.tearDown(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataTest.java index c738fe79..1fbf1d4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/BrowsingDataTest.java
@@ -52,8 +52,7 @@ mUrl = mTestServer.getURL(TEST_FILE); } - private void clearBrowsingData(int dataType, int timePeriod) - throws InterruptedException, TimeoutException { + private void clearBrowsingData(int dataType, int timePeriod) throws TimeoutException { CallbackHelper helper = new CallbackHelper(); TestThreadUtils.runOnUiThreadBlocking(() -> { BrowsingDataBridge.getInstance().clearBrowsingData(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java index fd5c05f1..9f41627 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java
@@ -59,7 +59,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> ProfileSyncService.resetForTests()); SigninTestUtil.tearDownAuthForTest(); } @@ -105,7 +105,7 @@ */ @Test @SmallTest - public void testCheckBoxTextNonsigned() throws Exception { + public void testCheckBoxTextNonsigned() { final Preferences preferences = mActivityTestRule.startPreferences( ClearBrowsingDataPreferencesBasic.class.getName()); @@ -133,7 +133,7 @@ */ @Test @SmallTest - public void testCheckBoxTextSigned() throws Exception { + public void testCheckBoxTextSigned() { SigninTestUtil.addAndSignInTestAccount(); setSyncable(false); @@ -164,7 +164,7 @@ */ @Test @SmallTest - public void testCheckBoxTextSignedAndSynced() throws Exception { + public void testCheckBoxTextSignedAndSynced() { SigninTestUtil.addAndSignInTestAccount(); setSyncable(true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java index 5f2cbe3..d5420ef 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
@@ -100,7 +100,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { SigninTestUtil.tearDownAuthForTest(); } @@ -195,7 +195,7 @@ */ @Test @MediumTest - public void testClearingEverything() throws Exception { + public void testClearingEverything() { setDataTypesToClear(ClearBrowsingDataPreferences.getAllOptions()); final ClearBrowsingDataPreferences preferences = @@ -279,7 +279,7 @@ */ @Test @LargeTest - public void testDialogAboutOtherFormsOfBrowsingHistory() throws Exception { + public void testDialogAboutOtherFormsOfBrowsingHistory() { // Sign in. SigninTestUtil.addAndSignInTestAccount(); OtherFormsOfHistoryDialogFragment.clearShownPreferenceForTesting( @@ -552,7 +552,7 @@ @Test @EnableFeatures(ChromeFeatureList.REMOVE_NAVIGATION_HISTORY) @MediumTest - public void testNavigationDeletion() throws Exception { + public void testNavigationDeletion() { final String url1 = mTestServer.getURL("/chrome/test/data/browsing_data/a.html"); final String url2 = mTestServer.getURL("/chrome/test/data/browsing_data/b.html"); @@ -583,7 +583,7 @@ @Test @MediumTest @EnableFeatures(ChromeFeatureList.REMOVE_NAVIGATION_HISTORY) - public void testFrozenNavigationDeletion() throws Exception { + public void testFrozenNavigationDeletion() { final String url1 = mTestServer.getURL("/chrome/test/data/browsing_data/a.html"); final String url2 = mTestServer.getURL("/chrome/test/data/browsing_data/b.html");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManagerNativeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManagerNativeTest.java index 77e6e3b..35fa8941 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManagerNativeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManagerNativeTest.java
@@ -38,7 +38,7 @@ @SmallTest @UiThreadTest @Feature({"Android-AppBase"}) - public void testSyncUsageAndCrashReporting() throws Throwable { + public void testSyncUsageAndCrashReporting() { PermissionContext context = new PermissionContext(InstrumentationRegistry.getTargetContext()); PrefServiceBridge prefBridge = PrefServiceBridge.getInstance(); @@ -59,7 +59,7 @@ @Feature({"Android-AppBase"}) @UiThreadTest @DisabledTest(message = "crbug.com/700500") - public void testSetUsageAndCrashReporting() throws Throwable { + public void testSetUsageAndCrashReporting() { PermissionContext context = new PermissionContext(InstrumentationRegistry.getTargetContext()); PrefServiceBridge prefBridge = PrefServiceBridge.getInstance();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/ManageSpaceActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/ManageSpaceActivityTest.java index 86b945f..00b50c9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/ManageSpaceActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/ManageSpaceActivityTest.java
@@ -56,7 +56,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -152,7 +152,7 @@ @Test @MediumTest @Feature({"SiteEngagement"}) - public void testClearUnimporantWithoutChromeStart() throws Exception { + public void testClearUnimporantWithoutChromeStart() { ManageSpaceActivity manageSpaceActivity = startManageSpaceActivity(); // Click 'clear' in the CBD screen. waitForClearButtonEnabled(manageSpaceActivity);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java index 1565b87..c73d8f9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java
@@ -67,7 +67,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -94,7 +94,7 @@ return TestThreadUtils.runOnUiThreadBlockingNoException( new Callable<InfoBarTestAnimationListener>() { @Override - public InfoBarTestAnimationListener call() throws Exception { + public InfoBarTestAnimationListener call() { InfoBarContainer container = mActivityTestRule.getInfoBarContainer(); InfoBarTestAnimationListener listener = new InfoBarTestAnimationListener(); container.addAnimationListener(listener); @@ -133,7 +133,7 @@ @SmallTest @Feature({"Preferences"}) @DisabledTest(message = "Modals are now enabled and test needs to be reworked crbug.com/935900") - public void testSetAllowLocationNotEnabled() throws Exception { + public void testSetAllowLocationNotEnabled() { setAllowLocation(false); // Launch a page that uses geolocation. @@ -263,12 +263,11 @@ /** * Tests that disabling cookies turns off the third-party cookie toggle. - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testThirdPartyCookieToggleGetsDisabled() throws Exception { + public void testThirdPartyCookieToggleGetsDisabled() { Preferences preferenceActivity = SiteSettingsTestUtils.startSiteSettingsCategory(SiteSettingsCategory.Type.COOKIES); setCookiesEnabled(preferenceActivity, true); @@ -390,12 +389,11 @@ /** * Sets Allow Popups Enabled to be false and make sure it is set correctly. - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testPopupsBlocked() throws Exception { + public void testPopupsBlocked() { setEnablePopups(false); // Test that the popup doesn't open. @@ -407,12 +405,11 @@ /** * Sets Allow Popups Enabled to be true and make sure it is set correctly. - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testPopupsNotBlocked() throws Exception { + public void testPopupsNotBlocked() { setEnablePopups(true); // Test that a popup opens. @@ -424,24 +421,22 @@ /** * Test that showing the Site Settings menu doesn't crash (crbug.com/610576). - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testSiteSettingsMenu() throws Exception { + public void testSiteSettingsMenu() { final Preferences preferenceActivity = SiteSettingsTestUtils.startSiteSettingsMenu(""); preferenceActivity.finish(); } /** * Test the Media Menu. - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testMediaMenu() throws Exception { + public void testMediaMenu() { final Preferences preferenceActivity = SiteSettingsTestUtils.startSiteSettingsMenu(SiteSettingsPreferences.MEDIA_KEY); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -468,12 +463,11 @@ /** * Tests that only expected Preferences are shown for a category. - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testOnlyExpectedPreferencesShown() throws Exception { + public void testOnlyExpectedPreferencesShown() { // If you add a category in the SiteSettings UI, please add a test for it below. Assert.assertEquals(19, SiteSettingsCategory.Type.NUM_ENTRIES); @@ -544,12 +538,11 @@ /** * Tests that {@link SingleWebsitePreferences#resetSite} doesn't crash * (see e.g. the crash on host names in issue 600232). - * @throws Exception */ @Test @SmallTest @Feature({"Preferences"}) - public void testResetDoesntCrash() throws Exception { + public void testResetDoesntCrash() { WebsiteAddress address = WebsiteAddress.create("example.com"); resetSite(address); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcherTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcherTest.java index 349f3bf..f038b4d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcherTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/WebsitePermissionsFetcherTest.java
@@ -112,7 +112,7 @@ @Test @SmallTest - public void testNullsCanBeHandled() throws Exception { + public void testNullsCanBeHandled() { // This is a smoke test to ensure that nulls do not cause crashes. WebsitePermissionsFetcher.OriginAndEmbedder nullBoth = new WebsitePermissionsFetcher.OriginAndEmbedder(null, null); @@ -260,7 +260,7 @@ @Test @SmallTest - public void testFetchAllPreferencesForSingleOrigin() throws Exception { + public void testFetchAllPreferencesForSingleOrigin() { WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(); FakeWebsitePreferenceBridge websitePreferenceBridge = new FakeWebsitePreferenceBridge(); fetcher.setWebsitePreferenceBridgeForTesting(websitePreferenceBridge); @@ -390,7 +390,7 @@ @Test @SmallTest - public void testFetchAllPreferencesForMultipleOrigins() throws Exception { + public void testFetchAllPreferencesForMultipleOrigins() { WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(); FakeWebsitePreferenceBridge websitePreferenceBridge = new FakeWebsitePreferenceBridge(); fetcher.setWebsitePreferenceBridgeForTesting(websitePreferenceBridge); @@ -471,7 +471,7 @@ @Test @SmallTest - public void testFetchPreferencesForCategoryPermissionInfoTypes() throws Exception { + public void testFetchPreferencesForCategoryPermissionInfoTypes() { WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(); FakeWebsitePreferenceBridge websitePreferenceBridge = new FakeWebsitePreferenceBridge(); fetcher.setWebsitePreferenceBridgeForTesting(websitePreferenceBridge); @@ -502,7 +502,7 @@ @Test @SmallTest - public void testFetchPreferencesForCategoryContentSettingExceptionTypes() throws Exception { + public void testFetchPreferencesForCategoryContentSettingExceptionTypes() { WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(); FakeWebsitePreferenceBridge websitePreferenceBridge = new FakeWebsitePreferenceBridge(); fetcher.setWebsitePreferenceBridgeForTesting(websitePreferenceBridge); @@ -557,7 +557,7 @@ @Test @SmallTest - public void testFetchPreferencesForCategoryStorageInfo() throws Exception { + public void testFetchPreferencesForCategoryStorageInfo() { WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(); FakeWebsitePreferenceBridge websitePreferenceBridge = new FakeWebsitePreferenceBridge(); fetcher.setWebsitePreferenceBridgeForTesting(websitePreferenceBridge); @@ -633,7 +633,7 @@ @Test @SmallTest - public void testFetchPreferencesForCategoryChooserDataTypes() throws Exception { + public void testFetchPreferencesForCategoryChooserDataTypes() { WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(); FakeWebsitePreferenceBridge websitePreferenceBridge = new FakeWebsitePreferenceBridge(); fetcher.setWebsitePreferenceBridgeForTesting(websitePreferenceBridge);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandlerTest.java index cc29579..2c53921 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandlerTest.java
@@ -61,7 +61,7 @@ final Callable<Profile> profileCallable = new Callable<Profile>() { @Override - public Profile call() throws Exception { + public Profile call() { return Profile.getLastUsedProfile(); } }; @@ -73,7 +73,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking( () -> mExternalPrerenderHandler.cancelCurrentPrerender()); mTestServer.stopAndDestroyServer(); @@ -139,8 +139,9 @@ public boolean isSatisfied() { boolean has_prefetched = ExternalPrerenderHandler.hasRecentlyPrefetchedUrlForTesting(mProfile, url); - if (has_prefetched) + if (has_prefetched) { ExternalPrerenderHandler.clearPrefetchInformationForTesting(mProfile); + } return has_prefetched; } }, ENSURE_COMPLETED_PRERENDER_TIMEOUT_MS, PRERENDER_DELAY_MS);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/PrerenderTestHelper.java b/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/PrerenderTestHelper.java index 6e8a0b8..da5a5722 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/PrerenderTestHelper.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/prerender/PrerenderTestHelper.java
@@ -70,7 +70,7 @@ TestThreadUtils.runOnUiThreadBlockingNoException( new Callable<ExternalPrerenderHandler>() { @Override - public ExternalPrerenderHandler call() throws Exception { + public ExternalPrerenderHandler call() { ExternalPrerenderHandler prerenderHandler = new ExternalPrerenderHandler(); Rect bounds = new Rect(0, 0, coord.getContentWidthPixInt(),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java index 69decf9..d3c8a7a8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java
@@ -75,7 +75,7 @@ private static final long TEST_TIMEOUT = 20000L; @Before - public void setUp() throws InterruptedException { + public void setUp() { // Do nothing. } @@ -102,7 +102,7 @@ } private static class WaitForOnWriteHelper extends CallbackHelper { - public void waitForCallback(String msg) throws InterruptedException, TimeoutException { + public void waitForCallback(String msg) throws TimeoutException { waitForFirst(msg, TEST_TIMEOUT, TimeUnit.MILLISECONDS); } } @@ -232,7 +232,7 @@ @TargetApi(Build.VERSION_CODES.KITKAT) @MediumTest @Feature({"Printing"}) - public void testPrintCloseWindowBeforeStart() throws Throwable { + public void testPrintCloseWindowBeforeStart() { if (!(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)) return; mActivityTestRule.startMainActivityWithURL(URL); @@ -386,7 +386,7 @@ @Test @SmallTest @Feature({"Printing"}) - public void testPdfWritingDoneCalledWithoutInitailizePrintingTask() throws Throwable { + public void testPdfWritingDoneCalledWithoutInitailizePrintingTask() { if (!(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)) return; mActivityTestRule.startMainActivityWithURL(URL);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java index 6c7c49e..a8de8e9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java
@@ -39,11 +39,12 @@ @Test @MediumTest - @DisableIf.Build(sdk_is_greater_than = 20, message = "https://crbug.com/964502") - @CommandLineFlags.Add({"memlog=browser", "memlog-stack-mode=native-include-thread-names", - "memlog-sampling-rate=1"}) - public void - testModeBrowser() throws Exception { + @DisableIf + .Build(sdk_is_greater_than = 20, message = "https://crbug.com/964502") + @CommandLineFlags.Add({"memlog=browser", + "memlog-stack-mode=native-include-thread-names", "memlog-sampling-rate=1"}) + public void + testModeBrowser() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue( shim.runTestForMode("browser", false, "native-include-thread-names", false, false)); @@ -52,7 +53,7 @@ @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest - public void testModeBrowserDynamicNonStreaming() throws Exception { + public void testModeBrowserDynamicNonStreaming() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("browser", true, "native", false, false)); } @@ -60,7 +61,7 @@ @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest - public void testModeBrowserDynamicPseudoNonStreaming() throws Exception { + public void testModeBrowserDynamicPseudoNonStreaming() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", false, false)); } @@ -75,7 +76,7 @@ @MediumTest @CommandLineFlags. Add({"memlog=all-renderers", "memlog-stack-mode=pseudo", "memlog-sampling-rate=1"}) - public void testModeRendererPseudo() throws Exception { + public void testModeRendererPseudo() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("all-renderers", false, "pseudo", false, false)); } @@ -84,7 +85,7 @@ @Test @MediumTest @CommandLineFlags.Add({"memlog=gpu", "memlog-stack-mode=pseudo", "memlog-sampling-rate=1"}) - public void testModeGpuPseudo() throws Exception { + public void testModeGpuPseudo() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("gpu", false, "native", false, false)); } @@ -92,7 +93,7 @@ @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest - public void testModeBrowserDynamicPseudoSamplePartial() throws Exception { + public void testModeBrowserDynamicPseudoSamplePartial() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", true, false)); } @@ -100,7 +101,7 @@ @DisabledTest(message = "https://crbug.com/986667") @Test @MediumTest - public void testModeBrowserAndAllUtility() throws Exception { + public void testModeBrowserAndAllUtility() { HeapProfilingTestShim shim = new HeapProfilingTestShim(); Assert.assertTrue(shim.runTestForMode("utility-and-browser", true, "pseudo", true, false)); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarkNodeUnitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarkNodeUnitTest.java index 9f49ce2..566adcb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarkNodeUnitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarkNodeUnitTest.java
@@ -28,7 +28,7 @@ byte[][] mImageBlobs; @Before - public void setUp() throws Exception { + public void setUp() { mImageBlobs = new byte[][] { { 1, 2, 3 }, { 4, 5, 6, 7 }, @@ -132,21 +132,21 @@ @Test @SmallTest @Feature({"Android-ContentProvider"}) - public void testBookmarkNodeParceling() throws InterruptedException { + public void testBookmarkNodeParceling() { Assert.assertTrue(internalTestNodeHierarchyParceling(createMockHierarchy())); } @Test @SmallTest @Feature({"Android-ContentProvider"}) - public void testBookmarkNodeParcelingWithImages() throws InterruptedException { + public void testBookmarkNodeParcelingWithImages() { Assert.assertTrue(internalTestNodeHierarchyParceling(createMockHierarchyWithImages())); } @Test @SmallTest @Feature({"Android-ContentProvider"}) - public void testSingleNodeParceling() throws InterruptedException { + public void testSingleNodeParceling() { BookmarkNode node = new BookmarkNode(1, Type.URL, "Google", "http://www.google.com/", null); Assert.assertTrue(internalTestNodeHierarchyParceling(node)); } @@ -154,7 +154,7 @@ @Test @SmallTest @Feature({"Android-ContentProvider"}) - public void testInvalidHierarchy() throws InterruptedException { + public void testInvalidHierarchy() { BookmarkNode root = new BookmarkNode(1, Type.FOLDER, "Bookmarks", null, null); root.addChild(new BookmarkNode(2, Type.URL, "Google", "http://www.google.com/", root)); root.addChild(new BookmarkNode(2, Type.URL, "GoogleMaps", "http://maps.google.com/", root));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarksUriTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarksUriTest.java index 33805a6..206a8a5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarksUriTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderBookmarksUriTest.java
@@ -40,13 +40,13 @@ private Uri mBookmarksUri; @Before - public void setUp() throws Exception { + public void setUp() { mBookmarksUri = ChromeBrowserProvider.getBookmarksApiUri(mProviderTestRule.getActivity()); mProviderTestRule.getContentResolver().delete(mBookmarksUri, null, null); } @After - public void tearDown() throws Exception { + public void tearDown() { mProviderTestRule.getContentResolver().delete(mBookmarksUri, null, null); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderSearchesUriTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderSearchesUriTest.java index 0d77df31..ecd4ad9d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderSearchesUriTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/provider/ProviderSearchesUriTest.java
@@ -36,13 +36,13 @@ private Uri mSearchesUri; @Before - public void setUp() throws Exception { + public void setUp() { mSearchesUri = ChromeBrowserProvider.getSearchesApiUri(mProviderTestRule.getActivity()); mProviderTestRule.getContentResolver().delete(mSearchesUri, null, null); } @After - public void tearDown() throws Exception { + public void tearDown() { mProviderTestRule.getContentResolver().delete(mSearchesUri, null, null); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/PushMessagingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/PushMessagingTest.java index 4597d77b..f6dcce3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/PushMessagingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/PushMessagingTest.java
@@ -76,7 +76,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { final PushMessagingServiceObserver.Listener listener = this; TestThreadUtils.runOnUiThreadBlocking(() -> { FakeInstanceIDWithSubtype.clearDataAndSetEnabled(true); @@ -87,7 +87,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> { PushMessagingServiceObserver.setListenerForTesting(null); FakeInstanceIDWithSubtype.clearDataAndSetEnabled(false); @@ -105,7 +105,7 @@ @Test @MediumTest @Feature({"Browser", "PushMessaging"}) - public void testNotificationsPermissionDenied() throws InterruptedException, TimeoutException { + public void testNotificationsPermissionDenied() throws TimeoutException { // Deny Notifications permission before trying to subscribe Push. mNotificationTestRule.setNotificationContentSettingForOrigin( ContentSettingValues.BLOCK, mEmbeddedTestServerRule.getOrigin()); @@ -131,7 +131,7 @@ //@CommandLineFlags.Add("disable-features=ModalPermissionPrompts") @Test @DisabledTest - public void testPushPermissionDenied() throws InterruptedException, TimeoutException { + public void testPushPermissionDenied() throws TimeoutException { // Notifications permission should initially be prompt. Assert.assertEquals("\"default\"", runScriptBlocking("Notification.permission")); @@ -184,7 +184,7 @@ @MediumTest @Feature({"Browser", "PushMessaging"}) @DisabledTest(message = "Modals are now enabled and test needs to be reworked crbug.com/935900") - public void testPushPermissionGranted() throws InterruptedException, TimeoutException { + public void testPushPermissionGranted() throws TimeoutException { // Notifications permission should initially be prompt. Assert.assertEquals("\"default\"", runScriptBlocking("Notification.permission")); @@ -209,7 +209,7 @@ @MediumTest @Feature({"Browser", "PushMessaging"}) @RetryOnFailure - public void testPushAndShowNotification() throws InterruptedException, TimeoutException { + public void testPushAndShowNotification() throws TimeoutException { mNotificationTestRule.setNotificationContentSettingForOrigin( ContentSettingValues.ALLOW, mEmbeddedTestServerRule.getOrigin()); runScriptAndWaitForTitle("subscribePush()", "subscribe ok"); @@ -230,7 +230,7 @@ @LargeTest @Feature({"Browser", "PushMessaging"}) @RetryOnFailure - public void testDefaultNotification() throws InterruptedException, TimeoutException { + public void testDefaultNotification() throws TimeoutException { // Start off using the tab loaded in setUp(). Assert.assertEquals(1, mNotificationTestRule.getActivity().getCurrentTabModel().getCount()); Tab tab = mNotificationTestRule.getActivity().getActivityTab(); @@ -282,7 +282,7 @@ /** * Runs {@code script} in the current tab and returns its synchronous result in JSON format. */ - private String runScriptBlocking(String script) throws InterruptedException, TimeoutException { + private String runScriptBlocking(String script) throws TimeoutException { return JavaScriptUtils.executeJavaScriptAndWaitForResult( mNotificationTestRule.getWebContents(), script); } @@ -291,8 +291,7 @@ * Runs {@code script} in the current tab and waits for the tab title to change to * {@code expectedTitle}. */ - private void runScriptAndWaitForTitle(String script, String expectedTitle) - throws InterruptedException { + private void runScriptAndWaitForTitle(String script, String expectedTitle) { runScriptAndWaitForTitle( script, expectedTitle, mNotificationTestRule.getActivity().getActivityTab()); } @@ -301,14 +300,13 @@ * Runs {@code script} in {@code tab} and waits for the tab title to change to * {@code expectedTitle}. */ - private void runScriptAndWaitForTitle(String script, String expectedTitle, Tab tab) - throws InterruptedException { + private void runScriptAndWaitForTitle(String script, String expectedTitle, Tab tab) { JavaScriptUtils.executeJavaScript(tab.getWebContents(), script); waitForTitle(tab, expectedTitle); } private void sendPushAndWaitForCallback(Pair<String, String> appIdAndSenderId) - throws InterruptedException, TimeoutException { + throws TimeoutException { final String appId = appIdAndSenderId.first; final String senderId = appIdAndSenderId.second; TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -327,7 +325,7 @@ } @SuppressWarnings("MissingFail") - private void waitForTitle(Tab tab, String expectedTitle) throws InterruptedException { + private void waitForTitle(Tab tab, String expectedTitle) { TabTitleObserver titleObserver = new TabTitleObserver(tab, expectedTitle); try { titleObserver.waitForTitleUpdate(TITLE_UPDATE_TIMEOUT_SECONDS);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java index eba892c9..4596c0c2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java
@@ -62,7 +62,7 @@ Assert.assertTrue(TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return TemplateUrlServiceFactory.get().isLoaded(); } })); @@ -79,7 +79,7 @@ throws ExecutionException { String result = TestThreadUtils.runOnUiThreadBlocking(new Callable<String>() { @Override - public String call() throws Exception { + public String call() { return TemplateUrlServiceFactory.get().getUrlForContextualSearchQuery( query, alternative, prefetch, protocolVersion); } @@ -106,7 +106,7 @@ Assert.assertTrue(TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return TemplateUrlServiceFactory.get().isLoaded(); } })); @@ -141,7 +141,7 @@ List<TemplateUrl> searchEngines = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<List<TemplateUrl>>() { @Override - public List<TemplateUrl> call() throws Exception { + public List<TemplateUrl> call() { return templateUrlService.getTemplateUrls(); } }); @@ -149,7 +149,7 @@ TemplateUrl defaultSearchEngine = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TemplateUrl>() { @Override - public TemplateUrl call() throws Exception { + public TemplateUrl call() { return templateUrlService.getDefaultSearchEngineTemplateUrl(); } }); @@ -165,7 +165,7 @@ defaultSearchEngine = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TemplateUrl>() { @Override - public TemplateUrl call() throws Exception { + public TemplateUrl call() { return templateUrlService.getDefaultSearchEngineTemplateUrl(); } }); @@ -185,7 +185,7 @@ TemplateUrl defaultSearchEngine = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TemplateUrl>() { @Override - public TemplateUrl call() throws Exception { + public TemplateUrl call() { return templateUrlService.getDefaultSearchEngineTemplateUrl(); } }); @@ -195,7 +195,7 @@ List<TemplateUrl> customSearchEngines = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<List<TemplateUrl>>() { @Override - public List<TemplateUrl> call() throws Exception { + public List<TemplateUrl> call() { templateUrlService.addSearchEngineForTesting("keyword1", 0); templateUrlService.addSearchEngineForTesting("keyword2", 0); templateUrlService.addSearchEngineForTesting("keyword3", 3); @@ -214,7 +214,7 @@ customSearchEngines = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<List<TemplateUrl>>() { @Override - public List<TemplateUrl> call() throws Exception { + public List<TemplateUrl> call() { templateUrlService.addSearchEngineForTesting("keyword4", 0); templateUrlService.addSearchEngineForTesting("keyword5", 0); List<TemplateUrl> searchEngines = templateUrlService.getTemplateUrls(); @@ -232,7 +232,7 @@ customSearchEngines = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<List<TemplateUrl>>() { @Override - public List<TemplateUrl> call() throws Exception { + public List<TemplateUrl> call() { templateUrlService.updateLastVisitedForTesting("keyword3"); List<TemplateUrl> searchEngines = templateUrlService.getTemplateUrls(); SearchEngineAdapter.sortAndFilterUnnecessaryTemplateUrl( @@ -250,7 +250,7 @@ customSearchEngines = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<List<TemplateUrl>>() { @Override - public List<TemplateUrl> call() throws Exception { + public List<TemplateUrl> call() { templateUrlService.setSearchEngine("keyword4"); List<TemplateUrl> searchEngines = templateUrlService.getTemplateUrls(); TemplateUrl newDefaultSearchEngine = @@ -299,7 +299,7 @@ TemplateUrl defaultSearchEngine = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TemplateUrl>() { @Override - public TemplateUrl call() throws Exception { + public TemplateUrl call() { return templateUrlService.getDefaultSearchEngineTemplateUrl(); } }); @@ -319,7 +319,7 @@ defaultSearchEngine = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TemplateUrl>() { @Override - public TemplateUrl call() throws Exception { + public TemplateUrl call() { return templateUrlService.getDefaultSearchEngineTemplateUrl(); } }); @@ -329,7 +329,7 @@ private int getSearchEngineCount(final TemplateUrlService templateUrlService) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return templateUrlService.getTemplateUrls().size(); } });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java index 0f2ba16..b8421e7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java
@@ -265,7 +265,7 @@ waitForChromeTabbedActivityToStart(new Callable<Void>() { @Override - public Void call() throws InterruptedException, TimeoutException { + public Void call() throws TimeoutException { // Finish initialization. It should notice the URL is queued up and start the // browser. TestThreadUtils.runOnUiThreadBlocking( @@ -282,7 +282,7 @@ @Test @SmallTest - public void testZeroSuggestBeforeNativeIsLoaded() throws Exception { + public void testZeroSuggestBeforeNativeIsLoaded() { LocaleManager.setInstanceForTest(new LocaleManager() { @Override public boolean needToCheckForSearchEnginePromo() { @@ -415,7 +415,7 @@ // SearchActivity should realize the failure case and prevent the user from using it. CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return ApplicationStatus.getRunningActivities().size(); } })); @@ -427,7 +427,7 @@ @Test @SmallTest - public void testNewIntentDiscardsQuery() throws Exception { + public void testNewIntentDiscardsQuery() { final SearchActivity searchActivity = startSearchActivity(); setUrlBarText(searchActivity, "first query"); final SearchActivityLocationBarLayout locationBar = @@ -449,11 +449,11 @@ }); } - private SearchActivity startSearchActivity() throws Exception { + private SearchActivity startSearchActivity() { return startSearchActivity(0); } - private SearchActivity startSearchActivity(int expectedCallCount) throws Exception { + private SearchActivity startSearchActivity(int expectedCallCount) { final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); ActivityMonitor searchMonitor = new ActivityMonitor(SearchActivity.class.getName(), null, false); @@ -485,7 +485,7 @@ CriteriaHelper.pollUiThread(Criteria.equals(expectedUrl, new Callable<String>() { @Override - public String call() throws Exception { + public String call() { Tab tab = cta.getActivityTab(); if (tab == null) return null;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchWidgetProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchWidgetProviderTest.java index bfd2010..0a7f920e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchWidgetProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchWidgetProviderTest.java
@@ -91,7 +91,7 @@ } } - private final static class TestContext extends AdvancedMockContext { + private static final class TestContext extends AdvancedMockContext { public TestContext() { super(InstrumentationRegistry.getInstrumentation() .getTargetContext() @@ -107,7 +107,7 @@ private TestDelegate mDelegate; @Before - public void setUp() throws Exception { + public void setUp() { ApplicationTestUtils.setUp(InstrumentationRegistry.getTargetContext()); SearchActivity.setDelegateForTests(new TestSearchDelegate()); @@ -117,7 +117,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { ApplicationTestUtils.tearDown(InstrumentationRegistry.getTargetContext()); } @@ -168,7 +168,7 @@ public void testUpdateCachedEngineNameBeforeFirstRun() throws ExecutionException { Assert.assertFalse(TestThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return SearchWidgetProvider.shouldShowFullString(); } }));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java index e7b2fdc..4486603 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java
@@ -56,7 +56,7 @@ @Feature({"ShapeDetection"}) @LargeTest @Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) - public void testBarcodeDetection() throws InterruptedException, TimeoutException { + public void testBarcodeDetection() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); try { @@ -81,7 +81,7 @@ @Feature({"ShapeDetection"}) @LargeTest @Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) - public void testTextDetection() throws InterruptedException, TimeoutException { + public void testTextDetection() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); try { @@ -109,7 +109,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> StrictMode.setThreadPolicy(mOldPolicy)); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java index ce9a7e3..84bc911 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java
@@ -53,7 +53,7 @@ @Test @SmallTest - public void testCanonicalUrlsOverHttps() throws InterruptedException, TimeoutException { + public void testCanonicalUrlsOverHttps() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartHTTPSServer( InstrumentationRegistry.getInstrumentation().getContext(), ServerCertificate.CERT_OK); @@ -75,7 +75,7 @@ @Test @SmallTest - public void testCanonicalUrlsOverHttp() throws InterruptedException, TimeoutException { + public void testCanonicalUrlsOverHttp() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer( InstrumentationRegistry.getInstrumentation().getContext()); final String httpsCanonicalUrl = testServer.getURL(PAGE_WITH_HTTPS_CANONICAL_URL); @@ -96,7 +96,7 @@ private void verifyShareUrl( String pageUrl, String expectedShareUrl, @CanonicalURLResult int expectedUrlResult) - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { mActivityTestRule.loadUrl(pageUrl); HistogramDelta urlResultDelta = new HistogramDelta( ShareMenuActionHandler.CANONICAL_URL_RESULT_HISTOGRAM, expectedUrlResult); @@ -105,7 +105,7 @@ Assert.assertEquals(1, urlResultDelta.getDelta()); } - private ShareParams triggerShare() throws InterruptedException, TimeoutException { + private ShareParams triggerShare() throws TimeoutException { final CallbackHelper helper = new CallbackHelper(); final AtomicReference<ShareParams> paramsRef = new AtomicReference<>(); TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareUrlTest.java index 0ad1ff89..e105d52 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareUrlTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareUrlTest.java
@@ -30,8 +30,7 @@ private static final String HTTP_URL = "http://www.google.com/"; private static final String HTTPS_URL = "https://www.google.com/"; - private void assertCorrectUrl(final String originalUrl, final String sharedUrl) - throws Throwable { + private void assertCorrectUrl(final String originalUrl, final String sharedUrl) { PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { ShareParams params = new ShareParams.Builder(new Activity(), "", sharedUrl).setText("").build(); @@ -44,14 +43,14 @@ @Test @SmallTest - public void testNormalUrl() throws Throwable { + public void testNormalUrl() { assertCorrectUrl(HTTP_URL, HTTP_URL); assertCorrectUrl(HTTPS_URL, HTTPS_URL); } @Test @SmallTest - public void testDistilledUrl() throws Throwable { + public void testDistilledUrl() { final String DomDistillerScheme = "chrome-distiller"; String distilledHttpUrl = DomDistillerUrlUtils.getDistillerViewUrlFromUrl(DomDistillerScheme, HTTP_URL);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java index 58d314632..7df3cf8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java
@@ -70,7 +70,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mContext = new AdvancedMockContext(InstrumentationRegistry.getTargetContext()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninTest.java index 02d6bca4..78c2eab 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninTest.java
@@ -261,7 +261,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> { mBookmarks.removeObserver(mTestBookmarkModelObserver);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java index f0c69346..c9f4ae5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java
@@ -29,8 +29,6 @@ import org.chromium.ui.KeyboardVisibilityDelegate; import org.chromium.ui.base.ActivityWindowAndroid; -import java.util.concurrent.TimeoutException; - /** * Tests for the SmsReceiverInfoBar class. */ @@ -42,8 +40,8 @@ new ChromeActivityTestRule<>(ChromeActivity.class); private ChromeActivity mActivity; - private final static String INFOBAR_HISTOGRAM = "Blink.Sms.Receive.Infobar"; - private final static String TIME_CANCEL_ON_KEYBOARD_DISMISSAL_HISTOGRAM = + private static final String INFOBAR_HISTOGRAM = "Blink.Sms.Receive.Infobar"; + private static final String TIME_CANCEL_ON_KEYBOARD_DISMISSAL_HISTOGRAM = "Blink.Sms.Receive.TimeCancelOnKeyboardDismissal"; @Before @@ -75,7 +73,7 @@ @Test @MediumTest @Feature({"InfoBars", "UiCatalogue"}) - public void testSmsInfoBarOk() throws TimeoutException, InterruptedException { + public void testSmsInfoBarOk() { SmsReceiverInfoBar infoBar = createInfoBar(); Assert.assertFalse(InfoBarUtil.hasSecondaryButton(infoBar)); @@ -91,7 +89,7 @@ @Test @MediumTest @Feature({"InfoBars", "UiCatalogue"}) - public void testSmsInfoBarClose() throws TimeoutException, InterruptedException { + public void testSmsInfoBarClose() { SmsReceiverInfoBar infoBar = createInfoBar(); Assert.assertFalse(InfoBarUtil.hasSecondaryButton(infoBar));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/undo/UndoBarControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/undo/UndoBarControllerTest.java index b6d9fb0..ec8f801a7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/undo/UndoBarControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/snackbar/undo/UndoBarControllerTest.java
@@ -156,7 +156,7 @@ private Snackbar getCurrentSnackbar() throws ExecutionException { return TestThreadUtils.runOnUiThreadBlocking(new Callable<Snackbar>() { @Override - public Snackbar call() throws Exception { + public Snackbar call() { return mSnackbarManager.getCurrentSnackbarForTesting(); } });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ssl/CaptivePortalTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ssl/CaptivePortalTest.java index af6139ca..015acd8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ssl/CaptivePortalTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ssl/CaptivePortalTest.java
@@ -81,7 +81,7 @@ private EmbeddedTestServer mServer; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startMainActivityFromLauncher(); mServer = EmbeddedTestServer.createAndStartHTTPSServer( InstrumentationRegistry.getContext(), ServerCertificate.CERT_MISMATCHED_NAME); @@ -91,7 +91,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsTest.java index c1f1b95..f9cbc26 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsTest.java
@@ -54,7 +54,7 @@ @Test @SmallTest @Feature("Suggestions") - public void testRemoteSuggestionsEnabled() throws InterruptedException { + public void testRemoteSuggestionsEnabled() { NewTabPage ntp = loadNTPWithSearchSuggestState(true); SuggestionsUiDelegate uiDelegate = ntp.getManagerForTesting(); Assert.assertTrue( @@ -64,7 +64,7 @@ @Test @SmallTest @Feature("Suggestions") - public void testRemoteSuggestionsDisabled() throws InterruptedException { + public void testRemoteSuggestionsDisabled() { NewTabPage ntp = loadNTPWithSearchSuggestState(false); SuggestionsUiDelegate uiDelegate = ntp.getManagerForTesting(); // Since header is expandable, category should still be enabled. @@ -72,8 +72,7 @@ isCategoryEnabled(uiDelegate.getSuggestionsSource(), KnownCategories.ARTICLES)); } - private NewTabPage loadNTPWithSearchSuggestState(final boolean enabled) - throws InterruptedException { + private NewTabPage loadNTPWithSearchSuggestState(final boolean enabled) { Tab tab = mActivityTestRule.getActivity().getActivityTab(); TestThreadUtils.runOnUiThreadBlocking( () -> PrefServiceBridge.getInstance().setSearchSuggestEnabled(enabled));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java index d91d851..d1f15769 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java
@@ -67,7 +67,7 @@ @Test @MediumTest @Feature({"UiCatalogue"}) - public void testContextMenu() throws Exception { + public void testContextMenu() { mActivityRule.setSheetState(BottomSheet.SheetState.FULL, false); waitForWindowUpdates(); @@ -79,7 +79,7 @@ @Test @MediumTest @Feature({"UiCatalogue"}) - public void testScrolling() throws Exception { + public void testScrolling() { mActivityRule.setSheetState(BottomSheet.SheetState.FULL, false); waitForWindowUpdates(); @@ -106,7 +106,7 @@ @Test @MediumTest @Feature({"UiCatalogue"}) - public void testContentSuggestionPlaceholder() throws Exception { + public void testContentSuggestionPlaceholder() { FakeSuggestionsSource source = (FakeSuggestionsSource) mDepsFactory.suggestionsSource; source.setSuggestionsForCategory(KnownCategories.ARTICLES, Collections.emptyList()); source.setStatusForCategory(KnownCategories.ARTICLES, CategoryStatus.AVAILABLE_LOADING);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/NavigationRecorderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/NavigationRecorderTest.java index 9ad6009..c691ae88 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/NavigationRecorderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/NavigationRecorderTest.java
@@ -46,7 +46,7 @@ private Tab mInitialTab; @Before - public void setUp() throws InterruptedException { + public void setUp() { mTestSetupRule.startMainActivityWithURL(UrlConstants.NTP_URL); mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); @@ -65,8 +65,7 @@ @Test @SmallTest - public void testRecordVisitInCurrentTabEndsWithBack() - throws InterruptedException, TimeoutException { + public void testRecordVisitInCurrentTabEndsWithBack() throws TimeoutException { final CallbackHelper callback = new CallbackHelper(); loadUrlAndRecordVisit(mNavUrl, new Callback<NavigationRecorder.VisitData>() { @Override @@ -85,8 +84,7 @@ @Test @SmallTest - public void testRecordVisitInCurrentTabEndsWhenHidden() - throws InterruptedException, TimeoutException { + public void testRecordVisitInCurrentTabEndsWhenHidden() throws TimeoutException { final CallbackHelper callback = new CallbackHelper(); loadUrlAndRecordVisit(mNavUrl, new Callback<NavigationRecorder.VisitData>() { @Override @@ -103,8 +101,7 @@ @Test @SmallTest - public void testRecordVisitInCurrentTabEndsWhenURLTyped() - throws InterruptedException, TimeoutException { + public void testRecordVisitInCurrentTabEndsWhenURLTyped() throws TimeoutException { final CallbackHelper callback = new CallbackHelper(); loadUrlAndRecordVisit(mNavUrl, new Callback<NavigationRecorder.VisitData>() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetTest.java index e491a6e4..d12e4bf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetTest.java
@@ -54,7 +54,7 @@ @Test @RetryOnFailure @MediumTest - public void testContextMenu() throws InterruptedException, ExecutionException { + public void testContextMenu() throws ExecutionException { ViewHolder suggestionViewHolder = mActivityRule.scrollToFirstItemOfType(ItemViewType.SNIPPET); assertFalse(mActivityRule.getBottomSheet().onInterceptTouchEvent(createTapEvent()));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetUiCaptureTest.java index 4c69066..8b69b0f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetUiCaptureTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetUiCaptureTest.java
@@ -52,7 +52,7 @@ @Test @MediumTest @Feature({"UiCatalogue"}) - public void testBottomSheetPosition() throws Exception { + public void testBottomSheetPosition() { mActivityRule.setSheetState(BottomSheet.SheetState.HALF, false); waitForWindowUpdates(); mScreenShooter.shoot("Half");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java index 7a6d290..9719f0a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java
@@ -209,7 +209,7 @@ return siteSuggestions; } - private NewTabPage setUpFakeDataToShowOnNtp(int suggestionCount) throws InterruptedException { + private NewTabPage setUpFakeDataToShowOnNtp(int suggestionCount) { List<SiteSuggestion> siteSuggestions = makeSuggestions(suggestionCount); FakeMostVisitedSites mMostVisitedSites = new FakeMostVisitedSites(); @@ -279,7 +279,7 @@ * @return the layout in which the suggestions are rendered. */ private TileGridLayout renderTiles(List<SiteSuggestion> siteSuggestions, - List<String> offlineUrls) throws IOException, InterruptedException { + List<String> offlineUrls) throws InterruptedException { // Launching the activity, that should now use the right UI. mActivityTestRule.startMainActivityOnBlankPage(); ChromeActivity activity = mActivityTestRule.getActivity(); @@ -313,7 +313,7 @@ } private TileGridLayout renderTiles(List<SiteSuggestion> siteSuggestions) - throws IOException, InterruptedException { + throws InterruptedException { return renderTiles(siteSuggestions, Collections.emptyList()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGroupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGroupTest.java index 8db90f6..0d54c0b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGroupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGroupTest.java
@@ -76,7 +76,7 @@ private EmbeddedTestServer mTestServer; @Before - public void setUp() throws Exception { + public void setUp() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mSiteSuggestionUrls = mTestServer.getURLs(FAKE_MOST_VISITED_URLS); @@ -89,7 +89,7 @@ initializeTab(); } - public void initializeTab() throws Exception { + public void initializeTab() { mActivityTestRule.startMainActivityWithURL(UrlConstants.NTP_URL); Tab mTab = mActivityTestRule.getActivity().getActivityTab(); NewTabPageTestUtils.waitForNtpLoaded(mTab); @@ -102,7 +102,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -219,8 +219,7 @@ return activity.findViewById(R.id.snackbar_button); } - private void waitForTileRemoved(final SiteSuggestion suggestion) - throws TimeoutException, InterruptedException { + private void waitForTileRemoved(final SiteSuggestion suggestion) throws TimeoutException { TileGridLayout tileContainer = getTileGridLayout(); final SuggestionsTileView removedTile = tileContainer.getTileView(suggestion); if (removedTile == null) return; @@ -239,8 +238,7 @@ tileContainer.setOnHierarchyChangeListener(null); } - private void waitForTileAdded(final SiteSuggestion suggestion) - throws TimeoutException, InterruptedException { + private void waitForTileAdded(final SiteSuggestion suggestion) throws TimeoutException { TileGridLayout tileContainer = getTileGridLayout(); if (tileContainer.getTileView(suggestion) != null) return;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java index 4d89d3e..ee6d3d5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
@@ -272,7 +272,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadBookmark() throws Exception { + public void testUploadBookmark() { addClientBookmark(TITLE, URL); waitForClientBookmarkCount(1); waitForServerBookmarkCountWithName(1, TITLE); @@ -282,7 +282,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadBookmarkModification() throws Exception { + public void testUploadBookmarkModification() { // Add the entity to test modifying. BookmarkId bookmarkId = addClientBookmark(TITLE, URL); waitForClientBookmarkCount(1); @@ -297,7 +297,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadBookmarkTombstone() throws Exception { + public void testUploadBookmarkTombstone() { // Add the entity to test deleting. BookmarkId bookmarkId = addClientBookmark(TITLE, URL); waitForClientBookmarkCount(1); @@ -344,7 +344,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadBookmarkFolder() throws Exception { + public void testUploadBookmarkFolder() { addClientBookmarkFolder(TITLE); waitForClientBookmarkCount(1); waitForServerBookmarkCountWithName(1, TITLE); @@ -354,7 +354,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadBookmarkFolderModification() throws Exception { + public void testUploadBookmarkFolderModification() { // Add the entity to test modifying. BookmarkId bookmarkId = addClientBookmarkFolder(TITLE); waitForClientBookmarkCount(1); @@ -369,7 +369,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadBookmarkFolderTombstone() throws Exception { + public void testUploadBookmarkFolderTombstone() { // Add the entity to test deleting. BookmarkId bookmarkId = addClientBookmarkFolder(TITLE); waitForClientBookmarkCount(1); @@ -395,7 +395,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testDisabledNoUploadBookmark() throws Exception { + public void testDisabledNoUploadBookmark() { mSyncTestRule.disableDataType(ModelType.BOOKMARKS); addClientBookmark(TITLE, URL); SyncTestUtil.triggerSyncAndWaitForCompletion(); @@ -406,7 +406,7 @@ BookmarkId id = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<BookmarkId>() { @Override - public BookmarkId call() throws Exception { + public BookmarkId call() { BookmarkId parentId = mBookmarkBridge.getMobileFolderId(); return mBookmarkBridge.addBookmark(parentId, 0, title, url); } @@ -419,7 +419,7 @@ BookmarkId id = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<BookmarkId>() { @Override - public BookmarkId call() throws Exception { + public BookmarkId call() { BookmarkId parentId = mBookmarkBridge.getMobileFolderId(); return mBookmarkBridge.addFolder(parentId, 0, title); } @@ -428,12 +428,12 @@ return id; } - private void addServerBookmark(String title, String url) throws InterruptedException { + private void addServerBookmark(String title, String url) { mSyncTestRule.getFakeServerHelper().injectBookmarkEntity( title, url, mSyncTestRule.getFakeServerHelper().getBookmarkBarFolderId()); } - private void addServerBookmarkFolder(String title) throws InterruptedException { + private void addServerBookmarkFolder(String title) { mSyncTestRule.getFakeServerHelper().injectBookmarkFolderEntity( title, mSyncTestRule.getFakeServerHelper().getBookmarkBarFolderId()); } @@ -501,7 +501,7 @@ count, ModelType.BOOKMARKS, name)); } - private void waitForClientBookmarkCount(int n) throws InterruptedException { + private void waitForClientBookmarkCount(int n) { mSyncTestRule.pollInstrumentationThread(Criteria.equals(n, new Callable<Integer>() { @Override public Integer call() throws Exception { @@ -512,8 +512,7 @@ })); } - private void waitForServerBookmarkCountWithName(final int count, final String name) - throws InterruptedException { + private void waitForServerBookmarkCountWithName(final int count, final String name) { mSyncTestRule.pollInstrumentationThread(new Criteria( "Expected " + count + " remote bookmarks with name " + name + ".") { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java index f1bde3a..b136459 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
@@ -51,7 +51,7 @@ @Rule public SyncTestRule mSyncTestRule = new SyncTestRule() { @Override - public void startMainActivityForSyncTest() throws Exception { + public void startMainActivityForSyncTest() { FirstRunActivity.setObserverForTest(mTestObserver); // Starts up and waits for the FirstRunActivity to be ready. @@ -120,7 +120,7 @@ private FirstRunActivity mActivity; @After - public void tearDown() throws Exception { + public void tearDown() { if (mActivity != null) mActivity.finish(); } @@ -131,7 +131,7 @@ */ @Test @FlakyTest(message = "https://crbug.com/616456") - public void testSignIn() throws Exception { + public void testSignIn() { Account testAccount = SigninTestUtil.addTestAccount(); Assert.assertNull(SigninTestUtil.getCurrentAccount()); Assert.assertFalse(SyncTestUtil.isSyncRequested()); @@ -149,7 +149,7 @@ */ @Test @FlakyTest(message = "https://crbug.com/616456") - public void testSignInWithOpenSettings() throws Exception { + public void testSignInWithOpenSettings() { final Account testAccount = SigninTestUtil.addTestAccount(); final Preferences prefActivity = processFirstRun(testAccount.name, true /* ShowSettings */); @@ -174,7 +174,7 @@ @SmallTest @Feature({"Sync"}) @DisabledTest // https://crbug.com/901488 - public void testNoSignIn() throws Exception { + public void testNoSignIn() { SigninTestUtil.addTestAccount(); Assert.assertFalse(SyncTestUtil.isSyncRequested()); processFirstRun(null, false /* ShowSettings */);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ManageSyncPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ManageSyncPreferencesTest.java index 4dae300b..67a7e31 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ManageSyncPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ManageSyncPreferencesTest.java
@@ -76,7 +76,7 @@ public SyncTestRule mSyncTestRule = new SyncTestRule(); @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> ProfileSyncService.resetForTests()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java index 69b52b5..f6c7e44 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java
@@ -100,7 +100,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadOpenTab() throws Exception { + public void testUploadOpenTab() { mSyncTestRule.loadUrl(URL); waitForLocalTabsForClient(mClientName, URL); waitForServerTabs(URL); @@ -110,7 +110,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadMultipleOpenTabs() throws Exception { + public void testUploadMultipleOpenTabs() { mSyncTestRule.loadUrl(URL); mSyncTestRule.loadUrlInNewTab(URL2); mSyncTestRule.loadUrlInNewTab(URL3); @@ -122,7 +122,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testUploadAndCloseOpenTab() throws Exception { + public void testUploadAndCloseOpenTab() { mSyncTestRule.loadUrl(URL); // Can't have zero tabs, so we have to open two to test closing one. mSyncTestRule.loadUrlInNewTab(URL2); @@ -142,7 +142,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testDownloadOpenTab() throws Exception { + public void testDownloadOpenTab() { addFakeServerTabs(FAKE_CLIENT, URL); SyncTestUtil.triggerSync(); waitForLocalTabsForClient(FAKE_CLIENT, URL); @@ -152,7 +152,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testDownloadMultipleOpenTabs() throws Exception { + public void testDownloadMultipleOpenTabs() { addFakeServerTabs(FAKE_CLIENT, URL, URL2, URL3); SyncTestUtil.triggerSync(); waitForLocalTabsForClient(FAKE_CLIENT, URL, URL2, URL3); @@ -194,7 +194,7 @@ return SESSION_TAG_PREFIX + (mSessionTagCounter++); } - private void addFakeServerTabs(String clientName, String... urls) throws InterruptedException { + private void addFakeServerTabs(String clientName, String... urls) { String tag = makeSessionTag(); EntitySpecifics header = makeSessionEntity(tag, clientName, urls.length); mSyncTestRule.getFakeServerHelper().injectUniqueClientEntity( @@ -254,8 +254,7 @@ } } - private void waitForLocalTabsForClient(final String clientName, String... urls) - throws InterruptedException { + private void waitForLocalTabsForClient(final String clientName, String... urls) { final List<String> urlList = new ArrayList<>(urls.length); for (String url : urls) urlList.add(url); mSyncTestRule.pollInstrumentationThread( @@ -267,7 +266,7 @@ })); } - private void waitForServerTabs(final String... urls) throws InterruptedException { + private void waitForServerTabs(final String... urls) { mSyncTestRule.pollInstrumentationThread( new Criteria("Expected server open tabs: " + Arrays.toString(urls)) { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncAndServicesPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncAndServicesPreferencesTest.java index 90c511c..c6d5c7d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncAndServicesPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncAndServicesPreferencesTest.java
@@ -40,7 +40,7 @@ private Preferences mPreferences; @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> ProfileSyncService.resetForTests()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java index 91c1d1e..a36f9132 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
@@ -46,7 +46,7 @@ @Test @LargeTest @Feature({"Sync"}) - public void testFlushDirectoryDoesntBreakSync() throws Throwable { + public void testFlushDirectoryDoesntBreakSync() { mSyncTestRule.setUpTestAccountAndSignIn(); final Activity activity = mSyncTestRule.getActivity();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java index 851e4c4..54492dfd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java
@@ -84,12 +84,12 @@ private ProfileSyncService mProfileSyncService; private MockSyncContentResolverDelegate mSyncContentResolver; - private void ruleSetUp() throws Throwable { + private void ruleSetUp() { // This must be called before super.setUp() in order for test authentication to work. SigninTestUtil.setUpAuthForTest(); } - private void ruleTearDown() throws Exception { + private void ruleTearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> { mProfileSyncService.requestStop(); FakeServerHelper.deleteFakeServer();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java index 0b1843a4..e1eb69a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java
@@ -124,7 +124,7 @@ }); } - private void addServerTypedUrl(String url) throws InterruptedException { + private void addServerTypedUrl(String url) { EntitySpecifics specifics = EntitySpecifics.newBuilder() .setTypedUrl(TypedUrlSpecifics.newBuilder()
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/UkmTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/UkmTest.java index 5e107e3..67ba978 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/UkmTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/UkmTest.java
@@ -47,7 +47,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking( () -> UmaSessionStats.unSetMetricsAndCrashReportingForTesting()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseActivityTest.java index 9189279..fe7e224 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseActivityTest.java
@@ -40,12 +40,12 @@ private Context mContext; @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); } @After - public void tearDown() throws Exception { + public void tearDown() { // Clear ProfileSyncService in case it was mocked. TestThreadUtils.runOnUiThreadBlocking(() -> ProfileSyncService.resetForTests()); } @@ -57,7 +57,7 @@ @SmallTest @Feature({"Sync"}) @RetryOnFailure - public void testCallbackAfterBackgrounded() throws Exception { + public void testCallbackAfterBackgrounded() { InstrumentationRegistry.getInstrumentation().waitForIdleSync(); SigninTestUtil.addAndSignInTestAccount();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragmentTest.java index 0cf1013b..d0fe7d0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragmentTest.java
@@ -56,7 +56,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testKeystoreEncryptionOptions() throws Exception { + public void testKeystoreEncryptionOptions() { createFragment(Passphrase.Type.KEYSTORE, true); assertPassphraseTypeOptions(false, new TypeOptions(Passphrase.Type.CUSTOM, ENABLED, UNCHECKED), @@ -66,7 +66,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testCustomEncryptionOptions() throws Exception { + public void testCustomEncryptionOptions() { createFragment(Passphrase.Type.CUSTOM, true); assertPassphraseTypeOptions(true, new TypeOptions(Passphrase.Type.CUSTOM, DISABLED, CHECKED), @@ -79,7 +79,7 @@ */ @Test @FlakyTest(message = "crbug.com/588050") - public void testFrozenImplicitEncryptionOptions() throws Exception { + public void testFrozenImplicitEncryptionOptions() { createFragment(Passphrase.Type.FROZEN_IMPLICIT, true); assertPassphraseTypeOptions(true, new TypeOptions(Passphrase.Type.FROZEN_IMPLICIT, DISABLED, CHECKED), @@ -89,7 +89,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testImplicitEncryptionOptions() throws Exception { + public void testImplicitEncryptionOptions() { createFragment(Passphrase.Type.IMPLICIT, true); assertPassphraseTypeOptions(false, new TypeOptions(Passphrase.Type.CUSTOM, ENABLED, UNCHECKED), @@ -99,7 +99,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testKeystoreEncryptionOptionsEncryptEverythingDisallowed() throws Exception { + public void testKeystoreEncryptionOptionsEncryptEverythingDisallowed() { createFragment(Passphrase.Type.KEYSTORE, false); assertPassphraseTypeOptions(false, new TypeOptions(Passphrase.Type.CUSTOM, DISABLED, UNCHECKED), @@ -109,7 +109,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testImplicitEncryptionOptionsEncryptEverythingDisallowed() throws Exception { + public void testImplicitEncryptionOptionsEncryptEverythingDisallowed() { createFragment(Passphrase.Type.IMPLICIT, false); assertPassphraseTypeOptions(false, new TypeOptions(Passphrase.Type.CUSTOM, DISABLED, UNCHECKED),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java index 85164f9c..53efe37 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java
@@ -114,13 +114,13 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @Test @SmallTest - public void testNavigationFromTimer() throws InterruptedException { + public void testNavigationFromTimer() { mActivityTestRule.loadUrl(mTestServer.getURL(NAVIGATION_FROM_TIMEOUT_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -131,7 +131,7 @@ @Test @SmallTest - public void testNavigationFromUserGesture() throws InterruptedException, TimeoutException { + public void testNavigationFromUserGesture() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NAVIGATION_FROM_USER_GESTURE_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -144,7 +144,7 @@ @Test @SmallTest - public void testNavigationFromXHRCallback() throws InterruptedException, TimeoutException { + public void testNavigationFromXHRCallback() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -163,8 +163,7 @@ @Test @SmallTest - public void testNavigationFromXHRCallbackAndShortTimeout() - throws InterruptedException, TimeoutException { + public void testNavigationFromXHRCallbackAndShortTimeout() throws TimeoutException { mActivityTestRule.loadUrl( mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_AND_SHORT_TIMEOUT_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -184,8 +183,7 @@ @Test @SmallTest - public void testNavigationFromXHRCallbackAndLongTimeout() - throws InterruptedException, TimeoutException { + public void testNavigationFromXHRCallbackAndLongTimeout() throws TimeoutException { mActivityTestRule.loadUrl( mTestServer.getURL(NAVIGATION_FROM_XHR_CALLBACK_AND_LONG_TIMEOUT_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -198,7 +196,7 @@ @Test @SmallTest - public void testNavigationFromImageOnLoad() throws InterruptedException, TimeoutException { + public void testNavigationFromImageOnLoad() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NAVIGATION_FROM_IMAGE_ONLOAD_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -217,7 +215,7 @@ @Test @MediumTest - public void testExternalAppIframeNavigation() throws InterruptedException, TimeoutException { + public void testExternalAppIframeNavigation() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(NAVIGATION_FROM_USER_GESTURE_IFRAME_PAGE)); Assert.assertEquals(1, mNavParamHistory.size()); @@ -230,5 +228,4 @@ Assert.assertTrue( mExternalNavParamHistory.get(2).getRedirectHandler().shouldStayInChrome(true)); } - }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java index d4db5fc9..d7f2eaed 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java
@@ -65,7 +65,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -194,7 +194,7 @@ } /** Performs a POST navigation in mTab. */ - private void postNavigation() throws Throwable { + private void postNavigation() { final String url = "/chrome/test/data/android/test.html"; final byte[] postData = new byte[] {42}; @@ -205,13 +205,12 @@ } /** Reloads mTab. */ - private void reload() throws Throwable { + private void reload() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> mTab.reload()); } /** Clicks the given button in the given dialog. */ - private void clickButton(final PropertyModel dialog, final @ButtonType int type) - throws Throwable { + private void clickButton(final PropertyModel dialog, final @ButtonType int type) { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> dialog.get(ModalDialogProperties.CONTROLLER).onClick(dialog, type)); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java index d74e3ea..b8f5e15 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java
@@ -129,13 +129,12 @@ * Confirm that after a successive refresh of a failed tab that failed to load, change the * button from "Reload" to "Send Feedback". If reloaded a third time and it is successful it * reverts from "Send Feedback" to "Reload". - * @throws InterruptedException * @throws IllegalArgumentException */ @Test @SmallTest @Feature({"SadTab"}) - public void testSadTabPageButtonText() throws IllegalArgumentException, InterruptedException { + public void testSadTabPageButtonText() throws IllegalArgumentException { final Tab tab = mActivityTestRule.getActivity().getActivityTab(); Assert.assertFalse(isShowingSadTab(tab));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabIdManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabIdManagerTest.java index c5c1c8d..76b08fa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabIdManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabIdManagerTest.java
@@ -30,7 +30,7 @@ public UiThreadTestRule mRule = new UiThreadTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mContext = new AdvancedMockContext(InstrumentationRegistry.getTargetContext()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabRedirectHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabRedirectHandlerTest.java index 8a7e3ab5..ef27717 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabRedirectHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabRedirectHandlerTest.java
@@ -53,7 +53,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { CommandLine.init(new String[0]); ContextUtils.initApplicationContextForTests(new TestContext()); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabStateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabStateTest.java index cbdd1f1..761202f7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabStateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabStateTest.java
@@ -36,13 +36,13 @@ private TestTabModelDirectory mTestTabModelDirectory; @Before - public void setUp() throws Exception { + public void setUp() { mTestTabModelDirectory = new TestTabModelDirectory( InstrumentationRegistry.getTargetContext(), "TabStateTest", null); } @After - public void tearDown() throws Exception { + public void tearDown() { TabState.setChannelNameOverrideForTest(null); mTestTabModelDirectory.tearDown(); } @@ -92,7 +92,7 @@ @Test @SmallTest - public void testSaveLoadThroughBundle() throws Exception { + public void testSaveLoadThroughBundle() { TabState tabState = new TabState(); byte[] bytes = {'A', 'B', 'C'}; tabState.contentsState = new WebContentsState(ByteBuffer.allocateDirect(bytes.length));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java index 328a5fd8..d67fa5d7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java
@@ -57,7 +57,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/UndoIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/UndoIntegrationTest.java index d05d2a2..736cd72 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/UndoIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/UndoIntegrationTest.java
@@ -64,7 +64,6 @@ /** * Test that a tab that is closing can't open other windows. - * @throws InterruptedException * @throws TimeoutException */ @Test @@ -72,7 +71,7 @@ @LargeTest @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @RetryOnFailure - public void testAddNewContentsFromClosingTab() throws InterruptedException, TimeoutException { + public void testAddNewContentsFromClosingTab() throws TimeoutException { mActivityTestRule.loadUrl(WINDOW_OPEN_BUTTON_URL); final TabModel model =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabbed_mode/TabbedNavigationBarColorControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabbed_mode/TabbedNavigationBarColorControllerTest.java index 67905f2..3ade53a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabbed_mode/TabbedNavigationBarColorControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabbed_mode/TabbedNavigationBarColorControllerTest.java
@@ -72,7 +72,7 @@ @Test @SmallTest - public void testToggleIncognito() throws InterruptedException { + public void testToggleIncognito() { assertEquals("Navigation bar should be white on normal tabs.", mLightNavigationColor, mWindow.getNavigationBarColor());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/AsyncTabCreationParamsManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/AsyncTabCreationParamsManagerTest.java index 088f155b..af33b475 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/AsyncTabCreationParamsManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/AsyncTabCreationParamsManagerTest.java
@@ -28,7 +28,7 @@ @Test @SmallTest @UiThreadTest - public void testBasicAddingAndRemoval() throws Exception { + public void testBasicAddingAndRemoval() { AsyncTabCreationParams asyncParams = new AsyncTabCreationParams(new LoadUrlParams("http://google.com")); AsyncTabParamsManager.add(11684, asyncParams);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreatorTest.java index 17246f5..929ff6d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreatorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreatorTest.java
@@ -53,7 +53,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -64,8 +64,7 @@ @Restriction(RESTRICTION_TYPE_LOW_END_DEVICE) @MediumTest @Feature({"Browser"}) - public void testCreateNewTabInBackgroundLowEnd() - throws ExecutionException, InterruptedException { + public void testCreateNewTabInBackgroundLowEnd() throws ExecutionException { final Tab fgTab = mActivityTestRule.getActivity().getActivityTab(); final Tab bgTab = TestThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override @@ -99,7 +98,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @MediumTest @Feature({"Browser"}) - public void testCreateNewTabInBackground() throws ExecutionException, InterruptedException { + public void testCreateNewTabInBackground() throws ExecutionException { final Tab fgTab = mActivityTestRule.getActivity().getActivityTab(); Tab bgTab = TestThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java index 1071d9b..9f3f53cd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java
@@ -118,7 +118,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking( () -> { FirstRunStatus.setFirstRunFlowComplete(false); }); mTestServer.stopAndDestroyServer(); @@ -130,7 +130,7 @@ @Test @MediumTest @Feature({"Browser"}) - public void testOpenInNewTabReferrer() throws InterruptedException, TimeoutException { + public void testOpenInNewTabReferrer() throws TimeoutException { triggerContextMenuLoad(mTestServer.getURL(HTML_PATH), "testLink", R.id.contextmenu_open_in_new_tab); @@ -145,7 +145,7 @@ @Test @MediumTest @Feature({"Browser"}) - public void testOpenInIncognitoTabNoReferrer() throws InterruptedException, TimeoutException { + public void testOpenInIncognitoTabNoReferrer() throws TimeoutException { triggerContextMenuLoad(mTestServer.getURL(HTML_PATH), "testLink", R.id.contextmenu_open_in_incognito_tab); @@ -159,7 +159,7 @@ @Test @MediumTest @Feature({"Browser"}) - public void testOpenInNewTabSanitizeReferrer() throws InterruptedException, TimeoutException { + public void testOpenInNewTabSanitizeReferrer() throws TimeoutException { String testUrl = mTestServer.getURL(HTML_PATH); String[] schemeAndUrl = SCHEME_SEPARATOR_RE.split(testUrl, 2); Assert.assertEquals(2, schemeAndUrl.length); @@ -170,7 +170,7 @@ } private void triggerContextMenuLoad(String url, String openerDomId, int menuItemId) - throws InterruptedException, TimeoutException { + throws TimeoutException { mActivityTestRule.loadUrl(url); mActivityTestRule.assertWaitForPageScaleFactorMatch(0.5f); Tab tab = mActivityTestRule.getActivity().getActivityTab();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/MultiInstanceMigrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/MultiInstanceMigrationTest.java index cbd6d24..b2e50b5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/MultiInstanceMigrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/MultiInstanceMigrationTest.java
@@ -35,7 +35,7 @@ private Context mAppContext; @Before - public void setUp() throws Exception { + public void setUp() { mAppContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext()); @@ -48,9 +48,7 @@ } @After - public void tearDown() throws Exception { - - } + public void tearDown() {} private void buildPersistentStoreAndWaitForMigration() { TestThreadUtils.runOnUiThreadBlocking(() -> {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/RestoreMigrateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/RestoreMigrateTest.java index 00dc42cf..c045a3b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/RestoreMigrateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/RestoreMigrateTest.java
@@ -33,7 +33,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; /** * Test that migrating the old tab state folder structure to the new one works. @@ -76,7 +75,7 @@ public UiThreadTestRule mRule = new UiThreadTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mAppContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext()); @@ -87,7 +86,7 @@ final TabModelSelector selector, final int selectorIndex) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TabPersistentStore>() { @Override - public TabPersistentStore call() throws Exception { + public TabPersistentStore call() { TabPersistencePolicy persistencePolicy = new TabbedModeTabPersistencePolicy( selectorIndex, false); TabPersistentStore store = new TabPersistentStore( @@ -100,16 +99,13 @@ /** * Test that normal migration of state files works. * @throws IOException - * @throws InterruptedException - * @throws ExecutionException */ @Test @SuppressWarnings("unused") @SmallTest @Feature({"TabPersistentStore"}) @UiThreadTest - public void testMigrateData() throws IOException, InterruptedException, ExecutionException { - + public void testMigrateData() throws IOException { // Write old state files. File filesDir = mAppContext.getFilesDir(); File stateFile = new File(filesDir, TabbedModeTabPersistencePolicy.LEGACY_SAVED_STATE_FILE); @@ -152,22 +148,18 @@ Assert.assertFalse("Could still find old tab 1 file", tab1.exists()); Assert.assertFalse("Could still find old tab 2 file", tab2.exists()); Assert.assertFalse("Could still find old tab 3 file", tab3.exists()); - } /** * Test that migration skips if it already has files in the new folder. * @throws IOException - * @throws InterruptedException - * @throws ExecutionException */ @Test @SuppressWarnings("unused") @SmallTest @Feature({"TabPersistentStore"}) @UiThreadTest - public void testSkipMigrateData() throws IOException, InterruptedException, ExecutionException { - + public void testSkipMigrateData() throws IOException { // Write old state files. File filesDir = mAppContext.getFilesDir(); File stateFile = new File(filesDir, TabbedModeTabPersistencePolicy.LEGACY_SAVED_STATE_FILE); @@ -208,23 +200,18 @@ Assert.assertFalse("Could find new tab 1 file", newTab1.exists()); Assert.assertFalse("Could find new tab 2 file", newTab2.exists()); Assert.assertFalse("Could find new tab 3 file", newTab3.exists()); - } /** * Test that the state file migration skips unrelated files. * @throws IOException - * @throws InterruptedException - * @throws ExecutionException */ @Test @SuppressWarnings("unused") @SmallTest @Feature({"TabPersistentStore"}) @UiThreadTest - public void testMigrationLeavesOtherFilesAlone() - throws IOException, InterruptedException, ExecutionException { - + public void testMigrationLeavesOtherFilesAlone() throws IOException { // Write old state files. File filesDir = mAppContext.getFilesDir(); File stateFile = new File(filesDir, TabbedModeTabPersistencePolicy.LEGACY_SAVED_STATE_FILE); @@ -253,7 +240,6 @@ Assert.assertTrue("Could not find new state file", newStateFile.exists()); Assert.assertTrue("Could not find new tab 0 file", newTab0.exists()); Assert.assertFalse("Could find new other file", newOtherFile.exists()); - } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java index a92c070..f18c0e0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelMergingTest.java
@@ -366,8 +366,7 @@ @Test @LargeTest @Feature({"TabPersistentStore", "MultiWindow"}) - public void testMergeOnColdStartIntoChromeTabbedActivity2() - throws TimeoutException, InterruptedException { + public void testMergeOnColdStartIntoChromeTabbedActivity2() throws TimeoutException { String CTA2ClassName = mActivity2.getClass().getName(); String CTA2PackageName = mActivity2.getPackageName(); @@ -437,7 +436,7 @@ @Test @LargeTest @Feature({"TabPersistentStore", "MultiWindow"}) - public void testMergeWithNoTabs() throws Exception { + public void testMergeWithNoTabs() { // Close all tabs and wait for the callback. ChromeTabUtils.closeAllTabs(InstrumentationRegistry.getInstrumentation(), mActivity1); @@ -454,7 +453,7 @@ @Test @LargeTest @Feature({"TabPersistentStore", "MultiWindow"}) - public void testMergingIncognitoTabs() throws InterruptedException { + public void testMergingIncognitoTabs() { // Incognito tabs must be fully loaded so that their tab states are written out. ChromeTabUtils.fullyLoadUrlInNewTab( InstrumentationRegistry.getInstrumentation(), mActivity1, TEST_URL_5, true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorObserverTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorObserverTestRule.java index 4e9498b4..6c1f4ecc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorObserverTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorObserverTestRule.java
@@ -58,7 +58,7 @@ }, description); } - private void setUp() throws Exception { + private void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { initialize(); }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabModelObserverTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabModelObserverTest.java index 16d054a4..25fda6f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabModelObserverTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabModelObserverTest.java
@@ -46,7 +46,7 @@ @Test @SmallTest - public void testAlreadyInitializedSelector() throws InterruptedException, TimeoutException { + public void testAlreadyInitializedSelector() throws TimeoutException { final CallbackHelper registrationCompleteCallback = new CallbackHelper(); TabModelSelectorTabModelObserver observer = TestThreadUtils.runOnUiThreadBlockingNoException( @@ -63,7 +63,7 @@ @Test @UiThreadTest @SmallTest - public void testUninitializedSelector() throws InterruptedException, TimeoutException { + public void testUninitializedSelector() throws TimeoutException { mSelector = new TabModelSelectorBase(null, false) { @Override public Tab openNewTab(LoadUrlParams loadUrlParams, @TabLaunchType int type, Tab parent,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java index 1c0d4f03..bc880fa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java
@@ -293,7 +293,7 @@ private SharedPreferences mPreferences; @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { mChromeActivity = new ChromeActivity() { @Override @@ -330,7 +330,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> { TabWindowManager.getInstance().onActivityStateChange( mChromeActivity, ActivityState.DESTROYED); @@ -343,7 +343,7 @@ final TabPersistentStoreObserver observer) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<TabPersistentStore>() { @Override - public TabPersistentStore call() throws Exception { + public TabPersistentStore call() { return new TabPersistentStore(persistencePolicy, modelSelector, creatorManager, observer); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TestTabModelDirectory.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TestTabModelDirectory.java index 5dd45f96..5b51dfd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TestTabModelDirectory.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TestTabModelDirectory.java
@@ -306,7 +306,7 @@ * subdirectories of the base data directory. */ public TestTabModelDirectory( - Context context, String baseDirectoryName, String subdirectoryName) throws Exception { + Context context, String baseDirectoryName, String subdirectoryName) { mTestingDirectory = new File(context.getCacheDir(), baseDirectoryName); if (mTestingDirectory.exists()) FileUtils.recursivelyDeleteFile(mTestingDirectory); if (!mTestingDirectory.mkdirs()) { @@ -324,7 +324,7 @@ } /** Nukes all the testing data. */ - public void tearDown() throws Exception { + public void tearDown() { FileUtils.recursivelyDeleteFile(mTestingDirectory); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java index 63b9157..d983334 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java
@@ -108,7 +108,7 @@ } private void closeTabOnUiThread(final TabModel model, final Tab tab, final boolean undoable) - throws InterruptedException, TimeoutException { + throws TimeoutException { // Check preconditions. Assert.assertFalse(tab.isClosing()); Assert.assertTrue(tab.isInitialized()); @@ -149,7 +149,7 @@ } private void cancelTabClosureOnUiThread(final TabModel model, final Tab tab) - throws InterruptedException, TimeoutException { + throws TimeoutException { // Check preconditions. Assert.assertTrue(tab.isClosing()); Assert.assertTrue(tab.isInitialized()); @@ -180,7 +180,7 @@ } private void cancelAllTabClosuresOnUiThread(final TabModel model, final Tab[] expectedToClose) - throws InterruptedException, TimeoutException { + throws TimeoutException { final CallbackHelper tabClosureUndoneHelper = new CallbackHelper(); for (int i = 0; i < expectedToClose.length; i++) { @@ -218,7 +218,7 @@ } private void commitTabClosureOnUiThread(final TabModel model, final Tab tab) - throws InterruptedException, TimeoutException { + throws TimeoutException { // Check preconditions. Assert.assertTrue(tab.isClosing()); Assert.assertTrue(tab.isInitialized()); @@ -249,7 +249,7 @@ } private void commitAllTabClosuresOnUiThread(final TabModel model, Tab[] expectedToClose) - throws InterruptedException, TimeoutException { + throws TimeoutException { final CallbackHelper tabClosureCommittedHelper = new CallbackHelper(); for (int i = 0; i < expectedToClose.length; i++) { @@ -324,12 +324,11 @@ * 9. CreateTab(0) [ 0s ] - [ 0s ] * 10. CloseTab(0, disallow undo) - - - * - * @throws InterruptedException */ @Test @MediumTest @RetryOnFailure - public void testSingleTab() throws InterruptedException, TimeoutException { + public void testSingleTab() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); @@ -415,7 +414,6 @@ * 24. CloseTab(1, allow undo) - [ 1 0 ] [ 1s 0 ] * 25. CommitAllClose - - - * - * @throws InterruptedException */ @Test // @MediumTest @@ -423,7 +421,7 @@ @DisabledTest( message = "Flaky on all Android configurations except Swarming. See crbug.com/620014.") public void - testTwoTabs() throws InterruptedException, TimeoutException { + testTwoTabs() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -567,12 +565,11 @@ * 23. CancelClose(0) [ 0 1s 3 ] [ 2 ] [ 0 1s 2 3 ] * 24. CancelClose(2) [ 0 1s 2 3 ] - [ 0 1s 2 3 ] * - * @throws InterruptedException */ @Test @MediumTest @RetryOnFailure - public void testInOrderRestore() throws InterruptedException, TimeoutException { + public void testInOrderRestore() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -699,7 +696,6 @@ checkState(model, new Tab[] { tab0, tab1, tab2, tab3 }, tab1, EMPTY, fullList, tab1); } - /** * Test restoring in the reverse of closing with the following actions/expected states: * Action Model List Close List Comprehensive List @@ -728,12 +724,11 @@ * 23. CancelClose(0) [ 0 1s 2 ] [ 3 ] [ 0 1s 2 3 ] * 24. CancelClose(3) [ 0 1s 2 3 ] - [ 0 1s 2 3 ] * - * @throws InterruptedException */ @Test @MediumTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // See crbug.com/633607 - public void testReverseOrderRestore() throws InterruptedException, TimeoutException { + public void testReverseOrderRestore() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -881,12 +876,11 @@ * 16. CancelClose(1) [ 1 2s ] - [ 1 2s ] * 17. CloseTab(2, disallow undo) [ 1s ] - [ 1s ] * - * @throws InterruptedException */ @Test @MediumTest @RetryOnFailure - public void testOutOfOrder1() throws InterruptedException, TimeoutException { + public void testOutOfOrder1() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -998,12 +992,11 @@ * 13. CloseTab(1, allow undo) - [ 1 3 ] [ 1s 3 ] * 14. CommitAll - - - * - * @throws InterruptedException */ @Test @MediumTest @FlakyTest(message = "crbug.com/592969") - public void testOutOfOrder2() throws InterruptedException, TimeoutException { + public void testOutOfOrder2() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -1096,12 +1089,11 @@ * 8. CreateTab(0) [ 0s ] - [ 0s ] * 9. CloseAll - [ 0 ] [ 0s ] * - * @throws InterruptedException */ @Test @MediumTest @DisabledTest(message = "crbug.com/633607") - public void testCloseAll() throws InterruptedException, TimeoutException { + public void testCloseAll() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -1172,11 +1164,10 @@ * 3. CloseTab(2, allow undo) [ 0 3s ] [ 2 1 ] [ 0 1 2 3s ] * 4. CloseTab(3, disallow undo) [ 0s ] - [ 0s ] * - * @throws InterruptedException */ @Test @MediumTest - public void testCloseTab() throws InterruptedException, TimeoutException { + public void testCloseTab() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -1219,12 +1210,11 @@ * 3. CloseTab(2, allow undo) [ 0 3s ] [ 2 1 ] [ 0 1 2 3s ] * 4. MoveTab(0, 2) [ 3s 0 ] - [ 3s 0 ] * - * @throws InterruptedException */ @Test @MediumTest @RetryOnFailure - public void testMoveTab() throws InterruptedException, TimeoutException { + public void testMoveTab() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -1270,14 +1260,13 @@ * 6. CloseTab(3, allow undo) [ 4s ] [ 3 0 ] [ 0 3 4s ] * 7. CloseTab(4, allow undo) - [ 4 3 0 ] [ 0s 3 4 ] * 8. CreateTab(5) [ 5s ] - [ 5s ] - * @throws InterruptedException */ //@MediumTest //@Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // See crbug.com/633607 // Disabled due to flakiness on linux_android_rel_ng (crbug.com/661429) @Test @DisabledTest - public void testAddTab() throws InterruptedException, TimeoutException { + public void testAddTab() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); createTabOnUiThread(tabCreator); @@ -1346,12 +1335,11 @@ * 2. CloseTab(1, allow undo) [ 0 2 3s ] - [ 0 2 3s ] * 3. CloseAll - - - * - * @throws InterruptedException */ @Test @MediumTest @RetryOnFailure - public void testUndoNotSupported() throws InterruptedException, TimeoutException { + public void testUndoNotSupported() throws TimeoutException { TabModel model = mActivityTestRule.getActivity().getTabModelSelector().getModel(true); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(true); createTabOnUiThread(tabCreator); @@ -1398,7 +1386,7 @@ @Test @MediumTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // See crbug.com/633607 - public void testSaveStateCommitsUndos() throws InterruptedException, TimeoutException { + public void testSaveStateCommitsUndos() throws TimeoutException { TabModelSelector selector = mActivityTestRule.getActivity().getTabModelSelector(); TabModel model = selector.getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); @@ -1426,12 +1414,11 @@ /** * Test opening recently closed tabs using the rewound list in Java. - * @throws InterruptedException */ @Test @MediumTest @RetryOnFailure - public void testOpenRecentlyClosedTab() throws InterruptedException, TimeoutException { + public void testOpenRecentlyClosedTab() throws TimeoutException { TabModelSelector selector = mActivityTestRule.getActivity().getTabModelSelector(); TabModel model = selector.getModel(false); ChromeTabCreator tabCreator = mActivityTestRule.getActivity().getTabCreator(false); @@ -1452,11 +1439,10 @@ /** * Test opening recently closed tab using native tab restore service. - * @throws InterruptedException */ @Test @MediumTest - public void testOpenRecentlyClosedTabNative() throws InterruptedException, TimeoutException { + public void testOpenRecentlyClosedTabNative() throws TimeoutException { final TabModelSelector selector = mActivityTestRule.getActivity().getTabModelSelector(); final TabModel model = selector.getModel(false); @@ -1495,15 +1481,13 @@ * 5. Close tab in window 2. | * 6. Restore tab. | Tab restored in window 2. * 7. Restore tab. | Tab restored in window 1. - * @throws InterruptedException */ @Test @MediumTest @MinAndroidSdkLevel(24) @TargetApi(Build.VERSION_CODES.LOLLIPOP) @CommandLineFlags.Add(ChromeSwitches.DISABLE_TAB_MERGING_FOR_TESTING) - public void testOpenRecentlyClosedTabMultiWindow() - throws InterruptedException, TimeoutException { + public void testOpenRecentlyClosedTabMultiWindow() throws TimeoutException { final ChromeTabbedActivity2 secondActivity = MultiWindowTestHelper.createSecondChromeTabbedActivity( mActivityTestRule.getActivity()); @@ -1577,15 +1561,13 @@ * 3. Close tab in window 2. | * 4. Close second window. | * 5. Restore tab. | Tab restored in first window. - * @throws InterruptedException */ @Test @MediumTest @MinAndroidSdkLevel(24) @TargetApi(Build.VERSION_CODES.LOLLIPOP) @CommandLineFlags.Add(ChromeSwitches.DISABLE_TAB_MERGING_FOR_TESTING) - public void testOpenRecentlyClosedTabMultiWindowFallback() - throws InterruptedException, TimeoutException { + public void testOpenRecentlyClosedTabMultiWindowFallback() throws TimeoutException { final ChromeTabbedActivity2 secondActivity = MultiWindowTestHelper.createSecondChromeTabbedActivity( mActivityTestRule.getActivity());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java index 99436c2a..02bae174 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java
@@ -52,7 +52,7 @@ private ChromeTabbedActivity mActivity; @Before - public void setUp() throws Exception { + public void setUp() { FeatureUtilities.setGridTabSwitcherEnabledForTesting(true); mActivityTestRule.startMainActivityFromLauncher(); @@ -112,7 +112,7 @@ assertEquals(2, mActivityTestRule.getActivity().getTabModelSelector().getTotalTabCount()); } - private void setupTabs() throws InterruptedException { + private void setupTabs() { TestThreadUtils.runOnUiThreadBlocking( () -> mActivityTestRule.getActivity().getTabModelSelector().closeAllTabs()); EmbeddedTestServer testServer = @@ -130,7 +130,7 @@ assertEquals(2, mActivity.getTabModelSelector().getTotalTabCount()); } - private void finishActivityCompletely() throws InterruptedException, TimeoutException { + private void finishActivityCompletely() throws TimeoutException { final CallbackHelper activityCallback = new CallbackHelper(); ApplicationStatus.ActivityStateListener stateListener = new ApplicationStatus.ActivityStateListener() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java index 7127f74..47f5361 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java
@@ -48,13 +48,12 @@ /** * After closing all {@link Tab}s, the {@link LocationBarModel} should know that it is not * showing any {@link Tab}. - * @throws InterruptedException */ @Test @Feature({"Android-Toolbar"}) @MediumTest @RetryOnFailure - public void testClosingLastTabReflectedInModel() throws InterruptedException { + public void testClosingLastTabReflectedInModel() { Assert.assertNotSame("No current tab", Tab.INVALID_TAB_ID, getCurrentTabId(mActivityTestRule.getActivity())); ChromeTabUtils.closeCurrentTab( @@ -67,7 +66,7 @@ @Test @SmallTest - public void testDisplayAndEditText() throws Exception { + public void testDisplayAndEditText() { TestThreadUtils.runOnUiThreadBlocking(() -> { TestLocationBarModel model = new TestLocationBarModel(); model.mUrl = UrlConstants.NTP_URL;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java index 38e3e5bd..fdf8f66 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java
@@ -48,7 +48,7 @@ private ToolbarProgressBar mProgressBar; @Before - public void setUp() throws InterruptedException, TimeoutException { + public void setUp() throws InterruptedException { mActivityTestRule.startMainActivityOnBlankPage(); mProgressBar = mActivityTestRule.getActivity().getToolbarManager().getToolbar().getProgressBar(); @@ -63,7 +63,7 @@ @Test @Feature({"Android-Progress-Bar"}) @MediumTest - public void testProgressBarTraversesScreenOnce() throws InterruptedException, TimeoutException { + public void testProgressBarTraversesScreenOnce() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarTest.java index 19825b8e..aa6b607 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarTest.java
@@ -106,8 +106,7 @@ @Test @Feature({"Android-Progress-Bar"}) @SmallTest - public void testProgressBarCompletion_indeterminateAnimation() - throws InterruptedException, TimeoutException { + public void testProgressBarCompletion_indeterminateAnimation() throws TimeoutException { Animator progressAnimator = mProgressBar.getIndeterminateAnimatorForTesting(); int currentVisibilityCallCount = mProgressVisibilityHelper.getCallCount(); @@ -160,8 +159,7 @@ @Test @Feature({"Android-Progress-Bar"}) @SmallTest - public void testProgressBarCompletion_noAnimation() - throws InterruptedException, TimeoutException { + public void testProgressBarCompletion_noAnimation() throws TimeoutException { int currentVisibilityCallCount = mProgressVisibilityHelper.getCallCount(); int currentProgressCallCount = mProgressUpdateHelper.getCallCount(); @@ -202,8 +200,7 @@ @Test @Feature({"Android-Progress-Bar"}) @SmallTest - public void testProgressBarCompletion_indeterminateAnimation_noDelay() - throws InterruptedException, TimeoutException { + public void testProgressBarCompletion_indeterminateAnimation_noDelay() throws TimeoutException { Animator progressAnimator = mProgressBar.getIndeterminateAnimatorForTesting(); int currentVisibilityCallCount = mProgressVisibilityHelper.getCallCount(); @@ -245,8 +242,7 @@ @Test @Feature({"Android-Progress-Bar"}) @SmallTest - public void testProgressBarReset_indeterminateAnimation() - throws InterruptedException, TimeoutException { + public void testProgressBarReset_indeterminateAnimation() throws TimeoutException { Animator progressAnimator = mProgressBar.getIndeterminateAnimatorForTesting(); int currentVisibilityCallCount = mProgressVisibilityHelper.getCallCount();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java index 105442a..e476989 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java
@@ -81,7 +81,7 @@ @Test @MediumTest - public void testNTPNavigatesToErrorPageOnDisconnectedNetwork() throws Exception { + public void testNTPNavigatesToErrorPageOnDisconnectedNetwork() { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); String testUrl = testServer.getURL(TEST_PAGE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java index 163969b..432b979 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java
@@ -105,7 +105,7 @@ } } - protected void startMainActivityWithURL(String url) throws InterruptedException { + protected void startMainActivityWithURL(String url) { mActivityTestRule.startMainActivityWithURL(url); mToolbar = (ToolbarPhone) mActivityTestRule.getActivity().findViewById(R.id.toolbar); mToolbarDataProvider = mToolbar.getToolbarDataProvider(); @@ -123,7 +123,7 @@ @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Omnibox"}) - public void testNoBrandColor() throws InterruptedException { + public void testNoBrandColor() { startMainActivityWithURL(getUrlWithBrandColor("")); checkForBrandColor(mDefaultColor); } @@ -135,7 +135,7 @@ @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Omnibox"}) - public void testBrandColorNoAlpha() throws InterruptedException { + public void testBrandColorNoAlpha() { startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1)); checkForBrandColor(Color.parseColor(BRAND_COLOR_1)); } @@ -147,7 +147,7 @@ @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Omnibox"}) - public void testImmediateColorChange() throws InterruptedException { + public void testImmediateColorChange() { startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1)); checkForBrandColor(Color.parseColor(BRAND_COLOR_1)); @@ -168,7 +168,7 @@ @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Omnibox"}) - public void testBrandColorWithLoadStarted() throws InterruptedException { + public void testBrandColorWithLoadStarted() { startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1)); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -187,7 +187,7 @@ @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Omnibox"}) - public void testNavigatingToNewBrandColor() throws InterruptedException { + public void testNavigatingToNewBrandColor() { startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1)); checkForBrandColor(Color.parseColor(BRAND_COLOR_1)); mActivityTestRule.loadUrl(getUrlWithBrandColor(BRAND_COLOR_2)); @@ -202,7 +202,7 @@ @SmallTest @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Feature({"Omnibox"}) - public void testNavigatingToBrandColorAndBack() throws InterruptedException { + public void testNavigatingToBrandColorAndBack() { startMainActivityWithURL("about:blank"); checkForBrandColor(mDefaultColor); mActivityTestRule.loadUrl(getUrlWithBrandColor(BRAND_COLOR_1)); @@ -227,7 +227,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @DisableInTabbedMode @Feature({"Omnibox"}) - public void testBrandColorInterstitial() throws InterruptedException { + public void testBrandColorInterstitial() { final String brandColorUrl = getUrlWithBrandColor(BRAND_COLOR_1); startMainActivityWithURL(brandColorUrl); checkForBrandColor(Color.parseColor(BRAND_COLOR_1));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java index fdbe0cb5..d11c23d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java
@@ -62,7 +62,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @@ -73,7 +73,7 @@ @MediumTest @Feature({"Browser", "Main"}) @Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) - public void testTranslateCompactInfoBarAppears() throws InterruptedException, TimeoutException { + public void testTranslateCompactInfoBarAppears() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE)); mListener.addInfoBarAnimationFinished("InfoBar not opened."); InfoBar infoBar = mInfoBarContainer.getInfoBarsForTesting().get(0); @@ -88,8 +88,7 @@ @MediumTest @Feature({"Browser", "Main"}) @Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) - public void testTranslateCompactInfoBarOverflowMenus() - throws InterruptedException, TimeoutException { + public void testTranslateCompactInfoBarOverflowMenus() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE)); mListener.addInfoBarAnimationFinished("InfoBar not opened."); TranslateCompactInfoBar infoBar = @@ -140,8 +139,7 @@ @MediumTest @Feature({"Browser", "Main"}) @Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) - public void testTranslateCompactInfoBarReopenOnTarget() - throws InterruptedException, TimeoutException { + public void testTranslateCompactInfoBarReopenOnTarget() throws TimeoutException { mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE)); mListener.addInfoBarAnimationFinished("InfoBar not opened.");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateOptionsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateOptionsTest.java index 1f792673..89d6f7a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateOptionsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateOptionsTest.java
@@ -26,7 +26,7 @@ private static final int[] UMA_HASH_CODES = {10, 20, 30}; @Before - public void setUp() throws Exception {} + public void setUp() {} @Test @SmallTest
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/usage_stats/TabSuspensionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/usage_stats/TabSuspensionTest.java index 6aad6720..dbf927ea 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/usage_stats/TabSuspensionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/usage_stats/TabSuspensionTest.java
@@ -112,13 +112,13 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTestServer.stopAndDestroyServer(); } @Test @MediumTest - public void testNavigateToSuspended() throws InterruptedException { + public void testNavigateToSuspended() { doReturn(true).when(mSuspensionTracker).isWebsiteSuspended(STARTING_FQDN); startLoadingUrl(mTab, mStartingUrl); waitForSuspendedTabToShow(mTab, STARTING_FQDN); @@ -130,7 +130,7 @@ @Test @MediumTest - public void testNavigateToSuspendedDomain_differentPage() throws InterruptedException { + public void testNavigateToSuspendedDomain_differentPage() { doReturn(true).when(mSuspensionTracker).isWebsiteSuspended(STARTING_FQDN); startLoadingUrl(mTab, mStartingUrl); waitForSuspendedTabToShow(mTab, STARTING_FQDN); @@ -141,7 +141,7 @@ @Test @MediumTest - public void testNewTabSuspended() throws InterruptedException { + public void testNewTabSuspended() { mActivityTestRule.loadUrl(mStartingUrl); doReturn(true).when(mSuspensionTracker).isWebsiteSuspended(DIFFERENT_FQDN); @@ -157,7 +157,7 @@ @Test @MediumTest - public void testTabSwitchBackToSuspended() throws InterruptedException { + public void testTabSwitchBackToSuspended() { mActivityTestRule.loadUrl(mStartingUrl); final int originalTabIndex = mActivity.getTabModelSelector().getCurrentModel().indexOf(mTab); @@ -173,7 +173,7 @@ @Test @MediumTest - public void testEagerSuspension() throws InterruptedException { + public void testEagerSuspension() { mActivityTestRule.loadUrl(mStartingUrl); suspendDomain(STARTING_FQDN); waitForSuspendedTabToShow(mTab, STARTING_FQDN); @@ -189,7 +189,7 @@ @Test @MediumTest - public void testMediaSuspension() throws InterruptedException, TimeoutException { + public void testMediaSuspension() throws TimeoutException { mActivityTestRule.loadUrl( mTestServer.getURLWithHostName(STARTING_FQDN, MEDIA_FILE_TEST_PATH)); assertTrue(DOMUtils.isMediaPaused(mTab.getWebContents(), VIDEO_ID)); @@ -217,7 +217,7 @@ @Test @MediumTest - public void testMultiWindow() throws InterruptedException { + public void testMultiWindow() { mActivityTestRule.loadUrl(mStartingUrl); Tab tab2 = mActivityTestRule.loadUrlInNewTab(mDifferentUrl); suspendDomain(DIFFERENT_FQDN); @@ -250,7 +250,7 @@ @Test @MediumTest - public void testTabAddedFromCustomTab() throws InterruptedException { + public void testTabAddedFromCustomTab() { mCustomTabActivityTestRule.startCustomTabActivityWithIntent( CustomTabsTestUtils.createMinimalCustomTabIntent( InstrumentationRegistry.getTargetContext(), mStartingUrl)); @@ -264,7 +264,7 @@ @Test @MediumTest - public void testTabAddedInBackground() throws InterruptedException, ExecutionException { + public void testTabAddedInBackground() throws ExecutionException { Tab bgTab = TestThreadUtils.runOnUiThreadBlocking(() -> { return mActivity.getCurrentTabCreator().createNewTab( new LoadUrlParams(mStartingUrl), TabLaunchType.FROM_LONGPRESS_BACKGROUND, mTab); @@ -277,7 +277,7 @@ @Test @MediumTest - public void testTabUnsuspendedInBackground() throws InterruptedException { + public void testTabUnsuspendedInBackground() { doReturn(true).when(mSuspensionTracker).isWebsiteSuspended(STARTING_FQDN); mActivityTestRule.loadUrl(mStartingUrl); waitForSuspendedTabToShow(mTab, STARTING_FQDN); @@ -297,7 +297,7 @@ @Test @MediumTest - public void testNavigationFromSuspendedTabToInterstitial() throws InterruptedException { + public void testNavigationFromSuspendedTabToInterstitial() { doReturn(true).when(mSuspensionTracker).isWebsiteSuspended(STARTING_FQDN); mActivityTestRule.loadUrl(mStartingUrl); waitForSuspendedTabToShow(mTab, STARTING_FQDN); @@ -313,7 +313,7 @@ @Test @MediumTest - public void testRendererCrashOnSuspendedTab() throws InterruptedException { + public void testRendererCrashOnSuspendedTab() { doReturn(true).when(mSuspensionTracker).isWebsiteSuspended(STARTING_FQDN); mActivityTestRule.loadUrl(mStartingUrl); waitForSuspendedTabToShow(mTab, STARTING_FQDN); @@ -356,7 +356,7 @@ () -> { mPageViewObserver.notifySiteSuspensionChanged(domain, false); }); } - private void waitForSuspendedTabToShow(Tab tab, String fqdn) throws InterruptedException { + private void waitForSuspendedTabToShow(Tab tab, String fqdn) { CriteriaHelper.pollUiThread(() -> { return SuspendedTab.from(tab).isShowing(); }, "Suspended tab should be showing", 10000, 50);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java index 3c3a117f..6db5c0b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java
@@ -22,7 +22,7 @@ public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.loadNativeLibraryNoBrowserProcess(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java index 65e2651..db8eedd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java
@@ -77,7 +77,7 @@ */ @Test @FlakyTest(message = "crbug.com/458368") - public void testExitFullscreenNotifiesTabObservers() throws InterruptedException { + public void testExitFullscreenNotifiesTabObservers() { String url = mTestServerRule.getServer().getURL( "/chrome/test/data/android/media/video-fullscreen.html"); mActivityTestRule.loadUrl(url); @@ -102,7 +102,7 @@ */ @Test @MediumTest - public void testFullscreenDimensions() throws InterruptedException, TimeoutException { + public void testFullscreenDimensions() throws TimeoutException { String url = mTestServerRule.getServer().getURL("/content/test/data/media/video-player.html"); String video = "video";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java index 33a6fce..fb11094db 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java
@@ -43,7 +43,7 @@ @Feature({"Media", "Media-Video", "Main"}) @LargeTest @RetryOnFailure - public void testLoadMediaUrl() throws InterruptedException, TimeoutException { + public void testLoadMediaUrl() throws TimeoutException { EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); try {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserCompositorViewHolderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserCompositorViewHolderTest.java index 75a1363..bb5d3da 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserCompositorViewHolderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserCompositorViewHolderTest.java
@@ -27,7 +27,6 @@ import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; /** @@ -46,13 +45,10 @@ /** * Verify that resizing the CompositorViewHolder does not cause the current tab to resize while * the CompositorViewHolder is detached from the TabModelSelector. See crbug.com/680240. - * @throws InterruptedException - * @throws TimeoutException */ @Test @MediumTest - public void testResizeWithCompositorViewHolderDetached() - throws InterruptedException, TimeoutException { + public void testResizeWithCompositorViewHolderDetached() { final AtomicInteger oldWidth = new AtomicInteger(); final AtomicInteger oldHeight = new AtomicInteger(); final int testWidth = 123;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserControllerInputTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserControllerInputTest.java index 04c73e7a..35c3fc5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserControllerInputTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserControllerInputTest.java
@@ -59,7 +59,7 @@ private VrBrowserTestFramework mVrBrowserTestFramework; @Before - public void setUp() throws Exception { + public void setUp() { // Ensure that all frame updates are delivered to the browser so we can monitor for // scroll changes. WebContentsUtils.reportAllFrameSubmissions(mVrTestRule.getWebContents(), true); @@ -323,7 +323,7 @@ */ @Test @MediumTest - public void testControllerClicksRegisterOnWebpage() throws InterruptedException { + public void testControllerClicksRegisterOnWebpage() { mVrTestRule.loadUrl(VrBrowserTestFramework.getFileUrlForHtmlTestFile( "test_controller_clicks_register_on_webpage"), PAGE_LOAD_TIMEOUT_S); @@ -341,7 +341,7 @@ */ @Test @MediumTest - public void testControllerClicksRegisterOnIframe() throws InterruptedException { + public void testControllerClicksRegisterOnIframe() { mVrTestRule.loadUrl( VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_iframe_clicks_outer")); NativeUiUtils.clickElement(UserFriendlyElementName.CONTENT_QUAD, new PointF()); @@ -411,7 +411,7 @@ */ @Test @MediumTest - public void testAppButtonExitsFullscreen() throws InterruptedException, TimeoutException { + public void testAppButtonExitsFullscreen() throws TimeoutException { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_navigation_2d_page"), PAGE_LOAD_TIMEOUT_S); @@ -429,7 +429,7 @@ try { return !DOMUtils.isFullscreen( mVrBrowserTestFramework.getCurrentWebContents()); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } }, @@ -444,7 +444,7 @@ */ @Test @MediumTest - public void testDragRefresh() throws InterruptedException, TimeoutException { + public void testDragRefresh() { mVrTestRule.loadUrl( VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_controller_scrolling"), PAGE_LOAD_TIMEOUT_S);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserDialogTest.java index 16e169d89..8c622766 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserDialogTest.java
@@ -37,7 +37,6 @@ import org.chromium.content_public.browser.UiThreadTaskTraits; import java.io.IOException; -import java.util.concurrent.TimeoutException; /** * End-to-End test for capturing and comparing screen images for VR Browsering Dialogs @@ -64,7 +63,7 @@ private VrBrowserTestFramework mVrBrowserTestFramework; @Before - public void setUp() throws Exception { + public void setUp() { mVrBrowserTestFramework = new VrBrowserTestFramework(mVrTestRule); mVrTestRule.getEmbeddedTestServerRule().setServerPort(SERVER_PORT); @@ -77,7 +76,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { clearNotificationChannel(); } @@ -91,8 +90,7 @@ } } - private void navigateAndDisplayPermissionPrompt(String page, final String promptCommand) - throws InterruptedException, TimeoutException { + private void navigateAndDisplayPermissionPrompt(String page, final String promptCommand) { // Trying to grant permissions on file:// URLs ends up hitting DCHECKS, so load from a local // server instead. mVrBrowserTestFramework.loadUrlAndAwaitInitialization( @@ -115,7 +113,7 @@ } private void permissionPromptTestImpl(String promptSnippet, String nameBase, int indicatorName, - final boolean grant) throws InterruptedException, TimeoutException, IOException { + final boolean grant) throws InterruptedException, IOException { // Display the requested permission. navigateAndDisplayPermissionPrompt("2d_permission_page", promptSnippet); // Capture an image with the permission prompt displayed @@ -168,8 +166,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testMicrophonePermissionPrompt() - throws InterruptedException, TimeoutException, IOException { + public void testMicrophonePermissionPrompt() throws InterruptedException, IOException { testMicrophonePermissionPromptImpl(false, false); } @@ -179,15 +176,14 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testMicrophonePermissionPromptIncognito() - throws InterruptedException, TimeoutException, IOException { + public void testMicrophonePermissionPromptIncognito() throws InterruptedException, IOException { // Create an incognito tab mVrBrowserTestFramework.openIncognitoTab("about:blank"); testMicrophonePermissionPromptImpl(true, false); } private void testMicrophonePermissionPromptImpl(boolean incognito, boolean reposition) - throws InterruptedException, TimeoutException, IOException { + throws InterruptedException, IOException { permissionPromptTestImpl("navigator.getUserMedia({audio: true}, onGranted, onDenied)", "microphone_permission_prompt" + (incognito ? "_incognito" : "") + (reposition ? "_reposition" : ""), @@ -210,7 +206,7 @@ @LargeTest @Feature({"Browser", "RenderTest"}) public void testMicrophonePermissionPromptRepositionResize() - throws InterruptedException, TimeoutException, IOException { + throws InterruptedException, IOException { VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); // Move the content quad a bit up and to the right and make it smaller. NativeUiUtils.selectRepositionBar(); @@ -234,8 +230,7 @@ @LargeTest @Feature({"Browser", "RenderTest"}) @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testCameraPermissionPrompt() - throws InterruptedException, TimeoutException, IOException { + public void testCameraPermissionPrompt() throws InterruptedException, IOException { permissionPromptTestImpl("navigator.getUserMedia({video: true}, onGranted, onDenied)", "camera_permission_prompt", UserFriendlyElementName.CAMERA_PERMISSION_INDICATOR, true /* grant */); @@ -247,8 +242,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testLocationPermissionPrompt() - throws InterruptedException, TimeoutException, IOException { + public void testLocationPermissionPrompt() throws InterruptedException, IOException { permissionPromptTestImpl("navigator.geolocation.watchPosition(onGranted, onDenied, " + "{enableHighAccuracy:true})", "location_permission_prompt", UserFriendlyElementName.LOCATION_PERMISSION_INDICATOR, @@ -261,8 +255,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testNotificationPermissionPrompt() - throws InterruptedException, TimeoutException, IOException { + public void testNotificationPermissionPrompt() throws InterruptedException, IOException { permissionPromptTestImpl("Notification.requestPermission(onGranted, onDenied)", "notification_permission_prompt", UserFriendlyElementName.NONE, true /* grant */); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNativeUiTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNativeUiTest.java index 46b7adc5..81f90e7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNativeUiTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNativeUiTest.java
@@ -69,7 +69,7 @@ VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_navigation_2d_page"); @Before - public void setUp() throws Exception { + public void setUp() { mVrBrowserTestFramework = new VrBrowserTestFramework(mVrTestRule); VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); } @@ -79,8 +79,7 @@ */ @Test @MediumTest - public void testUrlOnNativeUi() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testUrlOnNativeUi() throws IllegalArgumentException { for (String url : NATIVE_URLS_OF_INTEREST) { mVrTestRule.loadUrl(url, PAGE_LOAD_TIMEOUT_S); Assert.assertFalse("URL is being shown for native page " + url, @@ -93,8 +92,7 @@ */ @Test @MediumTest - public void testUrlOnNonNativeUi() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testUrlOnNonNativeUi() throws IllegalArgumentException { mVrTestRule.loadUrl(TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); Assert.assertTrue("URL is not being show for non-native page", TestVrShellDelegate.isDisplayingUrlForTesting()); @@ -106,7 +104,7 @@ */ @Test @MediumTest - public void testPaymentRequest() throws InterruptedException { + public void testPaymentRequest() { // We can't request payment on file:// URLs, so use a local server. mVrBrowserTestFramework.loadUrlAndAwaitInitialization( mVrBrowserTestFramework.getEmbeddedServerUrlForHtmlTestFile("test_payment_request"), @@ -307,8 +305,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testKeyboardAppearsOnUrlBarClick() - throws InterruptedException, TimeoutException, IOException { + public void testKeyboardAppearsOnUrlBarClick() throws InterruptedException, IOException { NativeUiUtils.clickElementAndWaitForUiQuiescence(UserFriendlyElementName.URL, new PointF()); // For whatever reason, the laser has a lot of random noise (not visible to an actual user) // when the keyboard is present on certain OS/hardware configurations (currently known to @@ -336,8 +333,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testOverflowMenuAppears() - throws InterruptedException, TimeoutException, IOException { + public void testOverflowMenuAppears() throws InterruptedException, IOException { // TODO(https://crbug.com/930840): Remove this when the weird gradient behavior is fixed. mRenderTestRule.setPixelDiffThreshold(2); NativeUiUtils.clickElementAndWaitForUiQuiescence( @@ -407,7 +403,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testUrlBarHovering() throws InterruptedException, TimeoutException, IOException { + public void testUrlBarHovering() throws InterruptedException, IOException { testUrlBarHoveringImpl(false); } @@ -418,14 +414,13 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testUrlBarHoveringIncognito() - throws InterruptedException, TimeoutException, IOException { + public void testUrlBarHoveringIncognito() throws InterruptedException, IOException { mVrBrowserTestFramework.openIncognitoTab("about:blank"); testUrlBarHoveringImpl(true); } private void testUrlBarHoveringImpl(boolean incognito) - throws InterruptedException, TimeoutException, IOException { + throws InterruptedException, IOException { // Back button hovering doesn't do anything unless the back button is actually active. so // navigate to do that. mVrTestRule.loadUrl("chrome://version/", PAGE_LOAD_TIMEOUT_S); @@ -457,8 +452,7 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testOverflowMenuHovering() - throws InterruptedException, TimeoutException, IOException { + public void testOverflowMenuHovering() throws InterruptedException, IOException { testOverflowMenuHoveringImpl(false); } @@ -469,14 +463,13 @@ @Test @LargeTest @Feature({"Browser", "RenderTest"}) - public void testOverflowMenuHoveringIncognito() - throws InterruptedException, TimeoutException, IOException { + public void testOverflowMenuHoveringIncognito() throws InterruptedException, IOException { mVrBrowserTestFramework.openIncognitoTab("about:blank"); testOverflowMenuHoveringImpl(true); } private void testOverflowMenuHoveringImpl(boolean incognito) - throws InterruptedException, TimeoutException, IOException { + throws InterruptedException, IOException { // TODO(https://crbug.com/930840): Remove this when the weird gradient behavior is fixed. mRenderTestRule.setPixelDiffThreshold(2); // The forward button only has a hover state if the button is actually active, so navigate @@ -527,8 +520,7 @@ @Test @MediumTest @Feature({"Browser", "RenderTest"}) - public void testSuggestionHovering() - throws InterruptedException, TimeoutException, IOException { + public void testSuggestionHovering() throws InterruptedException, IOException { // Input some text to get suggestions. NativeUiUtils.enableMockedKeyboard(); NativeUiUtils.clickElementAndWaitForUiQuiescence(UserFriendlyElementName.URL, new PointF()); @@ -602,7 +594,7 @@ @Test @MediumTest @Feature({"Browser", "RenderTest"}) - public void testScrollResizing() throws InterruptedException, TimeoutException, IOException { + public void testScrollResizing() throws InterruptedException, IOException { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( VrBrowserTestFramework.getFileUrlForHtmlTestFile( "test_content_resizing_does_not_affect_webpage"), @@ -653,8 +645,7 @@ @Test @MediumTest @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testRAFsFireWhileRepositioning() - throws InterruptedException, TimeoutException, IOException { + public void testRAFsFireWhileRepositioning() { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( VrBrowserTestFramework.getFileUrlForHtmlTestFile( "test_rafs_fire_while_repositioning"), @@ -671,7 +662,7 @@ @MediumTest @Feature({"Browser", "RenderTest"}) public void testRepositionBarDoesNotAppearWithPermissionPromptVisible() - throws InterruptedException, TimeoutException, IOException { + throws InterruptedException, IOException { // We don't need to actually accept the prompt, so we don't need to use the local server. mVrBrowserTestFramework.loadUrlAndAwaitInitialization( VrBrowserTestFramework.getFileUrlForHtmlTestFile("2d_permission_page"),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNavigationTest.java index 39602a8..76fff67d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserNavigationTest.java
@@ -111,7 +111,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); mVrBrowserTestFramework = new VrBrowserTestFramework(mTestRule); @@ -138,7 +138,7 @@ * {@link ChromeActivityTestRule#loadUrl loadUrl} but makes sure page initiates the * navigation. This is desirable since we are testing navigation transitions end-to-end. */ - private void navigateTo(final @Page int to) throws InterruptedException { + private void navigateTo(final @Page int to) { ChromeTabUtils.waitForTabPageLoaded( mTestRule.getActivity().getActivityTab(), getUrl(to), () -> { mVrBrowserTestFramework.runJavaScriptOrFail( @@ -146,15 +146,14 @@ }, POLL_TIMEOUT_LONG_MS); } - private void enterFullscreenOrFail(WebContents webContents) - throws InterruptedException, TimeoutException { + private void enterFullscreenOrFail(WebContents webContents) throws TimeoutException { DOMUtils.clickNode(webContents, "fullscreen", false /* goThroughRootAndroidView */); VrBrowserTestFramework.waitOnJavaScriptStep(webContents); Assert.assertTrue("Failed to enter fullscreen", DOMUtils.isFullscreen(webContents)); } private void assertState(WebContents wc, @Page int page, @PresentationMode int presentationMode, - @FullscreenMode int fullscreenMode) throws InterruptedException, TimeoutException { + @FullscreenMode int fullscreenMode) throws TimeoutException { Assert.assertTrue("Browser is not in VR", VrShellDelegate.isInVr()); Assert.assertEquals("Browser is not on correct web site", getUrl(page), wc.getVisibleUrl()); Assert.assertEquals("Browser's presentation mode does not match expectation", @@ -172,7 +171,7 @@ */ @Test @MediumTest - public void test2dTo2d() throws InterruptedException, TimeoutException { + public void test2dTo2d() throws TimeoutException { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); @@ -209,8 +208,7 @@ */ @Test @MediumTest - public void test2dToWebVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void test2dToWebVr() throws IllegalArgumentException, TimeoutException { impl2dToWeb(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -222,13 +220,12 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void test2dToWebXr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void test2dToWebXr() throws IllegalArgumentException, TimeoutException { impl2dToWeb(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void impl2dToWeb(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); navigateTo(page); @@ -242,8 +239,7 @@ */ @Test @MediumTest - public void test2dFullscreenToWebVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void test2dFullscreenToWebVr() throws IllegalArgumentException, TimeoutException { impl2dFullscreenToWeb(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -256,12 +252,12 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) public void test2dFullscreenToWebXr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { impl2dFullscreenToWeb(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void impl2dFullscreenToWeb(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); enterFullscreenOrFail(framework.getCurrentWebContents()); @@ -276,8 +272,7 @@ */ @Test @MediumTest - public void testWebVrTo2d() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebVrTo2d() throws IllegalArgumentException, TimeoutException { webTo2dImpl(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -289,13 +284,12 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testWebXrTo2d() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebXrTo2d() throws IllegalArgumentException, TimeoutException { webTo2dImpl(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void webTo2dImpl(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(getUrl(page), PAGE_LOAD_TIMEOUT_S); navigateTo(Page.PAGE_2D); @@ -309,8 +303,7 @@ */ @Test @MediumTest - public void testWebVrToWebVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebVrToWebVr() throws IllegalArgumentException, TimeoutException { webToWebImpl(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -322,13 +315,12 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testWebXrToWebXr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebXrToWebXr() throws IllegalArgumentException, TimeoutException { webToWebImpl(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void webToWebImpl(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(getUrl(page), PAGE_LOAD_TIMEOUT_S); navigateTo(page); @@ -342,8 +334,7 @@ */ @Test @MediumTest - public void testWebVrPresentingTo2d() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebVrPresentingTo2d() throws IllegalArgumentException, TimeoutException { webPresentingTo2dImpl(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -356,12 +347,12 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) public void testWebXrPresentingTo2d() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { webPresentingTo2dImpl(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void webPresentingTo2dImpl(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(getUrl(page), PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); @@ -376,8 +367,7 @@ */ @Test @MediumTest - public void testWebVrPresentingToWebVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebVrPresentingToWebVr() throws IllegalArgumentException, TimeoutException { webPresentingToWebImpl(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -390,12 +380,12 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) public void testWebXrPresentingToWebXr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { webPresentingToWebImpl(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void webPresentingToWebImpl(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(getUrl(page), PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); @@ -410,8 +400,7 @@ */ @Test @MediumTest - public void testWebVrFullscreenTo2d() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebVrFullscreenTo2d() throws IllegalArgumentException, TimeoutException { webFullscreenTo2dImpl(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -424,12 +413,12 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) public void testWebXrFullscreenTo2d() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { webFullscreenTo2dImpl(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void webFullscreenTo2dImpl(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(getUrl(page), PAGE_LOAD_TIMEOUT_S); enterFullscreenOrFail(framework.getCurrentWebContents()); @@ -444,8 +433,7 @@ */ @Test @MediumTest - public void testWebVrFullscreenToWebVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testWebVrFullscreenToWebVr() throws IllegalArgumentException, TimeoutException { webFullscreenToWebImpl(Page.PAGE_WEBVR, mWebVrTestFramework); } @@ -458,12 +446,12 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) public void testWebXrFullscreenToWebXr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { webFullscreenToWebImpl(Page.PAGE_WEBXR, mWebXrVrTestFramework); } private void webFullscreenToWebImpl(@Page int page, WebXrVrTestFramework framework) - throws InterruptedException, TimeoutException { + throws TimeoutException { framework.loadUrlAndAwaitInitialization(getUrl(page), PAGE_LOAD_TIMEOUT_S); enterFullscreenOrFail(framework.getCurrentWebContents()); @@ -479,8 +467,7 @@ */ @Test @MediumTest - public void testBackDoesntBackgroundChrome() - throws IllegalArgumentException, InterruptedException { + public void testBackDoesntBackgroundChrome() throws IllegalArgumentException { Assert.assertFalse( "Back button is enabled.", VrBrowserTransitionUtils.isBackButtonEnabled()); mTestRule.loadUrlInNewTab(getUrl(Page.PAGE_2D), false, TabLaunchType.FROM_CHROME_UI); @@ -612,8 +599,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testNativeNavigationAndInteraction() - throws IllegalArgumentException, InterruptedException { + public void testNativeNavigationAndInteraction() throws IllegalArgumentException { for (String url : NATIVE_URLS_OF_INTEREST) { mTestRule.loadUrl(TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); mTestRule.loadUrl(url, PAGE_LOAD_TIMEOUT_S); @@ -629,7 +615,7 @@ @Test @MediumTest public void testRendererKilledInFullscreenStaysInVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + throws IllegalArgumentException, TimeoutException { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); enterFullscreenOrFail(mVrBrowserTestFramework.getCurrentWebContents()); @@ -654,8 +640,7 @@ */ @Test @MediumTest - public void testIncognitoMaintainsSeparateHistoryStack() - throws InterruptedException, TimeoutException { + public void testIncognitoMaintainsSeparateHistoryStack() throws InterruptedException { // Test non-Incognito's forward/back. mTestRule.loadUrl(TEST_PAGE_2D_URL); mTestRule.loadUrl(TEST_PAGE_2D_2_URL); @@ -714,8 +699,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testNewTabAutomaticallyOpenedWhenIncognitoClosed() - throws InterruptedException, TimeoutException { + public void testNewTabAutomaticallyOpenedWhenIncognitoClosed() throws InterruptedException { VrBrowserTransitionUtils.forceExitVr(); TestThreadUtils.runOnUiThreadBlocking(() -> { // Close the tab that's automatically open at test start.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserTransitionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserTransitionTest.java index ece2672..3fcd473 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserTransitionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserTransitionTest.java
@@ -76,7 +76,7 @@ private VrBrowserTestFramework mVrBrowserTestFramework; @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); mVrBrowserTestFramework = new VrBrowserTestFramework(mTestRule); @@ -207,8 +207,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testExitFullscreenAfterExitingVrFromCinemaMode() - throws InterruptedException, TimeoutException { + public void testExitFullscreenAfterExitingVrFromCinemaMode() throws TimeoutException { VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); mVrBrowserTestFramework.loadUrlAndAwaitInitialization( VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_navigation_2d_page"), @@ -228,7 +227,7 @@ try { return !DOMUtils.isFullscreen( mVrBrowserTestFramework.getCurrentWebContents()); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } }, @@ -245,8 +244,7 @@ @CommandLineFlags.Add("enable-webvr") @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) @MediumTest - public void testExitPresentationWebVrToVrShell() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testExitPresentationWebVrToVrShell() throws IllegalArgumentException { exitPresentationToVrShellImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("test_navigation_webvr_page"), mWebVrTestFramework); @@ -260,15 +258,13 @@ @CommandLineFlags.Add("enable-features=WebXR") @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) @MediumTest - public void testExitPresentationWebXrToVrShell() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testExitPresentationWebXrToVrShell() throws IllegalArgumentException { exitPresentationToVrShellImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_navigation_webxr_page"), mWebXrVrTestFramework); } - private void exitPresentationToVrShellImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void exitPresentationToVrShellImpl(String url, WebXrVrTestFramework framework) { VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); VrShell vrShell = TestVrShellDelegate.getVrShellForTesting(); @@ -297,7 +293,7 @@ @CommandLineFlags.Add("enable-webvr") @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) @MediumTest - public void testWebVrReEntryFromVrBrowser() throws InterruptedException, TimeoutException { + public void testWebVrReEntryFromVrBrowser() { reEntryFromVrBrowserImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("test_webvr_reentry_from_vr_browser"), mWebVrTestFramework); @@ -311,14 +307,13 @@ @CommandLineFlags.Add("enable-features=WebXR") @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) @MediumTest - public void testWebXrReEntryFromVrBrowser() throws InterruptedException, TimeoutException { + public void testWebXrReEntryFromVrBrowser() { reEntryFromVrBrowserImpl(WebXrVrTestFramework.getFileUrlForHtmlTestFile( "test_webxr_reentry_from_vr_browser"), mWebXrVrTestFramework); } - private void reEntryFromVrBrowserImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void reEntryFromVrBrowserImpl(String url, WebXrVrTestFramework framework) { VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); @@ -342,7 +337,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testEnterVrInOverviewMode() throws InterruptedException, TimeoutException { + public void testEnterVrInOverviewMode() { final ChromeTabbedActivity activity = mTestRule.getActivity(); TestThreadUtils.runOnUiThreadBlocking(() -> { ImageView tabSwitcher = (ImageView) activity.findViewById(R.id.tab_switcher_button); @@ -365,8 +360,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testStartActivityTriggersDoffChromeActivity() - throws InterruptedException, TimeoutException { + public void testStartActivityTriggersDoffChromeActivity() { testStartActivityTriggersDoffImpl(mTestRule.getActivity()); } @@ -377,13 +371,11 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testStartActivityTriggersDoffAppContext() - throws InterruptedException, TimeoutException { + public void testStartActivityTriggersDoffAppContext() { testStartActivityTriggersDoffImpl(mTestRule.getActivity().getApplicationContext()); } - private void testStartActivityTriggersDoffImpl(Context context) - throws InterruptedException, TimeoutException { + private void testStartActivityTriggersDoffImpl(Context context) { VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); MockVrDaydreamApi mockApi = new MockVrDaydreamApi(); @@ -434,7 +426,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testStartActivityIfNeeded() throws InterruptedException, TimeoutException { + public void testStartActivityIfNeeded() { Activity context = mTestRule.getActivity(); VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); @@ -453,7 +445,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @LargeTest - public void testExitVrWithPromptDisplayed() throws InterruptedException, TimeoutException { + public void testExitVrWithPromptDisplayed() { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_navigation_2d_page"), PAGE_LOAD_TIMEOUT_S); @@ -483,7 +475,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testIncognitoLearnMoreTriggersDoff() throws InterruptedException, TimeoutException { + public void testIncognitoLearnMoreTriggersDoff() { mTestRule.newIncognitoTabFromMenu(); VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); final IncognitoNewTabPage ntp = @@ -517,7 +509,7 @@ @Test @Restriction({RESTRICTION_TYPE_VIEWER_DAYDREAM}) @MediumTest - public void testVrUnsupportedWhenReprojectionFails() throws InterruptedException { + public void testVrUnsupportedWhenReprojectionFails() { AtomicBoolean failed = new AtomicBoolean(false); TestThreadUtils.runOnUiThreadBlocking(() -> { try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) { @@ -543,7 +535,7 @@ @Test @Restriction({RESTRICTION_TYPE_VIEWER_DAYDREAM}) @MediumTest - public void testPermissionsPersistWhenEnteringVrBrowser() throws InterruptedException { + public void testPermissionsPersistWhenEnteringVrBrowser() { // Permissions don't work on file:// URLs, so use a local server. mVrBrowserTestFramework.loadUrlAndAwaitInitialization( mVrBrowserTestFramework.getEmbeddedServerUrlForHtmlTestFile( @@ -583,7 +575,7 @@ @Test @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MediumTest - public void testNfcScanOnNativePage() throws InterruptedException { + public void testNfcScanOnNativePage() { // We can't loop over all the native URLs since multiple NFC entries in a short timespan // isn't possible. So, just pick the native history page as a suitable one. mTestRule.loadUrl(UrlConstants.NATIVE_HISTORY_URL, PAGE_LOAD_TIMEOUT_S);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserWebInputEditingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserWebInputEditingTest.java index 05fbe22..768a2a0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserWebInputEditingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserWebInputEditingTest.java
@@ -60,7 +60,7 @@ private VrBrowserTestFramework mVrBrowserTestFramework; @Before - public void setUp() throws Exception { + public void setUp() { mVrBrowserTestFramework = new VrBrowserTestFramework(mVrTestRule); } @@ -148,7 +148,7 @@ */ @Test @MediumTest - public void testSelectTag() throws TimeoutException, InterruptedException { + public void testSelectTag() throws TimeoutException { mVrTestRule.loadUrl(VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_select_tag"), PAGE_LOAD_TIMEOUT_S); VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrFeedbackInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrFeedbackInfoBarTest.java index 0754b96..a8cfa36 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrFeedbackInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrFeedbackInfoBarTest.java
@@ -29,8 +29,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.util.ChromeTabUtils; -import java.util.concurrent.TimeoutException; - /** * Tests for the infobar that prompts the user to enter feedback on their VR browsing experience. */ @@ -56,7 +54,7 @@ WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"); @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); mVrBrowserTestFramework = new VrBrowserTestFramework(mTestRule); @@ -82,7 +80,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testFeedbackFrequency() throws InterruptedException, TimeoutException { + public void testFeedbackFrequency() { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); // Set frequency of infobar to every 2nd time. @@ -110,7 +108,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testFeedbackOptOut() throws InterruptedException, TimeoutException { + public void testFeedbackOptOut() { mVrBrowserTestFramework.loadUrlAndAwaitInitialization( TEST_PAGE_2D_URL, PAGE_LOAD_TIMEOUT_S); @@ -136,7 +134,7 @@ */ @Test @MediumTest - public void testFeedbackOnlyOnVrBrowsing() throws InterruptedException, TimeoutException { + public void testFeedbackOnlyOnVrBrowsing() { feedbackOnlyOnVrBrowsingImpl(TEST_PAGE_WEBVR_URL, mWebVrTestFramework); } @@ -148,13 +146,11 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testFeedbackOnlyOnVrBrowsing_WebXr() - throws InterruptedException, TimeoutException { + public void testFeedbackOnlyOnVrBrowsing_WebXr() { feedbackOnlyOnVrBrowsingImpl(TEST_PAGE_WEBXR_URL, mWebXrVrTestFramework); } - private void feedbackOnlyOnVrBrowsingImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void feedbackOnlyOnVrBrowsingImpl(String url, WebXrVrTestFramework framework) { // Enter VR presentation mode. framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); @@ -174,7 +170,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testExitPresentationInVr() throws InterruptedException, TimeoutException { + public void testExitPresentationInVr() { // Enter VR presentation mode. exitPresentationInVrImpl(TEST_PAGE_WEBVR_URL, mWebVrTestFramework); } @@ -189,13 +185,11 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testExitPresentationInVr_WebXr() - throws InterruptedException, TimeoutException { + public void testExitPresentationInVr_WebXr() { exitPresentationInVrImpl(TEST_PAGE_WEBXR_URL, mWebXrVrTestFramework); } - private void exitPresentationInVrImpl(String url, final WebXrVrTestFramework framework) - throws InterruptedException { + private void exitPresentationInVrImpl(String url, final WebXrVrTestFramework framework) { // Enter VR presentation mode. framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrInstallUpdateInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrInstallUpdateInfoBarTest.java index 242c8694..e86a261 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrInstallUpdateInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrInstallUpdateInfoBarTest.java
@@ -118,7 +118,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testInfoBarNotPresentWhenVrServicesCurrent() throws InterruptedException { + public void testInfoBarNotPresentWhenVrServicesCurrent() { infoBarTestHelper(VrCoreCompatibility.VR_READY); } @@ -130,7 +130,7 @@ @XrActivityRestriction({XrActivityRestriction.SupportedActivity.CTA, XrActivityRestriction.SupportedActivity.CCT}) public void - testInfoBarPresentWhenVrServicesOutdated() throws InterruptedException { + testInfoBarPresentWhenVrServicesOutdated() { infoBarTestHelper(VrCoreCompatibility.VR_OUT_OF_DATE); } @@ -142,7 +142,7 @@ @XrActivityRestriction({XrActivityRestriction.SupportedActivity.CTA, XrActivityRestriction.SupportedActivity.CCT}) public void - testInfoBarPresentWhenVrServicesMissing() throws InterruptedException { + testInfoBarPresentWhenVrServicesMissing() { infoBarTestHelper(VrCoreCompatibility.VR_NOT_AVAILABLE); } @@ -153,7 +153,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testInfoBarNotPresentWhenVrServicesNotSupported() throws InterruptedException { + public void testInfoBarNotPresentWhenVrServicesNotSupported() { infoBarTestHelper(VrCoreCompatibility.VR_NOT_SUPPORTED); } @@ -164,7 +164,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testKeyboardInstallUpgradePromptUrlBar() throws InterruptedException { + public void testKeyboardInstallUpgradePromptUrlBar() { testKeyboardInstallUpgradeImpl(UserFriendlyElementName.URL); } @@ -175,12 +175,11 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - public void testKeyboardInstallUpgradePromptWebInput() throws InterruptedException { + public void testKeyboardInstallUpgradePromptWebInput() { testKeyboardInstallUpgradeImpl(UserFriendlyElementName.CONTENT_QUAD); } - private void testKeyboardInstallUpgradeImpl(final int uiElementToClick) - throws InterruptedException { + private void testKeyboardInstallUpgradeImpl(final int uiElementToClick) { mVrTestRule.loadUrl( VrBrowserTestFramework.getFileUrlForHtmlTestFile("test_web_input_editing"), PAGE_LOAD_TIMEOUT_S);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArSessionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArSessionTest.java index 59855ae2..9e18905 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArSessionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrArSessionTest.java
@@ -57,7 +57,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrArTestFramework = new WebXrArTestFramework(mTestRule); } @@ -67,7 +67,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testArRequestSessionSucceeds() throws InterruptedException { + public void testArRequestSessionSucceeds() { mWebXrArTestFramework.loadUrlAndAwaitInitialization( mWebXrArTestFramework.getEmbeddedServerUrlForHtmlTestFile( "test_ar_request_session_succeeds"), @@ -84,7 +84,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentPersistanceOnSamePage() throws InterruptedException { + public void testConsentPersistanceOnSamePage() { mWebXrArTestFramework.loadUrlAndAwaitInitialization( mWebXrArTestFramework.getEmbeddedServerUrlForHtmlTestFile( "test_ar_request_session_succeeds"), @@ -118,7 +118,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testRepeatedArSessionsSucceed() throws InterruptedException { + public void testRepeatedArSessionsSucceed() { mWebXrArTestFramework.loadUrlAndAwaitInitialization( mWebXrArTestFramework.getEmbeddedServerUrlForHtmlTestFile( "test_ar_request_session_succeeds"),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrTestFramework.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrTestFramework.java index 4fe094f..8cbd13c8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrTestFramework.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrTestFramework.java
@@ -55,7 +55,7 @@ public void enterSessionWithUserGesture(WebContents webContents) { try { DOMUtils.clickNode(webContents, "webgl-canvas", false /* goThroughRootAndroidView */); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { Assert.fail("Failed to click canvas to enter session: " + e.toString()); } } @@ -139,7 +139,7 @@ * * @param sessionType The session type to pass to JavaScript defined in webxr_boilerplate.js, * e.g. sessionTypes.AR - * @param webCointents The WebContents to check in. + * @param webContents The WebContents to check in. * @return True if the given session type is expected to trigger the consent dialog, otherwise * false. */
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrConsentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrConsentTest.java index 6164a69..f703937 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrConsentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrConsentTest.java
@@ -57,7 +57,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrConsentTestFramework = new WebXrVrConsentTestFramework(mTestRule); } @@ -67,7 +67,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentCancelFailsSessionCreation() throws InterruptedException { + public void testConsentCancelFailsSessionCreation() { mWebXrVrConsentTestFramework.setConsentDialogAction( WebXrVrTestFramework.CONSENT_DIALOG_ACTION_DENY); mWebXrVrConsentTestFramework.setConsentDialogExpected(true); @@ -91,7 +91,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentPersistsSameLevel() throws InterruptedException { + public void testConsentPersistsSameLevel() { mWebXrVrConsentTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), PAGE_LOAD_TIMEOUT_S); @@ -113,7 +113,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentNotNeededForInline() throws InterruptedException { + public void testConsentNotNeededForInline() { mWebXrVrConsentTestFramework.setConsentDialogExpected(false); mWebXrVrConsentTestFramework.loadUrlAndAwaitInitialization( @@ -133,7 +133,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentPersistsLowerLevel() throws InterruptedException { + public void testConsentPersistsLowerLevel() { mWebXrVrConsentTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_consent"), PAGE_LOAD_TIMEOUT_S); @@ -161,7 +161,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentRepromptsHigherLevel() throws InterruptedException { + public void testConsentRepromptsHigherLevel() { mWebXrVrConsentTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_consent"), PAGE_LOAD_TIMEOUT_S); @@ -188,7 +188,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentRepromptsAfterReload() throws InterruptedException { + public void testConsentRepromptsAfterReload() { mWebXrVrConsentTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), PAGE_LOAD_TIMEOUT_S);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrDeviceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrDeviceTest.java index 6fd7374..c1bd9151 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrDeviceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrDeviceTest.java
@@ -64,7 +64,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); } @@ -77,7 +77,7 @@ @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // WebVR is only supported on L+ - public void testDeviceCapabilitiesMatchExpectations() throws InterruptedException { + public void testDeviceCapabilitiesMatchExpectations() { mWebVrTestFramework.loadUrlAndAwaitInitialization( WebVrTestFramework.getFileUrlForHtmlTestFile( "test_device_capabilities_match_expectations"), @@ -96,7 +96,7 @@ @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) @Restriction(RESTRICTION_TYPE_SVR) // Sensorless still works on older devices since it doesn't rely on anything in the DFM. - public void testGvrlessMagicWindowCapabilities() throws InterruptedException { + public void testGvrlessMagicWindowCapabilities() { // Make Chrome think that VrCore is not installed VrShellDelegateUtils.setVrCoreCompatibility(VrCoreCompatibility.VR_NOT_AVAILABLE); @@ -121,7 +121,7 @@ @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // WebXR is only supported on L+ - public void testWebXrCapabilities() throws InterruptedException { + public void testWebXrCapabilities() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_capabilities"), PAGE_LOAD_TIMEOUT_S); @@ -144,7 +144,7 @@ @CommandLineFlags.Add({"enable-features=WebXR"}) @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // WebXR is only supported on L+ - public void testForNullPosesInInlineVrPostImmersive() throws InterruptedException { + public void testForNullPosesInInlineVrPostImmersive() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_inline_vr_poses"), PAGE_LOAD_TIMEOUT_S); @@ -182,7 +182,7 @@ @CommandLineFlags.Add({"enable-features=WebXR"}) @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // WebVR is only supported on L+ - public void testForNullPosesInInlineVrFromNfc() throws InterruptedException { + public void testForNullPosesInInlineVrFromNfc() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_inline_vr_poses"), PAGE_LOAD_TIMEOUT_S); @@ -217,7 +217,7 @@ @CommandLineFlags.Add({"enable-features=WebXR"}) @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // WebVR is only supported on L+ - public void testForNullPosesInInlineVrOnNavigation() throws InterruptedException { + public void testForNullPosesInInlineVrOnNavigation() { NfcSimUtils.simNfcScanUntilVrEntry(mTestRule.getActivity()); mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_inline_vr_poses"),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrInputTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrInputTest.java index 247f4cc..6dac1ad 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrInputTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrInputTest.java
@@ -84,7 +84,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); } @@ -165,7 +165,7 @@ @LargeTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testControllerClicksRegisteredOnDaydream() throws InterruptedException { + public void testControllerClicksRegisteredOnDaydream() { EmulatedVrController controller = new EmulatedVrController(mTestRule.getActivity()); mWebVrTestFramework.loadUrlAndAwaitInitialization( WebVrTestFramework.getFileUrlForHtmlTestFile("test_gamepad_button"), @@ -212,8 +212,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testControllerClicksRegisteredOnDaydream_WebXr() - throws InterruptedException { + public void testControllerClicksRegisteredOnDaydream_WebXr() { EmulatedVrController controller = new EmulatedVrController(mTestRule.getActivity()); mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_input"), @@ -249,8 +248,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testControllerExposedAsGamepadOnDaydream_WebXr() - throws InterruptedException { + public void testControllerExposedAsGamepadOnDaydream_WebXr() { EmulatedVrController controller = new EmulatedVrController(mTestRule.getActivity()); mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_gamepad_support"), @@ -365,7 +363,7 @@ @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_NON_DAYDREAM) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testScreenTapsRegisteredOnCardboard() throws InterruptedException { + public void testScreenTapsRegisteredOnCardboard() { mWebVrTestFramework.loadUrlAndAwaitInitialization( WebVrTestFramework.getFileUrlForHtmlTestFile("test_gamepad_button"), PAGE_LOAD_TIMEOUT_S); @@ -401,7 +399,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testScreenTapsRegisteredOnCardboard_WebXr() throws InterruptedException { + public void testScreenTapsRegisteredOnCardboard_WebXr() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_input"), PAGE_LOAD_TIMEOUT_S); @@ -439,8 +437,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testTransientScreenTapsRegisteredOnCardboard_WebXr() - throws InterruptedException { + public void testTransientScreenTapsRegisteredOnCardboard_WebXr() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_transient_input"), PAGE_LOAD_TIMEOUT_S); @@ -471,7 +468,7 @@ @DisableIf. Build(message = "K/M https://crbug.com/897259", sdk_is_less_than = Build.VERSION_CODES.N) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testPresentationLocksFocus() throws InterruptedException { + public void testPresentationLocksFocus() { presentationLocksFocusImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("test_presentation_locks_focus"), mWebVrTestFramework); @@ -487,14 +484,13 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testPresentationLocksFocus_WebXr() throws InterruptedException { + public void testPresentationLocksFocus_WebXr() { presentationLocksFocusImpl(WebXrVrTestFramework.getFileUrlForHtmlTestFile( "webxr_test_presentation_locks_focus"), mWebXrVrTestFramework); } - private void presentationLocksFocusImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void presentationLocksFocusImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); framework.executeStepAndWait("stepSetupFocusLoss()"); @@ -508,7 +504,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) - public void testAppButtonExitsPresentation() throws InterruptedException { + public void testAppButtonExitsPresentation() { appButtonExitsPresentationImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("generic_webvr_page"), mWebVrTestFramework); @@ -524,14 +520,13 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testAppButtonExitsPresentation_WebXr() throws InterruptedException { + public void testAppButtonExitsPresentation_WebXr() { appButtonExitsPresentationImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), mWebXrVrTestFramework); } - private void appButtonExitsPresentationImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void appButtonExitsPresentationImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); NativeUiUtils.clickAppButton(UserFriendlyElementName.NONE, new PointF()); @@ -547,8 +542,7 @@ @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testAppButtonNoopsWhenBrowsingDisabled() - throws InterruptedException, ExecutionException { + public void testAppButtonNoopsWhenBrowsingDisabled() throws ExecutionException { appButtonNoopsTestImpl(WebVrTestFramework.getFileUrlForHtmlTestFile("generic_webvr_page"), mWebVrTestFramework); } @@ -563,7 +557,7 @@ @XrActivityRestriction({XrActivityRestriction.SupportedActivity.WAA, XrActivityRestriction.SupportedActivity.CCT}) public void - testAppButtonNoopsWhenBrowsingNotSupported() throws InterruptedException, ExecutionException { + testAppButtonNoopsWhenBrowsingNotSupported() throws ExecutionException { appButtonNoopsTestImpl(WebVrTestFramework.getFileUrlForHtmlTestFile("generic_webvr_page"), mWebVrTestFramework); } @@ -579,8 +573,7 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testAppButtonNoopsWhenBrowsingDisabled_WebXr() - throws InterruptedException, ExecutionException { + public void testAppButtonNoopsWhenBrowsingDisabled_WebXr() throws ExecutionException { appButtonNoopsTestImpl(WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), mWebXrVrTestFramework); } @@ -598,14 +591,13 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) public void - testAppButtonNoopsWhenBrowsingNotSupported_WebXr() - throws InterruptedException, ExecutionException { + testAppButtonNoopsWhenBrowsingNotSupported_WebXr() throws ExecutionException { appButtonNoopsTestImpl(WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), mWebXrVrTestFramework); } private void appButtonNoopsTestImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException, ExecutionException { + throws ExecutionException { VrShellDelegateUtils.getDelegateInstance().setVrBrowsingDisabled(true); framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); @@ -617,7 +609,7 @@ Assert.assertFalse("App button left Chrome", TestThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return mockApi.getExitFromVrCalled() || mockApi.getLaunchVrHomescreenCalled(); } @@ -635,7 +627,7 @@ @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testFocusUpdatesSynchronously() throws InterruptedException { + public void testFocusUpdatesSynchronously() { mWebVrTestFramework.loadUrlAndAwaitInitialization( WebVrTestFramework.getFileUrlForHtmlTestFile( "generic_webvr_page_with_activate_listener"), @@ -664,7 +656,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) - public void testAppButtonAfterPageStopsSubmitting() throws InterruptedException { + public void testAppButtonAfterPageStopsSubmitting() { appButtonAfterPageStopsSubmittingImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("webvr_page_submits_once"), mWebVrTestFramework); @@ -680,14 +672,13 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testAppButtonAfterPageStopsSubmitting_WebXr() throws InterruptedException { + public void testAppButtonAfterPageStopsSubmitting_WebXr() { appButtonAfterPageStopsSubmittingImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile("webxr_page_submits_once"), mWebXrVrTestFramework); } - private void appButtonAfterPageStopsSubmittingImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void appButtonAfterPageStopsSubmittingImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); // Wait for page to stop submitting frames. @@ -709,7 +700,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testWebXrInputSourceHasGamepad() throws InterruptedException { + public void testWebXrInputSourceHasGamepad() { webxrGamepadSupportImpl(true /* daydream */); } @@ -725,11 +716,11 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testWebXrInputSourceWithoutGamepad_Cardboard() throws InterruptedException { + public void testWebXrInputSourceWithoutGamepad_Cardboard() { webxrGamepadSupportImpl(false /* daydream */); } - private void webxrGamepadSupportImpl(boolean daydream) throws InterruptedException { + private void webxrGamepadSupportImpl(boolean daydream) { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("test_webxr_gamepad_support"), PAGE_LOAD_TIMEOUT_S); @@ -865,7 +856,7 @@ // TODO(https://crbug.com/901494): Make this run everywhere when permissions are // unbroken. @XrActivityRestriction({XrActivityRestriction.SupportedActivity.CTA}) - public void testInSessionPermissionRequests() throws InterruptedException { + public void testInSessionPermissionRequests() { testInSessionPermissionRequestsImpl(); } @@ -876,12 +867,12 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.CTA}) - public void testInSessionPermissionRequestsIncognito() throws InterruptedException { + public void testInSessionPermissionRequestsIncognito() { mWebXrVrTestFramework.openIncognitoTab("about:blank"); testInSessionPermissionRequestsImpl(); } - private void testInSessionPermissionRequestsImpl() throws InterruptedException { + private void testInSessionPermissionRequestsImpl() { // Note that we need to pass in the WebContents to use throughout this because automatically // using the first tab's WebContents doesn't work in Incognito. mWebXrVrTestFramework.loadUrlAndAwaitInitialization(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTabTest.java index 3da2fffc..f05cd5c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTabTest.java
@@ -61,7 +61,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); } @@ -74,7 +74,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_SVR) - public void testPoseDataUnfocusedTab() throws InterruptedException { + public void testPoseDataUnfocusedTab() { testPoseDataUnfocusedTabImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("test_pose_data_unfocused_tab"), mWebVrTestFramework); @@ -91,14 +91,13 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testPoseDataUnfocusedTab_WebXr() throws InterruptedException { + public void testPoseDataUnfocusedTab_WebXr() { testPoseDataUnfocusedTabImpl(WebXrVrTestFramework.getFileUrlForHtmlTestFile( "webxr_test_pose_data_unfocused_tab"), mWebXrVrTestFramework); } - private void testPoseDataUnfocusedTabImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void testPoseDataUnfocusedTabImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.executeStepAndWait("stepCheckFrameDataWhileFocusedTab()"); WebContents firstTabContents = framework.getCurrentWebContents();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTransitionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTransitionTest.java index afed7037..7b6cba49 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTransitionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/WebXrVrTransitionTest.java
@@ -63,7 +63,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; /** * End-to-end tests for transitioning between WebVR and WebXR's magic window and @@ -92,7 +91,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mWebXrVrTestFramework = new WebXrVrTestFramework(mTestRule); mWebVrTestFramework = new WebVrTestFramework(mTestRule); } @@ -103,7 +102,7 @@ @Test @MediumTest @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testRequestPresentEntersVr() throws InterruptedException { + public void testRequestPresentEntersVr() { testPresentationEntryImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("generic_webvr_page"), mWebVrTestFramework); @@ -118,14 +117,13 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testRequestSessionEntersVr() throws InterruptedException { + public void testRequestSessionEntersVr() { testPresentationEntryImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), mWebXrVrTestFramework); } - private void testPresentationEntryImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void testPresentationEntryImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); Assert.assertTrue("Browser did not enter VR", VrShellDelegate.isInVr()); @@ -171,7 +169,7 @@ @MediumTest @CommandLineFlags.Remove({"enable-webvr"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testWebVrDisabledWithoutFlagSet() throws InterruptedException { + public void testWebVrDisabledWithoutFlagSet() { // TODO(bsheedy): Remove this test once WebVR is on by default without // requiring an origin trial. apiDisabledWithoutFlagSetImpl(WebVrTestFramework.getFileUrlForHtmlTestFile( @@ -187,7 +185,7 @@ @MediumTest @CommandLineFlags.Remove({"enable-webvr"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testWebXrDisabledWithoutFlagSet() throws InterruptedException { + public void testWebXrDisabledWithoutFlagSet() { // TODO(bsheedy): Remove this test once WebXR is on by default without // requiring an origin trial. apiDisabledWithoutFlagSetImpl(WebXrVrTestFramework.getFileUrlForHtmlTestFile( @@ -195,8 +193,7 @@ mWebXrVrTestFramework); } - private void apiDisabledWithoutFlagSetImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void apiDisabledWithoutFlagSetImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.waitOnJavaScriptStep(); framework.endTest(); @@ -210,7 +207,7 @@ @LargeTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testNfcFiresVrdisplayactivate() throws InterruptedException { + public void testNfcFiresVrdisplayactivate() { mWebVrTestFramework.loadUrlAndAwaitInitialization( WebVrTestFramework.getFileUrlForHtmlTestFile("test_nfc_fires_vrdisplayactivate"), PAGE_LOAD_TIMEOUT_S); @@ -235,7 +232,7 @@ @VrSettingsFile(VrSettingsServiceUtils.FILE_DDVIEW_DONENABLED) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) @DisabledTest(message = "crbug.com/972153") - public void testPresentationPromiseUnresolvedDuringDon() throws InterruptedException { + public void testPresentationPromiseUnresolvedDuringDon() { presentationPromiseUnresolvedDuringDonImpl( WebVrTestFramework.getFileUrlForHtmlTestFile( "test_presentation_promise_unresolved_during_don"), @@ -254,8 +251,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testPresentationPromiseUnresolvedDuringDon_WebXr() - throws InterruptedException { + public void testPresentationPromiseUnresolvedDuringDon_WebXr() { presentationPromiseUnresolvedDuringDonImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile( "webxr_test_presentation_promise_unresolved_during_don"), @@ -263,7 +259,7 @@ } private void presentationPromiseUnresolvedDuringDonImpl( - String url, WebXrVrTestFramework framework) throws InterruptedException { + String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureAndWait(); framework.endTest(); @@ -278,7 +274,7 @@ @VrSettingsFile(VrSettingsServiceUtils.FILE_DDVIEW_DONENABLED) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) @DisabledTest(message = "crbug.com/972153") - public void testPresentationPromiseRejectedIfDonCanceled() throws InterruptedException { + public void testPresentationPromiseRejectedIfDonCanceled() { presentationPromiseRejectedIfDonCanceledImpl( WebVrTestFramework.getFileUrlForHtmlTestFile( "test_presentation_promise_rejected_if_don_canceled"), @@ -296,8 +292,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testPresentationPromiseRejectedIfDonCanceled_WebXr() - throws InterruptedException { + public void testPresentationPromiseRejectedIfDonCanceled_WebXr() { presentationPromiseRejectedIfDonCanceledImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile( "webxr_test_presentation_promise_rejected_if_don_canceled"), @@ -305,7 +300,7 @@ } private void presentationPromiseRejectedIfDonCanceledImpl( - String url, WebXrVrTestFramework framework) throws InterruptedException { + String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); final UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); @@ -422,8 +417,7 @@ @Test @MediumTest @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM_OR_STANDALONE) - public void testRendererKilledInWebVrStaysInVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testRendererKilledInWebVrStaysInVr() throws IllegalArgumentException { rendererKilledInVrStaysInVrImpl( WebVrTestFramework.getFileUrlForHtmlTestFile("generic_webvr_page"), mWebVrTestFramework); @@ -438,15 +432,13 @@ @CommandLineFlags .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) - public void testRendererKilledInWebXrStaysInVr() - throws IllegalArgumentException, InterruptedException, TimeoutException { + public void testRendererKilledInWebXrStaysInVr() throws IllegalArgumentException { rendererKilledInVrStaysInVrImpl( WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), mWebXrVrTestFramework); } - private void rendererKilledInVrStaysInVrImpl(String url, WebXrVrTestFramework framework) - throws InterruptedException { + private void rendererKilledInVrStaysInVrImpl(String url, WebXrVrTestFramework framework) { framework.loadUrlAndAwaitInitialization(url, PAGE_LOAD_TIMEOUT_S); framework.enterSessionWithUserGestureOrFail(); framework.simulateRendererKilled(); @@ -463,7 +455,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testWindowRafFiresDuringNonImmersiveSession() throws InterruptedException { + public void testWindowRafFiresDuringNonImmersiveSession() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile( "test_window_raf_fires_during_non_immersive_session"), @@ -483,7 +475,7 @@ @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) @DisableFeatures(ChromeFeatureList.SEND_TAB_TO_SELF) - public void testNonImmersiveStopsDuringImmersive() throws InterruptedException { + public void testNonImmersiveStopsDuringImmersive() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile( "test_non_immersive_stops_during_immersive"), @@ -507,7 +499,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.CTA}) - public void testAppButtonExitToast() throws InterruptedException { + public void testAppButtonExitToast() { mWebXrVrTestFramework.loadUrlAndAwaitInitialization( WebXrVrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), PAGE_LOAD_TIMEOUT_S); @@ -526,8 +518,7 @@ .Remove({"enable-webvr"}) @CommandLineFlags.Add({"enable-features=WebXR"}) @XrActivityRestriction({XrActivityRestriction.SupportedActivity.ALL}) - public void testConsentDialogIsDismissedWhenPageNavigatesAwayInMainFrame() - throws InterruptedException { + public void testConsentDialogIsDismissedWhenPageNavigatesAwayInMainFrame() { mWebXrVrTestFramework.setConsentDialogAction( WebXrVrTestFramework.CONSENT_DIALOG_ACTION_DO_NOTHING); mWebXrVrTestFramework.loadUrlAndAwaitInitialization(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/XrTestFramework.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/XrTestFramework.java index 1348010..d0f2ff7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/XrTestFramework.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/XrTestFramework.java
@@ -123,7 +123,7 @@ try { return JavaScriptUtils.executeJavaScriptAndWaitForResult( webContents, js, timeout, TimeUnit.MILLISECONDS); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { Assert.fail("Fatal interruption or timeout running JavaScript '" + js + "': " + e.toString()); } @@ -160,7 +160,7 @@ try { result = JavaScriptUtils.executeJavaScriptAndWaitForResult(webContents, boolExpression, POLL_CHECK_INTERVAL_SHORT_MS, TimeUnit.MILLISECONDS); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { // Expected to happen regularly, do nothing } return Boolean.parseBoolean(result); @@ -395,8 +395,7 @@ * @param timeoutSec The timeout of the page load in seconds. * @return The return value of ChromeActivityTestRule.loadUrl(). */ - public int loadUrlAndAwaitInitialization(String url, int timeoutSec) - throws InterruptedException { + public int loadUrlAndAwaitInitialization(String url, int timeoutSec) { int result = mRule.loadUrl(url, timeoutSec); Assert.assertTrue("Timed out waiting for JavaScript test initialization", pollJavaScriptBoolean("isInitializationComplete()", POLL_TIMEOUT_LONG_MS,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/jsdialog/VrBrowserJavaScriptModalDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/jsdialog/VrBrowserJavaScriptModalDialogTest.java index b68deb2..99720d4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr/jsdialog/VrBrowserJavaScriptModalDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr/jsdialog/VrBrowserJavaScriptModalDialogTest.java
@@ -33,7 +33,6 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils; import java.io.IOException; -import java.util.concurrent.ExecutionException; /** * Test JavaScript modal dialogs in VR. @@ -53,7 +52,7 @@ private VrBrowserTestFramework mVrBrowserTestFramework; @Before - public void setUp() throws InterruptedException { + public void setUp() { mActivity = mActivityTestRule.getActivity(); mVrBrowserTestFramework = new VrBrowserTestFramework(mActivityTestRule); mVrBrowserTestFramework.loadUrlAndAwaitInitialization( @@ -72,8 +71,7 @@ @Test @MediumTest @Feature({"Browser", "RenderTest"}) - public void testAlertModalDialog() - throws InterruptedException, ExecutionException, IOException { + public void testAlertModalDialog() throws InterruptedException, IOException { NativeUiUtils.performActionAndWaitForUiQuiescence(() -> { NativeUiUtils.performActionAndWaitForVisibilityStatus( UserFriendlyElementName.BROWSING_DIALOG, true /* visible */, () -> { @@ -94,8 +92,7 @@ @Test @MediumTest @Feature({"Browser", "RenderTest"}) - public void testConfirmModalDialog() - throws InterruptedException, ExecutionException, IOException { + public void testConfirmModalDialog() throws InterruptedException, IOException { NativeUiUtils.performActionAndWaitForUiQuiescence(() -> { NativeUiUtils.performActionAndWaitForVisibilityStatus( UserFriendlyElementName.BROWSING_DIALOG, true /* visible */, () -> { @@ -123,8 +120,7 @@ @Test @MediumTest @Feature({"Browser", "RenderTest"}) - public void testPromptModalDialog() - throws InterruptedException, ExecutionException, IOException { + public void testPromptModalDialog() throws InterruptedException, IOException { String expectedString = "Hopefully not"; NativeUiUtils.performActionAndWaitForUiQuiescence(() -> { NativeUiUtils.performActionAndWaitForVisibilityStatus(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/ActivityAssignerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/ActivityAssignerTest.java index e63786c5..136595d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/ActivityAssignerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/ActivityAssignerTest.java
@@ -42,7 +42,7 @@ @Before @SuppressWarnings("unchecked") - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); mContext = new AdvancedMockContext(ContextUtils.getApplicationContext()); mPreferences = new HashMap[ActivityAssigner.ActivityAssignerNamespace.NUM_ENTRIES]; @@ -54,7 +54,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTest.java index 1e4fefc..1b8821b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTest.java
@@ -143,7 +143,7 @@ @Test @LargeTest @Feature({"WebApk"}) - public void testLaunchIntervalHistogramNotRecordedOnFirstLaunch() throws Exception { + public void testLaunchIntervalHistogramNotRecordedOnFirstLaunch() { android.util.Log.e("ABCD", "Start"); final String histogramName = "WebApk.LaunchInterval"; WebApkActivity webApkActivity = mActivityTestRule.startWebApkActivity(createWebApkInfo( @@ -198,7 +198,7 @@ */ @LargeTest @Test - public void testActivateWebApkLPlus() throws Exception { + public void testActivateWebApkLPlus() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; // Launch WebAPK.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java index 6e8c810..e8ee6b1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java
@@ -31,7 +31,7 @@ * Launches WebApkActivity and waits for the page to have finished loading and for the splash * screen to be hidden. */ - public WebApkActivity startWebApkActivity(WebApkInfo webApkInfo) throws InterruptedException { + public WebApkActivity startWebApkActivity(WebApkInfo webApkInfo) { Intent intent = createIntent(webApkInfo); WebappActivity.addWebappInfo(webApkInfo.id(), webApkInfo);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java index 6fedf6ff..d6cd430 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java
@@ -52,7 +52,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { WebApkUpdateManager.setUpdatesEnabledForTesting(false); mActivityTestRule.getEmbeddedTestServerRule().setServerUsesHttps(true); Uri mapToUri =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java index 35c81510..2e0e6681 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java
@@ -150,7 +150,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java index fa99e35..4db3db4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationTest.java
@@ -49,7 +49,7 @@ public final WebappActivityTestRule mActivityTestRule = new WebappActivityTestRule(); @Before - public void startWebapp() throws Exception { + public void startWebapp() { mActivityTestRule.startWebappActivity(mActivityTestRule.createIntent().putExtra( ShortcutHelper.EXTRA_URL, mActivityTestRule.getTestServer().getURL(WEB_APP_PATH))); mActivityTestRule.waitUntilSplashscreenHides();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java index bcc8a2e..ee24523 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java
@@ -137,14 +137,14 @@ /** * Starts up the WebappActivity and sets up the test observer. */ - public final void startWebappActivity() throws Exception { + public final void startWebappActivity() { startWebappActivity(createIntent()); } /** * Starts up the WebappActivity with a specific Intent and sets up the test observer. */ - public final void startWebappActivity(Intent intent) throws Exception { + public final void startWebappActivity(Intent intent) { launchActivity(intent); waitUntilIdle(); } @@ -200,7 +200,7 @@ * Starts up the WebappActivity and sets up the test observer. * Wait till Splashscreen full loaded. */ - public final ViewGroup startWebappActivityAndWaitForSplashScreen() throws Exception { + public final ViewGroup startWebappActivityAndWaitForSplashScreen() { return startWebappActivityAndWaitForSplashScreen(createIntent()); } @@ -209,8 +209,7 @@ * Wait till Splashscreen full loaded. * Intent url is modified to one that takes more time to load. */ - public final ViewGroup startWebappActivityAndWaitForSplashScreen(Intent intent) - throws Exception { + public final ViewGroup startWebappActivityAndWaitForSplashScreen(Intent intent) { // Reset the url to one that takes more time to load. // This is to make sure splash screen won't disappear during test. intent.putExtra(ShortcutHelper.EXTRA_URL, getTestServer().getURL("/slow?2"));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java index 0594f6b..9a59f86 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java
@@ -22,12 +22,12 @@ @RunWith(ChromeJUnit4ClassRunner.class) public class WebappAuthenticatorTest { @Before - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); } @After - public void tearDown() throws Exception { + public void tearDown() { RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappDisplayModeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappDisplayModeTest.java index 2e2a3e08..41b9010b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappDisplayModeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappDisplayModeTest.java
@@ -48,7 +48,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testStandalone() throws Exception { + public void testStandalone() { WebappActivity activity = startActivity(WebDisplayMode.STANDALONE, ""); Assert.assertFalse(activity.getToolbarManager().getToolbarLayoutForTesting().isShown()); @@ -58,7 +58,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testFullScreen() throws Exception { + public void testFullScreen() { WebappActivity activity = startActivity(WebDisplayMode.FULLSCREEN, ""); Assert.assertFalse(activity.getToolbarManager().getToolbarLayoutForTesting().isShown()); @@ -68,7 +68,7 @@ @Test @MediumTest @Feature({"Webapps"}) - public void testFullScreenInFullscreen() throws Exception { + public void testFullScreenInFullscreen() { WebappActivity activity = startActivity(WebDisplayMode.FULLSCREEN, "fullscreen_on_click"); Assert.assertFalse(activity.getToolbarManager().getToolbarLayoutForTesting().isShown()); @@ -91,7 +91,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testMinimalUi() throws Exception { + public void testMinimalUi() { WebappActivity activity = startActivity(WebDisplayMode.MINIMAL_UI, ""); Assert.assertFalse(isFullscreen(activity)); @@ -110,15 +110,14 @@ private String getJavascriptResult(WebContents webContents, String js) { try { return JavaScriptUtils.executeJavaScriptAndWaitForResult(webContents, js); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { Assert.fail("Fatal interruption or timeout running JavaScript '" + js + "': " + e.toString()); return ""; } } - private WebappActivity startActivity(@WebDisplayMode int displayMode, String action) - throws Exception { + private WebappActivity startActivity(@WebDisplayMode int displayMode, String action) { String url = WebappTestPage.getServiceWorkerUrlWithAction( mActivityTestRule.getTestServer(), action); mActivityTestRule.startWebappActivity(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java index 4c19398..688393f5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
@@ -99,7 +99,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { WebappRegistry.refreshSharedPrefsForTesting(); @@ -191,7 +191,7 @@ @Test @MediumTest @Feature({"Webapps"}) - public void testBringTabToFront() throws Exception { + public void testBringTabToFront() { // Start the WebappActivity. final WebappActivity firstActivity = startWebappActivity(WEBAPP_1_ID, WEBAPP_1_URL, WEBAPP_1_TITLE, WEBAPP_ICON); @@ -262,7 +262,7 @@ @Test @MediumTest @Feature({"Webapps"}) - public void testWebappInfoReuse() throws Exception { + public void testWebappInfoReuse() { Intent intent = createIntent( WebappActivityTestRule.WEBAPP_ID, WEBAPP_2_URL, WEBAPP_2_TITLE, WEBAPP_ICON, true); Intent newIntent = createIntent( @@ -293,7 +293,7 @@ @Test // @MediumTest // @Feature({"Webapps"}) - public void testSetsHasBeenLaunchedOnFirstLaunch() throws Exception { + public void testSetsHasBeenLaunchedOnFirstLaunch() { WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataStorage(WEBAPP_1_ID); Assert.assertFalse(storage.hasBeenLaunched());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java index 289120c..369f905a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java
@@ -301,7 +301,7 @@ @SmallTest @Feature({"Webapps"}) @RetryOnFailure - public void testOpenInChromeFromCustomMenuTabbedChrome() throws Exception { + public void testOpenInChromeFromCustomMenuTabbedChrome() { WebappActivity activity = runWebappActivityAndWaitForIdle(mActivityTestRule.createIntent().putExtra( ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.MINIMAL_UI)); @@ -439,13 +439,12 @@ ChromeTabUtils.waitForTabPageLoaded(activity.getActivityTab(), initialInScopeUrl); } - private WebappActivity runWebappActivityAndWaitForIdle(Intent intent) throws Exception { + private WebappActivity runWebappActivityAndWaitForIdle(Intent intent) { return runWebappActivityAndWaitForIdleWithUrl( intent, WebappTestPage.getServiceWorkerUrl(mActivityTestRule.getTestServer())); } - private WebappActivity runWebappActivityAndWaitForIdleWithUrl(Intent intent, String url) - throws Exception { + private WebappActivity runWebappActivityAndWaitForIdleWithUrl(Intent intent, String url) { mActivityTestRule.startWebappActivity(intent.putExtra(ShortcutHelper.EXTRA_URL, url)); mActivityTestRule.waitUntilSplashscreenHides(); mActivityTestRule.waitUntilIdle();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java index 5e77fd7..a5e000f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java
@@ -32,7 +32,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testShowBackgroundColorAndRecordUma() throws Exception { + public void testShowBackgroundColorAndRecordUma() { ViewGroup splashScreen = mActivityTestRule.startWebappActivityAndWaitForSplashScreen( mActivityTestRule .createIntent()
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java index 98dcb27..28f2a44 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java
@@ -34,7 +34,7 @@ private ViewGroup mSplashScreen; @Before - public void setUp() throws Exception { + public void setUp() { mSplashScreen = mActivityTestRule.startWebappActivityAndWaitForSplashScreen( mActivityTestRule.createIntent().putExtra( ShortcutHelper.EXTRA_ICON, WebappActivityTestRule.TEST_ICON));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java index 27d47d3..5a34b51 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java
@@ -34,7 +34,7 @@ private ViewGroup mSplashScreen; @Before - public void setUp() throws Exception { + public void setUp() { WebappRegistry.getInstance() .getWebappDataStorage(WebappActivityTestRule.WEBAPP_ID) .updateSplashScreenImage(WebappActivityTestRule.TEST_SPLASH_ICON);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java index 9af20b8..16fc9bef 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java
@@ -67,7 +67,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testDefaultBackgroundColor() throws Exception { + public void testDefaultBackgroundColor() { ViewGroup splashScreen = mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); ColorDrawable background = (ColorDrawable) splashScreen.getBackground(); @@ -81,7 +81,7 @@ @SmallTest @Feature({"Webapps"}) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testThemeColorWhenNotSpecified() throws Exception { + public void testThemeColorWhenNotSpecified() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; @@ -92,7 +92,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testHidesAfterFirstPaint() throws Exception { + public void testHidesAfterFirstPaint() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); Assert.assertTrue(mActivityTestRule.isSplashScreenVisible()); @@ -106,7 +106,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testHidesAfterCrash() throws Throwable { + public void testHidesAfterCrash() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); Assert.assertTrue(mActivityTestRule.isSplashScreenVisible()); @@ -120,7 +120,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testHidesAfterLoadCompletes() throws Exception { + public void testHidesAfterLoadCompletes() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); Assert.assertTrue(mActivityTestRule.isSplashScreenVisible()); @@ -134,7 +134,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testHidesAfterLoadFails() throws Exception { + public void testHidesAfterLoadFails() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); Assert.assertTrue(mActivityTestRule.isSplashScreenVisible()); @@ -148,7 +148,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testHidesAfterMultipleEvents() throws Exception { + public void testHidesAfterMultipleEvents() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); Assert.assertTrue(mActivityTestRule.isSplashScreenVisible()); @@ -166,7 +166,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testUmaOnNativeLoad() throws Exception { + public void testUmaOnNativeLoad() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); // Tests UMA values. @@ -178,7 +178,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testUmaWhenSplashHides() throws Exception { + public void testUmaWhenSplashHides() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> TabTestUtils.simulateFirstVisuallyNonEmptyPaint( @@ -263,7 +263,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testSplashScreenAppearsWithoutRegisteredSplashImage() throws Exception { + public void testSplashScreenAppearsWithoutRegisteredSplashImage() { // Don't register anything for the web app, which represents apps that were added to the // home screen before splash screen images were downloaded. ViewGroup splashScreen = mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); @@ -289,7 +289,7 @@ @Test @SmallTest @Feature({"Webapps"}) - public void testSplashScreenWithSynchronousLayoutInflation() throws Exception { + public void testSplashScreenWithSynchronousLayoutInflation() { WebappActivity.setOverrideCoreCount(2); mActivityTestRule.startWebappActivityAndWaitForSplashScreen();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java index 49c02f9..cb50696 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java
@@ -40,7 +40,7 @@ public final WebappActivityTestRule mActivityTestRule = new WebappActivityTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.startWebappActivityAndWaitForSplashScreen( mActivityTestRule .createIntent()
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java index 2dc421c..f9d7f38 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java
@@ -37,7 +37,7 @@ private static final String WEBAPP_URL = "http://originalwebsite.com"; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.loadNativeLibraryNoBrowserProcess(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenManagerTest.java index 65603b9c..fe950daf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenManagerTest.java
@@ -166,6 +166,11 @@ public void onIconAvailable(Bitmap icon) { TestAddToHomescreenManager.this.addToHomescreen(mTitle); } + + @Override + public void onAdaptableIconAvailable(Bitmap icon) { + TestAddToHomescreenManager.this.addToHomescreen(mTitle); + } }; } } @@ -285,7 +290,7 @@ @Feature("{Webapp}") @Restriction(Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE) @CommandLineFlags.Add(ContentSwitches.DISABLE_POPUP_BLOCKING) - public void testAddWebappShortcutWithEmptyPage() throws Exception { + public void testAddWebappShortcutWithEmptyPage() { Tab spawnedPopup = spawnPopupInBackground(""); addShortcutToTab(spawnedPopup, "", false); } @@ -343,7 +348,7 @@ new TabLoadObserver(mTab, expectedPageTitle, null).fullyLoadUrl(url); } - private void addShortcutToTab(Tab tab, String title, boolean expectAdded) throws Exception { + private void addShortcutToTab(Tab tab, String title, boolean expectAdded) { // Add the shortcut. TestAddToHomescreenManager manager = new TestAddToHomescreenManager(mActivity, tab, title); startManagerOnUiThread(manager);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenViewTest.java index b12092d..60ed853 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenViewTest.java
@@ -60,7 +60,7 @@ @SmallTest @Feature("{Webapp}") @RetryOnFailure - public void testSmoke() throws InterruptedException { + public void testSmoke() { TestThreadUtils.runOnUiThreadBlocking(() -> { AddToHomescreenView dialog = new AddToHomescreenView(mActivityTestRule.getActivity(), new MockAddToHomescreenManager(mActivityTestRule.getActivity(),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java index 06d385b..27314fc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java
@@ -103,7 +103,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mTab.removeObserver(mUpdateWaiter); mTestServer.stopAndDestroyServer(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java index 6c82e71..8d840e4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java
@@ -103,7 +103,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { if (mTab != null) mTab.removeObserver(mUpdateWaiter); if (mTestServer != null) mTestServer.stopAndDestroyServer();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/PromoDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/PromoDialogTest.java index c0a61e5..7f2da8b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/PromoDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/PromoDialogTest.java
@@ -49,7 +49,7 @@ mDialogParams = dialogParams; dialog = TestThreadUtils.runOnUiThreadBlocking(new Callable<PromoDialog>() { @Override - public PromoDialog call() throws Exception { + public PromoDialog call() { PromoDialog dialog = new PromoDialog(activity) { @Override public DialogParams getDialogParams() { @@ -74,7 +74,7 @@ }); dialogLayout = TestThreadUtils.runOnUiThreadBlocking(new Callable<PromoDialogLayout>() { @Override - public PromoDialogLayout call() throws Exception { + public PromoDialogLayout call() { PromoDialogLayout promoDialogLayout = (PromoDialogLayout) dialog.getWindow().getDecorView().findViewById( R.id.promo_dialog_layout);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/RoundedIconGeneratorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/RoundedIconGeneratorTest.java index 786b3ff..e9b6d0c7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/RoundedIconGeneratorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/RoundedIconGeneratorTest.java
@@ -31,7 +31,7 @@ private Context mContext; @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java index c7cea1c..d9f1158 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ScrimTest.java
@@ -70,7 +70,7 @@ @Test @SmallTest @Feature({"Scrim"}) - public void testScrimVisibility() throws InterruptedException, TimeoutException { + public void testScrimVisibility() throws TimeoutException { CallbackHelper visibilityHelper = new CallbackHelper(); ScrimObserver observer = new ScrimObserver() { @Override @@ -104,7 +104,7 @@ @Test @SmallTest @Feature({"Scrim"}) - public void testBottomSheetScrim() throws InterruptedException, TimeoutException { + public void testBottomSheetScrim() { mScrim.disableAnimationForTesting(true); assertScrimVisibility(false); assertFalse("Nothing should be obscuring the tab.", @@ -137,7 +137,7 @@ @SmallTest @Feature({"Scrim"}) @DisabledTest(message = "crbug.com/877774") - public void testOmniboxScrim() throws InterruptedException, TimeoutException { + public void testOmniboxScrim() { assertScrimVisibility(false); assertFalse("Nothing should be obscuring the tab.", mActivityTestRule.getActivity().isViewObscuringAllTabs());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ThumbnailDiskStorageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ThumbnailDiskStorageTest.java index a72f2a3..6f682d89 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ThumbnailDiskStorageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ThumbnailDiskStorageTest.java
@@ -157,7 +157,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { RecordHistogram.setDisabledForTests(true); mTestThumbnailStorageDelegate = new TestThumbnailStorageDelegate(); mTestThumbnailGenerator = new TestThumbnailGenerator(); @@ -177,7 +177,7 @@ */ @Test @SmallTest - public void testCanInsertAndGet() throws Throwable { + public void testCanInsertAndGet() { mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1); Assert.assertEquals(1, mTestThumbnailDiskStorage.getCacheCount()); @@ -200,7 +200,7 @@ */ @Test @SmallTest - public void testRepeatedInsertShouldBeUpdated() throws Throwable { + public void testRepeatedInsertShouldBeUpdated() { mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1); mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP2, ICON_WIDTH1); @@ -219,7 +219,7 @@ */ @Test @SmallTest - public void testRetrieveThumbnailShouldMakeEntryMostRecent() throws Throwable { + public void testRetrieveThumbnailShouldMakeEntryMostRecent() { mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1); mTestThumbnailDiskStorage.addToDisk(CONTENT_ID2, BITMAP1, ICON_WIDTH1); mTestThumbnailDiskStorage.addToDisk(CONTENT_ID3, BITMAP1, ICON_WIDTH1); @@ -250,7 +250,7 @@ */ @Test @SmallTest - public void testExceedLimitShouldTrim() throws Throwable { + public void testExceedLimitShouldTrim() { // Add thumbnails up to cache limit to get 1 entry trimmed int count = 0; while (mTestThumbnailDiskStorage.removeCount.get() == 0) { @@ -277,7 +277,7 @@ */ @Test @SmallTest - public void testRemoveAllThumbnailsWithSameContentId() throws Throwable { + public void testRemoveAllThumbnailsWithSameContentId() { mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1); mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH2); Assert.assertEquals(2, mTestThumbnailDiskStorage.getCacheCount()); @@ -309,8 +309,7 @@ /** * Retrieve thumbnail and assert that {@link ThumbnailStorageDelegate} has received it. */ - private void retrieveThumbnailAndAssertRetrieved(final TestThumbnailRequest request) - throws Exception { + private void retrieveThumbnailAndAssertRetrieved(final TestThumbnailRequest request) { TestThreadUtils.runOnUiThreadBlocking( () -> { mTestThumbnailDiskStorage.retrieveThumbnail(request); }); @@ -322,7 +321,7 @@ }, TIMEOUT_MS, INTERVAL_MS); } - private void assertInitialized() throws Exception { + private void assertInitialized() { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ViewHighlighterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ViewHighlighterTest.java index c0d02ff..b9adda1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ViewHighlighterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/ViewHighlighterTest.java
@@ -34,14 +34,14 @@ private Context mContext; @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); mContext.setTheme(R.style.Theme_Chromium_WithWindowAnimation); } @Test @MediumTest - public void testRepeatedCallsToHighlightWorksCorrectly() throws Exception { + public void testRepeatedCallsToHighlightWorksCorrectly() { View tintedImageButton = LayoutInflater.from(mContext).inflate(R.layout.clear_storage, null, false); tintedImageButton.setBackground(new ColorDrawable(Color.LTGRAY)); @@ -64,7 +64,7 @@ @Test @MediumTest - public void testViewWithNullBackground() throws Exception { + public void testViewWithNullBackground() { View tintedImageButton = LayoutInflater.from(mContext).inflate(R.layout.clear_storage, null, false); checkHighlightOff(tintedImageButton);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetControllerTest.java index 7ff170d5..1398ed0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetControllerTest.java
@@ -94,7 +94,7 @@ @Test @SmallTest @Feature({"BottomSheetController"}) - public void testSheetPeek() throws InterruptedException, TimeoutException { + public void testSheetPeek() throws TimeoutException { requestContentInSheet(mLowPriorityContent, true); assertEquals("The bottom sheet should be peeking.", BottomSheet.SheetState.PEEK, mBottomSheet.getSheetState()); @@ -105,7 +105,7 @@ @Test @SmallTest @Feature({"BottomSheetController"}) - public void testSheetPriorityInPeekState() throws InterruptedException, TimeoutException { + public void testSheetPriorityInPeekState() throws TimeoutException { CallbackHelper hideCallbackHelper = new CallbackHelper(); mBottomSheet.addObserver(new EmptyBottomSheetObserver() { @Override @@ -124,7 +124,7 @@ @Test @SmallTest @Feature({"BottomSheetController"}) - public void testSheetPriorityInExpandedState() throws InterruptedException, TimeoutException { + public void testSheetPriorityInExpandedState() throws TimeoutException { requestContentInSheet(mLowPriorityContent, true); expandSheet(); requestContentInSheet(mHighPriorityContent, false); @@ -135,7 +135,7 @@ @Test @MediumTest @Feature({"BottomSheetController"}) - public void testHandleBackPressPeekable() throws InterruptedException, TimeoutException { + public void testHandleBackPressPeekable() throws TimeoutException { int expectedState = mBottomSheet.isSmallScreen() ? BottomSheet.SheetState.FULL : BottomSheet.SheetState.HALF; requestContentInSheet(mPeekableContent, true); @@ -153,7 +153,7 @@ @Test @MediumTest @Feature({"BottomSheetController"}) - public void testHandleBackPressNonPeekable() throws InterruptedException, TimeoutException { + public void testHandleBackPressNonPeekable() throws TimeoutException { int expectedState = mBottomSheet.isSmallScreen() ? BottomSheet.SheetState.FULL : BottomSheet.SheetState.HALF; requestContentInSheet(mNonPeekableContent, true); @@ -171,7 +171,7 @@ @Test @MediumTest @Feature({"BottomSheetController"}) - public void testSheetPeekAfterTabSwitcher() throws InterruptedException, TimeoutException { + public void testSheetPeekAfterTabSwitcher() throws TimeoutException { requestContentInSheet(mLowPriorityContent, true); enterAndExitTabSwitcher(); assertEquals("The bottom sheet should be peeking.", BottomSheet.SheetState.PEEK, @@ -183,7 +183,7 @@ @Test @MediumTest @Feature({"BottomSheetController"}) - public void testSheetHiddenAfterTabSwitcher() throws InterruptedException, TimeoutException { + public void testSheetHiddenAfterTabSwitcher() throws TimeoutException { // Open a second tab and then reselect the original activity tab. Tab tab1 = mActivityTestRule.getActivity().getActivityTab(); ChromeTabUtils.newTabFromMenu( @@ -213,7 +213,7 @@ @Test @MediumTest @Feature({"BottomSheetController"}) - public void testOpenTabInBackground() throws InterruptedException, TimeoutException { + public void testOpenTabInBackground() throws TimeoutException { requestContentInSheet(mLowPriorityContent, true); expandSheet(); openNewTabInBackground(); @@ -230,7 +230,7 @@ @Test @MediumTest @Feature({"BottomSheetController"}) - public void testSwitchTabs() throws InterruptedException, TimeoutException { + public void testSwitchTabs() throws TimeoutException { requestContentInSheet(mLowPriorityContent, true); assertEquals("The bottom sheet should be peeking.", BottomSheet.SheetState.PEEK, @@ -248,7 +248,7 @@ @FlakyTest(message = "https://crbug.com/837809") @MediumTest @Feature({"BottomSheetController"}) - public void testSwitchTabsMultipleTimes() throws InterruptedException, TimeoutException { + public void testSwitchTabsMultipleTimes() throws TimeoutException { ChromeTabbedActivity activity = mActivityTestRule.getActivity(); final int originalTabIndex = activity.getTabModelSelector().getCurrentModel().indexOf(activity.getActivityTab()); @@ -283,7 +283,7 @@ @Test @MediumTest - public void testCustomLifecycleContent() throws TimeoutException, InterruptedException { + public void testCustomLifecycleContent() throws TimeoutException { requestContentInSheet(mHighPriorityContent, true); requestContentInSheet(mLowPriorityContent, false); @@ -311,7 +311,7 @@ @Test @MediumTest - public void testCloseEvent() throws TimeoutException, InterruptedException { + public void testCloseEvent() throws TimeoutException { requestContentInSheet(mHighPriorityContent, true); expandSheet(); @@ -340,7 +340,7 @@ * BottomSheetObserver#onSheetContentChanged. */ private void requestContentInSheet(BottomSheetContent content, boolean expectContentChange) - throws InterruptedException, TimeoutException { + throws TimeoutException { CallbackHelper contentChangedHelper = new CallbackHelper(); mBottomSheet.addObserver(new EmptyBottomSheetObserver() { @Override @@ -385,7 +385,7 @@ /** * Open a new tab behind the active tab and wait for the tab selection event. */ - private void openNewTabInBackground() throws InterruptedException, TimeoutException { + private void openNewTabInBackground() throws TimeoutException { CallbackHelper tabSelectedHelper = new CallbackHelper(); mActivityTestRule.getActivity().getTabModelSelector().getCurrentModel().addObserver( new EmptyTabModelObserver() { @@ -410,7 +410,7 @@ /** * Open a new tab in front of the active tab and wait for it to be completely loaded. */ - private void openNewTabInForeground() throws InterruptedException, TimeoutException { + private void openNewTabInForeground() { ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), "about:blank", false); ThreadUtils.runOnUiThreadBlocking(() -> mBottomSheet.endAnimations());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java index 7c671bbe..1b618a8b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetObserverTest.java
@@ -50,7 +50,7 @@ */ @Test @MediumTest - public void testCloseEventCalledNoAnimation() throws InterruptedException, TimeoutException { + public void testCloseEventCalledNoAnimation() throws TimeoutException { mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.FULL, false); CallbackHelper closedCallbackHelper = mObserver.mClosedCallbackHelper; @@ -69,7 +69,7 @@ */ @Test @MediumTest - public void testCloseEventCalledWithAnimation() throws InterruptedException, TimeoutException { + public void testCloseEventCalledWithAnimation() throws TimeoutException { mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.FULL, false); CallbackHelper closedCallbackHelper = mObserver.mClosedCallbackHelper; @@ -88,7 +88,7 @@ */ @Test @MediumTest - public void testOpenedEventCalledNoAnimation() throws InterruptedException, TimeoutException { + public void testOpenedEventCalledNoAnimation() throws TimeoutException { mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.PEEK, false); CallbackHelper openedCallbackHelper = mObserver.mOpenedCallbackHelper; @@ -107,7 +107,7 @@ */ @Test @MediumTest - public void testOpenedEventCalledWithAnimation() throws InterruptedException, TimeoutException { + public void testOpenedEventCalledWithAnimation() throws TimeoutException { mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.PEEK, false); CallbackHelper openedCallbackHelper = mObserver.mOpenedCallbackHelper; @@ -126,7 +126,7 @@ */ @Test @MediumTest - public void testOffsetChangedEvent() throws InterruptedException, TimeoutException { + public void testOffsetChangedEvent() throws TimeoutException { mBottomSheetTestRule.setSheetState(BottomSheet.SheetState.FULL, false); CallbackHelper callbackHelper = mObserver.mOffsetChangedCallbackHelper; @@ -158,7 +158,7 @@ @Test @MediumTest - public void testWrapContentBehavior() throws TimeoutException, InterruptedException { + public void testWrapContentBehavior() throws TimeoutException { // We make sure the height of the wrapped content is smaller than sheetContainerHeight. BottomSheet bottomSheet = mBottomSheetTestRule.getBottomSheet(); int wrappedContentHeight = (int) bottomSheet.getSheetContainerHeight() / 2;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java b/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java index 9d3bdb1..926f040 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java
@@ -6,7 +6,6 @@ import android.support.test.filters.SmallTest; -import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,47 +32,31 @@ @SmallTest @Test public void testRendererCrash() { - try { - mActivityTestRule.startMainActivityFromLauncher(); - mActivityTestRule.loadUrl("chrome://crash"); - } catch (InterruptedException e) { - Assert.fail(e.toString()); - } + mActivityTestRule.startMainActivityFromLauncher(); + mActivityTestRule.loadUrl("chrome://crash"); } @DisabledTest @SmallTest @Test public void testBrowserCrash() { - try { - mActivityTestRule.startMainActivityFromLauncher(); - mActivityTestRule.loadUrl("chrome://inducebrowsercrashforrealz"); - } catch (InterruptedException e) { - Assert.fail(e.toString()); - } + mActivityTestRule.startMainActivityFromLauncher(); + mActivityTestRule.loadUrl("chrome://inducebrowsercrashforrealz"); } @DisabledTest @SmallTest @Test public void testJavaCrash() { - try { - mActivityTestRule.startMainActivityFromLauncher(); - mActivityTestRule.loadUrl("chrome://java-crash/"); - } catch (InterruptedException e) { - Assert.fail(e.toString()); - } + mActivityTestRule.startMainActivityFromLauncher(); + mActivityTestRule.loadUrl("chrome://java-crash/"); } @DisabledTest @SmallTest @Test public void testGpuCrash() { - try { - mActivityTestRule.startMainActivityFromLauncher(); - mActivityTestRule.loadUrl("chrome://gpucrash"); - } catch (InterruptedException e) { - Assert.fail(e.toString()); - } + mActivityTestRule.startMainActivityFromLauncher(); + mActivityTestRule.loadUrl("chrome://gpucrash"); } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java index 44fbda2..d0edcdd 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java
@@ -57,7 +57,7 @@ private TestChromeActionModeCallback mActionModeCallback; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); RecordUserAction.setDisabledForTests(true);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeBackupAgentTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeBackupAgentTest.java index b92668f7e..dea4fb4 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeBackupAgentTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeBackupAgentTest.java
@@ -368,7 +368,7 @@ private int mPos; @Override - public String answer(InvocationOnMock invocation) throws Throwable { + public String answer(InvocationOnMock invocation) { return keys[mPos++]; } }); @@ -377,7 +377,7 @@ private int mPos; @Override - public Integer answer(InvocationOnMock invocation) throws Throwable { + public Integer answer(InvocationOnMock invocation) { return values[mPos++].length; } }); @@ -387,7 +387,7 @@ private int mPos; @Override - public Integer answer(InvocationOnMock invocation) throws Throwable { + public Integer answer(InvocationOnMock invocation) { byte[] buffer = invocation.getArgument(0); for (int i = 0; i < values[mPos].length; i++) { buffer[i] = values[mPos][i]; @@ -400,7 +400,7 @@ private int mPos; @Override - public Boolean answer(InvocationOnMock invocation) throws Throwable { + public Boolean answer(InvocationOnMock invocation) { return mPos++ < 5; } });
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/InsetObserverViewTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/InsetObserverViewTest.java index 03f0f70d..843dfc4 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/InsetObserverViewTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/InsetObserverViewTest.java
@@ -89,7 +89,7 @@ private LinearLayout mContentView; @Before - public void setUp() throws Throwable { + public void setUp() { MockitoAnnotations.initMocks(this); mActivity = Robolectric.buildActivity(Activity.class).setup().get(); @@ -100,7 +100,7 @@ /** Test that applying new insets does not notify the observer.. */ @Test @SmallTest - public void applyInsets() throws Throwable { + public void applyInsets() { mView = new TestInsetObserverView(mActivity, null); mView.addObserver(mObserver); @@ -111,7 +111,7 @@ /** Test that applying new insets with a cutout notifies the observer. */ @Test @SmallTest - public void applyInsets_WithCutout() throws Throwable { + public void applyInsets_WithCutout() { mView = new TestInsetObserverView(mActivity, new DisplayCutout()); mView.addObserver(mObserver); @@ -122,7 +122,7 @@ /** Test applying new insets with a cutout and then remove the cutout. */ @Test @SmallTest - public void applyInsets_WithCutout_WithoutCutout() throws Throwable { + public void applyInsets_WithCutout_WithoutCutout() { mView = new TestInsetObserverView(mActivity, new DisplayCutout()); mView.addObserver(mObserver); @@ -138,7 +138,7 @@ /** Test that applying new insets with a cutout but no observer is a no-op. */ @Test @SmallTest - public void applyInsets_WithCutout_NoListener() throws Throwable { + public void applyInsets_WithCutout_NoListener() { mView = new TestInsetObserverView(mActivity, new DisplayCutout()); mView.onApplyWindowInsets(mInsets); } @@ -146,7 +146,7 @@ /** Test that applying new insets with no observer is a no-op. */ @Test @SmallTest - public void applyInsets_NoListener() throws Throwable { + public void applyInsets_NoListener() { mView = new TestInsetObserverView(mActivity, null); mView.onApplyWindowInsets(mInsets); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java index dbd9f67..a1968a1 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java
@@ -55,7 +55,7 @@ private static final long ONE_WEEK_IN_MILLISECONDS = TimeUnit.DAYS.toMillis(7); @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); ChromeBackgroundTaskFactory.setAsDefault();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskTest.java index 9799fe6a..b9d5777d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskTest.java
@@ -78,7 +78,7 @@ private ArgumentCaptor<TaskInfo> mTaskInfo; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); @@ -100,7 +100,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { // Clean up static state for subsequent Robolectric tests. CommandLine.reset(); SysUtils.resetForTesting();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncChromeWakeUpTaskTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncChromeWakeUpTaskTest.java index 5ef0112e..6ae8334c 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncChromeWakeUpTaskTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncChromeWakeUpTaskTest.java
@@ -75,7 +75,7 @@ private ArgumentCaptor<TaskInfo> mTaskInfo; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); @@ -94,7 +94,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { // Clean up static state for subsequent Robolectric tests. CommandLine.reset(); SysUtils.resetForTesting();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java index dd1ee52..28add58 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java
@@ -14,7 +14,6 @@ import android.content.ComponentName; import android.graphics.Bitmap; import android.net.Uri; -import android.os.RemoteException; import org.junit.Before; import org.junit.Test; @@ -63,7 +62,7 @@ private TrustedWebActivityClient mClient; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); when(mConnection.execute(any(), anyString(), any())) @@ -114,9 +113,8 @@ verify(mNotificationBuilder, never()).setContentSmallIconForRemoteApp(any()); } - @Test - public void doesntFetchIconIdFromService_IfBothIconsAreSet() throws RemoteException { + public void doesntFetchIconIdFromService_IfBothIconsAreSet() { setHasContentBitmap(true); setHasStatusBarBitmap(true); postNotification(); @@ -124,14 +122,13 @@ } @Test - public void doesntFetchIconBitmapFromService_IfIconsIdIs() throws RemoteException { + public void doesntFetchIconBitmapFromService_IfIconsIdIs() { setHasContentBitmap(false); when(mService.getSmallIconId()).thenReturn(-1); postNotification(); verify(mService, never()).getSmallIconBitmap(); } - private void setHasStatusBarBitmap(boolean hasBitmap) { when(mNotificationBuilder.hasStatusBarIconBitmap()).thenReturn(hasBitmap); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java index 652435c..cddb0f1 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java
@@ -68,7 +68,7 @@ private ChromeContextMenuPopulator mPopulator; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); when(mItemDelegate.getPageUrl()).thenReturn(PAGE_URL);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManagerTest.java index b08bc3c..0c49941 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManagerTest.java
@@ -75,7 +75,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { // Assume Smart Selection is enabled and we have a Smart Selection client for most tests. mSmartSelectionClientStub = new SelectionClientStub(); mManager = new SelectionClientManager(mSmartSelectionClientStub, true);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java index 60476c9..d49e7d9e 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java
@@ -51,7 +51,7 @@ private DisplayCutoutController mDisplayCutoutController; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); // Mock dependency on InsetObserverView. @@ -63,7 +63,7 @@ @Test @SmallTest - public void testViewportFitUpdate() throws Throwable { + public void testViewportFitUpdate() { verify(mDisplayCutoutController, never()).maybeUpdateLayout(); mDisplayCutoutController.setViewportFit(ViewportFit.COVER); @@ -72,7 +72,7 @@ @Test @SmallTest - public void testViewportFitUpdateNotChanged() throws Throwable { + public void testViewportFitUpdateNotChanged() { verify(mDisplayCutoutController, never()).maybeUpdateLayout(); mDisplayCutoutController.setViewportFit(ViewportFit.AUTO); @@ -81,7 +81,7 @@ @Test @SmallTest - public void testCutoutModeWhenAutoAndInteractable() throws Throwable { + public void testCutoutModeWhenAutoAndInteractable() { when(mTab.isUserInteractable()).thenReturn(true); mDisplayCutoutController.setViewportFit(ViewportFit.AUTO); @@ -91,7 +91,7 @@ @Test @SmallTest - public void testCutoutModeWhenCoverAndInteractable() throws Throwable { + public void testCutoutModeWhenCoverAndInteractable() { when(mTab.isUserInteractable()).thenReturn(true); mDisplayCutoutController.setViewportFit(ViewportFit.COVER); @@ -101,7 +101,7 @@ @Test @SmallTest - public void testCutoutModeWhenCoverForcedAndInteractable() throws Throwable { + public void testCutoutModeWhenCoverForcedAndInteractable() { when(mTab.isUserInteractable()).thenReturn(true); mDisplayCutoutController.setViewportFit(ViewportFit.COVER_FORCED_BY_USER_AGENT); @@ -111,7 +111,7 @@ @Test @SmallTest - public void testCutoutModeWhenContainAndInteractable() throws Throwable { + public void testCutoutModeWhenContainAndInteractable() { when(mTab.isUserInteractable()).thenReturn(true); mDisplayCutoutController.setViewportFit(ViewportFit.CONTAIN); @@ -121,7 +121,7 @@ @Test @SmallTest - public void testCutoutModeWhenAutoAndNotInteractable() throws Throwable { + public void testCutoutModeWhenAutoAndNotInteractable() { mDisplayCutoutController.setViewportFit(ViewportFit.AUTO); Assert.assertEquals("LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT", mDisplayCutoutController.getDisplayCutoutMode()); @@ -129,7 +129,7 @@ @Test @SmallTest - public void testCutoutModeWhenCoverAndNotInteractable() throws Throwable { + public void testCutoutModeWhenCoverAndNotInteractable() { mDisplayCutoutController.setViewportFit(ViewportFit.COVER); Assert.assertEquals("LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT", mDisplayCutoutController.getDisplayCutoutMode()); @@ -137,7 +137,7 @@ @Test @SmallTest - public void testCutoutModeWhenCoverForcedAndNotInteractable() throws Throwable { + public void testCutoutModeWhenCoverForcedAndNotInteractable() { mDisplayCutoutController.setViewportFit(ViewportFit.COVER_FORCED_BY_USER_AGENT); Assert.assertEquals("LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT", mDisplayCutoutController.getDisplayCutoutMode()); @@ -145,7 +145,7 @@ @Test @SmallTest - public void testCutoutModeWhenContainAndNotInteractable() throws Throwable { + public void testCutoutModeWhenContainAndNotInteractable() { mDisplayCutoutController.setViewportFit(ViewportFit.CONTAIN); Assert.assertEquals("LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT", mDisplayCutoutController.getDisplayCutoutMode()); @@ -153,7 +153,7 @@ @Test @SmallTest - public void testLayoutOnInteractability_True() throws Throwable { + public void testLayoutOnInteractability_True() { // In this test we are checking for a side effect of maybeUpdateLayout. // This is because the tab observer holds a reference to the original // mDisplayCutoutController and not the spied one. @@ -166,7 +166,7 @@ @Test @SmallTest - public void testLayoutOnInteractability_False() throws Throwable { + public void testLayoutOnInteractability_False() { // In this test we are checking for a side effect of maybeUpdateLayout. // This is because the tab observer holds a reference to the original // mDisplayCutoutController and not the spied one. @@ -179,7 +179,7 @@ @Test @SmallTest - public void testLayoutOnShown() throws Throwable { + public void testLayoutOnShown() { // In this test we are checking for a side effect of maybeUpdateLayout. // This is because the tab observer holds a reference to the original // mDisplayCutoutController and not the spied one.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBackgroundTaskUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBackgroundTaskUnitTest.java index 8ea08f0..45ba603 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBackgroundTaskUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBackgroundTaskUnitTest.java
@@ -184,7 +184,7 @@ } @Test - public void testNoNetwork() throws Exception { + public void testNoNetwork() { initDeviceConditions(ConnectionType.CONNECTION_NONE); TaskParameters params = TaskParameters.create(TaskIds.EXPLORE_SITES_REFRESH_JOB_ID).build(); @@ -196,7 +196,7 @@ } @Test - public void testRemovesDeprecatedJobId() throws Exception { + public void testRemovesDeprecatedJobId() { TaskInfo.Builder deprecatedTaskInfoBuilder = TaskInfo.createPeriodicTask(TaskIds.DEPRECATED_EXPLORE_SITES_REFRESH_JOB_ID, ExploreSitesBackgroundTask.class, TimeUnit.HOURS.toMillis(4), @@ -221,7 +221,7 @@ } @Test - public void testRemovesTaskIfFeatureIsDisabled() throws Exception { + public void testRemovesTaskIfFeatureIsDisabled() { disableExploreSites(); TaskInfo.Builder taskInfoBuilder = @@ -247,7 +247,7 @@ } @Test - public void testDoesNotRemoveTaskIfFeatureIsEnabled() throws Exception { + public void testDoesNotRemoveTaskIfFeatureIsEnabled() { TaskInfo.Builder taskInfoBuilder = TaskInfo.createPeriodicTask(TaskIds.EXPLORE_SITES_REFRESH_JOB_ID, ExploreSitesBackgroundTask.class, TimeUnit.HOURS.toMillis(4),
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedContentStorageTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedContentStorageTest.java index e75fd3f1..1be5ce79 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedContentStorageTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedContentStorageTest.java
@@ -154,7 +154,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mContentStorage = new FeedContentStorage(mBridge); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedImageLoaderTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedImageLoaderTest.java index c600312..6ec916e 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedImageLoaderTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedImageLoaderTest.java
@@ -86,7 +86,7 @@ private FeedImageLoader mImageLoader; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); setUpWithImageFetcher(mCachedImageFetcher); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedJournalStorageTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedJournalStorageTest.java index c823b52..8e23d83 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedJournalStorageTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedJournalStorageTest.java
@@ -155,7 +155,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mJournalStorage = new FeedJournalStorage(mBridge); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/NtpStreamLifecycleManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/NtpStreamLifecycleManagerTest.java index 937bd8f..8dee1ab 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/NtpStreamLifecycleManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/NtpStreamLifecycleManagerTest.java
@@ -59,7 +59,7 @@ private NtpStreamLifecycleManager mNtpStreamLifecycleManager; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); // Initialize a test instance for PrefServiceBridge.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/action/FeedActionHandlerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/action/FeedActionHandlerTest.java index 4398989..9040c99 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/action/FeedActionHandlerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/action/FeedActionHandlerTest.java
@@ -109,7 +109,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mActionHandler = new FeedActionHandler(mDelegate, mSuggestionConsumedObserver, mOfflineIndicator, mOfflinePageBridge, mLoggingBridge);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java index a4aa96c3..310cd51 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java
@@ -130,7 +130,7 @@ private TestFirstRunFlowSequencer mSequencer; @Before - public void setUp() throws Exception { + public void setUp() { mActivityController = Robolectric.buildActivity(Activity.class); mSequencer = new TestFirstRunFlowSequencer(mActivityController.setup().get()); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationUnitTest.java index d2806eb..1eae097 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationUnitTest.java
@@ -66,7 +66,7 @@ private ShadowApplication mShadowApplication; @Before - public void setUp() throws InterruptedException { + public void setUp() { mContext = RuntimeEnvironment.application; mShadowApplication = ShadowApplication.getInstance();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/CachedImageFetcherTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/CachedImageFetcherTest.java index b1a31de..69c5695 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/CachedImageFetcherTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/CachedImageFetcherTest.java
@@ -57,7 +57,7 @@ ArgumentCaptor<Callback<Bitmap>> mCallbackCaptor; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); ImageFetcherBridge.setupForTesting(mImageFetcherBridge); mCachedImageFetcher = Mockito.spy(new CachedImageFetcher(mImageFetcherBridge)); @@ -72,7 +72,7 @@ } @Test - public void testFetchImageWithDimensionsFoundOnDisk() throws Exception { + public void testFetchImageWithDimensionsFoundOnDisk() { mCachedImageFetcher.continueFetchImageAfterDisk(URL, UMA_CLIENT_NAME, WIDTH_PX, HEIGHT_PX, (Bitmap bitmap) -> { assertEquals(bitmap, mBitmap); }, mBitmap, START_TIME); @@ -86,7 +86,7 @@ } @Test - public void testFetchImageWithDimensionsCallToNative() throws Exception { + public void testFetchImageWithDimensionsCallToNative() { mCachedImageFetcher.continueFetchImageAfterDisk(URL, UMA_CLIENT_NAME, WIDTH_PX, HEIGHT_PX, (Bitmap bitmap) -> { assertEquals(bitmap, mBitmap); }, null, START_TIME); @@ -96,7 +96,7 @@ } @Test - public void testFetchTwoClients() throws Exception { + public void testFetchTwoClients() { Mockito.doReturn(null).when(mCachedImageFetcher).tryToLoadImageFromDisk(anyObject()); mCachedImageFetcher.continueFetchImageAfterDisk(URL, UMA_CLIENT_NAME, WIDTH_PX, HEIGHT_PX, (Bitmap bitmap) -> { assertEquals(bitmap, mBitmap); }, null, START_TIME); @@ -111,7 +111,7 @@ } @Test - public void testFetchGifFoundOnDisk() throws Exception { + public void testFetchGifFoundOnDisk() { mCachedImageFetcher.continueFetchGifAfterDisk(URL, UMA_CLIENT_NAME, (BaseGifImage gif) -> { assertEquals(gif, mGif); }, mGif, START_TIME); @@ -125,7 +125,7 @@ } @Test - public void testFetchGifCallToNative() throws Exception { + public void testFetchGifCallToNative() { mCachedImageFetcher.continueFetchGifAfterDisk(URL, UMA_CLIENT_NAME, (BaseGifImage gif) -> { assertEquals(gif, mGif); }, null, START_TIME);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherFactoryTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherFactoryTest.java index 4c3aae3..6237ce9 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherFactoryTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherFactoryTest.java
@@ -30,7 +30,7 @@ DiscardableReferencePool mReferencePool; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherTest.java index 0c1c454..91699f0 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherTest.java
@@ -62,19 +62,19 @@ private ImageFetcherForTest mImageFetcher; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mImageFetcher = Mockito.spy(new ImageFetcherForTest()); } @Test - public void testResize() throws Exception { + public void testResize() { Bitmap result = ImageFetcher.tryToResizeImage(mBitmap, WIDTH_PX / 2, HEIGHT_PX / 2); assertNotEquals(result, mBitmap); } @Test - public void testResizeBailsOutIfSizeIsZeroOrLess() throws Exception { + public void testResizeBailsOutIfSizeIsZeroOrLess() { Bitmap result = ImageFetcher.tryToResizeImage(mBitmap, WIDTH_PX - 1, HEIGHT_PX - 1); assertNotEquals(result, mBitmap);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/InMemoryCachedImageFetcherTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/InMemoryCachedImageFetcherTest.java index 9d9348f..92ce435 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/InMemoryCachedImageFetcherTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/image_fetcher/InMemoryCachedImageFetcherTest.java
@@ -97,7 +97,7 @@ @Test @SmallTest - public void testFetchImageCachesFirstCall() throws Exception { + public void testFetchImageCachesFirstCall() { answerFetch(mBitmap, mCachedImageFetcher, false); mInMemoryCachedImageFetcher.fetchImage( URL, UMA_CLIENT_NAME, WIDTH_PX, HEIGHT_PX, mCallback); @@ -118,7 +118,7 @@ @Test @SmallTest - public void testFetchImageReturnsNullWhenFetcherIsNull() throws Exception { + public void testFetchImageReturnsNullWhenFetcherIsNull() { answerFetch(mBitmap, null, false); doReturn(null) .when(mInMemoryCachedImageFetcher)
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/init/AsyncInitTaskRunnerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/init/AsyncInitTaskRunnerTest.java index 0b211f8..5cf84f1 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/init/AsyncInitTaskRunnerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/init/AsyncInitTaskRunnerTest.java
@@ -78,7 +78,7 @@ } @After - public void tearDown() throws InterruptedException { + public void tearDown() { PostTask.resetPrenativeThreadPoolExecutorForTesting(); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/SessionsInvalidationManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/SessionsInvalidationManagerTest.java index c54b7ee..561718d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/SessionsInvalidationManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/SessionsInvalidationManagerTest.java
@@ -55,7 +55,7 @@ * ApplicationStateListener. */ @Test - public void testEnsureConstructorRegistersListener() throws Exception { + public void testEnsureConstructorRegistersListener() { final AtomicBoolean listenerCallbackCalled = new AtomicBoolean(); // Create instance.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java index 1cf8e80..4c95b3d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java
@@ -39,8 +39,6 @@ import org.chromium.chrome.browser.notifications.NotificationUmaTracker; import org.chromium.services.media_session.MediaMetadata; -import java.util.concurrent.TimeoutException; - /** * JUnit tests for checking {@link MediaNotificationManager} handles the listener service life cycle * correctly. @@ -69,7 +67,7 @@ } @Test - public void testProcessIntentFailureStopsService() throws TimeoutException { + public void testProcessIntentFailureStopsService() { MediaNotificationManager manager = getManager(); setUpService();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java index 59ad1b1..b95c613 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java
@@ -186,7 +186,7 @@ } @Test - public void testMediaMetadataResetsAfterSameOriginNavigation() throws Throwable { + public void testMediaMetadataResetsAfterSameOriginNavigation() { mTabHolder.simulateNavigation("https://example.com/", false); mTabHolder.simulateMediaSessionStateChanged(true, false); mTabHolder.simulateMediaSessionMetadataChanged(new MediaMetadata("title2", "", "")); @@ -199,7 +199,7 @@ } @Test - public void testMediaMetadataPersistsAfterSameDocumentNavigation() throws Throwable { + public void testMediaMetadataPersistsAfterSameDocumentNavigation() { mTabHolder.simulateNavigation("https://example.com/", false); mTabHolder.simulateMediaSessionStateChanged(true, false); mTabHolder.simulateMediaSessionMetadataChanged(new MediaMetadata("title2", "", ""));
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/net/nqe/NetworkQualityProviderTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/net/nqe/NetworkQualityProviderTest.java index 5208c50..f75508d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/net/nqe/NetworkQualityProviderTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/net/nqe/NetworkQualityProviderTest.java
@@ -67,14 +67,14 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mProvider = new NetworkQualityProviderForTesting(); NetworkQualityProviderForTesting.reset(mProvider); mObserver = new TestNetworkQualityObserver(); } @Test - public void testObserversGetNotified() throws Exception { + public void testObserversGetNotified() { NetworkQualityProvider.addObserverAndMaybeTrigger(mObserver); assertEquals(0, mObserver.getConnectionTypeCount()); @@ -90,7 +90,7 @@ } @Test - public void testRemovedObserversDontGetNotified() throws Exception { + public void testRemovedObserversDontGetNotified() { NetworkQualityProvider.addObserverAndMaybeTrigger(mObserver); NetworkQualityProvider.removeObserver(mObserver); @@ -101,7 +101,7 @@ } @Test - public void testObserversGetNotifiedWhenAdded() throws Exception { + public void testObserversGetNotifiedWhenAdded() { mProvider.onEffectiveConnectionTypeChanged(CONNECTION_TYPE); NetworkQualityProvider.addObserverAndMaybeTrigger(mObserver); assertEquals(1, mObserver.getConnectionTypeCount());
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateControllerTest.java index 1ab2fe3a..48863b4 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateControllerTest.java
@@ -89,7 +89,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { ChromePreferenceManager.getInstance().removeKey(UI_THEME_SETTING_KEY); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateProviderHolderTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateProviderHolderTest.java index d4ac5ce..7f64d0f6 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateProviderHolderTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateProviderHolderTest.java
@@ -26,7 +26,7 @@ @Config(manifest = Config.NONE) public class GlobalNightModeStateProviderHolderTest { @After - public void tearDown() throws Exception { + public void tearDown() { FeatureUtilities.setNightModeAvailableForTesting(null); GlobalNightModeStateProviderHolder.resetInstanceForTesting(); ChromePreferenceManager.getInstance().removeKey(UI_THEME_SETTING_KEY);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java index 4683c1bf..4fab7f3 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java
@@ -35,7 +35,7 @@ */ @Test @Feature({"Browser", "Notifications"}) - public void testGetOriginFromNotificationTag() throws Exception { + public void testGetOriginFromNotificationTag() { // The common case. assertEquals("https://example.com", NotificationPlatformBridge.getOriginFromNotificationTag( @@ -64,7 +64,7 @@ */ @Test @Feature({"Browser", "Notifications"}) - public void testGetOriginFromChannelId() throws Exception { + public void testGetOriginFromChannelId() { // Returns the expected origin for a channel id associated with a particular origin. assertEquals("https://example.com", NotificationPlatformBridge.getOriginFromChannelId( @@ -85,7 +85,7 @@ */ @Test @Feature({"Browser", "Notifications"}) - public void testMakeDefaults() throws Exception { + public void testMakeDefaults() { // 0 should be returned if pattern length is 0, silent is true, and vibration is enabled. assertEquals(0, NotificationPlatformBridge.makeDefaults(0, true, true)); @@ -111,7 +111,7 @@ */ @Test @Feature({"Browser", "Notifications"}) - public void testMakeVibrationPattern() throws Exception { + public void testMakeVibrationPattern() { assertTrue(Arrays.equals(new long[] {0, 100, 200, 300}, NotificationPlatformBridge.makeVibrationPattern(new int[] {100, 200, 300}))); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtilUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtilUnitTest.java index 5f28d33..1b8c554 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtilUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtilUnitTest.java
@@ -27,14 +27,14 @@ @Config(manifest = Config.NONE) public class NotificationSystemStatusUtilUnitTest { @Test - public void testAppNotificationStatusEnabled() throws Exception { + public void testAppNotificationStatusEnabled() { getShadowNotificationManager().setNotificationsEnabled(true); assertThat(NotificationSystemStatusUtil.getAppNotificationStatus(), is(NotificationSystemStatusUtil.APP_NOTIFICATIONS_STATUS_ENABLED)); } @Test - public void testAppNotificationStatusDisabled() throws Exception { + public void testAppNotificationStatusDisabled() { getShadowNotificationManager().setNotificationsEnabled(false); assertThat(NotificationSystemStatusUtil.getAppNotificationStatus(), is(NotificationSystemStatusUtil.APP_NOTIFICATIONS_STATUS_DISABLED));
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java index 6c05999..14295ad 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java
@@ -50,14 +50,14 @@ private BackgroundTask.TaskFinishedCallback mTaskFinishedCallback; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); NotificationTriggerScheduler.setInstanceForTests(mTriggerScheduler); } @After - public void tearDown() throws Exception { + public void tearDown() { SysUtils.resetForTesting(); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java index 6a72337..847b7b5 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java
@@ -50,7 +50,7 @@ private NotificationTriggerScheduler mTriggerScheduler; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); mocker.mock(NotificationTriggerSchedulerJni.TEST_HOOKS, mNativeMock);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitionsTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitionsTest.java index 3b20fcc..9dd6a68 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitionsTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitionsTest.java
@@ -26,7 +26,7 @@ public TestRule processor = new Features.JUnitProcessor(); @Test - public void testNoOverlapBetweenStartupAndLegacyChannelIds() throws Exception { + public void testNoOverlapBetweenStartupAndLegacyChannelIds() { assertThat(ChannelDefinitions.getStartupChannelIds(), everyItem(not(isIn(ChannelDefinitions.getLegacyChannelIds())))); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java index ebedcff92..db601e4a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java
@@ -25,7 +25,7 @@ */ @Test @Feature({"Ntp"}) - public void testGetTitleForDisplay() throws Exception { + public void testGetTitleForDisplay() { // If the title is not null or empty it is simply returned. assertEquals("title", TitleUtil.getTitleForDisplay("title", "https://example.com/path")); assertEquals("title", TitleUtil.getTitleForDisplay("title", ""));
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java index ad53fc2..4ac9507 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java
@@ -49,7 +49,7 @@ ArgumentCaptor<TaskInfo> mTaskInfo; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); doReturn(true)
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflineBackgroundTaskTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflineBackgroundTaskTest.java index 4aabd85..a23772d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflineBackgroundTaskTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflineBackgroundTaskTest.java
@@ -92,7 +92,7 @@ private ArgumentCaptor<TaskInfo> mTaskInfo; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); doReturn(true) @@ -119,7 +119,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { // Clean up static state for subsequent Robolectric tests. CommandLine.reset(); SysUtils.resetForTesting();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeUnitTest.java index 30e0d3d..3baec0c 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeUnitTest.java
@@ -99,7 +99,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mocker.mock(OfflinePageBridgeJni.TEST_HOOKS, mOfflinePageBridgeJniMock); OfflinePageBridge bridge = new OfflinePageBridge(0);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java index 9a33fd8..1fab696 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageTabObserverTest.java
@@ -71,7 +71,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); // Setting up a mock tab. These are the values common to most tests, but individual
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsUnitTest.java index 5b12624..9253278 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsUnitTest.java
@@ -62,7 +62,7 @@ public final SadTabRule mSadTabRule = new SadTabRule(); @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); WrappedEnvironment.setDataDirectoryForTest(mMockDataDirectory);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java index da702486..ab0bb78 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java
@@ -246,7 +246,7 @@ } @Test - public void testBatteryLow() throws Exception { + public void testBatteryLow() { // Setup low battery conditions with no power connected. DeviceConditions deviceConditionsLowBattery = new DeviceConditions(!POWER_CONNECTED, LOW_BATTERY_LEVEL, ConnectionType.CONNECTION_WIFI, !POWER_SAVE_MODE_ON, METERED, @@ -268,7 +268,7 @@ } @Test - public void testBatteryHigh() throws Exception { + public void testBatteryHigh() { // Setup high battery conditions with no power connected. DeviceConditions deviceConditionsHighBattery = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_WIFI, !POWER_SAVE_MODE_ON, !METERED, @@ -290,7 +290,7 @@ } @Test - public void testNoNetwork() throws Exception { + public void testNoNetwork() { // Setup no network conditions. DeviceConditions deviceConditionsNoNetwork = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_NONE, !POWER_SAVE_MODE_ON, !METERED, @@ -316,7 +316,7 @@ * limitless prefetching is enabled. */ @Test - public void testNoNetworkLimitless() throws Exception { + public void testNoNetworkLimitless() { // Setup no network conditions. DeviceConditions deviceConditionsNoNetwork = new DeviceConditions(!POWER_CONNECTED, 0 /* battery level */, ConnectionType.CONNECTION_NONE, !POWER_SAVE_MODE_ON, @@ -341,7 +341,7 @@ } @Test - public void testUnmeteredWifiNetwork() throws Exception { + public void testUnmeteredWifiNetwork() { // Setup unmetered wifi conditions. DeviceConditions deviceConditionsUnmeteredWifi = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_WIFI, !POWER_SAVE_MODE_ON, !METERED, @@ -363,7 +363,7 @@ } @Test - public void testMeteredWifiNetwork() throws Exception { + public void testMeteredWifiNetwork() { // Setup metered wifi conditions. DeviceConditions deviceConditionsMeteredWifi = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_WIFI, !POWER_SAVE_MODE_ON, METERED, @@ -385,7 +385,7 @@ } @Test - public void test2GNetwork() throws Exception { + public void test2GNetwork() { // Setup metered 2g connection conditions. DeviceConditions deviceConditions2G = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_2G, !POWER_SAVE_MODE_ON, METERED, @@ -408,7 +408,7 @@ } @Test - public void testBluetoothNetwork() throws Exception { + public void testBluetoothNetwork() { // Setup bluetooth connection conditions. DeviceConditions deviceConditionsBluetooth = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_BLUETOOTH, !POWER_SAVE_MODE_ON, @@ -430,7 +430,7 @@ } @Test - public void testOnStopAfterCallback() throws Exception { + public void testOnStopAfterCallback() { final ArrayList<Boolean> reschedules = new ArrayList<>(); TaskParameters params = TaskParameters.create(TaskIds.OFFLINE_PAGES_PREFETCH_JOB_ID).build(); @@ -455,7 +455,7 @@ } @Test - public void testPowerSaverOn() throws Exception { + public void testPowerSaverOn() { // Setup power save mode, battery is high, wifi, not plugged in. DeviceConditions deviceConditionsPowerSave = new DeviceConditions(!POWER_CONNECTED, HIGH_BATTERY_LEVEL, ConnectionType.CONNECTION_WIFI, POWER_SAVE_MODE_ON, !METERED,
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java index 1ccaae5..f4a1b2a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/AutocompleteEditTextTest.java
@@ -171,7 +171,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { if (DEBUG) Log.i(TAG, "setUp started."); MockitoAnnotations.initMocks(this); mContext = RuntimeEnvironment.application;
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/KeyboardHideHelperUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/KeyboardHideHelperUnitTest.java index 88b7e9f..4cd11e2 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/KeyboardHideHelperUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/KeyboardHideHelperUnitTest.java
@@ -47,7 +47,7 @@ private KeyboardHideHelper mKeyboardHideHelper; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mView = spy(new View(RuntimeEnvironment.application)); @@ -74,7 +74,7 @@ final AtomicInteger height = new AtomicInteger(300); Answer<Void> windowVisibleDisplayFrameAnswer = new Answer<Void>() { @Override - public Void answer(InvocationOnMock invocation) throws Throwable { + public Void answer(InvocationOnMock invocation) { ((Rect) invocation.getArgument(0)).set(0, 0, 100, height.get()); return null; }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/UrlBarUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/UrlBarUnitTest.java index c8c71b3..5196804 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/UrlBarUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/UrlBarUnitTest.java
@@ -51,7 +51,7 @@ @SmallTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @Feature("Omnibox") - public void testAutofillStructureReceivesFullURL() throws InterruptedException { + public void testAutofillStructureReceivesFullURL() { mUrlBar.setTextForAutofillServices("https://www.google.com"); mUrlBar.setText("www.google.com"); mUrlBar.onProvideAutofillStructure(mViewStructure, 0);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/EditUrlSuggestionTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/EditUrlSuggestionTest.java index b71fd9e..5851d787 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/EditUrlSuggestionTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/EditUrlSuggestionTest.java
@@ -100,7 +100,7 @@ /** Test that the suggestion is triggered. */ @Test @SmallTest - public void testSuggestionTriggered() throws Exception { + public void testSuggestionTriggered() { mProcessor.onUrlFocusChange(true); Assert.assertTrue("The processor should handle the \"what you typed\" suggestion.", @@ -118,7 +118,7 @@ /** Test that the suggestion is not triggered if it is not the first suggestion. */ @Test @SmallTest - public void testWhatYouTypedSecondSuggestion() throws Exception { + public void testWhatYouTypedSecondSuggestion() { mProcessor.onUrlFocusChange(true); Assert.assertFalse("The processor should not handle the suggestion.", @@ -131,7 +131,7 @@ /** Test the edit button is pressed, the correct method in the URL bar delegate is triggered. */ @Test @SmallTest - public void testEditButtonPress() throws Exception { + public void testEditButtonPress() { mProcessor.onUrlFocusChange(true); mProcessor.doesProcessSuggestion(mWhatYouTypedSuggestion); mProcessor.populateModel(mWhatYouTypedSuggestion, mModel, 0); @@ -144,7 +144,7 @@ /** Test that when suggestion is tapped, it still navigates to the correct location. */ @Test @SmallTest - public void testPressSuggestion() throws Exception { + public void testPressSuggestion() { mProcessor.onUrlFocusChange(true); mProcessor.doesProcessSuggestion(mWhatYouTypedSuggestion); mProcessor.populateModel(mWhatYouTypedSuggestion, mModel, 0);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/page_info/PermissionParamsListBuilderUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/page_info/PermissionParamsListBuilderUnitTest.java index b08206f2c..9a77c82 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/page_info/PermissionParamsListBuilderUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/page_info/PermissionParamsListBuilderUnitTest.java
@@ -64,7 +64,7 @@ WebsitePreferenceBridge.Natives mWebsitePreferenceBridgeMock; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mocker.mock(WebsitePreferenceBridgeJni.TEST_HOOKS, mWebsitePreferenceBridgeMock); when(mWebsitePreferenceBridgeMock.isPermissionControlledByDSE(
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksFaviconThrottleTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksFaviconThrottleTest.java index d9f15542..50dfbba 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksFaviconThrottleTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/partnerbookmarks/PartnerBookmarksFaviconThrottleTest.java
@@ -29,12 +29,12 @@ public DisableHistogramsRule mDisableHistogramsRule = new DisableHistogramsRule(); @Before - public void setUp() throws Exception { + public void setUp() { mFaviconThrottle = new PartnerBookmarksFaviconThrottle(TEST_PREFERENCES_NAME); } @After - public void tearDown() throws Exception { + public void tearDown() { mFaviconThrottle.clearEntries(); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfAndroidBridgeTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfAndroidBridgeTest.java index 9ef182e..25e9884 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfAndroidBridgeTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfAndroidBridgeTest.java
@@ -54,7 +54,7 @@ private static final long SHARE_TIME_MS = 456l; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mocker.mock(SendTabToSelfAndroidBridgeJni.TEST_HOOKS, mNativeMock); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfShareActivityTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfShareActivityTest.java index c8fa8bf4..d7d154d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfShareActivityTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfShareActivityTest.java
@@ -71,7 +71,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mocker.mock(SendTabToSelfAndroidBridgeJni.TEST_HOOKS, mNativeMock); RecordHistogram.setDisabledForTests(true);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/snackbar/SnackbarCollectionUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/snackbar/SnackbarCollectionUnitTest.java index fcc01d55..324f7009 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/snackbar/SnackbarCollectionUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/snackbar/SnackbarCollectionUnitTest.java
@@ -38,7 +38,7 @@ @Test @Feature({"Browser", "Snackbar"}) - public void testActionCoversNotification() throws Exception { + public void testActionCoversNotification() { SnackbarCollection collection = new SnackbarCollection(); assertTrue(collection.isEmpty()); @@ -61,7 +61,7 @@ @Test @Feature({"Browser", "Snackbar"}) - public void testNotificationGoesUnderAction() throws Exception { + public void testNotificationGoesUnderAction() { SnackbarCollection collection = new SnackbarCollection(); assertTrue(collection.isEmpty()); @@ -89,7 +89,7 @@ @Test @Feature({"Browser", "Snackbar"}) - public void testClear() throws Exception { + public void testClear() { SnackbarCollection collection = new SnackbarCollection(); for (int i = 0; i < 3; i++) { collection.add(makeActionSnackbar()); @@ -103,7 +103,7 @@ @Test @Feature({"Browser", "Snackbar"}) - public void testRemoveMatchingSnackbars() throws Exception { + public void testRemoveMatchingSnackbars() { SnackbarCollection collection = new SnackbarCollection(); for (int i = 0; i < 3; i++) { collection.add(makeActionSnackbar()); @@ -124,7 +124,7 @@ @Test @Feature({"Browser", "Snackbar"}) - public void testRemoveMatchingSnackbarsWithData() throws Exception { + public void testRemoveMatchingSnackbarsWithData() { SnackbarCollection collection = new SnackbarCollection(); for (int i = 0; i < 3; i++) { collection.add(makeActionSnackbar().setAction(ACTION_TITLE, i));
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabAttributesTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabAttributesTest.java index a3934fc6..06b2e48 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabAttributesTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabAttributesTest.java
@@ -36,14 +36,14 @@ private static class TestObject {} @Before - public void setUp() throws InterruptedException { + public void setUp() { MockitoAnnotations.initMocks(this); when(mTab.getUserDataHost()).thenReturn(mUserDataHost); } @Test @SmallTest - public void testBasicGetAndSetOperation() throws Exception { + public void testBasicGetAndSetOperation() { // |get| for an uninitialized attribute returns null. Assert.assertNull(TabAttributes.from(mTab).get(ATTR1)); @@ -61,7 +61,7 @@ @Test @SmallTest - public void testGetWithDefaultReturnsNullForAttributeExplicitlySetToNull() throws Exception { + public void testGetWithDefaultReturnsNullForAttributeExplicitlySetToNull() { TestObject defaultValue = new TestObject(); // The attribute is not set by default, therefore default value is returned.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabUnitTest.java index 20b56a3..9f970b1 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/tab/TabUnitTest.java
@@ -59,7 +59,7 @@ private Tab mTab; @Before - public void setUp() throws InterruptedException { + public void setUp() { MockitoAnnotations.initMocks(this); doReturn(mWeakReferenceActivity).when(mWindowAndroid).getActivity(); @@ -79,7 +79,7 @@ @Test @SmallTest - public void testSetRootIdWithChange() throws Exception { + public void testSetRootIdWithChange() { assertThat(mTab.getRootId(), equalTo(TAB1_ID)); mTab.setRootId(TAB2_ID); @@ -91,7 +91,7 @@ @Test @SmallTest - public void testSetRootIdWithoutChange() throws Exception { + public void testSetRootIdWithoutChange() { assertThat(mTab.getRootId(), equalTo(TAB1_ID)); mTab.setIsTabStateDirty(false);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/util/UrlUtilitiesUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/util/UrlUtilitiesUnitTest.java index f314753..881af166 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/util/UrlUtilitiesUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/util/UrlUtilitiesUnitTest.java
@@ -18,7 +18,7 @@ @Config(manifest = Config.NONE) public class UrlUtilitiesUnitTest { @Test - public void testIsHttpOrHttps() throws InterruptedException { + public void testIsHttpOrHttps() { Assert.assertTrue( UrlUtilities.isHttpOrHttps("https://user:pass@awesome.com:9000/bad-scheme/#fake")); Assert.assertTrue(UrlUtilities.isHttpOrHttps("http://awesome.example.com/")); @@ -116,7 +116,7 @@ } @Test - public void testStripPath() throws InterruptedException { + public void testStripPath() { Assert.assertEquals("https://example.com:9000", UrlUtilities.stripPath("https://user:pass@example.com:9000/path/#extra")); Assert.assertEquals("http://awesome.example.com",
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkShareTargetUtilTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkShareTargetUtilTest.java index b8c0a8b..220225da 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkShareTargetUtilTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkShareTargetUtilTest.java
@@ -18,7 +18,6 @@ import org.chromium.base.test.BaseRobolectricTestRunner; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; @@ -169,7 +168,7 @@ * the correct information in the correct place. */ @Test - public void testPostUrlEncoded() throws UnsupportedEncodingException { + public void testPostUrlEncoded() { ShareTargetBuilder shareTargetBuilder = new ShareTargetBuilder("/share.html"); shareTargetBuilder.setMethod(ShareTarget.METHOD_POST); shareTargetBuilder.setEncodingType(ShareTarget.ENCODING_TYPE_URL_ENCODED);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java index fee27aa..782b3fc 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java
@@ -433,7 +433,7 @@ * succeeding. */ private static void tryCompletingUpdate(TestWebApkUpdateManager updateManager, - WebappDataStorage storage, @WebApkInstallResult int result) throws Exception { + WebappDataStorage storage, @WebApkInstallResult int result) { // Emulate proto creation as always succeeding. Callback<Boolean> storeUpdateRequestCallback = updateManager.getStoreUpdateRequestCallback(); @@ -485,7 +485,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { PathUtils.setPrivateDataDirectorySuffix("chrome"); PostTask.setPrenativeThreadPoolExecutorForTesting(new RoboExecutorService()); @@ -618,7 +618,7 @@ * update succeeded. */ @Test - public void testPendingUpdateFileDeletedAfterUpdateCompletion() throws Exception { + public void testPendingUpdateFileDeletedAfterUpdateCompletion() { mClockRule.advance(WebappDataStorage.UPDATE_INTERVAL); WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); @@ -643,7 +643,7 @@ * file but fails. */ @Test - public void testFileDeletedIfStoreWebApkUpdateRequestToFileFails() throws Exception { + public void testFileDeletedIfStoreWebApkUpdateRequestToFileFails() { mClockRule.advance(WebappDataStorage.UPDATE_INTERVAL); WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); @@ -1147,7 +1147,7 @@ * there wasn't a previous request for this ShellAPK version. */ @Test - public void testShellApkOutOfDate() throws Exception { + public void testShellApkOutOfDate() { registerWebApk(WEBAPK_PACKAGE_NAME, defaultManifestData(), REQUEST_UPDATE_FOR_SHELL_APK_VERSION - 1); WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); @@ -1179,7 +1179,7 @@ * change to the manifest. */ @Test - public void testForcedUpdateSuccess() throws Exception { + public void testForcedUpdateSuccess() { WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); storage.setShouldForceUpdate(true); TestWebApkUpdateManager updateManager = new TestWebApkUpdateManager(storage); @@ -1196,7 +1196,7 @@ * the manifest. */ @Test - public void testForcedUpdateNotNeeded() throws Exception { + public void testForcedUpdateNotNeeded() { WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); storage.setShouldForceUpdate(true); TestWebApkUpdateManager updateManager = new TestWebApkUpdateManager(storage); @@ -1211,7 +1211,7 @@ * Tests that a forced update handles failure gracefully. */ @Test - public void testForcedUpdateFailure() throws Exception { + public void testForcedUpdateFailure() { WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); storage.setShouldForceUpdate(true); TestWebApkUpdateManager updateManager = new TestWebApkUpdateManager(storage); @@ -1227,7 +1227,7 @@ * Tests that a forced update handles failing to retrieve the manifest. */ @Test - public void testForcedUpdateManifestNotRetrieved() throws Exception { + public void testForcedUpdateManifestNotRetrieved() { WebappDataStorage storage = getStorage(WEBAPK_PACKAGE_NAME); storage.setShouldForceUpdate(true); TestWebApkUpdateManager updateManager = new TestWebApkUpdateManager(storage); @@ -1242,7 +1242,7 @@ * Test that WebappDataStorage#setShouldForceUpdate() is a no-op for unbound WebAPKs. */ @Test - public void testForceUpdateUnboundWebApk() throws Exception { + public void testForceUpdateUnboundWebApk() { registerWebApk(UNBOUND_WEBAPK_PACKAGE_NAME, defaultManifestData(), REQUEST_UPDATE_FOR_SHELL_APK_VERSION); registerStorageForWebApkPackage(UNBOUND_WEBAPK_PACKAGE_NAME);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java index d660f2f6..d83fb04 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
@@ -59,7 +59,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mSharedPreferences = ContextUtils.getApplicationContext().getSharedPreferences( WebappDataStorage.SHARED_PREFS_FILE_PREFIX + "test", Context.MODE_PRIVATE); @@ -90,7 +90,7 @@ @Test @Feature({"Webapp"}) - public void testLastUsedRetrieval() throws Exception { + public void testLastUsedRetrieval() { long lastUsed = 100; mSharedPreferences.edit().putLong(WebappDataStorage.KEY_LAST_USED, lastUsed).apply(); assertEquals(lastUsed, new WebappDataStorage("test").getLastUsedTimeMs()); @@ -137,7 +137,7 @@ @Test @Feature({"Webapp"}) - public void testScopeRetrieval() throws Exception { + public void testScopeRetrieval() { String scope = "http://drive.google.com"; mSharedPreferences.edit().putString(WebappDataStorage.KEY_SCOPE, scope).apply(); assertEquals(scope, new WebappDataStorage("test").getScope()); @@ -145,7 +145,7 @@ @Test @Feature({"Webapp"}) - public void testUrlRetrieval() throws Exception { + public void testUrlRetrieval() { String url = "https://www.google.com"; mSharedPreferences.edit().putString(WebappDataStorage.KEY_URL, url).apply(); assertEquals(url, new WebappDataStorage("test").getUrl()); @@ -153,7 +153,7 @@ @Test @Feature({"Webapp"}) - public void testWasLaunchedRecently() throws Exception { + public void testWasLaunchedRecently() { // Opening a data storage doesn't count as a launch. WebappDataStorage storage = WebappDataStorage.open("test"); assertTrue(!storage.wasUsedRecently()); @@ -198,7 +198,7 @@ @Test @Feature({"Webapp"}) - public void testWebappInfoUpdate() throws Exception { + public void testWebappInfoUpdate() { final String id = "id"; final String url = "url"; final String scope = "scope"; @@ -294,7 +294,7 @@ */ @Test @Feature({"Webapp"}) - public void testWebApkInfoUpdate() throws Exception { + public void testWebApkInfoUpdate() { String webApkPackageName = "org.chromium.webapk.random123"; String url = "url"; String scopeUrl = "scope";
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDirectoryManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDirectoryManagerTest.java index 73a63ae..1e845c2e 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDirectoryManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDirectoryManagerTest.java
@@ -58,7 +58,7 @@ private Context mContext; @Before - public void setUp() throws Exception { + public void setUp() { mContext = RuntimeEnvironment.application; ContextUtils.initApplicationContext(mContext); ThreadUtils.setThreadAssertsDisabledForTesting(true); @@ -72,7 +72,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { FileUtils.recursivelyDeleteFile(mContext.getDataDir()); FileUtils.recursivelyDeleteFile(mContext.getCodeCacheDir()); FileUtils.recursivelyDeleteFile(WebappDirectoryManager.getBaseWebappDirectory(mContext)); @@ -91,7 +91,7 @@ @Test @Feature({"Webapps"}) - public void testDeletesObsoleteDirectories() throws Exception { + public void testDeletesObsoleteDirectories() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; // Seed the base directory with folders that correspond to pre-L web apps. @@ -161,7 +161,7 @@ */ @Test @Feature({"Webapps"}) - public void testDoesNotCountFilesForNewlyScheduledUpdates() throws Exception { + public void testDoesNotCountFilesForNewlyScheduledUpdates() { File directory = new File(WebappDirectoryManager.getWebApkUpdateDirectory(), WEBAPK_ID_1); directory.mkdirs(); registerWebapp(WEBAPK_ID_1);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarControllerTest.java index a072385..4c90333e 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarControllerTest.java
@@ -41,7 +41,7 @@ public Resources mResources; @Before - public void setUp() throws InterruptedException { + public void setUp() { MockitoAnnotations.initMocks(this); doReturn("test text").when(mResources).getString(anyInt());
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java index e2f00cb0..688fb5f 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
@@ -78,7 +78,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { WebappRegistry.refreshSharedPrefsForTesting(); mSharedPreferences = ContextUtils.getApplicationContext().getSharedPreferences( REGISTRY_FILE_NAME, Context.MODE_PRIVATE); @@ -130,7 +130,7 @@ @Test @Feature({"Webapp"}) - public void testWebappIdsRetrieval() throws Exception { + public void testWebappIdsRetrieval() { final Set<String> expected = addWebappsToRegistry("first", "second"); assertEquals(expected, WebappRegistry.getRegisteredWebappIdsForTesting()); } @@ -225,7 +225,7 @@ @Test @Feature({"Webapp"}) - public void testCleanupDoesNotRunTooOften() throws Exception { + public void testCleanupDoesNotRunTooOften() { // Put the current time to just before the task should run. long currentTime = INITIAL_TIME + WebappRegistry.FULL_CLEANUP_DURATION - 1; @@ -252,7 +252,7 @@ @Test @Feature({"Webapp"}) - public void testCleanupDoesNotRemoveRecentApps() throws Exception { + public void testCleanupDoesNotRemoveRecentApps() { // Put the current time such that the task runs. long currentTime = INITIAL_TIME + WebappRegistry.FULL_CLEANUP_DURATION; @@ -284,7 +284,7 @@ @Test @Feature({"Webapp"}) - public void testCleanupRemovesOldApps() throws Exception { + public void testCleanupRemovesOldApps() { // Put the current time such that the task runs. long currentTime = INITIAL_TIME + WebappRegistry.FULL_CLEANUP_DURATION;
diff --git a/chrome/android/junit/src/org/chromium/chrome/test/support/DisableHistogramsRule.java b/chrome/android/junit/src/org/chromium/chrome/test/support/DisableHistogramsRule.java index 73f9317..e4b560a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/test/support/DisableHistogramsRule.java +++ b/chrome/android/junit/src/org/chromium/chrome/test/support/DisableHistogramsRule.java
@@ -13,7 +13,7 @@ */ public class DisableHistogramsRule extends ExternalResource { @Override - protected void before() throws Throwable { + protected void before() { RecordHistogram.setDisabledForTests(true); }
diff --git a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkIdentityServiceClientTest.java b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkIdentityServiceClientTest.java index 7911a46..2c215b3 100644 --- a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkIdentityServiceClientTest.java +++ b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkIdentityServiceClientTest.java
@@ -6,7 +6,6 @@ import android.content.ComponentName; import android.os.Bundle; -import android.os.RemoteException; import org.junit.After; import org.junit.Assert; @@ -61,7 +60,7 @@ } @Override - public String getRuntimeHostBrowserPackageName() throws RemoteException { + public String getRuntimeHostBrowserPackageName() { return mRuntimeHost; } }
diff --git a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkServiceConnectionManagerTest.java b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkServiceConnectionManagerTest.java index ad08c1d..07241f24 100644 --- a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkServiceConnectionManagerTest.java +++ b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkServiceConnectionManagerTest.java
@@ -94,7 +94,7 @@ * already exists. */ @Test - public void testAfterConnectionEstablished() throws Exception { + public void testAfterConnectionEstablished() { TestCallback callback1 = new TestCallback(); TestCallback callback2 = new TestCallback(); @@ -117,7 +117,7 @@ * WebAPK but has not established a connection yet. */ @Test - public void testConnectWhileConnectionBeingEstablished() throws Exception { + public void testConnectWhileConnectionBeingEstablished() { // Context for testing {@link Context#bindService()} occurring asynchronously. class AsyncBindContext extends ContextWrapper { private ServiceConnection mConnection; @@ -224,7 +224,7 @@ * Test reconnecting to a WebAPK's service. */ @Test - public void testConnectDisconnectConnect() throws Exception { + public void testConnectDisconnectConnect() { final int flagRunBackgroundTasksAfterConnect = 0x1; final int flagRunBackgroundTasksAfterDisconnect = 0x2;
diff --git a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkValidatorTest.java b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkValidatorTest.java index 69c0d4f..5d7ba1e7 100644 --- a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkValidatorTest.java +++ b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkValidatorTest.java
@@ -16,7 +16,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.Signature; import android.os.Bundle; @@ -233,7 +232,7 @@ * WebAPK and the WebAPK is valid. */ @Test - public void testIsValidWebApkReturnsTrueForValidWebApk() throws NameNotFoundException { + public void testIsValidWebApkReturnsTrueForValidWebApk() { mPackageManager.addPackage(newPackageInfoWithBrowserSignature( WEBAPK_PACKAGE_NAME, new Signature(EXPECTED_SIGNATURE), TEST_STARTURL)); @@ -291,8 +290,7 @@ * signatures, even if the second one matches the expected signature. */ @Test - public void testIsValidWebApkReturnsFalseForMoreThanTwoSignatures() - throws NameNotFoundException { + public void testIsValidWebApkReturnsFalseForMoreThanTwoSignatures() { Signature[] signatures = new Signature[] {new Signature(SIGNATURE_1), new Signature(EXPECTED_SIGNATURE), new Signature(SIGNATURE_2)}; mPackageManager.addPackage( @@ -307,8 +305,7 @@ * signatures but none of the signatures match the expected signature. */ @Test - public void testIsValidWebApkReturnsFalseForWebApkWithMultipleSignaturesWithoutAnyMatched() - throws NameNotFoundException { + public void testIsValidWebApkReturnsFalseForWebApkWithMultipleSignaturesWithoutAnyMatched() { Signature signatures[] = new Signature[] {new Signature(SIGNATURE_1), new Signature(SIGNATURE_2)}; mPackageManager.addPackage(
diff --git a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkVerifySignatureTest.java b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkVerifySignatureTest.java index 4c12f28..912dcb69 100644 --- a/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkVerifySignatureTest.java +++ b/chrome/android/webapk/libs/client/junit/src/org/chromium/webapk/lib/client/WebApkVerifySignatureTest.java
@@ -43,7 +43,7 @@ } @Test - public void testHexToBytes() throws Exception { + public void testHexToBytes() { byte[] empty = {}; assertArrayEquals(empty, WebApkVerifySignature.hexToBytes("")); byte[] test = {(byte) 0xFF, (byte) 0xFE, 0x00, 0x01}; @@ -53,7 +53,7 @@ } @Test - public void testCommentHash() throws Exception { + public void testCommentHash() { byte[] bytes = {(byte) 0xde, (byte) 0xca, (byte) 0xfb, (byte) 0xad}; assertEquals(null, WebApkVerifySignature.parseCommentSignature("weapk:decafbad")); assertEquals(null, WebApkVerifySignature.parseCommentSignature("webapk:"));
diff --git a/chrome/android/webapk/shell_apk/BUILD.gn b/chrome/android/webapk/shell_apk/BUILD.gn index 49284bb7..cd72acd 100644 --- a/chrome/android/webapk/shell_apk/BUILD.gn +++ b/chrome/android/webapk/shell_apk/BUILD.gn
@@ -332,6 +332,7 @@ "junit/src/org/chromium/webapk/shell_apk/HostBrowserLauncherParamsTest.java", "junit/src/org/chromium/webapk/shell_apk/HostBrowserUtilsTest.java", "junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java", + "junit/src/org/chromium/webapk/shell_apk/TestBrowserInstaller.java", "junit/src/org/chromium/webapk/shell_apk/WebApkServiceImplWrapperTest.java", "junit/src/org/chromium/webapk/shell_apk/WebApkUtilsTest.java", ] @@ -346,6 +347,7 @@ junit_binary("webapk_shell_apk_h2o_junit_tests") { java_files = [ "junit/src/org/chromium/webapk/shell_apk/CustomAndroidOsShadowAsyncTask.java", + "junit/src/org/chromium/webapk/shell_apk/TestBrowserInstaller.java", "junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java", "junit/src/org/chromium/webapk/shell_apk/h2o/SplashActivityTest.java", ]
diff --git a/chrome/android/webapk/shell_apk/current_version/current_version.gni b/chrome/android/webapk/shell_apk/current_version/current_version.gni index b24b291..3a8eaab3 100644 --- a/chrome/android/webapk/shell_apk/current_version/current_version.gni +++ b/chrome/android/webapk/shell_apk/current_version/current_version.gni
@@ -12,4 +12,4 @@ # //chrome/android/webapk/shell_apk:webapk is changed. This includes # Java files, Android resource files and AndroidManifest.xml. Does not affect # Chrome.apk -current_shell_apk_version = 107 +current_shell_apk_version = 108
diff --git a/chrome/android/webapk/shell_apk/javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java b/chrome/android/webapk/shell_apk/javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java index d5be7caf..744399ba 100644 --- a/chrome/android/webapk/shell_apk/javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java +++ b/chrome/android/webapk/shell_apk/javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java
@@ -130,7 +130,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mContext.unbindService(mServiceConnection); }
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/HostBrowserUtilsTest.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/HostBrowserUtilsTest.java index 4187e68..66c3ea4 100644 --- a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/HostBrowserUtilsTest.java +++ b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/HostBrowserUtilsTest.java
@@ -5,11 +5,7 @@ package org.chromium.webapk.shell_apk; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.ActivityInfo; -import android.content.pm.ApplicationInfo; -import android.content.pm.ResolveInfo; import android.os.Bundle; import androidx.annotation.IntDef; @@ -21,9 +17,7 @@ import org.robolectric.ParameterizedRobolectricTestRunner; import org.robolectric.ParameterizedRobolectricTestRunner.Parameters; import org.robolectric.RuntimeEnvironment; -import org.robolectric.Shadows; import org.robolectric.annotation.Config; -import org.robolectric.shadows.ShadowPackageManager; import org.chromium.testing.local.LocalRobolectricTestRunner; import org.chromium.webapk.lib.common.WebApkMetaDataKeys; @@ -34,9 +28,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; import java.util.List; -import java.util.Set; /** Tests for HostBrowserUtils. */ @RunWith(ParameterizedRobolectricTestRunner.class) @@ -66,10 +58,8 @@ BROWSERS_SUPPORTING_WEBAPKS, BROWSERS_NOT_SUPPORTING_WEBAPKS); private Context mContext; - private ShadowPackageManager mPackageManager; private SharedPreferences mSharedPrefs; - - private Set<String> mInstalledBrowsers = new HashSet<String>(); + private TestBrowserInstaller mBrowserInstaller = new TestBrowserInstaller(); // Whether we are testing with bound WebAPKs. private boolean mIsBoundWebApk; @@ -87,7 +77,6 @@ public void setUp() { mContext = RuntimeEnvironment.application; - mPackageManager = Shadows.shadowOf(mContext.getPackageManager()); mSharedPrefs = WebApkSharedPreferences.getPrefs(mContext); HostBrowserUtils.resetCachedHostPackageForTesting(); @@ -252,7 +241,7 @@ Assert.assertEquals(sharedPrefBrowserSupportingWebApks, HostBrowserUtils.computeHostBrowserPackageClearCachedDataOnChange(mContext)); - uninstallBrowser(sharedPrefBrowserSupportingWebApks); + mBrowserInstaller.uninstallBrowser(sharedPrefBrowserSupportingWebApks); Assert.assertNotEquals(sharedPrefBrowserSupportingWebApks, HostBrowserUtils.getCachedHostBrowserPackage(mContext)); Assert.assertNotEquals(sharedPrefBrowserSupportingWebApks, @@ -280,7 +269,7 @@ HostBrowserUtils.computeHostBrowserPackageClearCachedDataOnChange(mContext)); Assert.assertEquals("random", mSharedPrefs.getString(sharedPrefToTest, null)); - uninstallBrowser(sharedPrefBrowserSupportingWebApks); + mBrowserInstaller.uninstallBrowser(sharedPrefBrowserSupportingWebApks); Assert.assertNull( HostBrowserUtils.computeHostBrowserPackageClearCachedDataOnChange(mContext)); @@ -310,7 +299,7 @@ Assert.assertEquals(sharedPrefBrowserSupportingWebApks, HostBrowserUtils.getCachedHostBrowserPackage(mContext)); - uninstallBrowser(sharedPrefBrowserSupportingWebApks); + mBrowserInstaller.uninstallBrowser(sharedPrefBrowserSupportingWebApks); Assert.assertNull(HostBrowserUtils.getCachedHostBrowserPackage(mContext)); // SharedPreferences should be unaffected. @@ -335,61 +324,10 @@ private void setInstalledBrowsersAndClearedCachedData( @DefaultBrowserWebApkSupport int defaultBrowser, String[] newPackages) { HostBrowserUtils.resetCachedHostPackageForTesting(); - - while (!mInstalledBrowsers.isEmpty()) { - uninstallBrowser(mInstalledBrowsers.iterator().next()); - } - String defaultPackage = (defaultBrowser == DefaultBrowserWebApkSupport.YES) ? DEFAULT_BROWSER_SUPPORTING_WEBAPKS : DEFAULT_BROWSER_NOT_SUPPORTING_WEBAPKS; - installBrowser(defaultPackage); - if (newPackages != null) { - for (String newPackage : newPackages) { - installBrowser(newPackage); - } - } - } - - private void installBrowser(String packageName) { - if (mInstalledBrowsers.contains(packageName)) return; - - Intent intent = null; - try { - intent = WebApkUtils.getQueryInstalledBrowsersIntent(); - } catch (Exception e) { - Assert.fail(); - return; - } - mPackageManager.addResolveInfoForIntent(intent, newResolveInfo(packageName)); - mPackageManager.addPackage(packageName); - mInstalledBrowsers.add(packageName); - } - - /** - * Uninstall a browser. Note: this function only works for uninstalling the non default browser. - */ - private void uninstallBrowser(String packageName) { - Intent intent = null; - try { - intent = WebApkUtils.getQueryInstalledBrowsersIntent(); - } catch (Exception e) { - Assert.fail(); - return; - } - mPackageManager.removeResolveInfosForIntent(intent, packageName); - mPackageManager.removePackage(packageName); - mInstalledBrowsers.remove(packageName); - } - - private static ResolveInfo newResolveInfo(String packageName) { - ActivityInfo activityInfo = new ActivityInfo(); - activityInfo.packageName = packageName; - activityInfo.applicationInfo = new ApplicationInfo(); - activityInfo.applicationInfo.enabled = true; - ResolveInfo resolveInfo = new ResolveInfo(); - resolveInfo.activityInfo = activityInfo; - return resolveInfo; + mBrowserInstaller.setInstalledModernBrowsers(defaultPackage, newPackages); } private String getHostBrowserFromSharedPreferences() {
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java index 386207c6..7bf3ecf 100644 --- a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java +++ b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java
@@ -5,11 +5,7 @@ package org.chromium.webapk.shell_apk; import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Bundle; @@ -19,7 +15,6 @@ import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RuntimeEnvironment; -import org.robolectric.Shadows; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowApplication; @@ -43,7 +38,7 @@ @Before public void setUp() { mPackageManager = RuntimeEnvironment.application.getPackageManager(); - installBrowser(BROWSER_PACKAGE_NAME); + new TestBrowserInstaller().installModernBrowser(BROWSER_PACKAGE_NAME); } /** @@ -239,7 +234,7 @@ * launch intent are in fact propagated. */ @Test - public void testPropagatedDeepLinkExtras() throws Exception { + public void testPropagatedDeepLinkExtras() { final String startUrl = "https://www.google.com/"; Bundle extrasToPropagate = new Bundle(); @@ -280,29 +275,4 @@ Assert.assertEquals(HostBrowserLauncher.ACTION_START_WEBAPK, intent.getAction()); Assert.assertEquals(expectedStartUrl, intent.getStringExtra(WebApkConstants.EXTRA_URL)); } - - private void installBrowser(String browserPackageName) { - Intent intent = WebApkUtils.getQueryInstalledBrowsersIntent(); - Shadows.shadowOf(RuntimeEnvironment.application.getPackageManager()) - .addResolveInfoForIntent(intent, newResolveInfo(browserPackageName)); - Shadows.shadowOf(RuntimeEnvironment.application.getPackageManager()) - .addPackage(newPackageInfo(browserPackageName)); - } - - private static ResolveInfo newResolveInfo(String packageName) { - ActivityInfo activityInfo = new ActivityInfo(); - activityInfo.packageName = packageName; - ResolveInfo resolveInfo = new ResolveInfo(); - resolveInfo.activityInfo = activityInfo; - return resolveInfo; - } - - private static PackageInfo newPackageInfo(String packageName) { - PackageInfo packageInfo = new PackageInfo(); - packageInfo.packageName = packageName; - packageInfo.versionName = "10000.0.0.0"; - packageInfo.applicationInfo = new ApplicationInfo(); - packageInfo.applicationInfo.enabled = true; - return packageInfo; - } }
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/TestBrowserInstaller.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/TestBrowserInstaller.java new file mode 100644 index 0000000..5d37419 --- /dev/null +++ b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/TestBrowserInstaller.java
@@ -0,0 +1,100 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.webapk.shell_apk; + +import android.content.pm.ActivityInfo; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageInfo; +import android.content.pm.ResolveInfo; +import android.os.Bundle; + +import org.robolectric.RuntimeEnvironment; +import org.robolectric.Shadows; +import org.robolectric.shadows.ShadowPackageManager; + +import java.util.HashSet; +import java.util.Set; + +/** + * Helper class for JUnit tests. Contains utility methods for installing and uninstalling mock + * browsers. + */ +public class TestBrowserInstaller { + Set<String> mInstalledBrowsers = new HashSet<String>(); + + /** + * Changes the installed browsers to the passed-in list. + */ + public void setInstalledModernBrowsers(String defaultBrowserPackage, String[] newPackages) { + while (!mInstalledBrowsers.isEmpty()) { + uninstallBrowser(mInstalledBrowsers.iterator().next()); + } + + installModernBrowser(defaultBrowserPackage); + if (newPackages != null) { + for (String newPackage : newPackages) { + installModernBrowser(newPackage); + } + } + } + + /** + * Installs browser with the passed-in package name and large version name. + */ + public void installModernBrowser(String packageName) { + installBrowserWithVersion(packageName, "10000.0.0.0"); + } + + /** + * Installs browser with the passed-in package name and version code. + */ + public void installBrowserWithVersion(String packageName, String versionName) { + if (mInstalledBrowsers.contains(packageName)) return; + + ShadowPackageManager packageManager = getShadowPackageManager(); + packageManager.addResolveInfoForIntent( + WebApkUtils.getQueryInstalledBrowsersIntent(), newResolveInfo(packageName)); + packageManager.addPackage(newPackageInfo(packageName, versionName)); + + mInstalledBrowsers.add(packageName); + } + + /** + * Uninstalls browser with the given package name. + */ + public void uninstallBrowser(String packageName) { + if (!mInstalledBrowsers.contains(packageName)) return; + + ShadowPackageManager packageManager = getShadowPackageManager(); + packageManager.removeResolveInfosForIntent( + WebApkUtils.getQueryInstalledBrowsersIntent(), packageName); + packageManager.removePackage(packageName); + + mInstalledBrowsers.remove(packageName); + } + + private static ShadowPackageManager getShadowPackageManager() { + return Shadows.shadowOf(RuntimeEnvironment.application.getPackageManager()); + } + + private static ResolveInfo newResolveInfo(String packageName) { + ActivityInfo activityInfo = new ActivityInfo(); + activityInfo.packageName = packageName; + ResolveInfo resolveInfo = new ResolveInfo(); + resolveInfo.activityInfo = activityInfo; + return resolveInfo; + } + + private static PackageInfo newPackageInfo(String packageName, String versionName) { + PackageInfo packageInfo = new PackageInfo(); + packageInfo.packageName = packageName; + packageInfo.versionName = versionName; + packageInfo.applicationInfo = new ApplicationInfo(); + packageInfo.applicationInfo.packageName = packageName; + packageInfo.applicationInfo.enabled = true; + packageInfo.applicationInfo.metaData = new Bundle(); + return packageInfo; + } +}
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java index 5109af82..9621291 100644 --- a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java +++ b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java
@@ -10,11 +10,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.ActivityInfo; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Bundle; @@ -38,8 +34,8 @@ import org.chromium.webapk.shell_apk.CustomAndroidOsShadowAsyncTask; import org.chromium.webapk.shell_apk.HostBrowserLauncher; import org.chromium.webapk.shell_apk.HostBrowserUtils; +import org.chromium.webapk.shell_apk.TestBrowserInstaller; import org.chromium.webapk.shell_apk.WebApkSharedPreferences; -import org.chromium.webapk.shell_apk.WebApkUtils; import org.chromium.webapk.test.WebApkTestHelper; import java.util.ArrayList; @@ -62,6 +58,8 @@ private PackageManager mPackageManager; private ShadowPackageManager mShadowPackageManager; + private TestBrowserInstaller mTestBrowserInstaller = new TestBrowserInstaller(); + @Before public void setUp() { sWebApkPackageName = RuntimeEnvironment.application.getPackageName(); @@ -235,7 +233,7 @@ * yield an infinite loop. */ @Test - public void testDoesNotPropagateRelaunchDirective() throws Exception { + public void testDoesNotPropagateRelaunchDirective() { final String deepLinkUrl = "https://pwa.rocks/deep_link.html"; Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(deepLinkUrl)); @@ -454,9 +452,8 @@ /** Installs browser with the given package name and version. */ private void installBrowser(String browserPackageName, int version) { - Intent intent = WebApkUtils.getQueryInstalledBrowsersIntent(); - mShadowPackageManager.addResolveInfoForIntent(intent, newResolveInfo(browserPackageName)); - mShadowPackageManager.addPackage(newPackageInfo(browserPackageName, version)); + mTestBrowserInstaller.uninstallBrowser(browserPackageName); + mTestBrowserInstaller.installBrowserWithVersion(browserPackageName, version + "."); } private static void setAppTaskTopActivity(int taskId, Activity topActivity) { @@ -475,23 +472,4 @@ ShadowActivityManager shadowActivityManager = Shadows.shadowOf(activityManager); shadowActivityManager.setAppTasks(appTasks); } - - private static ResolveInfo newResolveInfo(String packageName) { - ActivityInfo activityInfo = new ActivityInfo(); - activityInfo.packageName = packageName; - ResolveInfo resolveInfo = new ResolveInfo(); - resolveInfo.activityInfo = activityInfo; - return resolveInfo; - } - - private static PackageInfo newPackageInfo(String packageName, int version) { - PackageInfo packageInfo = new PackageInfo(); - packageInfo.packageName = packageName; - packageInfo.versionName = version + "."; - packageInfo.applicationInfo = new ApplicationInfo(); - packageInfo.applicationInfo.packageName = packageName; - packageInfo.applicationInfo.enabled = true; - packageInfo.applicationInfo.metaData = new Bundle(); - return packageInfo; - } }
diff --git a/chrome/app/vector_icons/BUILD.gn b/chrome/app/vector_icons/BUILD.gn index db76a62..c6c62ef 100644 --- a/chrome/app/vector_icons/BUILD.gn +++ b/chrome/app/vector_icons/BUILD.gn
@@ -41,6 +41,7 @@ "cast_for_education.icon", "content_paste.icon", "cookie.icon", + "copy.icon", "crashed_tab.icon", "credit_card.icon", "default_touch_favicon.icon",
diff --git a/chrome/app/vector_icons/copy.icon b/chrome/app/vector_icons/copy.icon new file mode 100644 index 0000000..e02cd7e --- /dev/null +++ b/chrome/app/vector_icons/copy.icon
@@ -0,0 +1,30 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 24, +MOVE_TO, 16, 1, +H_LINE_TO, 4, +R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2, +R_V_LINE_TO, 14, +R_H_LINE_TO, 2, +V_LINE_TO, 3, +R_H_LINE_TO, 12, +V_LINE_TO, 1, +CLOSE, +R_MOVE_TO, 3, 4, +H_LINE_TO, 8, +R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2, +R_V_LINE_TO, 14, +R_CUBIC_TO, 0, 1.1f, 0.9f, 2, 2, 2, +R_H_LINE_TO, 11, +R_CUBIC_TO, 1.1f, 0, 2, -0.9f, 2, -2, +V_LINE_TO, 7, +R_CUBIC_TO, 0, -1.1f, -0.9f, -2, -2, -2, +CLOSE, +R_MOVE_TO, 0, 16, +H_LINE_TO, 8, +V_LINE_TO, 7, +R_H_LINE_TO, 11, +R_V_LINE_TO, 14, +CLOSE
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index ddbcb40..5d57d3a 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -4140,6 +4140,11 @@ flag_descriptions::kCupsPrintersUiOverhaulDescription, kOsCrOS, FEATURE_VALUE_TYPE(features::kCupsPrintersUiOverhaul)}, + {"reduce-display-notifications", + flag_descriptions::kReduceDisplayNotificationsName, + flag_descriptions::kReduceDisplayNotificationsDescription, kOsCrOS, + FEATURE_VALUE_TYPE(ash::features::kReduceDisplayNotifications)}, + {"use-search-click-for-right-click", flag_descriptions::kUseSearchClickForRightClickName, flag_descriptions::kUseSearchClickForRightClickDescription, kOsCrOS,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 2d98eee..41e0499 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -580,7 +580,7 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kUsageStatsFeature{"UsageStats", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kUserMediaScreenCapturing{ "UserMediaScreenCapturing", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/browser_switcher/browser_switcher_policy_migrator.cc b/chrome/browser/browser_switcher/browser_switcher_policy_migrator.cc index a1b3249a..011ae87 100644 --- a/chrome/browser/browser_switcher/browser_switcher_policy_migrator.cc +++ b/chrome/browser/browser_switcher/browser_switcher_policy_migrator.cc
@@ -18,8 +18,6 @@ namespace { -const char kLBSExtensionId[] = "heildphpnddilhkemkielfhnkaagiabh"; - void SecondsToMilliseconds(base::Value* val) { const int ms_per_second = 1000; *val = base::Value(val->GetInt() * ms_per_second); @@ -43,6 +41,8 @@ } // namespace +const char kLBSExtensionId[] = "heildphpnddilhkemkielfhnkaagiabh"; + BrowserSwitcherPolicyMigrator::BrowserSwitcherPolicyMigrator() = default; BrowserSwitcherPolicyMigrator::~BrowserSwitcherPolicyMigrator() = default;
diff --git a/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h b/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h index b2b91f2..0a2d5e1 100644 --- a/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h +++ b/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h
@@ -9,6 +9,8 @@ namespace browser_switcher { +extern const char kLBSExtensionId[]; + class BrowserSwitcherPolicyMigrator : public policy::ChromeExtensionPolicyMigrator { public:
diff --git a/chrome/browser/browser_switcher/browser_switcher_service.cc b/chrome/browser/browser_switcher/browser_switcher_service.cc index 7a0ffaf0..3ba79e0 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service.cc +++ b/chrome/browser/browser_switcher/browser_switcher_service.cc
@@ -262,6 +262,10 @@ return prefs_; } +Profile* BrowserSwitcherService::profile() { + return profile_; +} + XmlDownloader* BrowserSwitcherService::sitelist_downloader() { return sitelist_downloader_.get(); }
diff --git a/chrome/browser/browser_switcher/browser_switcher_service.h b/chrome/browser/browser_switcher/browser_switcher_service.h index bac8b38..6a5e4cfed 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service.h +++ b/chrome/browser/browser_switcher/browser_switcher_service.h
@@ -130,6 +130,7 @@ AlternativeBrowserDriver* driver(); BrowserSwitcherSitelist* sitelist(); BrowserSwitcherPrefs& prefs(); + Profile* profile(); base::TimeDelta fetch_delay(); base::TimeDelta refresh_delay();
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc b/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc index bcbe6bbe..037ad7c 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc +++ b/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc
@@ -32,7 +32,13 @@ #if defined(OS_WIN) #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" +#include "chrome/browser/browser_switcher/browser_switcher_policy_migrator.h" #include "chrome/browser/browser_switcher/browser_switcher_service_win.h" +#include "chrome/browser/extensions/extension_service.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/browser/extension_system.h" +#include "extensions/common/extension.h" +#include "extensions/common/extension_builder.h" #endif namespace browser_switcher { @@ -870,7 +876,7 @@ policy_provider().UpdateChromePolicy(policies); base::RunLoop().RunUntilIdle(); - base::CreateDirectory(cache_dir()); + ASSERT_TRUE(base::CreateDirectory(cache_dir())); base::WriteFile(sitelist_cache_file_path(), "", 0); ASSERT_TRUE(base::PathExists(sitelist_cache_file_path())); @@ -913,6 +919,51 @@ action_timeout()); run_loop.Run(); } + +IN_PROC_BROWSER_TEST_F(BrowserSwitcherServiceTest, + DoesNotDeleteIfExtensionIsEnabled) { + base::ScopedAllowBlockingForTesting allow_blocking; + + // No policies configured. + + // LBS extension is installed. + auto extension = extensions::ExtensionBuilder() + .SetLocation(extensions::Manifest::INTERNAL) + .SetID(kLBSExtensionId) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "Legacy Browser Support") + .Set("manifest_version", 2) + .Set("version", "5.9") + .Build()) + .Build(); + extensions::ExtensionSystem::Get(browser()->profile()) + ->extension_service() + ->AddExtension(extension.get()); + + // Cache files already exist. + ASSERT_TRUE(base::CreateDirectory(cache_dir())); + base::WriteFile(cache_file_path(), "", 0); + base::WriteFile(sitelist_cache_file_path(), "", 0); + ASSERT_TRUE(base::PathExists(cache_file_path())); + ASSERT_TRUE(base::PathExists(sitelist_cache_file_path())); + + BrowserSwitcherServiceFactory::GetForBrowserContext(browser()->profile()); + base::RunLoop run_loop; + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, + base::BindOnce( + [](base::FilePath cache_dir, base::FilePath cache_file_path, + base::FilePath sitelist_cache_file_path, base::OnceClosure quit) { + EXPECT_TRUE(base::PathExists(cache_dir)); + EXPECT_TRUE(base::PathExists(cache_file_path)); + EXPECT_TRUE(base::PathExists(sitelist_cache_file_path)); + std::move(quit).Run(); + }, + cache_dir(), cache_file_path(), sitelist_cache_file_path(), + run_loop.QuitClosure()), + action_timeout()); + run_loop.Run(); +} #endif } // namespace browser_switcher
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_win.cc b/chrome/browser/browser_switcher/browser_switcher_service_win.cc index 196725c6..4544b61 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service_win.cc +++ b/chrome/browser/browser_switcher/browser_switcher_service_win.cc
@@ -21,10 +21,12 @@ #include "base/task/post_task.h" #include "base/task/task_traits.h" #include "base/win/registry.h" +#include "chrome/browser/browser_switcher/browser_switcher_policy_migrator.h" #include "chrome/browser/browser_switcher/browser_switcher_prefs.h" #include "chrome/browser/browser_switcher/browser_switcher_sitelist.h" #include "chrome/browser/browser_switcher/ieem_sitelist_parser.h" #include "chrome/browser/profiles/profile.h" +#include "extensions/browser/extension_registry.h" namespace browser_switcher { @@ -140,6 +142,13 @@ return ieem_sitelist_url_for_testing.get(); } +bool IsLBSExtensionEnabled(Profile* profile) { + auto* reg = extensions::ExtensionRegistry::Get(profile); + DCHECK(reg); + return reg->GetExtensionById(kLBSExtensionId, + extensions::ExtensionRegistry::ENABLED); +} + } // namespace BrowserSwitcherServiceWin::BrowserSwitcherServiceWin(Profile* profile) @@ -148,14 +157,7 @@ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) { - if (prefs().IsEnabled()) - SavePrefsToFile(); - else - DeletePrefsFile(); - - // Clean up sitelistcache.dat from the extension, or from a previous Chrome - // version. - DeleteSitelistCacheFile(); + UpdateAllCacheFiles(); } BrowserSwitcherServiceWin::~BrowserSwitcherServiceWin() = default; @@ -165,10 +167,7 @@ const std::vector<std::string>& changed_prefs) { BrowserSwitcherService::OnBrowserSwitcherPrefsChanged(prefs, changed_prefs); - if (prefs->IsEnabled()) - SavePrefsToFile(); - else - DeletePrefsFile(); + UpdateAllCacheFiles(); } // static @@ -239,21 +238,36 @@ } void BrowserSwitcherServiceWin::SavePrefsToFile() { + DCHECK(prefs().IsEnabled()); sequenced_task_runner_->PostTask( FROM_HERE, base::BindOnce(&SaveDataToFile, SerializeCacheFile(prefs(), sitelist()), "cache.dat")); } -void BrowserSwitcherServiceWin::DeletePrefsFile() const { +void BrowserSwitcherServiceWin::DeletePrefsFile() { sequenced_task_runner_->PostTask( FROM_HERE, base::BindOnce(&DoRemoveFileFromCacheDir, "cache.dat")); } -void BrowserSwitcherServiceWin::DeleteSitelistCacheFile() const { +void BrowserSwitcherServiceWin::DeleteSitelistCacheFile() { sequenced_task_runner_->PostTask( FROM_HERE, base::BindOnce(&DoRemoveFileFromCacheDir, "sitelistcache.dat")); } +void BrowserSwitcherServiceWin::UpdateAllCacheFiles() { + const bool has_extension = IsLBSExtensionEnabled(profile()); + + if (prefs().IsEnabled()) + SavePrefsToFile(); + else if (!has_extension) + DeletePrefsFile(); + + // Clean up sitelistcache.dat from the extension, or from a previous Chrome + // version. + if (!has_extension) + DeleteSitelistCacheFile(); +} + } // namespace browser_switcher
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_win.h b/chrome/browser/browser_switcher/browser_switcher_service_win.h index 14aefc56..a10504ce 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service_win.h +++ b/chrome/browser/browser_switcher/browser_switcher_service_win.h
@@ -48,10 +48,14 @@ void SavePrefsToFile(); // Delete the "cache.dat" file created by |SavePrefsToFile()|. This call does // not block, it only posts a task to a worker thread. - void DeletePrefsFile() const; + void DeletePrefsFile(); // Delete the "sitelistcache.dat" file that might be left from the LBS // extension, or from a previous Chrome version. Called during initialization. - void DeleteSitelistCacheFile() const; + void DeleteSitelistCacheFile(); + + // Updates or cleans up cache.dat and sitelistcache.dat, based on whether + // BrowserSwitcher is enabled or disabled. + void UpdateAllCacheFiles(); scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc index 0f43410..24f8d47 100644 --- a/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc +++ b/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc
@@ -266,7 +266,7 @@ const ExternalInstallInfoFile& info) override { const extensions::Extension* existing = extension_registry_->GetExtensionById( - info.extension_id, extensions::ExtensionRegistry::COMPATIBILITY); + info.extension_id, extensions::ExtensionRegistry::EVERYTHING); // Alredy exists, and does not require update. if (existing && existing->version().CompareTo(info.version) >= 0) return false; @@ -286,7 +286,7 @@ const ExternalInstallInfoUpdateUrl& info, bool is_initial_load) override { if (extension_registry_->GetExtensionById( - info.extension_id, extensions::ExtensionRegistry::COMPATIBILITY)) + info.extension_id, extensions::ExtensionRegistry::EVERYTHING)) return false; if (!extension_service_->pending_extension_manager()
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc index 3902b04..04992c9 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
@@ -66,27 +66,16 @@ return gfx::Image(gfx::CreateVectorIcon(icon, kDeviceIconSize, color)); } -// Adds remote devices to |picker_entries| and returns the new list. The devices -// are added to the beginning of the list. -std::vector<apps::IntentPickerAppInfo> MaybeAddDevices( - const GURL& url, - WebContents* web_contents, +// Adds |devices| to |picker_entries| and returns the new list. The devices are +// added to the beginning of the list. +std::vector<apps::IntentPickerAppInfo> AddDevices( + const std::vector<std::unique_ptr<syncer::DeviceInfo>>& devices, std::vector<apps::IntentPickerAppInfo> picker_entries) { - if (!ShouldOfferClickToCallForURL(web_contents->GetBrowserContext(), url)) - return picker_entries; - - ClickToCallUiController* controller = - ClickToCallUiController::GetOrCreateFromWebContents(web_contents); - if (!controller) - return picker_entries; - - controller->UpdateDevices(); - if (controller->devices().empty()) - return picker_entries; + DCHECK(!devices.empty()); // First add all devices to the list. std::vector<apps::IntentPickerAppInfo> all_entries; - for (const auto& device : controller->devices()) { + for (const auto& device : devices) { all_entries.emplace_back(apps::PickerEntryType::kDevice, CreateDeviceIcon(device->device_type()), device->guid(), device->client_name()); @@ -113,21 +102,35 @@ if (!browser) return false; - std::vector<apps::IntentPickerAppInfo> all_apps = - MaybeAddDevices(url, web_contents, std::move(app_info)); + bool has_apps = !app_info.empty(); + bool has_devices = false; - if (all_apps.empty()) + PageActionIconType icon_type = PageActionIconType::kIntentPicker; + ClickToCallUiController* controller = nullptr; + + if (ShouldOfferClickToCallForURL(web_contents->GetBrowserContext(), url)) { + icon_type = PageActionIconType::kClickToCall; + controller = + ClickToCallUiController::GetOrCreateFromWebContents(web_contents); + controller->UpdateDevices(); + + const auto& devices = controller->devices(); + has_devices = !devices.empty(); + if (has_devices) + app_info = AddDevices(devices, std::move(app_info)); + } + + if (app_info.empty()) return false; - PageActionIconType icon_type = - ShouldOfferClickToCallForURL(web_contents->GetBrowserContext(), url) - ? PageActionIconType::kClickToCall - : PageActionIconType::kIntentPicker; IntentPickerTabHelper::SetShouldShowIcon( web_contents, icon_type == PageActionIconType::kIntentPicker); - browser->window()->ShowIntentPickerBubble(std::move(all_apps), stay_in_chrome, - show_remember_selection, icon_type, - std::move(callback)); + browser->window()->ShowIntentPickerBubble( + std::move(app_info), stay_in_chrome, show_remember_selection, icon_type, + base::BindOnce(std::move(callback))); + + if (controller) + controller->OnDialogShown(has_devices, has_apps); return true; }
diff --git a/chrome/browser/chromeos/extensions/printing_metrics/OWNERS b/chrome/browser/chromeos/extensions/printing_metrics/OWNERS new file mode 100644 index 0000000..85e681a --- /dev/null +++ b/chrome/browser/chromeos/extensions/printing_metrics/OWNERS
@@ -0,0 +1,2 @@ +nikitapodguzov@chromium.org +skau@chromium.org
diff --git a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc index 087994c9a..57b8be8 100644 --- a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
@@ -746,7 +746,8 @@ // LocalFileSystemExtensionApiTests. // -IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileSystemOperations) { +IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, + DISABLED_FileSystemOperations) { EXPECT_TRUE(RunFileSystemExtensionApiTest( "file_browser/filesystem_operations_test", FILE_PATH_LITERAL("manifest.json"),
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc b/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc index f31b091e..f96cdef 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc
@@ -80,8 +80,8 @@ extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); - const extensions::Extension* extension = extension_registry->GetExtensionById( - extension_id, extensions::ExtensionRegistry::COMPATIBILITY); + const extensions::Extension* extension = + extension_registry->enabled_extensions().GetByID(extension_id); if (!extension) { // We've already done too much setup at this point to just return out, it // is safer to just restart.
diff --git a/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc b/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc index b89d855..1fa7f73 100644 --- a/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc +++ b/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc
@@ -210,11 +210,15 @@ DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); }; -IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { +// Flaky. https://crbug.com/1005456. +IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, + DISABLED_PRE_OpenPortalDialog) { StartupUtils::MarkOobeCompleted(); } -IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { +// Flaky. https://crbug.com/1005456. +IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, + DISABLED_OpenPortalDialog) { LoginDisplayHost* host = LoginDisplayHost::default_host(); ASSERT_TRUE(host); OobeUI* oobe = host->GetOobeUI();
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc index ec736215..6ca97f21 100644 --- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -1179,12 +1179,11 @@ ASSERT_TRUE(profile); extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); - EXPECT_TRUE(extension_registry->GetExtensionById( - kHostedAppID, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(extension_registry->enabled_extensions().GetByID(kHostedAppID)); // Verify that the extension was not installed. EXPECT_FALSE(extension_registry->GetExtensionById( - kGoodExtensionID, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodExtensionID, extensions::ExtensionRegistry::EVERYTHING)); // Verify that the app was downloaded to the account's extension cache. base::FilePath test_dir; @@ -1265,12 +1264,11 @@ ASSERT_TRUE(profile); extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); - EXPECT_TRUE(extension_registry->GetExtensionById( - kHostedAppID, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(extension_registry->enabled_extensions().GetByID(kHostedAppID)); // Verify that the extension was not installed. EXPECT_FALSE(extension_registry->GetExtensionById( - kGoodExtensionID, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodExtensionID, extensions::ExtensionRegistry::EVERYTHING)); // Verify that the app is still in the account's extension cache. { @@ -2352,8 +2350,8 @@ ASSERT_TRUE(profile); extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); - EXPECT_TRUE(extension_registry->GetExtensionById( - kShowManagedStorageID, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE( + extension_registry->enabled_extensions().GetByID(kShowManagedStorageID)); // Wait for the app policy if it hasn't been fetched yet. ProfilePolicyConnector* connector = profile->GetProfilePolicyConnector();
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc index b59f26f..b04c883 100644 --- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc +++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -1004,6 +1004,35 @@ nullptr); } } + + if (container.has_login_screen_sticky_keys_enabled()) { + PolicyLevel level; + if (GetPolicyLevel( + container.has_login_screen_sticky_keys_enabled_options(), + container.login_screen_sticky_keys_enabled_options(), &level)) { + policies->Set(key::kDeviceLoginScreenStickyKeysEnabled, level, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>( + container.login_screen_sticky_keys_enabled()), + nullptr); + } + } + + if (container.has_login_screen_keyboard_focus_highlight_enabled()) { + PolicyLevel level; + if (GetPolicyLevel( + container + .has_login_screen_keyboard_focus_highlight_enabled_options(), + container.login_screen_keyboard_focus_highlight_enabled_options(), + &level)) { + policies->Set( + key::kDeviceLoginScreenKeyboardFocusHighlightEnabled, level, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>( + container.login_screen_keyboard_focus_highlight_enabled()), + nullptr); + } + } } }
diff --git a/chrome/browser/chromeos/policy/login_profile_policy_provider.cc b/chrome/browser/chromeos/policy/login_profile_policy_provider.cc index 362525c3..d1eb594 100644 --- a/chrome/browser/chromeos/policy/login_profile_policy_provider.cc +++ b/chrome/browser/chromeos/policy/login_profile_policy_provider.cc
@@ -51,6 +51,9 @@ {key::kDeviceLoginScreenCaretHighlightEnabled, key::kCaretHighlightEnabled}, {key::kDeviceLoginScreenMonoAudioEnabled, key::kMonoAudioEnabled}, {key::kDeviceLoginScreenAutoclickEnabled, key::kAutoclickEnabled}, + {key::kDeviceLoginScreenStickyKeysEnabled, key::kStickyKeysEnabled}, + {key::kDeviceLoginScreenKeyboardFocusHighlightEnabled, + key::kKeyboardFocusHighlightEnabled}, }; const DevicePolicyToUserPolicyMapEntry kRecommendedDevicePoliciesMap[] = {
diff --git a/chrome/browser/chromeos/policy/login_screen_accessibility_policy_browsertest.cc b/chrome/browser/chromeos/policy/login_screen_accessibility_policy_browsertest.cc index baf9360..48c9ef5 100644 --- a/chrome/browser/chromeos/policy/login_screen_accessibility_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/login_screen_accessibility_policy_browsertest.cc
@@ -803,4 +803,109 @@ accessibility_manager->EnableAutoclick(false); EXPECT_FALSE(accessibility_manager->IsAutoclickEnabled()); } + +IN_PROC_BROWSER_TEST_F(LoginScreenAccessibilityPolicyBrowsertest, + DeviceLoginScreenStickyKeysEnabled) { + // Verifies that the state of the sticky keys accessibility feature on + // the login screen can be controlled through device policy. + chromeos::AccessibilityManager* accessibility_manager = + chromeos::AccessibilityManager::Get(); + ASSERT_TRUE(accessibility_manager); + EXPECT_FALSE(accessibility_manager->IsStickyKeysEnabled()); + + // Manually enable the sticky keys. + accessibility_manager->EnableStickyKeys(true); + EXPECT_TRUE(accessibility_manager->IsStickyKeysEnabled()); + + // Disable the sticky keys through device policy and wait for the change + // to take effect. + em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); + proto.mutable_accessibility_settings()->set_login_screen_sticky_keys_enabled( + false); + RefreshDevicePolicyAndWaitForPrefChange( + ash::prefs::kAccessibilityStickyKeysEnabled); + + // Verify that the pref which controls the sticky keys in the login + // profile is managed by the policy. + EXPECT_TRUE(IsPrefManaged(ash::prefs::kAccessibilityStickyKeysEnabled)); + EXPECT_EQ(base::Value(false), + GetPrefValue(ash::prefs::kAccessibilityStickyKeysEnabled)); + + // Verify that the sticky keys cannot be enabled manually anymore. + accessibility_manager->EnableStickyKeys(true); + EXPECT_FALSE(accessibility_manager->IsStickyKeysEnabled()); + + // Enable the sticky keys through device policy as a recommended value and + // wait for the change to take effect. + proto.mutable_accessibility_settings()->set_login_screen_sticky_keys_enabled( + true); + proto.mutable_accessibility_settings() + ->mutable_login_screen_sticky_keys_enabled_options() + ->set_mode(em::PolicyOptions::RECOMMENDED); + RefreshDevicePolicyAndWaitForPrefChange( + ash::prefs::kAccessibilityStickyKeysEnabled); + + // Verify that the pref which controls the sticky keys in the login + // profile is being applied as recommended by the policy. + EXPECT_FALSE(IsPrefManaged(ash::prefs::kAccessibilityStickyKeysEnabled)); + EXPECT_EQ(base::Value(true), + GetPrefValue(ash::prefs::kAccessibilityStickyKeysEnabled)); + + // Verify that the sticky keys can be enabled manually again. + accessibility_manager->EnableStickyKeys(false); + EXPECT_FALSE(accessibility_manager->IsStickyKeysEnabled()); +} + +IN_PROC_BROWSER_TEST_F(LoginScreenAccessibilityPolicyBrowsertest, + DeviceLoginScreenKeyboardFocusHighlightEnabled) { + // Verifies that the state of the keyboard focus highlight accessibility + // feature on the login screen can be controlled through device policy. + chromeos::AccessibilityManager* accessibility_manager = + chromeos::AccessibilityManager::Get(); + ASSERT_TRUE(accessibility_manager); + EXPECT_FALSE(accessibility_manager->IsFocusHighlightEnabled()); + + // Manually enable the keyboard focus highlight. + accessibility_manager->SetFocusHighlightEnabled(true); + EXPECT_TRUE(accessibility_manager->IsFocusHighlightEnabled()); + + // Disable the keyboard focus highlight through device policy and wait for the + // change to take effect. + em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); + proto.mutable_accessibility_settings() + ->set_login_screen_keyboard_focus_highlight_enabled(false); + RefreshDevicePolicyAndWaitForPrefChange( + ash::prefs::kAccessibilityFocusHighlightEnabled); + + // Verify that the pref which controls the keyboard focus highlight in the + // login profile is managed by the policy. + EXPECT_TRUE(IsPrefManaged(ash::prefs::kAccessibilityFocusHighlightEnabled)); + EXPECT_EQ(base::Value(false), + GetPrefValue(ash::prefs::kAccessibilityFocusHighlightEnabled)); + + // Verify that the keyboard focus highlight cannot be enabled manually + // anymore. + accessibility_manager->SetFocusHighlightEnabled(true); + EXPECT_FALSE(accessibility_manager->IsFocusHighlightEnabled()); + + // Enable the keyboard focus highlight through device policy as a recommended + // value and wait for the change to take effect. + proto.mutable_accessibility_settings() + ->set_login_screen_keyboard_focus_highlight_enabled(true); + proto.mutable_accessibility_settings() + ->mutable_login_screen_keyboard_focus_highlight_enabled_options() + ->set_mode(em::PolicyOptions::RECOMMENDED); + RefreshDevicePolicyAndWaitForPrefChange( + ash::prefs::kAccessibilityFocusHighlightEnabled); + + // Verify that the pref which controls the keyboard focus highlight in the + // login profile is being applied as recommended by the policy. + EXPECT_FALSE(IsPrefManaged(ash::prefs::kAccessibilityFocusHighlightEnabled)); + EXPECT_EQ(base::Value(true), + GetPrefValue(ash::prefs::kAccessibilityFocusHighlightEnabled)); + + // Verify that the keyboard focus highlight can be enabled manually again. + accessibility_manager->SetFocusHighlightEnabled(false); + EXPECT_FALSE(accessibility_manager->IsFocusHighlightEnabled()); +} } // namespace policy
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager.cc b/chrome/browser/chromeos/scheduler_configuration_manager.cc index ffe6024..b2cfb62 100644 --- a/chrome/browser/chromeos/scheduler_configuration_manager.cc +++ b/chrome/browser/chromeos/scheduler_configuration_manager.cc
@@ -83,16 +83,23 @@ // NB: Also send an update when the config gets reset to let the system pick // whatever default. Note that the value we read in this case will be the // default specified on pref registration, e.g. empty string. - debug_daemon_client_->SetSchedulerConfiguration( + debug_daemon_client_->SetSchedulerConfigurationV2( config_name, + /*lock_policy=*/false, base::BindOnce(&SchedulerConfigurationManager::OnConfigurationSet, weak_ptr_factory_.GetWeakPtr())); } -void SchedulerConfigurationManager::OnConfigurationSet(bool result) { - if (!result) { +void SchedulerConfigurationManager::OnConfigurationSet( + bool result, + size_t num_cores_disabled) { + if (result) { + VLOG(1) << num_cores_disabled << " logical CPU cores are disabled"; + } else { LOG(ERROR) << "Failed to update scheduler configuration"; } + for (Observer& obs : observer_list_) + obs.OnConfigurationSet(result, num_cores_disabled); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager.h b/chrome/browser/chromeos/scheduler_configuration_manager.h index b4c63a8..69c493c8 100644 --- a/chrome/browser/chromeos/scheduler_configuration_manager.h +++ b/chrome/browser/chromeos/scheduler_configuration_manager.h
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "chromeos/system/scheduler_configuration_manager_base.h" #include "components/prefs/pref_change_registrar.h" class PrefRegistrySimple; @@ -25,18 +26,18 @@ // For more information on why H/T is configurable, see // https://www.chromium.org/chromium-os/mds-on-chromeos // -class SchedulerConfigurationManager { +class SchedulerConfigurationManager : public SchedulerConfigurationManagerBase { public: SchedulerConfigurationManager(DebugDaemonClient* debug_daemon_client, PrefService* local_state); - ~SchedulerConfigurationManager(); + ~SchedulerConfigurationManager() override; static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); private: void OnDebugDaemonReady(bool service_is_ready); void OnPrefChange(); - void OnConfigurationSet(bool result); + void OnConfigurationSet(bool result, size_t num_cores_disabled); DebugDaemonClient* debug_daemon_client_ = nullptr; PrefChangeRegistrar observer_;
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc b/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc index b406a35..842b58f 100644 --- a/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc +++ b/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc
@@ -17,17 +17,26 @@ namespace chromeos { -class SchedulerConfigurationManagerTest : public testing::Test { +class SchedulerConfigurationManagerTest + : public testing::Test, + public SchedulerConfigurationManagerBase::Observer { public: SchedulerConfigurationManagerTest() { SchedulerConfigurationManager::RegisterLocalStatePrefs( local_state_.registry()); } + // SchedulerConfigurationManagerBase::Observer: + void OnConfigurationSet(bool success, size_t num_cores_disabled) override { + ++configuration_set_count_; + } + base::test::TaskEnvironment task_environment_; FakeDebugDaemonClient debug_daemon_client_; TestingPrefServiceSimple local_state_; + + size_t configuration_set_count_ = 0; }; TEST_F(SchedulerConfigurationManagerTest, Startup) { @@ -36,49 +45,61 @@ // Manager waits on initialization for service to be available. SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); + manager.AddObserver(this); + task_environment_.RunUntilIdle(); EXPECT_EQ("", debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(0u, configuration_set_count_); // Config changes don't lead to updates while debugd isn't ready. local_state_.SetString(prefs::kSchedulerConfiguration, "config"); task_environment_.RunUntilIdle(); EXPECT_EQ("", debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(0u, configuration_set_count_); // Once the debugd service becomes available, the config gets set. debug_daemon_client_.SetServiceIsAvailable(true); task_environment_.RunUntilIdle(); EXPECT_EQ("config", debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(1u, configuration_set_count_); } TEST_F(SchedulerConfigurationManagerTest, ConfigChange) { // Correct default is used when there is no configured value. SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); + manager.AddObserver(this); + task_environment_.RunUntilIdle(); EXPECT_EQ(debugd::scheduler_configuration::kConservativeScheduler, debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(1u, configuration_set_count_); // Change user pref, which should trigger a config change. local_state_.SetUserPref(prefs::kSchedulerConfiguration, std::make_unique<base::Value>("user")); task_environment_.RunUntilIdle(); EXPECT_EQ("user", debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(2u, configuration_set_count_); // Set a policy, which should override the user setting local_state_.SetManagedPref(prefs::kSchedulerConfiguration, std::make_unique<base::Value>("policy")); task_environment_.RunUntilIdle(); EXPECT_EQ("policy", debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(3u, configuration_set_count_); // Dropping the user pref doesn't change anything. local_state_.RemoveUserPref(prefs::kSchedulerConfiguration); task_environment_.RunUntilIdle(); EXPECT_EQ("policy", debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(4u, configuration_set_count_); // Dropping the policy as well reverts to the default configuration. local_state_.RemoveManagedPref(prefs::kSchedulerConfiguration); task_environment_.RunUntilIdle(); EXPECT_EQ(debugd::scheduler_configuration::kConservativeScheduler, debug_daemon_client_.scheduler_configuration_name()); + EXPECT_EQ(5u, configuration_set_count_); } TEST_F(SchedulerConfigurationManagerTest, FinchDefault) {
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 18cd43b8..fd04b3e 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -3300,8 +3300,10 @@ // This test ensures that a cross-domain download correctly sets the referrer // according to the referrer policy. +// +// Disabled because flaky. See https://crbug.com/1009022. IN_PROC_BROWSER_TEST_P(DownloadReferrerPolicyTest, - DownloadCrossDomainReferrerPolicy) { + DISABLED_DownloadCrossDomainReferrerPolicy) { embedded_test_server()->RegisterRequestHandler( base::Bind(&ServerRedirectRequestHandler)); embedded_test_server()->RegisterRequestHandler(
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc index c90d6a5..dc419d2 100644 --- a/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc +++ b/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
@@ -50,7 +50,6 @@ personal_data_->RemoveObserver(this); } -// TODO(crbug.com/923868): Change the 2 calls to a single OnPersonalDataChanged. void AutofillPrivateEventRouter::OnPersonalDataChanged() { // Ignore any updates before data is loaded. This can happen in tests. if (!(personal_data_ && personal_data_->IsDataLoaded())) @@ -58,24 +57,20 @@ autofill_util::AddressEntryList addressList = extensions::autofill_util::GenerateAddressList(*personal_data_); - std::unique_ptr<base::ListValue> args( - api::autofill_private::OnAddressListChanged::Create(addressList) - .release()); - std::unique_ptr<Event> extension_event( - new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED, - api::autofill_private::OnAddressListChanged::kEventName, - std::move(args))); - event_router_->BroadcastEvent(std::move(extension_event)); autofill_util::CreditCardEntryList creditCardList = extensions::autofill_util::GenerateCreditCardList(*personal_data_); - args.reset( - api::autofill_private::OnCreditCardListChanged::Create(creditCardList) + + std::unique_ptr<base::ListValue> args( + api::autofill_private::OnPersonalDataChanged::Create(addressList, + creditCardList) .release()); - extension_event.reset( - new Event(events::AUTOFILL_PRIVATE_ON_CREDIT_CARD_LIST_CHANGED, - api::autofill_private::OnCreditCardListChanged::kEventName, + + std::unique_ptr<Event> extension_event( + new Event(events::AUTOFILL_PRIVATE_ON_PERSONAL_DATA_CHANGED, + api::autofill_private::OnPersonalDataChanged::kEventName, std::move(args))); + event_router_->BroadcastEvent(std::move(extension_event)); }
diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index 93f3c8d..64291f90 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -245,15 +245,12 @@ // Install low-permission version of the extension. ASSERT_TRUE(InstallExtension(path_v1, 1)); - EXPECT_TRUE(extension_registry()->GetExtensionById( - kId, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(extension_registry()->enabled_extensions().GetByID(kId)); // Update to a high-permission version - it should get disabled. EXPECT_FALSE(UpdateExtension(kId, path_v2, -1)); - EXPECT_FALSE(extension_registry()->GetExtensionById( - kId, ExtensionRegistry::ENABLED)); - EXPECT_TRUE(extension_registry()->GetExtensionById( - kId, ExtensionRegistry::COMPATIBILITY)); + EXPECT_FALSE(extension_registry()->enabled_extensions().GetByID(kId)); + EXPECT_TRUE(extension_registry()->disabled_extensions().GetByID(kId)); EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile()) ->DidExtensionEscalatePermissions(kId)); } @@ -347,9 +344,7 @@ extension_service()->AddExtension(target_extension.get()); SetEnabled(false, true, std::string(), source_extension); SetEnabled(true, true, std::string(), source_extension); - const Extension* extension = - extension_registry()->GetExtensionById(kId, ExtensionRegistry::ENABLED); - EXPECT_TRUE(extension); + EXPECT_TRUE(extension_registry()->enabled_extensions().GetByID(kId)); } }
diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc index bbc3cb9f..82be4ae2 100644 --- a/chrome/browser/extensions/api/management/management_apitest.cc +++ b/chrome/browser/extensions/api/management/management_apitest.cc
@@ -340,9 +340,8 @@ extensions::ScopedTestDialogAutoConfirm::ACCEPT); extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry::Get(browser()->profile()); - EXPECT_TRUE( - registry->GetExtensionById(extension_ids_["enabled_extension"], - extensions::ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry->enabled_extensions().GetByID( + extension_ids_["enabled_extension"])); // Ensure that all actions are allowed. extensions::ExtensionSystem::Get( @@ -353,7 +352,7 @@ // The last thing the test does is uninstall the "enabled_extension". EXPECT_FALSE( registry->GetExtensionById(extension_ids_["enabled_extension"], - extensions::ExtensionRegistry::COMPATIBILITY)); + extensions::ExtensionRegistry::EVERYTHING)); } // Fails often on Windows dbg bots. http://crbug.com/177163 @@ -368,9 +367,8 @@ LoadExtensions(); extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry::Get(browser()->profile()); - EXPECT_TRUE( - registry->GetExtensionById(extension_ids_["enabled_extension"], - extensions::ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry->enabled_extensions().GetByID( + extension_ids_["enabled_extension"])); // Prohibit status changes. extensions::ManagementPolicy* policy = extensions::ExtensionSystem::Get( @@ -410,7 +408,7 @@ UninstallExtension(app_id); ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); ASSERT_FALSE(registry->GetExtensionById( - app_id, extensions::ExtensionRegistry::COMPATIBILITY)); + app_id, extensions::ExtensionRegistry::EVERYTHING)); // Set a pref indicating that the user wants to launch in a regular tab. // This should be ignored, because panel apps always load in a popup. @@ -468,7 +466,7 @@ UninstallExtension(app_id); ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); ASSERT_FALSE(registry->GetExtensionById( - app_id, extensions::ExtensionRegistry::COMPATIBILITY)); + app_id, extensions::ExtensionRegistry::EVERYTHING)); // Set a pref indicating that the user wants to launch in a window. extensions::SetLaunchType(browser()->profile(), app_id,
diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc index 91b2e2c..265e4a2 100644 --- a/chrome/browser/extensions/api/management/management_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_browsertest.cc
@@ -261,8 +261,7 @@ // it being disabled, since good.crx has permissions that require approval. std::string id = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; ASSERT_FALSE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 0)); - ASSERT_TRUE(extension_registry()->GetExtensionById( - id, ExtensionRegistry::COMPATIBILITY)); + ASSERT_TRUE(extension_registry()->disabled_extensions().GetByID(id)); UninstallExtension(id); // And the install should succeed when the permissions are accepted. @@ -445,8 +444,8 @@ install_observer.WaitForExtensionWillBeInstalled(); EXPECT_TRUE(listener2.WaitUntilSatisfied()); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", - ExtensionRegistry::ENABLED); + extension = registry->enabled_extensions().GetByID( + "ogjcoiohnmldgjemafoockdghcjciccf"); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); ASSERT_TRUE(notification_listener.started()); @@ -470,8 +469,8 @@ // Make sure the extension state is the same as before. ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", - ExtensionRegistry::ENABLED); + extension = registry->enabled_extensions().GetByID( + "ogjcoiohnmldgjemafoockdghcjciccf"); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); } @@ -546,11 +545,11 @@ install_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(disabled_size_before + 1, registry->disabled_extensions().size()); ASSERT_EQ(enabled_size_before, registry->enabled_extensions().size()); - extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", - ExtensionRegistry::COMPATIBILITY); + extension = registry->disabled_extensions().GetByID( + "ogjcoiohnmldgjemafoockdghcjciccf"); ASSERT_TRUE(extension); - ASSERT_FALSE(registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", - ExtensionRegistry::ENABLED)); + ASSERT_FALSE(registry->enabled_extensions().GetByID( + "ogjcoiohnmldgjemafoockdghcjciccf")); ASSERT_EQ("2.0", extension->VersionString()); // The extension should have not made the callback because it is disabled. @@ -621,7 +620,7 @@ install_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); const Extension* extension = - registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); + registry->enabled_extensions().GetByID(kExtensionId); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); @@ -726,7 +725,7 @@ // Check if the extension got installed. ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); const Extension* extension = - registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); + registry->enabled_extensions().GetByID(kExtensionId); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); @@ -751,8 +750,8 @@ policies.Erase(policy::key::kExtensionInstallForcelist); UpdateProviderPolicy(policies); EXPECT_EQ(size_before + 1, registry->enabled_extensions().size()); - EXPECT_FALSE(registry->GetExtensionById(kExtensionId, - ExtensionRegistry::COMPATIBILITY)); + EXPECT_FALSE( + registry->GetExtensionById(kExtensionId, ExtensionRegistry::EVERYTHING)); } // See http://crbug.com/103371 and http://crbug.com/120640. @@ -808,7 +807,7 @@ ASSERT_TRUE(InstallExtension(v2_path, 1)); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); const Extension* extension = - registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); + registry->enabled_extensions().GetByID(kExtensionId); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::INTERNAL, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); @@ -827,8 +826,7 @@ install_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = - registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); + extension = registry->enabled_extensions().GetByID(kExtensionId); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); @@ -840,15 +838,14 @@ policies.Erase(policy::key::kExtensionInstallForcelist); UpdateProviderPolicy(policies); ASSERT_EQ(size_before, registry->enabled_extensions().size()); - extension = registry->GetExtensionById(kExtensionId, - ExtensionRegistry::COMPATIBILITY); + extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::EVERYTHING); EXPECT_FALSE(extension); // User install again, but have it disabled too before setting the policy. ASSERT_TRUE(InstallExtension(v2_path, 1)); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = - registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); + extension = registry->enabled_extensions().GetByID(kExtensionId); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::INTERNAL, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); @@ -856,8 +853,7 @@ DisableExtension(kExtensionId); EXPECT_EQ(1u, registry->disabled_extensions().size()); - extension = registry->GetExtensionById(kExtensionId, - ExtensionRegistry::COMPATIBILITY); + extension = registry->disabled_extensions().GetByID(kExtensionId); EXPECT_TRUE(extension); EXPECT_FALSE(service->IsExtensionEnabled(kExtensionId)); @@ -873,8 +869,7 @@ extension_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = - registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); + extension = registry->enabled_extensions().GetByID(kExtensionId); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc index cdc749a..881f36c6 100644 --- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc +++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
@@ -34,12 +34,14 @@ devices.push_back(std::make_unique<DeviceInfo>( base::GenerateGUID(), "abc Device", "XYZ v1", "XYZ SyncAgent v1", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id1", base::Time(), - /*send_tab_to_self_receiving_enabled=*/true)); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt)); devices.push_back(std::make_unique<DeviceInfo>( base::GenerateGUID(), "def Device", "XYZ v1", "XYZ SyncAgent v1", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id2", base::Time(), - /*send_tab_to_self_receiving_enabled=*/true)); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt)); base::DictionaryValue dictionary; @@ -57,7 +59,8 @@ devices.push_back(std::make_unique<DeviceInfo>( base::GenerateGUID(), "ghi Device", "XYZ v1", "XYZ SyncAgent v1", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id3", base::Time(), - /*send_tab_to_self_receiving_enabled=*/true)); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt)); CreateMappingForUnmappedDevices(devices, &dictionary);
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc index 1d5d4ea..187d6b0b 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
@@ -42,15 +42,17 @@ scoped_refptr<Extension> extension_test = extension_prefs.AddExtension(extension_name); - DeviceInfo device_info1(base::GenerateGUID(), "abc Device", "XYZ v1", - "XYZ SyncAgent v1", - sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time(), true); + DeviceInfo device_info1( + base::GenerateGUID(), "abc Device", "XYZ v1", "XYZ SyncAgent v1", + sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", base::Time(), + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); - DeviceInfo device_info2(base::GenerateGUID(), "def Device", "XYZ v2", - "XYZ SyncAgent v2", - sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time(), true); + DeviceInfo device_info2( + base::GenerateGUID(), "def Device", "XYZ v2", "XYZ SyncAgent v2", + sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", base::Time(), + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); device_tracker.Add(&device_info1); device_tracker.Add(&device_info2); @@ -67,10 +69,11 @@ // Add a third device and make sure the first 2 ids are retained and a new // id is generated for the third device. - DeviceInfo device_info3(base::GenerateGUID(), "def Device", "jkl v2", - "XYZ SyncAgent v2", - sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time(), true); + DeviceInfo device_info3( + base::GenerateGUID(), "def Device", "jkl v2", "XYZ SyncAgent v2", + sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", base::Time(), + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); device_tracker.Add(&device_info3); @@ -156,15 +159,17 @@ DeviceInfoSyncServiceFactory::GetForProfile(profile())) ->fake_tracker(); - DeviceInfo device_info1(base::GenerateGUID(), "abc Device", "XYZ v1", - "XYZ SyncAgent v1", - sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time(), true); + DeviceInfo device_info1( + base::GenerateGUID(), "abc Device", "XYZ v1", "XYZ SyncAgent v1", + sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", base::Time(), + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); - DeviceInfo device_info2(base::GenerateGUID(), "def Device", "XYZ v2", - "XYZ SyncAgent v2", - sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time(), true); + DeviceInfo device_info2( + base::GenerateGUID(), "def Device", "XYZ v2", "XYZ SyncAgent v2", + sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", base::Time(), + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); device_tracker->Add(&device_info1); device_tracker->Add(&device_info2);
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 7aa6296..c62565180 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -542,7 +542,7 @@ // Note: this is flaky on multiple platforms (crbug.com/1003598). Temporarily // enabled to find flakiness cause. IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest, - WebRequestAuthRequiredAsync) { + DISABLED_WebRequestAuthRequiredAsync) { CancelLoginDialog login_dialog_helper; ASSERT_TRUE(StartEmbeddedTestServer());
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 4086e7f..d81cfb1e 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc
@@ -544,7 +544,7 @@ ExtensionRegistry* registry = ExtensionRegistry::Get(service->profile()); for (const auto& import : imports) { const Extension* imported_module = registry->GetExtensionById( - import.extension_id, ExtensionRegistry::COMPATIBILITY); + import.extension_id, ExtensionRegistry::EVERYTHING); if (!imported_module) continue;
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc index 26a9bd97a..50491a78 100644 --- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
@@ -259,8 +259,7 @@ install_observer.WaitForExtensionWillBeInstalled(); content::RunAllTasksUntilIdle(); - extension = extension_registry()->GetExtensionById( - extension_id, ExtensionRegistry::COMPATIBILITY); + extension = extension_registry()->disabled_extensions().GetByID(extension_id); ASSERT_TRUE(extension); EXPECT_EQ("2", extension->VersionString()); EXPECT_EQ(1u, extension_registry()->disabled_extensions().size()); @@ -320,8 +319,8 @@ install_observer.WaitForExtensionWillBeInstalled(); content::RunAllTasksUntilIdle(); - const Extension* extension = extension_registry()->GetExtensionById( - extension_id, ExtensionRegistry::COMPATIBILITY); + const Extension* extension = + extension_registry()->disabled_extensions().GetByID(extension_id); ASSERT_TRUE(extension); EXPECT_EQ("2", extension->VersionString()); EXPECT_EQ(1u, extension_registry()->disabled_extensions().size());
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 8dd3bdf..a5ec923de 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc
@@ -217,7 +217,7 @@ InstallationReporter::Get(profile_); const Extension* extension = registry_->GetExtensionById( - info.extension_id, ExtensionRegistry::COMPATIBILITY); + info.extension_id, ExtensionRegistry::EVERYTHING); if (extension) { // Already installed. Skip this install if the current location has higher // priority than |info.download_location|, and we aren't doing a @@ -761,8 +761,8 @@ Manifest::IsComponentLocation(source_extension->location())); } - const Extension* extension = registry_->GetExtensionById( - extension_id, ExtensionRegistry::COMPATIBILITY); + const Extension* extension = + registry_->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); CHECK(system_->management_policy()->ExtensionMayModifySettings( source_extension, extension, nullptr)); extension_registrar_.DisableExtension(extension_id, disable_reasons); @@ -1147,7 +1147,7 @@ void ExtensionService::RemoveComponentExtension( const std::string& extension_id) { scoped_refptr<const Extension> extension( - registry_->GetExtensionById(extension_id, ExtensionRegistry::ENABLED)); + registry_->enabled_extensions().GetByID(extension_id)); UnloadExtension(extension_id, UnloadedExtensionReason::UNINSTALL); if (extension.get()) { ExtensionRegistry::Get(profile_)->TriggerOnUninstalled( @@ -1693,7 +1693,7 @@ // version. This is important because these extensions are going to get // installed on every startup. const Extension* existing = registry_->GetExtensionById( - info.extension_id, ExtensionRegistry::COMPATIBILITY); + info.extension_id, ExtensionRegistry::EVERYTHING); if (existing) { // The default apps will have the location set as INTERNAL. Since older @@ -1809,8 +1809,8 @@ // idle to update. Check all imports of these extensions, too. std::set<std::string> import_ids; for (auto it = extension_ids.begin(); it != extension_ids.end(); ++it) { - const Extension* extension = registry_->GetExtensionById( - *it, ExtensionRegistry::COMPATIBILITY); + const Extension* extension = + registry_->GetExtensionById(*it, ExtensionRegistry::EVERYTHING); if (!extension) continue; const std::vector<SharedModuleInfo::ImportInfo>& imports =
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc index fc2846c..a32bef9 100644 --- a/chrome/browser/extensions/extension_service_sync_unittest.cc +++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -364,8 +364,7 @@ ASSERT_EQ(3u, loaded_.size()); // We start enabled. - const Extension* extension = - registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + const Extension* extension = registry()->enabled_extensions().GetByID(good0); ASSERT_TRUE(extension); ASSERT_TRUE(service()->IsExtensionEnabled(good0)); @@ -564,10 +563,9 @@ extensions::disable_reason::DISABLE_USER_ACTION); ASSERT_FALSE(service()->IsExtensionEnabled(good2)); - const Extension* extension0 = - registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + const Extension* extension0 = registry()->enabled_extensions().GetByID(good0); const Extension* extension2 = - registry()->GetExtensionById(good2, ExtensionRegistry::COMPATIBILITY); + registry()->disabled_extensions().GetByID(good2); ASSERT_TRUE(extensions::sync_helper::IsSyncable(extension0)); ASSERT_TRUE(extensions::sync_helper::IsSyncable(extension2)); @@ -626,7 +624,7 @@ { const Extension* extension = - registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + registry()->enabled_extensions().GetByID(good0); ASSERT_TRUE(extension); // Disable the extension. @@ -642,7 +640,7 @@ { const Extension* extension = - registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + registry()->disabled_extensions().GetByID(good0); ASSERT_TRUE(extension); // Set incognito enabled to true. @@ -658,7 +656,7 @@ { const Extension* extension = - registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + registry()->disabled_extensions().GetByID(good0); ASSERT_TRUE(extension); // Add another disable reason. @@ -676,7 +674,7 @@ { const Extension* extension = - registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + registry()->disabled_extensions().GetByID(good0); ASSERT_TRUE(extension); // Uninstall the extension. @@ -1084,23 +1082,22 @@ // Should do nothing. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); EXPECT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + registry()->GetExtensionById(good_crx, ExtensionRegistry::EVERYTHING)); // Install the extension. base::FilePath extension_path = data_dir().AppendASCII("good.crx"); InstallCRX(extension_path, INSTALL_NEW); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); // Should uninstall the extension. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); EXPECT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + registry()->GetExtensionById(good_crx, ExtensionRegistry::EVERYTHING)); // Should again do nothing. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); EXPECT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + registry()->GetExtensionById(good_crx, ExtensionRegistry::EVERYTHING)); } TEST_F(ExtensionServiceSyncTest, ProcessSyncDataWrongType) { @@ -1111,8 +1108,7 @@ // Install the extension. base::FilePath extension_path = data_dir().AppendASCII("good.crx"); InstallCRX(extension_path, INSTALL_NEW); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); sync_pb::EntitySpecifics specifics; sync_pb::AppSpecifics* app_specifics = specifics.mutable_app(); @@ -1130,8 +1126,7 @@ // Should do nothing extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_TRUE(registry()->GetExtensionById(good_crx, - ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); } { @@ -1142,8 +1137,7 @@ // Should again do nothing. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); } }
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 21cd985d..46a23361 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -843,8 +843,7 @@ EXPECT_EQ(std::string("The first extension that I made."), loaded_[0]->description()); EXPECT_EQ(Manifest::INTERNAL, loaded_[0]->location()); - EXPECT_TRUE(registry()->GetExtensionById(loaded_[0]->id(), - ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(loaded_[0]->id())); EXPECT_EQ(expected_num_extensions, registry()->enabled_extensions().size()); ValidatePrefKeyCount(3); @@ -1216,7 +1215,7 @@ WaitForExternalExtensionInstalled(); const Extension* extension = - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); + registry()->enabled_extensions().GetByID(good_crx); ASSERT_TRUE(extension); ASSERT_TRUE(extension->from_bookmark()); ASSERT_TRUE(ValidateBooleanPref(good_crx, kPrefFromBookmark, true)); @@ -1225,8 +1224,7 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); ASSERT_TRUE(ValidateBooleanPref(good_crx, kPrefFromBookmark, true)); - extension = - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); + extension = registry()->enabled_extensions().GetByID(good_crx); ASSERT_TRUE(extension); ASSERT_TRUE(extension->from_bookmark()); } @@ -1247,8 +1245,7 @@ provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - ASSERT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); // Uninstall it and check that its killbit gets set. UninstallExtension(good_crx); @@ -1260,8 +1257,7 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); content::RunAllTasksUntilIdle(); - ASSERT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_FALSE(registry()->enabled_extensions().GetByID(good_crx)); EXPECT_TRUE(prefs->IsExternalExtensionUninstalled(good_crx)); std::string newer_version = "1.0.0.1"; @@ -1271,8 +1267,7 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); content::RunAllTasksUntilIdle(); - ASSERT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_FALSE(registry()->enabled_extensions().GetByID(good_crx)); EXPECT_TRUE(prefs->IsExternalExtensionUninstalled(good_crx)); // Try adding the same extension from an external update URL. @@ -1346,16 +1341,14 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - ASSERT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_FALSE(registry()->enabled_extensions().GetByID(good_crx)); // Try again with the right ID. Expect success. info = CreateExternalExtension(correct_id, version_str, path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - ASSERT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); } // Test that external extensions with incorrect versions are not installed. @@ -1373,8 +1366,7 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(wrong_info)); WaitForExternalExtensionInstalled(); - ASSERT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_FALSE(registry()->enabled_extensions().GetByID(good_crx)); // Try again with the right version. Expect success. service()->pending_extension_manager()->Remove(good_crx); @@ -1383,8 +1375,7 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(correct_info)); WaitForExternalExtensionInstalled(); - ASSERT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + ASSERT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); } // Install a user script (they get converted automatically to an extension) @@ -1410,8 +1401,7 @@ EXPECT_EQ(0u, errors.size()) << "There were errors: " << base::JoinString(errors, base::ASCIIToUTF16(",")); - EXPECT_TRUE(registry()->GetExtensionById(loaded_[0]->id(), - ExtensionRegistry::ENABLED)) + EXPECT_TRUE(registry()->enabled_extensions().GetByID(loaded_[0]->id())) << path.value(); installed_ = NULL; @@ -2474,11 +2464,9 @@ UpdateExtension(id, extensions_path.AppendASCII("v2.crx"), ENABLED); - ASSERT_EQ(std::string("2"), - registry() - ->GetExtensionById(id, ExtensionRegistry::ENABLED) - ->version() - .GetString()); + ASSERT_EQ( + std::string("2"), + registry()->enabled_extensions().GetByID(id)->version().GetString()); } // Verifies that the NTP page and launch ordinals are kept when updating apps. @@ -2505,11 +2493,9 @@ // Now try updating to v2. UpdateExtension(id, extensions_path.AppendASCII("v2.crx"), ENABLED); - ASSERT_EQ(std::string("2"), - registry() - ->GetExtensionById(id, ExtensionRegistry::ENABLED) - ->version() - .GetString()); + ASSERT_EQ( + std::string("2"), + registry()->enabled_extensions().GetByID(id)->version().GetString()); // Verify that the ordinals match. ASSERT_TRUE(new_page_ordinal.Equals(sorting->GetPageOrdinal(id))); @@ -2660,7 +2646,7 @@ // Reload so extension gets reinitialized with new value. service()->ReloadExtensionsForTest(); - extension = registry()->GetExtensionById(id, ExtensionRegistry::ENABLED); + extension = registry()->enabled_extensions().GetByID(id); ASSERT_TRUE(extension->from_webstore()); // Upgrade to version 2.0 @@ -2685,7 +2671,7 @@ // Also test that the extension's old and new title are correctly retrieved. path = data_dir().AppendASCII("good2.crx"); InstallCRX(path, INSTALL_UPDATED, Extension::NO_FLAGS, "My extension 1"); - extension = registry()->GetExtensionById(id, ExtensionRegistry::ENABLED); + extension = registry()->enabled_extensions().GetByID(id); ASSERT_EQ("1.0.0.1", extension->version().GetString()); ASSERT_EQ("My updated extension 1", extension->name()); @@ -2717,11 +2703,11 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); - ASSERT_EQ("1.0.0.1", - registry() - ->GetExtensionById(good_crx, ExtensionRegistry::ENABLED) - ->version() - .GetString()); + ASSERT_EQ("1.0.0.1", registry() + ->enabled_extensions() + .GetByID(good_crx) + ->version() + .GetString()); } // Extensions should not be updated during browser shutdown. @@ -2741,11 +2727,11 @@ bool updated = service()->UpdateExtension( CRXFileInfo(good_crx, GetTestVerifierFormat(), path), true, NULL); ASSERT_FALSE(updated); - ASSERT_EQ("1.0.0.0", - registry() - ->GetExtensionById(good_crx, ExtensionRegistry::ENABLED) - ->version() - .GetString()); + ASSERT_EQ("1.0.0.0", registry() + ->enabled_extensions() + .GetByID(good_crx) + ->version() + .GetString()); } // Test updating a not-already-installed extension - this should fail @@ -2774,11 +2760,11 @@ // Change path from good2.crx -> good.crx path = data_dir().AppendASCII("good.crx"); UpdateExtension(good_crx, path, FAILED); - ASSERT_EQ("1.0.0.1", - registry() - ->GetExtensionById(good_crx, ExtensionRegistry::ENABLED) - ->version() - .GetString()); + ASSERT_EQ("1.0.0.1", registry() + ->enabled_extensions() + .GetByID(good_crx) + ->version() + .GetString()); } // Make sure calling update with an identical version does nothing @@ -2810,8 +2796,7 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, INSTALLED); ASSERT_EQ(1u, registry()->disabled_extensions().size()); - const Extension* good2 = - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY); + const Extension* good2 = registry()->disabled_extensions().GetByID(good_crx); ASSERT_EQ("1.0.0.1", good2->version().GetString()); EXPECT_TRUE(util::IsIncognitoEnabled(good2->id(), profile())); EXPECT_EQ(disable_reason::DISABLE_USER_ACTION, @@ -2831,8 +2816,7 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); - const Extension* good2 = - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); + const Extension* good2 = registry()->enabled_extensions().GetByID(good_crx); ASSERT_EQ("1.0.0.1", good2->version().GetString()); EXPECT_EQ(good2->location(), Manifest::EXTERNAL_PREF); } @@ -2964,7 +2948,7 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(kGoodId)); const Extension* extension = - registry()->GetExtensionById(kGoodId, ExtensionRegistry::COMPATIBILITY); + registry()->enabled_extensions().GetByID(kGoodId); EXPECT_TRUE(extension); } @@ -2994,7 +2978,7 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(kGoodId)); const Extension* extension = - registry()->GetExtensionById(kGoodId, ExtensionRegistry::COMPATIBILITY); + registry()->disabled_extensions().GetByID(kGoodId); EXPECT_TRUE(extension); } @@ -3019,7 +3003,7 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(theme_crx)); const Extension* extension = - registry()->GetExtensionById(theme_crx, ExtensionRegistry::COMPATIBILITY); + registry()->enabled_extensions().GetByID(theme_crx); ASSERT_TRUE(extension); EXPECT_FALSE( @@ -3048,7 +3032,7 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(theme_crx)); const Extension* extension = - registry()->GetExtensionById(theme_crx, ExtensionRegistry::COMPATIBILITY); + registry()->enabled_extensions().GetByID(theme_crx); ASSERT_TRUE(extension); EXPECT_FALSE( @@ -3126,7 +3110,7 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(theme_crx)); const Extension* extension = - registry()->GetExtensionById(theme_crx, ExtensionRegistry::COMPATIBILITY); + registry()->GetExtensionById(theme_crx, ExtensionRegistry::EVERYTHING); ASSERT_FALSE(extension); } @@ -3821,12 +3805,12 @@ // Extension should be installed despite blacklist. ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(registry()->GetExtensionById(good0, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good0)); // Poke external providers and make sure the extension is still present. service()->CheckForExternalUpdates(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(registry()->GetExtensionById(good0, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good0)); // Extension should not be uninstalled on blacklist changes. { @@ -3835,7 +3819,7 @@ } content::RunAllTasksUntilIdle(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(registry()->GetExtensionById(good0, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good0)); } // Tests that active permissions are not revoked from component extensions @@ -3857,7 +3841,8 @@ // Extension should have the "tabs" permission. EXPECT_TRUE(registry() - ->GetExtensionById(good0, ExtensionRegistry::ENABLED) + ->enabled_extensions() + .GetByID(good0) ->permissions_data() ->active_permissions() .HasAPIPermission(APIPermission::kTab)); @@ -3871,7 +3856,8 @@ service()->OnExtensionManagementSettingsChanged(); content::RunAllTasksUntilIdle(); EXPECT_TRUE(registry() - ->GetExtensionById(good0, ExtensionRegistry::ENABLED) + ->enabled_extensions() + .GetByID(good0) ->permissions_data() ->active_permissions() .HasAPIPermission(APIPermission::kTab)); @@ -3902,8 +3888,7 @@ // Extension should be installed despite blacklist. ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); // Blacklist update should not uninstall the extension. { @@ -3912,8 +3897,7 @@ } content::RunAllTasksUntilIdle(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); } // Tests that extensions cannot be installed if the policy provider prohibits @@ -3986,8 +3970,7 @@ service()->DisableExtension(good_crx, disable_reason::DISABLE_USER_ACTION); EXPECT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); EXPECT_EQ(0u, registry()->disabled_extensions().size()); EXPECT_EQ(disable_reason::DISABLE_NONE, ExtensionPrefs::Get(profile())->GetDisableReasons(good_crx)); @@ -3999,10 +3982,8 @@ EXPECT_EQ(0u, registry()->enabled_extensions().size()); EXPECT_EQ(1u, registry()->disabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); - EXPECT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->disabled_extensions().GetByID(good_crx)); + EXPECT_FALSE(registry()->enabled_extensions().GetByID(good_crx)); EXPECT_EQ(disable_reason::DISABLE_CORRUPTED, ExtensionPrefs::Get(profile())->GetDisableReasons(good_crx)); } @@ -4025,8 +4006,7 @@ good_crx, UNINSTALL_REASON_FOR_TESTING, NULL)); EXPECT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); } // Tests that previously installed extensions that are now prohibited from @@ -4228,8 +4208,7 @@ PackAndInstallCRX(path2, pem_path, INSTALL_FAILED); // Verify that the old version is still enabled. - updated = registry()->GetExtensionById(permissions_blocklist, - ExtensionRegistry::ENABLED); + updated = registry()->enabled_extensions().GetByID(permissions_blocklist); ASSERT_TRUE(updated); EXPECT_EQ(old_version, updated->VersionString()); } @@ -4337,10 +4316,8 @@ observer.Wait(); ASSERT_EQ(2u, registry()->enabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); - EXPECT_TRUE( - registry()->GetExtensionById(page_action, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(page_action)); ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); ASSERT_TRUE(!prefs->IsExternalExtensionAcknowledged(good_crx)); ASSERT_TRUE(prefs->IsExternalExtensionAcknowledged(page_action)); @@ -4518,10 +4495,9 @@ WaitForExternalExtensionInstalled(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); const Extension* extension = - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); + registry()->enabled_extensions().GetByID(good_crx); EXPECT_TRUE(extension->from_webstore()); EXPECT_TRUE(extension->was_installed_by_default()); } @@ -4561,7 +4537,7 @@ UpdateExtension(good_crx, path, ENABLED); ASSERT_TRUE(ValidateBooleanPref(good_crx, kPrefFromBookmark, true)); const Extension* extension = - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); + registry()->enabled_extensions().GetByID(good_crx); ASSERT_TRUE(extension); ASSERT_TRUE(extension->from_bookmark()); } @@ -4571,10 +4547,7 @@ InitializeEmptyExtensionService(); InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx)); EXPECT_EQ(1u, registry()->enabled_extensions().size()); EXPECT_EQ(0u, registry()->disabled_extensions().size()); @@ -4584,10 +4557,8 @@ // Disable it. service()->DisableExtension(good_crx, disable_reason::DISABLE_USER_ACTION); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); - EXPECT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(registry()->disabled_extensions().GetByID(good_crx)); + EXPECT_FALSE(registry()->enabled_extensions().GetByID(good_crx)); EXPECT_EQ(0u, registry()->enabled_extensions().size()); EXPECT_EQ(1u, registry()->disabled_extensions().size()); EXPECT_EQ(0u, registry()->terminated_extensions().size()); @@ -4616,16 +4587,13 @@ InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); TerminateExtension(good_crx); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::TERMINATED)); + EXPECT_TRUE(registry()->terminated_extensions().GetByID(good_crx)); // Disable it. service()->DisableExtension(good_crx, disable_reason::DISABLE_USER_ACTION); - EXPECT_FALSE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::TERMINATED)); - EXPECT_TRUE( - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + EXPECT_FALSE(registry()->terminated_extensions().GetByID(good_crx)); + EXPECT_TRUE(registry()->disabled_extensions().GetByID(good_crx)); EXPECT_EQ(0u, registry()->enabled_extensions().size()); EXPECT_EQ(1u, registry()->disabled_extensions().size()); @@ -4672,7 +4640,7 @@ // The creation flags should not change when reloading the extension. const Extension* extension = - registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY); + registry()->disabled_extensions().GetByID(good_crx); EXPECT_TRUE(extension->from_webstore()); EXPECT_TRUE(extension->was_installed_by_default()); EXPECT_FALSE(extension->from_bookmark()); @@ -6430,7 +6398,7 @@ // Is an extension installed? bool IsCrxInstalled() { return (registry()->GetExtensionById( - crx_id_, ExtensionRegistry::COMPATIBILITY) != nullptr); + crx_id_, ExtensionRegistry::EVERYTHING) != nullptr); } protected:
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc index e668ab7..253a1785f 100644 --- a/chrome/browser/extensions/external_provider_impl.cc +++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -349,10 +349,9 @@ keep_if_present) { ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); const Extension* extension = - extension_registry - ? extension_registry->GetExtensionById( - extension_id, ExtensionRegistry::COMPATIBILITY) - : nullptr; + extension_registry ? extension_registry->GetExtensionById( + extension_id, ExtensionRegistry::EVERYTHING) + : nullptr; if (!extension) { unsupported_extensions.insert(extension_id); installation_reporter->ReportFailure(
diff --git a/chrome/browser/extensions/navigation_observer.cc b/chrome/browser/extensions/navigation_observer.cc index bf3303c..84c9a38 100644 --- a/chrome/browser/extensions/navigation_observer.cc +++ b/chrome/browser/extensions/navigation_observer.cc
@@ -121,7 +121,7 @@ ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); const Extension* extension = extension_registry->GetExtensionById( - in_progress_prompt_extension_id_, ExtensionRegistry::COMPATIBILITY); + in_progress_prompt_extension_id_, ExtensionRegistry::EVERYTHING); CHECK(extension); if (result == ExtensionInstallPrompt::Result::ACCEPTED) {
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc index 20475a2..6e9f46d1 100644 --- a/chrome/browser/extensions/unpacked_installer.cc +++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -174,7 +174,7 @@ for (i = imports.begin(); i != imports.end(); ++i) { base::Version version_required(i->minimum_version); const Extension* imported_module = registry->GetExtensionById( - i->extension_id, ExtensionRegistry::COMPATIBILITY); + i->extension_id, ExtensionRegistry::EVERYTHING); if (!imported_module) { ReportExtensionLoadError(kImportMissing); return;
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index f05e9b7..dc9c7303 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -358,7 +358,7 @@ } else { for (const std::string& id : params.ids) { const Extension* extension = registry_->GetExtensionById( - id, extensions::ExtensionRegistry::COMPATIBILITY); + id, extensions::ExtensionRegistry::EVERYTHING); if (extension) { if (update_service_->CanUpdate(id)) { update_check_params.update_info[id] = ExtensionUpdateData(); @@ -528,7 +528,7 @@ std::string* version) { DCHECK(alive_); const Extension* extension = registry_->GetExtensionById( - id, extensions::ExtensionRegistry::COMPATIBILITY); + id, extensions::ExtensionRegistry::EVERYTHING); if (!extension) return false; const Extension* update = service_->GetPendingExtensionUpdate(id);
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index f96c18d..09a2e13 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -195,8 +195,8 @@ std::unique_ptr<WebstoreInstaller::Approval> approval = CreateApproval(); ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); - const Extension* installed_extension = extension_registry->GetExtensionById( - id_, ExtensionRegistry::COMPATIBILITY); + const Extension* installed_extension = + extension_registry->GetExtensionById(id_, ExtensionRegistry::EVERYTHING); if (installed_extension) { std::string install_message; webstore_install::Result install_result = webstore_install::SUCCESS;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 20b6b22f..407b5b6 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2917,6 +2917,10 @@ "owners": [ "mdjones" ], "expiry_milestone": 78 }, + { "name": "reduce-display-notifications", + "owners": [ "baileyberro", "zentaro" ], + "expiry_milestone": 82 + }, { "name": "reduced-referrer-granularity", "owners": [ "jochen", "mkwst" ],
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 88cf8b3..29313c6 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3546,6 +3546,11 @@ "searches Chrome Web Store for extensions that support printing to a USB " "printer with specific USB ID."; +const char kReduceDisplayNotificationsName[] = "Reduce display notifications"; +const char kReduceDisplayNotificationsDescription[] = + "If enabled, notifications for display rotation, display removed, display " + "mirroring, and display extending will be suppressed."; + const char kReleaseNotesName[] = "CrOS Release Notes."; const char kReleaseNotesDescription[] = "Instructs OS to show notification about CrOS ReleaseNotes on login after "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index feaa489..59f4e8b2 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2112,6 +2112,9 @@ extern const char kPrinterProviderSearchAppName[]; extern const char kPrinterProviderSearchAppDescription[]; +extern const char kReduceDisplayNotificationsName[]; +extern const char kReduceDisplayNotificationsDescription[]; + extern const char kReleaseNotesName[]; extern const char kReleaseNotesDescription[];
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc index e557e55b..da4c6f6 100644 --- a/chrome/browser/importer/importer_list.cc +++ b/chrome/browser/importer/importer_list.cc
@@ -47,6 +47,8 @@ } void DetectEdgeProfiles(std::vector<importer::SourceProfile>* profiles) { + if (!importer::EdgeImporterCanImport()) + return; importer::SourceProfile edge; edge.importer_name = l10n_util::GetStringUTF16(IDS_IMPORT_FROM_EDGE); edge.importer_type = importer::TYPE_EDGE; @@ -57,10 +59,13 @@ void DetectBuiltinWindowsProfiles( std::vector<importer::SourceProfile>* profiles) { - // Make the assumption on Windows 10 that Edge exists and is probably default. - if (importer::EdgeImporterCanImport()) + if (shell_integration::IsIEDefaultBrowser()) { + DetectIEProfiles(profiles); DetectEdgeProfiles(profiles); - DetectIEProfiles(profiles); + } else { + DetectEdgeProfiles(profiles); + DetectIEProfiles(profiles); + } } #endif // defined(OS_WIN)
diff --git a/chrome/browser/media/router/presentation/independent_otr_profile_manager.cc b/chrome/browser/media/router/presentation/independent_otr_profile_manager.cc index bb42583..87673e9 100644 --- a/chrome/browser/media/router/presentation/independent_otr_profile_manager.cc +++ b/chrome/browser/media/router/presentation/independent_otr_profile_manager.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" using content::BrowserThread; @@ -58,6 +59,12 @@ callbacks_map_.emplace(otr_profile, std::move(callback)); DCHECK(entry.second); DCHECK(callback_entry.second); + + content::NotificationService::current()->Notify( + chrome::NOTIFICATION_PROFILE_CREATED, + content::Source<Profile>(otr_profile), + content::NotificationService::NoDetails()); + return base::WrapUnique(new OTRProfileRegistration(this, otr_profile)); }
diff --git a/chrome/browser/media/router/presentation/independent_otr_profile_manager_browsertest.cc b/chrome/browser/media/router/presentation/independent_otr_profile_manager_browsertest.cc index bd25f277..ca90d05 100644 --- a/chrome/browser/media/router/presentation/independent_otr_profile_manager_browsertest.cc +++ b/chrome/browser/media/router/presentation/independent_otr_profile_manager_browsertest.cc
@@ -26,6 +26,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/test_utils.h" #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" @@ -378,3 +379,31 @@ ASSERT_FALSE(base::Contains(*BrowserList::GetInstance(), otr_browser)); EXPECT_TRUE(destroyed); } + +IN_PROC_BROWSER_TEST_F(IndependentOTRProfileManagerTest, Notifications) { + // Create the OTR profile. + content::WindowedNotificationObserver profile_created_observer( + chrome::NOTIFICATION_PROFILE_CREATED, + content::NotificationService::AllSources()); + + auto* profile = browser()->profile(); + auto profile_registration = manager_->CreateFromOriginalProfile( + profile, base::BindOnce(&OriginalProfileNeverDestroyed)); + profile_created_observer.Wait(); + + // Verify the received notification. + auto* otr_profile = profile_registration->profile(); + EXPECT_EQ(profile_created_observer.source(), + content::Source<Profile>(otr_profile)); + EXPECT_FALSE(profile->HasOffTheRecordProfile()); + EXPECT_TRUE(otr_profile->IsOffTheRecord()); + EXPECT_TRUE(otr_profile->IsIndependentOffTheRecordProfile()); + + // Destroy the OTR profile. + content::WindowedNotificationObserver profile_destroyed_observer( + chrome::NOTIFICATION_PROFILE_DESTROYED, + content::Source<Profile>(otr_profile)); + + profile_registration.reset(); + profile_destroyed_observer.Wait(); +}
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc index 1d73f33d..9a7ef46 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc
@@ -279,6 +279,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1); @@ -377,6 +379,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1); @@ -429,6 +433,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", false, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", false, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", false, 1); histogram_tester.ExpectTotalCount( "OptimizationGuide.HintCache.HostMatch.AtCommit", 0); @@ -473,6 +479,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1); @@ -516,6 +524,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1);
diff --git a/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc b/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc index 75f8603..b2d2c432 100644 --- a/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc +++ b/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
@@ -46,7 +46,9 @@ optimization_type_decisions_(other.optimization_type_decisions_), optimization_target_decisions_(other.optimization_target_decisions_), has_hint_before_commit_(other.has_hint_before_commit_), - has_hint_after_commit_(other.has_hint_after_commit_) { + has_hint_after_commit_(other.has_hint_after_commit_), + was_host_covered_by_fetch_at_navigation_start_( + other.was_host_covered_by_fetch_at_navigation_start_) { if (other.has_page_hint_value()) { page_hint_ = std::make_unique<optimization_guide::proto::PageHint>( *other.page_hint()); @@ -61,9 +63,15 @@ void OptimizationGuideNavigationData::RecordHintCacheMatch( bool has_committed) const { + bool has_hint_before_commit = false; if (has_hint_before_commit_.has_value()) { + has_hint_before_commit = has_hint_before_commit_.value(); UMA_HISTOGRAM_BOOLEAN("OptimizationGuide.HintCache.HasHint.BeforeCommit", - has_hint_before_commit_.value()); + has_hint_before_commit); + UMA_HISTOGRAM_BOOLEAN( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", + has_hint_before_commit || + was_host_covered_by_fetch_at_navigation_start_.value_or(false)); } // If the navigation didn't commit, then don't proceed to record any of the // remaining metrics.
diff --git a/chrome/browser/optimization_guide/optimization_guide_navigation_data.h b/chrome/browser/optimization_guide/optimization_guide_navigation_data.h index d43fb03..066cff6 100644 --- a/chrome/browser/optimization_guide/optimization_guide_navigation_data.h +++ b/chrome/browser/optimization_guide/optimization_guide_navigation_data.h
@@ -86,6 +86,16 @@ page_hint_ = std::move(page_hint); } + // Whether the host was covered by a hints fetch at the start of navigation. + base::Optional<bool> was_host_covered_by_fetch_at_navigation_start() const { + return was_host_covered_by_fetch_at_navigation_start_; + } + void set_was_host_covered_by_fetch_at_navigation_start( + bool was_host_covered_by_fetch_at_navigation_start) { + was_host_covered_by_fetch_at_navigation_start_ = + was_host_covered_by_fetch_at_navigation_start; + } + private: // Records hint cache histograms based on data currently held in |this|. void RecordHintCacheMatch(bool has_committed) const; @@ -104,7 +114,7 @@ const int64_t navigation_id_; // The serialized hints version for the hint that applied to the navigation. - base::Optional<std::string> serialized_hint_version_string_ = base::nullopt; + base::Optional<std::string> serialized_hint_version_string_; // The map from optimization type to the last decision made for that type. std::unordered_map<optimization_guide::proto::OptimizationType, @@ -117,14 +127,18 @@ optimization_target_decisions_; // Whether the hint cache had a hint for the navigation before commit. - base::Optional<bool> has_hint_before_commit_ = base::nullopt; + base::Optional<bool> has_hint_before_commit_; // Whether the hint cache had a hint for the navigation after commit. - base::Optional<bool> has_hint_after_commit_ = base::nullopt; + base::Optional<bool> has_hint_after_commit_; // The page hint for the navigation. base::Optional<std::unique_ptr<optimization_guide::proto::PageHint>> - page_hint_ = base::nullopt; + page_hint_; + + // Whether the host was covered by a hints fetch at the start of + // navigation. + base::Optional<bool> was_host_covered_by_fetch_at_navigation_start_; DISALLOW_ASSIGN(OptimizationGuideNavigationData); };
diff --git a/chrome/browser/optimization_guide/optimization_guide_navigation_data_unittest.cc b/chrome/browser/optimization_guide/optimization_guide_navigation_data_unittest.cc index 837b1b5..faaaa84 100644 --- a/chrome/browser/optimization_guide/optimization_guide_navigation_data_unittest.cc +++ b/chrome/browser/optimization_guide/optimization_guide_navigation_data_unittest.cc
@@ -33,6 +33,7 @@ EXPECT_THAT(histogram_tester.GetAllHistogramsRecorded(), Not(AnyOf(HasSubstr("OptimizationGuide.ApplyDecision"), HasSubstr("OptimizationGuide.HintCache"), + HasSubstr("OptimizationGuide.Hints."), HasSubstr("OptimizationGuide.TargetDecision")))); // Make sure no UKM recorded. @@ -52,7 +53,8 @@ // Make sure no UMA recorded. EXPECT_THAT(histogram_tester.GetAllHistogramsRecorded(), - Not(AnyOf(HasSubstr("OptimizationGuide.HintCache")))); + Not(AnyOf(HasSubstr("OptimizationGuide.Hints."), + HasSubstr("OptimizationGuide.HintCache")))); // Make sure no UKM recorded. auto entries = ukm_recorder.GetEntriesByName( ukm::builders::OptimizationGuide::kEntryName); @@ -60,15 +62,59 @@ } TEST(OptimizationGuideNavigationDataTest, + RecordMetricsCoveredByFetchButNoHintLoadAttempted) { + base::HistogramTester histogram_tester; + + OptimizationGuideNavigationData data(/*navigation_id=*/3); + data.set_was_host_covered_by_fetch_at_navigation_start(true); + data.RecordMetrics(/*has_committed=*/false); + + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.HasHint.BeforeCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.HasHint.AtCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.HostMatch.AtCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.PageMatch.AtCommit", 0); +} + +TEST(OptimizationGuideNavigationDataTest, RecordMetricsHintCacheNoHostMatchBeforeCommit) { base::HistogramTester histogram_tester; OptimizationGuideNavigationData data(/*navigation_id=*/3); data.set_has_hint_before_commit(false); + data.set_was_host_covered_by_fetch_at_navigation_start(true); data.RecordMetrics(/*has_committed=*/false); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", false, 1); + histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.HasHint.AtCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.HostMatch.AtCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.HintCache.PageMatch.AtCommit", 0); +} + +TEST(OptimizationGuideNavigationDataTest, + RecordMetricsHintCacheNoHostMatchBeforeCommitAlsoNotCoveredByFetch) { + base::HistogramTester histogram_tester; + + OptimizationGuideNavigationData data(/*navigation_id=*/3); + data.set_has_hint_before_commit(false); + data.set_was_host_covered_by_fetch_at_navigation_start(false); + data.RecordMetrics(/*has_committed=*/false); + + histogram_tester.ExpectUniqueSample( + "OptimizationGuide.HintCache.HasHint.BeforeCommit", false, 1); + histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", false, 1); histogram_tester.ExpectTotalCount( "OptimizationGuide.HintCache.HasHint.AtCommit", 0); histogram_tester.ExpectTotalCount( @@ -89,6 +135,8 @@ // check works for before commit. histogram_tester.ExpectTotalCount( "OptimizationGuide.HintCache.HasHint.BeforeCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", 0); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", false, 1); histogram_tester.ExpectTotalCount( @@ -109,6 +157,8 @@ // check works for before commit. histogram_tester.ExpectTotalCount( "OptimizationGuide.HintCache.HasHint.BeforeCommit", 0); + histogram_tester.ExpectTotalCount( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", 0); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( @@ -123,6 +173,7 @@ OptimizationGuideNavigationData data(/*navigation_id=*/3); data.set_has_hint_before_commit(true); + data.set_was_host_covered_by_fetch_at_navigation_start(false); data.set_has_hint_after_commit(true); data.set_serialized_hint_version_string("abc"); data.set_page_hint(std::make_unique<optimization_guide::proto::PageHint>()); @@ -131,6 +182,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1); @@ -151,6 +204,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1); @@ -172,6 +227,8 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.BeforeCommit", true, 1); histogram_tester.ExpectUniqueSample( + "OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit", true, 1); + histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HasHint.AtCommit", true, 1); histogram_tester.ExpectUniqueSample( "OptimizationGuide.HintCache.HostMatch.AtCommit", true, 1);
diff --git a/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.cc b/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.cc index 6c3610b..0d43ffb 100644 --- a/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.cc +++ b/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h" +#include "base/metrics/histogram_macros.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" #include "chrome/browser/profiles/profile.h" @@ -19,18 +20,25 @@ // Records if the host for the current navigation was successfully // covered by a HintsFetch. HintsFetching must be enabled and only HTTPS -// navigations are logged. -void RecordHintsFetcherCoverage(content::NavigationHandle* navigation_handle) { +// navigations are logged. Returns whether navigation was covered by fetch. +bool RecordHintsFetcherCoverage(content::NavigationHandle* navigation_handle) { if (!navigation_handle->GetURL().SchemeIs(url::kHttpsScheme)) - return; + return false; if (!optimization_guide::features::IsHintsFetchingEnabled()) - return; + return false; - optimization_guide::HintsFetcher::RecordHintsFetcherCoverage( - Profile::FromBrowserContext( - navigation_handle->GetWebContents()->GetBrowserContext()) - ->GetPrefs(), - navigation_handle->GetURL().GetOrigin().host()); + bool was_host_covered_by_fetch = + optimization_guide::HintsFetcher::WasHostCoveredByFetch( + Profile::FromBrowserContext( + navigation_handle->GetWebContents()->GetBrowserContext()) + ->GetPrefs(), + navigation_handle->GetURL().GetOrigin().host()); + + UMA_HISTOGRAM_BOOLEAN( + "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", + was_host_covered_by_fetch); + + return was_host_covered_by_fetch; } } // namespace @@ -76,13 +84,18 @@ // Record the HintsFetcher coverage for the navigation, regardless if the // keyed service is active or not. - RecordHintsFetcherCoverage(navigation_handle); + bool was_host_covered_by_fetch = + RecordHintsFetcherCoverage(navigation_handle); if (!optimization_guide_keyed_service_) return; optimization_guide_keyed_service_->MaybeLoadHintForNavigation( navigation_handle); + OptimizationGuideNavigationData* nav_data = + GetOrCreateOptimizationGuideNavigationData(navigation_handle); + nav_data->set_was_host_covered_by_fetch_at_navigation_start( + was_host_covered_by_fetch); } void OptimizationGuideWebContentsObserver::DidRedirectNavigation(
diff --git a/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.cc b/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.cc index 4e5febe8..e7ea347 100644 --- a/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.cc +++ b/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.cc
@@ -15,12 +15,229 @@ DecisionTreePredictionModel::~DecisionTreePredictionModel() = default; +bool DecisionTreePredictionModel::ValidatePredictionModel() const { + // Only the top-level ensemble or decision tree must have a threshold. Any + // submodels of an ensemble will have model weights but no threshold. + // TODO(mcrouse): Add metrics to record if the validation is successful or + // not. + if (!model_->has_threshold()) + return false; + return ValidateModel(*model_.get()); +} + +bool DecisionTreePredictionModel::ValidateModel( + const proto::Model& model) const { + if (model.has_ensemble()) { + return ValidateEnsembleModel(model.ensemble()); + } + if (model.has_decision_tree()) { + return ValidateDecisionTree(model.decision_tree()); + } + return false; +} + +bool DecisionTreePredictionModel::ValidateEnsembleModel( + const proto::Ensemble& ensemble) const { + if (ensemble.members_size() == 0) + return false; + + for (const auto& member : ensemble.members()) { + if (!ValidateModel(member.submodel())) { + return false; + } + } + return true; +} + +bool DecisionTreePredictionModel::ValidateDecisionTree( + const proto::DecisionTree& tree) const { + if (tree.nodes_size() == 0) + return false; + return ValidateTreeNode(tree, tree.nodes(0), 0); +} + +bool DecisionTreePredictionModel::ValidateLeaf(const proto::Leaf& leaf) const { + return leaf.has_vector() && leaf.vector().value_size() == 1 && + leaf.vector().value(0).has_double_value(); +} + +bool DecisionTreePredictionModel::ValidateInequalityTest( + const proto::InequalityTest& inequality_test) const { + if (!inequality_test.has_threshold()) + return false; + if (!inequality_test.threshold().has_float_value()) + return false; + if (!inequality_test.has_feature_id()) + return false; + if (!inequality_test.feature_id().has_id()) + return false; + if (!inequality_test.has_type()) + return false; + return true; +} + +bool DecisionTreePredictionModel::ValidateTreeNode( + const proto::DecisionTree& tree, + const proto::TreeNode& node, + const int& node_index) const { + if (node.has_leaf()) + return ValidateLeaf(node.leaf()); + + if (!node.has_binary_node()) + return false; + + proto::BinaryNode binary_node = node.binary_node(); + if (!binary_node.has_inequality_left_child_test()) + return false; + + if (!ValidateInequalityTest(binary_node.inequality_left_child_test())) + return false; + + if (!binary_node.left_child_id().has_value()) + return false; + if (!binary_node.right_child_id().has_value()) + return false; + + if (binary_node.left_child_id().value() >= tree.nodes_size()) + return false; + if (binary_node.right_child_id().value() >= tree.nodes_size()) + return false; + + // Assure that no parent has an child index less than itself in order to + // prevent loops. + if (node_index >= binary_node.left_child_id().value()) + return false; + if (node_index >= binary_node.right_child_id().value()) + return false; + + if (!ValidateTreeNode(tree, tree.nodes(binary_node.left_child_id().value()), + binary_node.left_child_id().value())) { + return false; + } + if (!ValidateTreeNode(tree, tree.nodes(binary_node.right_child_id().value()), + binary_node.right_child_id().value())) { + return false; + } + return true; +} + optimization_guide::OptimizationTargetDecision DecisionTreePredictionModel::Predict( const base::flat_map<std::string, float>& model_features) { SEQUENCE_CHECKER(sequence_checker_); - // TODO(crbug/1001194): Add decision tree evaluation implementation. - return optimization_guide::OptimizationTargetDecision::kUnknown; + + double result = 0.0; + // TODO(mcrouse): Add metrics to record if the model evaluation fails. + if (!EvaluateModel(*model_.get(), model_features, &result)) + return optimization_guide::OptimizationTargetDecision::kUnknown; + if (result > model_->threshold().value()) + return optimization_guide::OptimizationTargetDecision::kPageLoadMatches; + return optimization_guide::OptimizationTargetDecision::kPageLoadDoesNotMatch; +} + +bool DecisionTreePredictionModel::TraverseTree( + const proto::DecisionTree& tree, + const proto::TreeNode& node, + const base::flat_map<std::string, float>& model_features, + double* result) { + if (node.has_leaf()) { + *result = node.leaf().vector().value(0).double_value(); + return true; + } + + proto::BinaryNode binary_node = node.binary_node(); + float threshold = + binary_node.inequality_left_child_test().threshold().float_value(); + std::string feature_name = + binary_node.inequality_left_child_test().feature_id().id().value(); + auto it = model_features.find(feature_name); + if (it == model_features.end()) + return false; + switch (binary_node.inequality_left_child_test().type()) { + case proto::InequalityTest::LESS_OR_EQUAL: + if (it->second <= threshold) + return TraverseTree(tree, + tree.nodes(binary_node.left_child_id().value()), + model_features, result); + return TraverseTree(tree, + tree.nodes(binary_node.right_child_id().value()), + model_features, result); + case proto::InequalityTest::LESS_THAN: + if (it->second < threshold) + return TraverseTree(tree, + tree.nodes(binary_node.left_child_id().value()), + model_features, result); + return TraverseTree(tree, + tree.nodes(binary_node.right_child_id().value()), + model_features, result); + case proto::InequalityTest::GREATER_OR_EQUAL: + if (it->second >= threshold) + return TraverseTree(tree, + tree.nodes(binary_node.left_child_id().value()), + model_features, result); + return TraverseTree(tree, + tree.nodes(binary_node.right_child_id().value()), + model_features, result); + case proto::InequalityTest::GREATER_THAN: + if (it->second > threshold) + return TraverseTree(tree, + tree.nodes(binary_node.left_child_id().value()), + model_features, result); + return TraverseTree(tree, + tree.nodes(binary_node.right_child_id().value()), + model_features, result); + default: + return false; + } + return false; +} + +bool DecisionTreePredictionModel::EvaluateDecisionTree( + const proto::DecisionTree& tree, + const base::flat_map<std::string, float>& model_features, + double* result) { + if (TraverseTree(tree, tree.nodes(0), model_features, result)) { + *result *= tree.weight(); + return true; + } + return false; +} + +bool DecisionTreePredictionModel::EvaluateEnsembleModel( + const proto::Ensemble& ensemble, + const base::flat_map<std::string, float>& model_features, + double* result) { + if (ensemble.members_size() == 0) + return false; + + double score = 0.0; + for (const auto& member : ensemble.members()) { + if (!EvaluateModel(member.submodel(), model_features, &score)) { + *result = 0.0; + return false; + } + + *result += score; + } + *result = *result / ensemble.members_size(); + return true; +} + +bool DecisionTreePredictionModel::EvaluateModel( + const proto::Model& model, + const base::flat_map<std::string, float>& model_features, + double* result) { + DCHECK(result); + // Clear the result value. + *result = 0.0; + + if (model.has_ensemble()) { + return EvaluateEnsembleModel(model.ensemble(), model_features, result); + } + if (model.has_decision_tree()) { + return EvaluateDecisionTree(model.decision_tree(), model_features, result); + } + return false; } } // namespace optimization_guide
diff --git a/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.h b/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.h index de2b84c..c367a49 100644 --- a/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.h +++ b/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model.h
@@ -33,6 +33,64 @@ const base::flat_map<std::string, float>& model_features) override; private: + // Evaluates the provided model, either an ensemble or decision tree model, + // with the |model_features| and stores the output in |result|. Returns false + // if evaluation fails. + bool EvaluateModel(const proto::Model& model, + const base::flat_map<std::string, float>& model_features, + double* result); + + // Evaluates the decision tree model with the |model_features| and + // stores the output in |result|. Returns false if the evaluation fails. + bool EvaluateDecisionTree( + const proto::DecisionTree& tree, + const base::flat_map<std::string, float>& model_features, + double* result); + + // Evaluates an ensemble model with the |model_features| and + // stores the output in |result|. Returns false if the evaluation fails. + bool EvaluateEnsembleModel( + const proto::Ensemble& ensemble, + const base::flat_map<std::string, float>& model_features, + double* result); + + // Performs a depth first traversal the |tree| based on |model_features| + // and stores the value of the leaf in |result|. Returns false if the + // traversal or node evaluation fails. + bool TraverseTree(const proto::DecisionTree& tree, + const proto::TreeNode& node, + const base::flat_map<std::string, float>& model_features, + double* result); + + // PredictionModel implementation: + bool ValidatePredictionModel() const override; + + // Validates a model or submodel of an ensemble. Returns + // false if the model is invalid. + bool ValidateModel(const proto::Model& model) const; + + // Validates an ensemble model. Returns false if the ensemble + // if invalid. + bool ValidateEnsembleModel(const proto::Ensemble& ensemble) const; + + // Validates a decision tree model. Returns false if the + // decision tree model is invalid. + bool ValidateDecisionTree(const proto::DecisionTree& tree) const; + + // Validates a leaf. Returns false if the leaf is invalid. + bool ValidateLeaf(const proto::Leaf& leaf) const; + + // Validates an inequality test. Returns false if the + // inequality test is invalid. + bool ValidateInequalityTest( + const proto::InequalityTest& inequality_test) const; + + // Validates each node of a decision tree by traversing every + // node of the |tree|. Returns false if any part of the tree is invalid. + bool ValidateTreeNode(const proto::DecisionTree& tree, + const proto::TreeNode& node, + const int& node_index) const; + SEQUENCE_CHECKER(sequence_checker_); DISALLOW_COPY_AND_ASSIGN(DecisionTreePredictionModel);
diff --git a/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model_unittest.cc b/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model_unittest.cc index c478a9e..44b0600 100644 --- a/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model_unittest.cc +++ b/chrome/browser/optimization_guide/prediction/decision_tree_prediction_model_unittest.cc
@@ -13,33 +13,434 @@ namespace optimization_guide { +std::unique_ptr<proto::PredictionModel> GetValidDecisionTreePredictionModel() { + std::unique_ptr<proto::PredictionModel> prediction_model = + std::make_unique<proto::PredictionModel>(); + prediction_model->mutable_model()->mutable_threshold()->set_value(5.0); + + proto::DecisionTree decision_tree_model = proto::DecisionTree(); + decision_tree_model.set_weight(2.0); + + proto::TreeNode* tree_node = decision_tree_model.add_nodes(); + tree_node->mutable_node_id()->set_value(0); + tree_node->mutable_binary_node()->mutable_left_child_id()->set_value(1); + tree_node->mutable_binary_node()->mutable_right_child_id()->set_value(2); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_feature_id() + ->mutable_id() + ->set_value("agg1"); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::LESS_OR_EQUAL); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_threshold() + ->set_float_value(1.0); + + tree_node = decision_tree_model.add_nodes(); + tree_node->mutable_node_id()->set_value(1); + tree_node->mutable_leaf()->mutable_vector()->add_value()->set_double_value( + 2.); + + tree_node = decision_tree_model.add_nodes(); + tree_node->mutable_node_id()->set_value(2); + tree_node->mutable_leaf()->mutable_vector()->add_value()->set_double_value( + 4.); + + *prediction_model->mutable_model()->mutable_decision_tree() = + decision_tree_model; + return prediction_model; +} + +std::unique_ptr<proto::PredictionModel> GetValidEnsemblePredictionModel() { + std::unique_ptr<proto::PredictionModel> prediction_model = + std::make_unique<proto::PredictionModel>(); + prediction_model->mutable_model()->mutable_threshold()->set_value(5.0); + proto::Ensemble ensemble = proto::Ensemble(); + *ensemble.add_members()->mutable_submodel() = + *GetValidDecisionTreePredictionModel()->mutable_model(); + + *ensemble.add_members()->mutable_submodel() = + *GetValidDecisionTreePredictionModel()->mutable_model(); + + *prediction_model->mutable_model()->mutable_ensemble() = ensemble; + return prediction_model; +} + TEST(DecisionTreePredictionModel, ValidDecisionTreeModel) { - std::unique_ptr<optimization_guide::proto::PredictionModel> prediction_model = - std::make_unique<optimization_guide::proto::PredictionModel>(); + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); - optimization_guide::proto::DecisionTree* decision_tree_model = - prediction_model->mutable_model()->mutable_decision_tree(); - decision_tree_model->set_weight(2.0); - - optimization_guide::proto::ModelInfo* model_info = - prediction_model->mutable_model_info(); + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); model_info->set_version(1); model_info->add_supported_model_types( - optimization_guide::proto::ModelType::MODEL_TYPE_DECISION_TREE); + proto::ModelType::MODEL_TYPE_DECISION_TREE); model_info->add_supported_model_features( - optimization_guide::proto::ClientModelFeature:: + proto::ClientModelFeature:: CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); std::unique_ptr<PredictionModel> model = PredictionModel::Create(std::move(prediction_model), {"agg1"}); - base::flat_map<std::string, float> feature_map = {}; - EXPECT_EQ(1, model->GetVersion()); - EXPECT_EQ(2u, model->GetModelFeatures().size()); - EXPECT_TRUE(model->GetModelFeatures().count("agg1")); - EXPECT_TRUE(model->GetModelFeatures().count( - "CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE")); - EXPECT_EQ(optimization_guide::OptimizationTargetDecision::kUnknown, - model->Predict(feature_map)); + EXPECT_TRUE(model); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadDoesNotMatch, + model->Predict({{"agg1", 1.0}})); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadMatches, + model->Predict({{"agg1", 2.0}})); +} + +TEST(DecisionTreePredictionModel, InequalityLessThan) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(0) + ->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::LESS_THAN); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_TRUE(model); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadDoesNotMatch, + model->Predict({{"agg1", 0.5}})); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadMatches, + model->Predict({{"agg1", 2.0}})); +} + +TEST(DecisionTreePredictionModel, InequalityGreaterOrEqual) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(0) + ->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::GREATER_OR_EQUAL); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_TRUE(model); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadMatches, + model->Predict({{"agg1", 0.5}})); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadDoesNotMatch, + model->Predict({{"agg1", 1.0}})); +} + +TEST(DecisionTreePredictionModel, InequalityGreaterThan) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(0) + ->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::GREATER_THAN); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_TRUE(model); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadMatches, + model->Predict({{"agg1", 0.5}})); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadDoesNotMatch, + model->Predict({{"agg1", 2.0}})); +} + +TEST(DecisionTreePredictionModel, MissingInequalityTest) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(0) + ->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->Clear(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, NoDecisionTreeThreshold) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model()->clear_threshold(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, EmptyTree) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model()->mutable_decision_tree()->clear_nodes(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, ModelFeatureNotInFeatureMap) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model()->mutable_decision_tree()->clear_nodes(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, DecisionTreeMissingLeaf) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(1) + ->mutable_leaf() + ->Clear(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, DecisionTreeLeftChildIndexInvalid) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(0) + ->mutable_binary_node() + ->mutable_left_child_id() + ->set_value(3); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, DecisionTreeRightChildIndexInvalid) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + prediction_model->mutable_model() + ->mutable_decision_tree() + ->mutable_nodes(0) + ->mutable_binary_node() + ->mutable_right_child_id() + ->set_value(3); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, DecisionTreeWithLoopOnLeftChild) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + proto::TreeNode* tree_node = + prediction_model->mutable_model()->mutable_decision_tree()->mutable_nodes( + 1); + + tree_node->mutable_node_id()->set_value(0); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_feature_id() + ->mutable_id() + ->set_value("agg1"); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::LESS_OR_EQUAL); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_threshold() + ->set_float_value(1.0); + + tree_node->mutable_binary_node()->mutable_left_child_id()->set_value(0); + tree_node->mutable_binary_node()->mutable_right_child_id()->set_value(2); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, DecisionTreeWithLoopOnRightChild) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidDecisionTreePredictionModel(); + + proto::TreeNode* tree_node = + prediction_model->mutable_model()->mutable_decision_tree()->mutable_nodes( + 1); + + tree_node->mutable_node_id()->set_value(0); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_feature_id() + ->mutable_id() + ->set_value("agg1"); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::LESS_OR_EQUAL); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_threshold() + ->set_float_value(1.0); + + tree_node->mutable_binary_node()->mutable_left_child_id()->set_value(2); + tree_node->mutable_binary_node()->mutable_right_child_id()->set_value(0); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); +} + +TEST(DecisionTreePredictionModel, ValidEnsembleModel) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidEnsemblePredictionModel(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_TRUE(model); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadDoesNotMatch, + model->Predict({{"agg1", 1.0}})); + EXPECT_EQ(OptimizationTargetDecision::kPageLoadMatches, + model->Predict({{"agg1", 2.0}})); +} + +TEST(DecisionTreePredictionModel, EnsembleWithNoMembers) { + std::unique_ptr<proto::PredictionModel> prediction_model = + GetValidEnsemblePredictionModel(); + prediction_model->mutable_model() + ->mutable_ensemble() + ->mutable_members() + ->Clear(); + + proto::ModelInfo* model_info = prediction_model->mutable_model_info(); + model_info->set_version(1); + model_info->add_supported_model_types( + proto::ModelType::MODEL_TYPE_DECISION_TREE); + model_info->add_supported_model_features( + proto::ClientModelFeature:: + CLIENT_MODEL_FEATURE_EFFECTIVE_CONNECTION_TYPE); + + std::unique_ptr<PredictionModel> model = + PredictionModel::Create(std::move(prediction_model), {"agg1"}); + EXPECT_FALSE(model); } } // namespace optimization_guide
diff --git a/chrome/browser/optimization_guide/prediction/prediction_model.cc b/chrome/browser/optimization_guide/prediction/prediction_model.cc index c9f730aa..64f03b1 100644 --- a/chrome/browser/optimization_guide/prediction/prediction_model.cc +++ b/chrome/browser/optimization_guide/prediction/prediction_model.cc
@@ -12,6 +12,10 @@ std::unique_ptr<optimization_guide::proto::PredictionModel> prediction_model, const base::flat_set<std::string>& host_model_features) { + // TODO(crbug/1009123): Add a histogram to record if the provided model is + // constructed successfully or not. + // TODO(crbug/1009123): Adding timing metrics around initialization due to + // potential validation overhead. if (!prediction_model->has_model()) return nullptr; @@ -44,13 +48,21 @@ return nullptr; } + std::unique_ptr<PredictionModel> model; // The Decision Tree model type is currently the only supported model type. - if (prediction_model->model_info().supported_model_types(0) == + if (prediction_model->model_info().supported_model_types(0) != optimization_guide::proto::ModelType::MODEL_TYPE_DECISION_TREE) { - return std::make_unique<DecisionTreePredictionModel>( - std::move(prediction_model), host_model_features); + return nullptr; } - return nullptr; + model = std::make_unique<DecisionTreePredictionModel>( + std::move(prediction_model), host_model_features); + + // Any constructed model must be validated for correctness according to its + // model type before being returned. + if (!model->ValidatePredictionModel()) + return nullptr; + + return model; } PredictionModel::PredictionModel( @@ -70,6 +82,8 @@ // Insert all the host model features for the owned |model_|. for (const auto& host_model_feature : host_model_features) model_features_.emplace(host_model_feature); + model_ = std::make_unique<optimization_guide::proto::Model>( + prediction_model->model()); } int64_t PredictionModel::GetVersion() const {
diff --git a/chrome/browser/optimization_guide/prediction/prediction_model.h b/chrome/browser/optimization_guide/prediction/prediction_model.h index e4dfd4b..24931f28 100644 --- a/chrome/browser/optimization_guide/prediction/prediction_model.h +++ b/chrome/browser/optimization_guide/prediction/prediction_model.h
@@ -24,8 +24,9 @@ public: virtual ~PredictionModel(); - // Creates an Prediction model of the correct ModelType - // specified in |prediction_model|. + // Creates an Prediction model of the correct ModelType specified in + // |prediction_model|. The validation overhead of this factory can be high and + // should should be called in the background. static std::unique_ptr<PredictionModel> Create( std::unique_ptr<optimization_guide::proto::PredictionModel> prediction_model, @@ -48,10 +49,14 @@ prediction_model, const base::flat_set<std::string>& host_model_features); - private: // The in-memory model used for prediction. std::unique_ptr<optimization_guide::proto::Model> model_; + private: + // Determines if the |model_| is complete and can be successfully evaluated by + // |this|. + virtual bool ValidatePredictionModel() const = 0; + // The information that describes the |model_| std::unique_ptr<optimization_guide::proto::ModelInfo> model_info_;
diff --git a/chrome/browser/optimization_guide/prediction/prediction_model_unittest.cc b/chrome/browser/optimization_guide/prediction/prediction_model_unittest.cc index 25bd5550..d491355b 100644 --- a/chrome/browser/optimization_guide/prediction/prediction_model_unittest.cc +++ b/chrome/browser/optimization_guide/prediction/prediction_model_unittest.cc
@@ -12,12 +12,42 @@ namespace optimization_guide { TEST(PredictionModelTest, ValidPredictionModel) { - std::unique_ptr<optimization_guide::proto::PredictionModel> prediction_model = - std::make_unique<optimization_guide::proto::PredictionModel>(); + std::unique_ptr<proto::PredictionModel> prediction_model = + std::make_unique<proto::PredictionModel>(); + prediction_model->mutable_model()->mutable_threshold()->set_value(5.0); - optimization_guide::proto::DecisionTree* decision_tree_model = - prediction_model->mutable_model()->mutable_decision_tree(); - decision_tree_model->set_weight(2.0); + proto::DecisionTree decision_tree_model = proto::DecisionTree(); + decision_tree_model.set_weight(2.0); + + proto::TreeNode* tree_node = decision_tree_model.add_nodes(); + tree_node->mutable_node_id()->set_value(0); + tree_node->mutable_binary_node()->mutable_left_child_id()->set_value(1); + tree_node->mutable_binary_node()->mutable_right_child_id()->set_value(2); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_feature_id() + ->mutable_id() + ->set_value("agg1"); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->set_type(proto::InequalityTest::LESS_OR_EQUAL); + tree_node->mutable_binary_node() + ->mutable_inequality_left_child_test() + ->mutable_threshold() + ->set_float_value(1.0); + + tree_node = decision_tree_model.add_nodes(); + tree_node->mutable_node_id()->set_value(1); + tree_node->mutable_leaf()->mutable_vector()->add_value()->set_double_value( + 2.); + + tree_node = decision_tree_model.add_nodes(); + tree_node->mutable_node_id()->set_value(2); + tree_node->mutable_leaf()->mutable_vector()->add_value()->set_double_value( + 4.); + + *prediction_model->mutable_model()->mutable_decision_tree() = + decision_tree_model; optimization_guide::proto::ModelInfo* model_info = prediction_model->mutable_model_info();
diff --git a/chrome/browser/password_manager/password_generation_interactive_uitest.cc b/chrome/browser/password_manager/password_generation_interactive_uitest.cc index e12b74d..ee69e29 100644 --- a/chrome/browser/password_manager/password_generation_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_generation_interactive_uitest.cc
@@ -295,7 +295,7 @@ } IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, - PopupShownAndDismissed) { + DISABLED_PopupShownAndDismissed) { FocusPasswordField(); EXPECT_TRUE(GenerationPopupShowing());
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 9c85889..c0d6cb1 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -680,6 +680,12 @@ { key::kDeviceLoginScreenAutoclickEnabled, nullptr, base::Value::Type::BOOLEAN }, + { key::kDeviceLoginScreenStickyKeysEnabled, + nullptr, + base::Value::Type::BOOLEAN }, + { key::kDeviceLoginScreenKeyboardFocusHighlightEnabled, + nullptr, + base::Value::Type::BOOLEAN }, { key::kRebootAfterUpdate, prefs::kRebootAfterUpdate, base::Value::Type::BOOLEAN },
diff --git a/chrome/browser/policy/extension_policy_browsertest.cc b/chrome/browser/policy/extension_policy_browsertest.cc index c870443..5965509 100644 --- a/chrome/browser/policy/extension_policy_browsertest.cc +++ b/chrome/browser/policy/extension_policy_browsertest.cc
@@ -248,9 +248,9 @@ // Verifies that blacklisted extensions can't be installed. extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); ASSERT_FALSE(registry->GetExtensionById( - kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kSimpleWithIconCrxId, extensions::ExtensionRegistry::EVERYTHING)); base::ListValue blacklist; blacklist.AppendString(kGoodCrxId); PolicyMap policies; @@ -262,17 +262,15 @@ // "good.crx" is blacklisted. EXPECT_FALSE(InstallExtension(kGoodCrxName)); EXPECT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); // "simple_with_icon.crx" is not. const extensions::Extension* simple_with_icon = InstallExtension(kSimpleWithIconCrxName); ASSERT_TRUE(simple_with_icon); EXPECT_EQ(kSimpleWithIconCrxId, simple_with_icon->id()); - EXPECT_EQ( - simple_with_icon, - registry->GetExtensionById(kSimpleWithIconCrxId, - extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_EQ(simple_with_icon, + registry->enabled_extensions().GetByID(kSimpleWithIconCrxId)); } // Ensure that bookmark apps are not blocked by the ExtensionInstallBlacklist @@ -439,9 +437,8 @@ extensions::ExtensionService* service = extension_service(); extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); - ASSERT_TRUE(registry->GetExtensionById( - kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); + ASSERT_TRUE(registry->enabled_extensions().GetByID(kSimpleWithIconCrxId)); base::ListValue blacklist; blacklist.AppendString("*"); PolicyMap policies; @@ -451,8 +448,7 @@ UpdateProviderPolicy(policies); // "simple_with_icon" should be disabled. - EXPECT_TRUE(registry->GetExtensionById( - kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(registry->disabled_extensions().GetByID(kSimpleWithIconCrxId)); EXPECT_FALSE(service->IsExtensionEnabled(kSimpleWithIconCrxId)); // It shouldn't be possible to re-enable "simple_with_icon", until it @@ -463,7 +459,7 @@ // It shouldn't be possible to install good.crx. EXPECT_FALSE(InstallExtension(kGoodCrxName)); EXPECT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); } IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest, @@ -495,9 +491,9 @@ extensions::ExtensionService* service = extension_service(); extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kImporterId, extensions::ExtensionRegistry::COMPATIBILITY)); + kImporterId, extensions::ExtensionRegistry::EVERYTHING)); ASSERT_FALSE(registry->GetExtensionById( - kSharedModuleId, extensions::ExtensionRegistry::COMPATIBILITY)); + kSharedModuleId, extensions::ExtensionRegistry::EVERYTHING)); // Mock the webstore update URL. This is where the shared module extension // will be installed from. @@ -529,12 +525,12 @@ observe_shared_module.WaitForExtensionLoaded(); // Verify that both extensions got installed. - const extensions::Extension* importer = registry->GetExtensionById( - kImporterId, extensions::ExtensionRegistry::COMPATIBILITY); + const extensions::Extension* importer = + registry->enabled_extensions().GetByID(kImporterId); ASSERT_TRUE(importer); EXPECT_EQ(kImporterId, importer->id()); - const extensions::Extension* shared_module = registry->GetExtensionById( - kSharedModuleId, extensions::ExtensionRegistry::COMPATIBILITY); + const extensions::Extension* shared_module = + registry->enabled_extensions().GetByID(kSharedModuleId); ASSERT_TRUE(shared_module); EXPECT_EQ(kSharedModuleId, shared_module->id()); EXPECT_TRUE(shared_module->is_shared_module()); @@ -556,9 +552,9 @@ // Verifies that the whitelist can open exceptions to the blacklist. extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); ASSERT_FALSE(registry->GetExtensionById( - kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kSimpleWithIconCrxId, extensions::ExtensionRegistry::EVERYTHING)); base::ListValue blacklist; blacklist.AppendString("*"); base::ListValue whitelist; @@ -574,14 +570,12 @@ // "simple_with_icon.crx" is blacklisted. EXPECT_FALSE(InstallExtension(kSimpleWithIconCrxName)); EXPECT_FALSE(registry->GetExtensionById( - kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kSimpleWithIconCrxId, extensions::ExtensionRegistry::EVERYTHING)); // "good.crx" has a whitelist exception. const extensions::Extension* good = InstallExtension(kGoodCrxName); ASSERT_TRUE(good); EXPECT_EQ(kGoodCrxId, good->id()); - EXPECT_EQ(good, - registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_EQ(good, registry->enabled_extensions().GetByID(kGoodCrxId)); // The user can also remove this extension. UninstallExtension(kGoodCrxId, true); } @@ -680,7 +674,7 @@ extensions::ExtensionService* service = extension_service(); extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); // Extensions that are force-installed come from an update URL, which defaults // to the webstore. Use a test URL for this test with an update manifest @@ -741,8 +735,7 @@ // exception, since the details object has already been freed prior to // the completion of observer.WaitForExtensionWillBeInstalled(). - EXPECT_TRUE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(registry->enabled_extensions().GetByID(kGoodCrxId)); // The user is not allowed to uninstall force-installed extensions. UninstallExtension(kGoodCrxId, false); @@ -766,11 +759,7 @@ ASSERT_TRUE(extension); const std::string old_version_number = - registry - ->GetExtensionById(kGoodCrxId, - extensions::ExtensionRegistry::COMPATIBILITY) - ->version() - .GetString(); + registry->enabled_extensions().GetByID(kGoodCrxId)->version().GetString(); content::WindowedNotificationObserver new_process_observer( content::NOTIFICATION_RENDERER_PROCESS_CREATED, @@ -786,10 +775,7 @@ update_observer.WaitForExtensionWillBeInstalled(); const base::Version& new_version = - registry - ->GetExtensionById(kGoodCrxId, - extensions::ExtensionRegistry::COMPATIBILITY) - ->version(); + registry->enabled_extensions().GetByID(kGoodCrxId)->version(); ASSERT_TRUE(new_version.IsValid()); base::Version old_version(old_version_number); ASSERT_TRUE(old_version.IsValid()); @@ -850,7 +836,7 @@ extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); // Setting the forcelist extension should install "good_v1.crx". base::ListValue forcelist; @@ -863,8 +849,7 @@ UpdateProviderPolicy(policies); observer.WaitForExtensionWillBeInstalled(); - EXPECT_TRUE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(registry->enabled_extensions().GetByID(kGoodCrxId)); } IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest, @@ -889,7 +874,7 @@ extensions::ExtensionService* service = extension_service(); extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); // Setting the forcelist extension should install "good_v1.crx". base::DictionaryValue dict_value; @@ -907,8 +892,11 @@ UpdateProviderPolicy(policies); observer.WaitForExtensionWillBeInstalled(); + // TODO(crbug.com/1006342): There is a race condition here where the extension + // may or may not be enabled by the time we get here. EXPECT_TRUE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::ENABLED | + extensions::ExtensionRegistry::DISABLED)); // The user is not allowed to uninstall recommended-installed extensions. UninstallExtension(kGoodCrxId, false); @@ -927,9 +915,9 @@ // list and the extension's type is not on that list. extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); ASSERT_FALSE(registry->GetExtensionById( - kHostedAppCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kHostedAppCrxId, extensions::ExtensionRegistry::EVERYTHING)); base::ListValue allowed_types; allowed_types.AppendString("hosted_app"); @@ -942,15 +930,14 @@ // "good.crx" is blocked. EXPECT_FALSE(InstallExtension(kGoodCrxName)); EXPECT_FALSE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); // "hosted_app.crx" is of a whitelisted type. const extensions::Extension* hosted_app = InstallExtension(kHostedAppCrxName); ASSERT_TRUE(hosted_app); EXPECT_EQ(kHostedAppCrxId, hosted_app->id()); EXPECT_EQ(hosted_app, - registry->GetExtensionById( - kHostedAppCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + registry->enabled_extensions().GetByID(kHostedAppCrxId)); // The user can remove the extension. UninstallExtension(kHostedAppCrxId, true); @@ -1006,9 +993,9 @@ // The first extension shouldn't be present, the second should be there. EXPECT_FALSE(extension_registry()->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); - EXPECT_TRUE(extension_registry()->GetExtensionById( - kSimpleWithIconCrxId, extensions::ExtensionRegistry::ENABLED)); + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); + EXPECT_TRUE( + extension_registry()->enabled_extensions().GetByID(kSimpleWithIconCrxId)); } // Verifies that extensions with version older than the minimum version required
diff --git a/chrome/browser/predictors/loading_predictor_browsertest.cc b/chrome/browser/predictors/loading_predictor_browsertest.cc index 0a13aea..bf6ca469 100644 --- a/chrome/browser/predictors/loading_predictor_browsertest.cc +++ b/chrome/browser/predictors/loading_predictor_browsertest.cc
@@ -1118,8 +1118,9 @@ // Checks the opposite of the above test - tests that even when a redirect is // predicted, preconnects are still made to the original origin using the // correct NetworkIsolationKey. +// TODO(crbug.com/1006637). Flaky on all platforms. IN_PROC_BROWSER_TEST_P(LoadingPredictorNetworkIsolationKeyBrowserTest, - LoadingPredictorWithRedirects2) { + DISABLED_LoadingPredictorWithRedirects2) { // Cache the redirect, so the only connections to the tracked server created // during navigations should be for preconnects. GURL destination_url = preconnecting_test_server()->GetURL("/cachetime");
diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc index 949f5c1e..fe64081 100644 --- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc +++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
@@ -173,7 +173,7 @@ // A base fixture designed such that implementations do two things: // 1) Override all three pure-virtual methods below to setup, attack, and -// verify preferenes throughout the tests provided by this fixture. +// verify preferences throughout the tests provided by this fixture. // 2) Instantiate their test via the PREF_HASH_BROWSER_TEST macro above. // Based on top of ExtensionBrowserTest to allow easy interaction with the // ExtensionRegistry. @@ -541,8 +541,7 @@ EXPECT_EQ("http://example.com", profile()->GetPrefs()->GetString(prefs::kHomePage)); - EXPECT_TRUE(extension_registry()->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); + EXPECT_TRUE(extension_registry()->enabled_extensions().GetByID(kGoodCrxId)); // Reaction should be identical to unattacked default prefs. PrefHashBrowserTestUnchangedDefault::VerifyReactionToPrefAttack(); @@ -925,10 +924,10 @@ user_prefs::tracked::kTrackedPrefHistogramReset, BEGIN_ALLOW_SINGLE_BUCKET + 5)); - EXPECT_EQ(protection_level_ < PROTECTION_ENABLED_EXTENSIONS, - extension_registry()->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY) != - nullptr); + EXPECT_EQ( + protection_level_ < PROTECTION_ENABLED_EXTENSIONS, + extension_registry()->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING) != nullptr); // Nothing else should have triggered. EXPECT_EQ(
diff --git a/chrome/browser/prerender/prerender_final_status.h b/chrome/browser/prerender/prerender_final_status.h index d213eb49..9d6e2eb 100644 --- a/chrome/browser/prerender/prerender_final_status.h +++ b/chrome/browser/prerender/prerender_final_status.h
@@ -20,7 +20,7 @@ FINAL_STATUS_USED = 0, FINAL_STATUS_TIMED_OUT = 1, // Obsolete: FINAL_STATUS_EVICTED = 2, - FINAL_STATUS_MANAGER_SHUTDOWN = 3, + // Obsolete: FINAL_STATUS_MANAGER_SHUTDOWN = 3, FINAL_STATUS_CLOSED = 4, FINAL_STATUS_CREATE_NEW_WINDOW = 5, FINAL_STATUS_PROFILE_DESTROYED = 6,
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 7c6730dc..a2e1d88d 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc
@@ -30,7 +30,6 @@ #include "base/time/time.h" #include "base/timer/elapsed_timer.h" #include "base/values.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/predictors/loading_predictor.h" @@ -54,8 +53,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/navigation_controller.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_source.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" @@ -213,10 +210,6 @@ GetCurrentTimeTicks() - base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs); - notification_registrar_.Add( - this, chrome::NOTIFICATION_PROFILE_DESTROYED, - content::Source<Profile>(profile_)); - MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this); } @@ -234,7 +227,7 @@ } void PrerenderManager::Shutdown() { - DestroyAllContents(FINAL_STATUS_MANAGER_SHUTDOWN); + DestroyAllContents(FINAL_STATUS_PROFILE_DESTROYED); on_close_web_contents_deleters_.clear(); profile_ = nullptr; @@ -1265,15 +1258,6 @@ "Consider whether a failed prerender should fallback to preconnect"); } -void PrerenderManager::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); - - DestroyAllContents(FINAL_STATUS_PROFILE_DESTROYED); - on_close_web_contents_deleters_.clear(); -} - void PrerenderManager::OnCreatingAudioStream(int render_process_id, int render_frame_id) { content::RenderFrameHost* render_frame_host =
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h index 8cae2ab2..346eb560 100644 --- a/chrome/browser/prerender/prerender_manager.h +++ b/chrome/browser/prerender/prerender_manager.h
@@ -25,8 +25,6 @@ #include "chrome/browser/prerender/prerender_histograms.h" #include "chrome/browser/prerender/prerender_origin.h" #include "components/keyed_service/core/keyed_service.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_process_host_observer.h" #include "url/gurl.h" #include "url/origin.h" @@ -75,8 +73,7 @@ // PrerenderManager is responsible for initiating and keeping prerendered // views of web pages. All methods must be called on the UI thread unless // indicated otherwise. -class PrerenderManager : public content::NotificationObserver, - public content::RenderProcessHostObserver, +class PrerenderManager : public content::RenderProcessHostObserver, public KeyedService, public MediaCaptureDevicesDispatcher::Observer { public: @@ -295,11 +292,6 @@ // Record a final status of a prerendered page in a histogram. void RecordFinalStatus(Origin origin, FinalStatus final_status) const; - // content::NotificationObserver - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; - // MediaCaptureDevicesDispatcher::Observer void OnCreatingAudioStream(int render_process_id, int render_frame_id) override; @@ -615,8 +607,6 @@ std::unique_ptr<PrerenderHistograms> histograms_; - content::NotificationRegistrar notification_registrar_; - // The number of bytes transferred over the network for the profile this // PrerenderManager is attached to. int64_t profile_network_bytes_;
diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc index 5205d20..2e02961 100644 --- a/chrome/browser/prerender/prerender_unittest.cc +++ b/chrome/browser/prerender/prerender_unittest.cc
@@ -152,7 +152,7 @@ // From KeyedService, via PrererenderManager: void Shutdown() override { if (next_prerender_contents()) - next_prerender_contents_->Destroy(FINAL_STATUS_MANAGER_SHUTDOWN); + next_prerender_contents_->Destroy(FINAL_STATUS_PROFILE_DESTROYED); PrerenderManager::Shutdown(); } @@ -464,7 +464,7 @@ DummyPrerenderContents* prerender_contents = prerender_manager()->CreateNextPrerenderContents( - url, FINAL_STATUS_MANAGER_SHUTDOWN); + url, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(url)); EXPECT_EQ(PREFETCH_ONLY, prerender_contents->prerender_mode()); } @@ -488,7 +488,7 @@ base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeature(kGWSPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( - url, FINAL_STATUS_MANAGER_SHUTDOWN); + url, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(url)); } @@ -504,7 +504,7 @@ scoped_feature_list.InitAndEnableFeature(kGWSPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( url, url::Origin::Create(GURL("www.google.com")), ORIGIN_GWS_PRERENDER, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); EXPECT_FALSE(AddSimpleGWSPrerender(url)); } @@ -519,7 +519,7 @@ base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndDisableFeature(kGWSPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( - url, FINAL_STATUS_MANAGER_SHUTDOWN); + url, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(url)); } @@ -535,7 +535,7 @@ scoped_feature_list.InitAndDisableFeature(kGWSPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( url, url::Origin::Create(GURL("www.google.com")), ORIGIN_GWS_PRERENDER, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimpleGWSPrerender(url)); } @@ -552,7 +552,7 @@ kNavigationPredictorPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( url, url::Origin::Create(GURL("www.notgoogle.com")), - ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN, FINAL_STATUS_MANAGER_SHUTDOWN); + ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(url)); } @@ -569,7 +569,7 @@ kNavigationPredictorPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( url, base::nullopt, ORIGIN_NAVIGATION_PREDICTOR, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); EXPECT_EQ(nullptr, prerender_manager()->AddPrerenderFromNavigationPredictor( url, nullptr, gfx::Size())); } @@ -586,7 +586,7 @@ kNavigationPredictorPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( url, url::Origin::Create(GURL("www.notgoogle.com")), - ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN, FINAL_STATUS_MANAGER_SHUTDOWN); + ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(url)); } @@ -603,7 +603,7 @@ kNavigationPredictorPrefetchHoldback); prerender_manager()->CreateNextPrerenderContents( url, base::nullopt, ORIGIN_NAVIGATION_PREDICTOR, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); EXPECT_NE(nullptr, prerender_manager()->AddPrerenderFromNavigationPredictor( url, nullptr, gfx::Size())); @@ -673,7 +673,7 @@ DummyPrerenderContents* prerender_contents1 = prerender_manager()->CreateNextPrerenderContents( - url, FINAL_STATUS_MANAGER_SHUTDOWN); + url, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(url)); EXPECT_EQ(prerender_contents1, prerender_manager()->next_prerender_contents()); @@ -814,7 +814,7 @@ GURL second_url("http://example2.com"); DummyPrerenderContents* second_prerender_contents = prerender_manager()->CreateNextPrerenderContents( - second_url, FINAL_STATUS_MANAGER_SHUTDOWN); + second_url, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(AddSimplePrerender(second_url)); EXPECT_EQ(second_prerender_contents, prerender_manager()->FindEntry(second_url)); @@ -846,7 +846,7 @@ prerender_manager()->CancelAllPrerenders(); prerender_manager()->CreateNextPrerenderContents( - kUrl, base::nullopt, ORIGIN_OMNIBOX, FINAL_STATUS_MANAGER_SHUTDOWN); + kUrl, base::nullopt, ORIGIN_OMNIBOX, FINAL_STATUS_PROFILE_DESTROYED); // Prefetching again before time_to_live aborts, because it is a duplicate. tick_clock()->Advance(base::TimeDelta::FromSeconds(1)); @@ -1118,8 +1118,7 @@ TEST_F(PrerenderTest, SourceRenderViewClosed) { GURL url("http://www.google.com/"); prerender_manager()->CreateNextPrerenderContents( - url, - FINAL_STATUS_MANAGER_SHUTDOWN); + url, FINAL_STATUS_PROFILE_DESTROYED); prerender_link_manager()->OnAddPrerender( 100, GetNextPrerenderID(), url, kDefaultRelTypes, Referrer(), url::Origin::Create(url), kSize, 200); @@ -1222,7 +1221,7 @@ DummyPrerenderContents* prerender_contents = prerender_manager()->CreateNextPrerenderContents( GURL("http://www.example.com"), base::nullopt, ORIGIN_OMNIBOX, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); EXPECT_TRUE(prerender_manager()->AddPrerenderFromOmnibox( GURL("http://www.example.com"), nullptr, gfx::Size())); @@ -1325,7 +1324,7 @@ DummyPrerenderContents* prerender_contents = prerender_manager()->CreateNextPrerenderContents( url, base::nullopt, ORIGIN_EXTERNAL_REQUEST, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); std::unique_ptr<PrerenderHandle> prerender_handle( prerender_manager()->AddPrerenderFromExternalRequest( url, content::Referrer(), nullptr, gfx::Rect(kSize))); @@ -1691,7 +1690,7 @@ // A cancelled NoStatePrefetch is counted as a prefetch recently happened. A // new attempt to prefetch should return as duplicate. prerender_manager()->CreateNextPrerenderContents( - url, FINAL_STATUS_MANAGER_SHUTDOWN); + url, FINAL_STATUS_PROFILE_DESTROYED); EXPECT_FALSE(AddSimplePrerender(url)); EXPECT_FALSE(prerender_manager()->FindEntry(url)); } @@ -1923,7 +1922,7 @@ DummyPrerenderContents* prerender_contents = prerender_manager()->CreateNextPrerenderContents( url, base::nullopt, ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER, - FINAL_STATUS_MANAGER_SHUTDOWN); + FINAL_STATUS_PROFILE_DESTROYED); std::unique_ptr<PrerenderHandle> prerender_handle = prerender_manager()->AddForcedPrerenderFromExternalRequest( url, content::Referrer(), nullptr, gfx::Rect(kSize));
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index bb090879..1f96099 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h
@@ -414,7 +414,9 @@ // ProfileDestroyer, but in tests, some are not. void MaybeSendDestroyedNotification(); - // Creates an OffTheRecordProfile which points to this Profile. + // Creates an OffTheRecordProfile which points to this Profile. The caller is + // responsible for sending a NOTIFICATION_PROFILE_CREATED when the profile is + // correctly assigned to its owner. Profile* CreateOffTheRecordProfile(); #if !defined(OS_ANDROID)
diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index c40ff8eb..652eac2 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc
@@ -49,6 +49,7 @@ #include "components/version_info/version_info.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/notification_observer.h" #include "content/public/browser/storage_partition.h" #include "content/public/test/test_utils.h" #include "extensions/browser/extension_registry.h" @@ -609,6 +610,67 @@ ASSERT_EQ(profile_impl->last_selected_directory(), home); } +IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, Notifications) { + base::ScopedAllowBlockingForTesting allow_blocking; + base::ScopedTempDir temp_dir; + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); + + // Create the profile and check that a notification is received for it. + std::unique_ptr<Profile> profile; + { + content::WindowedNotificationObserver profile_created_observer( + chrome::NOTIFICATION_PROFILE_CREATED, + content::NotificationService::AllSources()); + + profile = CreateProfile(temp_dir.GetPath(), nullptr, + Profile::CREATE_MODE_SYNCHRONOUS); + profile_created_observer.Wait(); + + EXPECT_EQ(profile_created_observer.source(), + content::Source<Profile>(profile.get())); + } + + // Now retrieve the off-the-record profile, which will be created because it + // doesn't exist yet. + Profile* otr_profile = nullptr; + { + content::WindowedNotificationObserver profile_created_observer( + chrome::NOTIFICATION_PROFILE_CREATED, + content::NotificationService::AllSources()); + + otr_profile = profile->GetOffTheRecordProfile(); + profile_created_observer.Wait(); + + EXPECT_EQ(profile_created_observer.source(), + content::Source<Profile>(otr_profile)); + EXPECT_TRUE(profile->HasOffTheRecordProfile()); + EXPECT_TRUE(otr_profile->IsOffTheRecord()); + EXPECT_FALSE(otr_profile->IsIndependentOffTheRecordProfile()); + } + + // Destroy the off-the-record profile. + { + content::WindowedNotificationObserver profile_destroyed_observer( + chrome::NOTIFICATION_PROFILE_DESTROYED, + content::Source<Profile>(otr_profile)); + + profile->DestroyOffTheRecordProfile(); + profile_destroyed_observer.Wait(); + + EXPECT_FALSE(profile->HasOffTheRecordProfile()); + } + + // Destroy the regular profile. + { + content::WindowedNotificationObserver profile_destroyed_observer( + chrome::NOTIFICATION_PROFILE_DESTROYED, + content::Source<Profile>(profile.get())); + + profile.reset(); + profile_destroyed_observer.Wait(); + } +} + class ProfileWithoutMediaCacheBrowserTest : public ProfileBrowserTest { public: ProfileWithoutMediaCacheBrowserTest() {
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 9a1e792..fae427d 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -2039,7 +2039,7 @@ 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:
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json b/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json index 33edb1598..f049fa2 100644 --- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json +++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json
@@ -924,6 +924,25 @@ } }, { + "command": "previousSimilarItem", + "sequence": { + "cvoxModifier": true, + "keys": { + "keyCode": [73], + "shiftKey": [true] + } + } + }, + { + "command": "nextSimilarItem", + "sequence": { + "cvoxModifier": true, + "keys": { + "keyCode": [73] + } + } + }, + { "command": "jumpToDetails", "sequence": { "cvoxModifier": true,
diff --git a/chrome/browser/resources/chromeos/chromevox/common/command_store.js b/chrome/browser/resources/chromeos/chromevox/common/command_store.js index 9f8e99c..b70b092 100644 --- a/chrome/browser/resources/chromeos/chromevox/common/command_store.js +++ b/chrome/browser/resources/chromeos/chromevox/common/command_store.js
@@ -320,6 +320,18 @@ skipInput: true, category: 'navigation' }, + 'previousSimilarItem': { + backward: true, + announce: true, + msgId: 'previous_similar_item', + category: 'navigation' + }, + 'nextSimilarItem': { + forward: true, + announce: true, + msgId: 'next_similar_item', + category: 'navigation' + }, 'jumpToTop': { forward: true,
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js index 2018679..09fd2ae 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
@@ -663,4 +663,15 @@ */ AutomationPredicate.text = AutomationPredicate.roles( [Role.STATIC_TEXT, Role.INLINE_TEXT_BOX, Role.LINE_BREAK]); + +/** + * Matches against nodes we should ignore in a jump command. + * @param {!AutomationNode} node + * @return {boolean} + */ +AutomationPredicate.ignoreDuringJump = function(node) { + return node.role == Role.GENERIC_CONTAINER || node.role == Role.STATIC_TEXT || + node.role == Role.INLINE_TEXT_BOX; +}; + }); // goog.scope
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs index 97b10d5..b06bb83d 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs
@@ -2061,3 +2061,30 @@ mockFeedback.replay(); }); }); + +TEST_F('ChromeVoxBackgroundTest', 'SimilarItemNavigation', function() { + var mockFeedback = this.createMockFeedback(); + this.runWithLoadedTree(function() {/*! + <h3><a href="#a">inner</a></h3> + <p>some text</p> + <button>some other text</button> + <a href="#b">outer1</a> + <h3>outer2</h3> + */}, function(root) { + assertEquals(RoleType.LINK, ChromeVoxState.instance.currentRange.start.node.role); + assertEquals('inner', ChromeVoxState.instance.currentRange.start.node.name); + mockFeedback.call(doCmd('nextSimilarItem')) + .expectSpeech('outer1', 'Link') + .call(doCmd('nextSimilarItem')) + .expectSpeech('inner', 'Link') + .call(doCmd('nextSimilarItem')) + .call(doCmd('previousSimilarItem')) + .expectSpeech('inner', 'Link') + .call(doCmd('nextHeading')) + .expectSpeech('outer2', 'Heading 3') + .call(doCmd('previousSimilarItem')) + .expectSpeech('inner', 'Heading 3'); + + mockFeedback.replay(); + }); +});
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js index c0dd8da7..f1d7e439 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
@@ -507,6 +507,21 @@ skipSync = true; pred = AutomationPredicate.group; break; + case 'previousSimilarItem': + dir = Dir.BACKWARD; + // Falls through. + case 'nextSimilarItem': + skipSync = true; + var node = current.start.node; + var originalNode = node; + + // Scan upwards until we get a role we don't want to ignore. + while (node && AutomationPredicate.ignoreDuringJump(node)) + node = node.parent; + + var useNode = node || originalNode; + pred = AutomationPredicate.roles([node.role]); + break; case 'jumpToTop': var node = AutomationUtil.findNodePost( current.start.node.root, Dir.FORWARD, AutomationPredicate.object);
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js index 4e48d74..cc9bb94 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -437,7 +437,7 @@ /** * Returns the deepest equivalent cursor. - * @return {cursors.Cursor} + * @return {!cursors.Cursor} */ get deepEquivalent() { var newNode = this.node;
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js index 55bce0d..8fff0474 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
@@ -546,10 +546,13 @@ var selectionEndObject = evt.target.root.selectionEndObject; var selectionEndOffset = evt.target.root.selectionEndOffset || 0; if (selectionStartObject && selectionEndObject) { + // Sync to the selection's deep equivalent especially in editables, where + // selection is often on the root text field with a child offset. var selectedRange = new cursors.Range( - new cursors.WrappingCursor( - selectionStartObject, selectionStartOffset), - new cursors.WrappingCursor(selectionEndObject, selectionEndOffset)); + new cursors.WrappingCursor(selectionStartObject, selectionStartOffset) + .deepEquivalent, + new cursors.WrappingCursor(selectionEndObject, selectionEndOffset) + .deepEquivalent); // Sync ChromeVox range with selection. ChromeVoxState.instance.setCurrentRange(selectedRange);
diff --git a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd index c1c43ae..603254051 100644 --- a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd +++ b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
@@ -2293,6 +2293,12 @@ <message desc="The description of the next group command. Displayed in the Options page." name="IDS_CHROMEVOX_NEXT_GROUP"> Next Group </message> + <message desc="The description of the previous similar command." name="IDS_CHROMEVOX_PREVIOUS_SIMILAR_ITEM"> + Previous similar item + </message> + <message desc="The description of the next similar item command." name="IDS_CHROMEVOX_NEXT_SIMILAR_ITEM"> + Next similar item + </message> <message desc="Describes nodes or anything describing them as a landmark." name="IDS_CHROMEVOX_ROLE_LANDMARK"> Landmark </message>
diff --git a/chrome/browser/resources/extensions/BUILD.gn b/chrome/browser/resources/extensions/BUILD.gn index 1798f62..e232cb5 100644 --- a/chrome/browser/resources/extensions/BUILD.gn +++ b/chrome/browser/resources/extensions/BUILD.gn
@@ -7,46 +7,48 @@ import("//tools/grit/grit_rule.gni") import("../optimize_webui.gni") -extensions_pak_file = "extensions_resources.pak" -unpak_folder = "extensions_resources.unpak" +if (optimize_webui) { + extensions_pak_file = "extensions_resources.pak" + unpak_folder = "extensions_resources.unpak" -optimize_webui("build") { - host = "extensions" - html_in_files = [ "extensions.html" ] - html_out_files = [ "vulcanized.html" ] - insert_in_head = "<base href=\"chrome://extensions\">" - input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir) - js_out_files = [ "crisper.js" ] - replace_for_html_imports_polyfill = "crisper.js" + optimize_webui("build") { + host = "extensions" + html_in_files = [ "extensions.html" ] + html_out_files = [ "vulcanized.html" ] + insert_in_head = "<base href=\"chrome://extensions\">" + input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir) + js_out_files = [ "crisper.js" ] + replace_for_html_imports_polyfill = "crisper.js" - deps = [ - ":unpak", - ] -} + deps = [ + ":unpak", + ] + } -unpak("unpak") { - pak_file = extensions_pak_file - out_folder = unpak_folder + unpak("unpak") { + pak_file = extensions_pak_file + out_folder = unpak_folder - deps = [ - ":flattened_resources", - ] -} + deps = [ + ":flattened_resources", + ] + } -grit("flattened_resources") { - source = "extensions_resources.grd" + grit("flattened_resources") { + source = "extensions_resources.grd" - # The .grd contains references to generated files. - source_is_generated = true + # The .grd contains references to generated files. + source_is_generated = true - defines = chrome_grit_defines - outputs = [ - "grit/extensions_resources.h", - "grit/extensions_resources_map.cc", - "grit/extensions_resources_map.h", - extensions_pak_file, - ] - output_dir = "$root_gen_dir/chrome/browser/resources/extensions" + defines = chrome_grit_defines + outputs = [ + "grit/extensions_resources.h", + "grit/extensions_resources_map.cc", + "grit/extensions_resources_map.h", + extensions_pak_file, + ] + output_dir = "$root_gen_dir/chrome/browser/resources/extensions" + } } group("closure_compile") {
diff --git a/chrome/browser/resources/print_preview/data/document_info.js b/chrome/browser/resources/print_preview/data/document_info.js index 8663ca2..d85124d 100644 --- a/chrome/browser/resources/print_preview/data/document_info.js +++ b/chrome/browser/resources/print_preview/data/document_info.js
@@ -159,7 +159,7 @@ Math.round(pageLayout.marginTop), Math.round(pageLayout.marginRight), Math.round(pageLayout.marginBottom), Math.round(pageLayout.marginLeft)); - const o = print_preview.ticket_items.CustomMarginsOrientation; + const o = print_preview.CustomMarginsOrientation; const pageSize = new print_preview.Size( pageLayout.contentWidth + margins.get(o.LEFT) + margins.get(o.RIGHT), pageLayout.contentHeight + margins.get(o.TOP) + margins.get(o.BOTTOM));
diff --git a/chrome/browser/resources/print_preview/data/margins.js b/chrome/browser/resources/print_preview/data/margins.js index 3facd5a8..cbf2a02 100644 --- a/chrome/browser/resources/print_preview/data/margins.js +++ b/chrome/browser/resources/print_preview/data/margins.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -cr.define('print_preview.ticket_items', function() { +cr.define('print_preview', function() { 'use strict'; /** @@ -61,18 +61,14 @@ /** * Backing store for the margin values in points. * @type {!Object< - * !print_preview.ticket_items.CustomMarginsOrientation, number>} + * !print_preview.CustomMarginsOrientation, number>} * @private */ this.value_ = {}; - this.value_[print_preview.ticket_items.CustomMarginsOrientation.TOP] = - top; - this.value_[print_preview.ticket_items.CustomMarginsOrientation.RIGHT] = - right; - this.value_[print_preview.ticket_items.CustomMarginsOrientation.BOTTOM] = - bottom; - this.value_[print_preview.ticket_items.CustomMarginsOrientation.LEFT] = - left; + this.value_[print_preview.CustomMarginsOrientation.TOP] = top; + this.value_[print_preview.CustomMarginsOrientation.RIGHT] = right; + this.value_[print_preview.CustomMarginsOrientation.BOTTOM] = bottom; + this.value_[print_preview.CustomMarginsOrientation.LEFT] = left; } /** @@ -83,15 +79,14 @@ */ static parse(state) { return new print_preview.Margins( - state[print_preview.ticket_items.CustomMarginsOrientation.TOP] || 0, - state[print_preview.ticket_items.CustomMarginsOrientation.RIGHT] || 0, - state[print_preview.ticket_items.CustomMarginsOrientation.BOTTOM] || - 0, - state[print_preview.ticket_items.CustomMarginsOrientation.LEFT] || 0); + state[print_preview.CustomMarginsOrientation.TOP] || 0, + state[print_preview.CustomMarginsOrientation.RIGHT] || 0, + state[print_preview.CustomMarginsOrientation.BOTTOM] || 0, + state[print_preview.CustomMarginsOrientation.LEFT] || 0); } /** - * @param {!print_preview.ticket_items.CustomMarginsOrientation} + * @param {!print_preview.CustomMarginsOrientation} * orientation Specifies the margin value to get. * @return {number} Value of the margin of the given orientation. */ @@ -100,7 +95,7 @@ } /** - * @param {!print_preview.ticket_items.CustomMarginsOrientation} + * @param {!print_preview.CustomMarginsOrientation} * orientation Specifies the margin to set. * @param {number} value Updated value of the margin in points to modify. * @return {!print_preview.Margins} A new copy of |this| with the @@ -110,10 +105,10 @@ const newValue = this.clone_(); newValue[orientation] = value; return new Margins( - newValue[print_preview.ticket_items.CustomMarginsOrientation.TOP], - newValue[print_preview.ticket_items.CustomMarginsOrientation.RIGHT], - newValue[print_preview.ticket_items.CustomMarginsOrientation.BOTTOM], - newValue[print_preview.ticket_items.CustomMarginsOrientation.LEFT]); + newValue[print_preview.CustomMarginsOrientation.TOP], + newValue[print_preview.CustomMarginsOrientation.RIGHT], + newValue[print_preview.CustomMarginsOrientation.BOTTOM], + newValue[print_preview.CustomMarginsOrientation.LEFT]); } /**
diff --git a/chrome/browser/resources/print_preview/data/model.js b/chrome/browser/resources/print_preview/data/model.js index 8094143..6c355bc6 100644 --- a/chrome/browser/resources/print_preview/data/model.js +++ b/chrome/browser/resources/print_preview/data/model.js
@@ -60,7 +60,7 @@ * width_microns: number, * custom_display_name: (string | undefined), * is_default: (boolean | undefined)} | undefined), - * marginsType: (print_preview.ticket_items.MarginsTypeValue | undefined), + * marginsType: (print_preview.MarginsTypeValue | undefined), * customMargins: (print_preview.MarginsSetting | undefined), * isColorEnabled: (boolean | undefined), * isDuplexEnabled: (boolean | undefined), @@ -262,9 +262,8 @@ updatesPreview: true, }, margins: { - value: print_preview.ticket_items.MarginsTypeValue.DEFAULT, - unavailableValue: - print_preview.ticket_items.MarginsTypeValue.DEFAULT, + value: print_preview.MarginsTypeValue.DEFAULT, + unavailableValue: print_preview.MarginsTypeValue.DEFAULT, valid: true, available: true, setByPolicy: false, @@ -791,22 +790,20 @@ // Otherwise, availability depends on the margins. let available = false; const marginsType = - /** @type {!print_preview.ticket_items.MarginsTypeValue} */ ( + /** @type {!print_preview.MarginsTypeValue} */ ( this.getSettingValue('margins')); switch (marginsType) { - case print_preview.ticket_items.MarginsTypeValue.DEFAULT: + case print_preview.MarginsTypeValue.DEFAULT: available = !this.margins || - this.margins.get( - print_preview.ticket_items.CustomMarginsOrientation.TOP) > 0 || - this.margins.get( - print_preview.ticket_items.CustomMarginsOrientation.BOTTOM) > 0; + this.margins.get(print_preview.CustomMarginsOrientation.TOP) > 0 || + this.margins.get(print_preview.CustomMarginsOrientation.BOTTOM) > 0; break; - case print_preview.ticket_items.MarginsTypeValue.NO_MARGINS: + case print_preview.MarginsTypeValue.NO_MARGINS: break; - case print_preview.ticket_items.MarginsTypeValue.MINIMUM: + case print_preview.MarginsTypeValue.MINIMUM: available = true; break; - case print_preview.ticket_items.MarginsTypeValue.CUSTOM: + case print_preview.MarginsTypeValue.CUSTOM: const margins = this.getSettingValue('customMargins'); available = margins.marginTop > 0 || margins.marginBottom > 0; break; @@ -1240,7 +1237,7 @@ } if (this.getSettingValue('margins') == - print_preview.ticket_items.MarginsTypeValue.CUSTOM) { + print_preview.MarginsTypeValue.CUSTOM) { ticket.marginsCustom = this.getSettingValue('customMargins'); }
diff --git a/chrome/browser/resources/print_preview/ui/margin_control.js b/chrome/browser/resources/print_preview/ui/margin_control.js index 0e9dca3..97e8f1b 100644 --- a/chrome/browser/resources/print_preview/ui/margin_control.js +++ b/chrome/browser/resources/print_preview/ui/margin_control.js
@@ -138,7 +138,7 @@ */ convertPixelsToPts: function(pixels) { let pts; - const Orientation = print_preview.ticket_items.CustomMarginsOrientation; + const Orientation = print_preview.CustomMarginsOrientation; if (this.side == Orientation.TOP) { pts = pixels - this.translateTransform.y + RADIUS_PX; pts /= this.scaleTransform; @@ -253,7 +253,7 @@ return; } - const Orientation = print_preview.ticket_items.CustomMarginsOrientation; + const Orientation = print_preview.CustomMarginsOrientation; let x = this.translateTransform.x; let y = this.translateTransform.y; let width = null;
diff --git a/chrome/browser/resources/print_preview/ui/margin_control_container.js b/chrome/browser/resources/print_preview/ui/margin_control_container.js index b507fc8..f4e9c4bf 100644 --- a/chrome/browser/resources/print_preview/ui/margin_control_container.js +++ b/chrome/browser/resources/print_preview/ui/margin_control_container.js
@@ -7,15 +7,13 @@ 'use strict'; /** - * @const {!Map<!print_preview.ticket_items.CustomMarginsOrientation, string>} + * @const {!Map<!print_preview.CustomMarginsOrientation, string>} */ const MARGIN_KEY_MAP = new Map([ - [print_preview.ticket_items.CustomMarginsOrientation.TOP, 'marginTop'], - [print_preview.ticket_items.CustomMarginsOrientation.RIGHT, 'marginRight'], - [ - print_preview.ticket_items.CustomMarginsOrientation.BOTTOM, 'marginBottom' - ], - [print_preview.ticket_items.CustomMarginsOrientation.LEFT, 'marginLeft'] + [print_preview.CustomMarginsOrientation.TOP, 'marginTop'], + [print_preview.CustomMarginsOrientation.RIGHT, 'marginRight'], + [print_preview.CustomMarginsOrientation.BOTTOM, 'marginBottom'], + [print_preview.CustomMarginsOrientation.LEFT, 'marginLeft'] ]); /** @const {number} */ @@ -87,16 +85,16 @@ }, /** - * @private {!Array<!print_preview.ticket_items.CustomMarginsOrientation>} + * @private {!Array<!print_preview.CustomMarginsOrientation>} */ marginSides_: { type: Array, notify: true, value: [ - print_preview.ticket_items.CustomMarginsOrientation.TOP, - print_preview.ticket_items.CustomMarginsOrientation.RIGHT, - print_preview.ticket_items.CustomMarginsOrientation.BOTTOM, - print_preview.ticket_items.CustomMarginsOrientation.LEFT, + print_preview.CustomMarginsOrientation.TOP, + print_preview.CustomMarginsOrientation.RIGHT, + print_preview.CustomMarginsOrientation.BOTTOM, + print_preview.CustomMarginsOrientation.LEFT, ], }, @@ -139,7 +137,7 @@ computeAvailable_: function() { return this.previewLoaded && !!this.clipSize_ && this.getSettingValue('margins') == - print_preview.ticket_items.MarginsTypeValue.CUSTOM && + print_preview.MarginsTypeValue.CUSTOM && !!this.pageSize; }, @@ -150,7 +148,7 @@ // custom margins were reset. const newMargins = {}; for (const side of Object.values( - print_preview.ticket_items.CustomMarginsOrientation)) { + print_preview.CustomMarginsOrientation)) { const key = print_preview.MARGIN_KEY_MAP.get(side); newMargins[key] = this.documentMargins.get(side); } @@ -187,11 +185,9 @@ this.resetMargins_ = true; const marginsSetting = this.getSetting('margins'); - if (marginsSetting.value == - print_preview.ticket_items.MarginsTypeValue.CUSTOM) { + if (marginsSetting.value == print_preview.MarginsTypeValue.CUSTOM) { // Set the margins value to default first. - this.setSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT); + this.setSetting('margins', print_preview.MarginsTypeValue.DEFAULT); } // Reset custom margins so that the sticky value is not restored for the // new paper size. @@ -218,16 +214,14 @@ }, /** - * @param {!print_preview.ticket_items.CustomMarginsOrientation} orientation + * @param {!print_preview.CustomMarginsOrientation} orientation * Orientation value to test. * @return {boolean} Whether the given orientation is TOP or BOTTOM. * @private */ isTopOrBottom_: function(orientation) { - return orientation == - print_preview.ticket_items.CustomMarginsOrientation.TOP || - orientation == - print_preview.ticket_items.CustomMarginsOrientation.BOTTOM; + return orientation == print_preview.CustomMarginsOrientation.TOP || + orientation == print_preview.CustomMarginsOrientation.BOTTOM; }, /** @@ -241,8 +235,7 @@ */ posInPixelsToPts_: function(control, posInPixels) { const side = - /** @type {print_preview.ticket_items.CustomMarginsOrientation} */ ( - control.side); + /** @type {print_preview.CustomMarginsOrientation} */ (control.side); return this.clipAndRoundValue_( side, control.convertPixelsToPts( @@ -349,7 +342,7 @@ const x = control.offsetLeft; const y = control.offsetTop; const isTopOrBottom = this.isTopOrBottom_( - /** @type {!print_preview.ticket_items.CustomMarginsOrientation} */ ( + /** @type {!print_preview.CustomMarginsOrientation} */ ( control.side)); const position = {}; // Extra padding, in px, to ensure the full textbox will be visible and @@ -395,8 +388,7 @@ */ setMargin_: function(side, marginValue) { const marginSide = - /** @type {!print_preview.ticket_items.CustomMarginsOrientation} */ ( - side); + /** @type {!print_preview.CustomMarginsOrientation} */ (side); const oldMargins = /** @type {print_preview.MarginsSetting} */ ( this.getSettingValue('customMargins')); const key = print_preview.MARGIN_KEY_MAP.get(marginSide); @@ -416,12 +408,11 @@ */ clipAndRoundValue_: function(side, value) { const marginSide = - /** @type {!print_preview.ticket_items.CustomMarginsOrientation} */ ( - side); + /** @type {!print_preview.CustomMarginsOrientation} */ (side); if (value < 0) { return 0; } - const Orientation = print_preview.ticket_items.CustomMarginsOrientation; + const Orientation = print_preview.CustomMarginsOrientation; let limit = 0; const margins = this.getSettingValue('customMargins'); if (marginSide == Orientation.TOP) { @@ -482,10 +473,9 @@ new print_preview.Coordinate2d(e.x, e.y); this.marginStartPositionInPixels_ = new print_preview.Coordinate2d(control.offsetLeft, control.offsetTop); - this.dragging_ = - this.isTopOrBottom_( - /** @type {print_preview.ticket_items.CustomMarginsOrientation} */ - (control.side)) ? + this.dragging_ = this.isTopOrBottom_( + /** @type {print_preview.CustomMarginsOrientation} */ + (control.side)) ? 'dragging-vertical' : 'dragging-horizontal'; this.listen(control, 'pointercancel', 'onPointerUp_');
diff --git a/chrome/browser/resources/print_preview/ui/margins_settings.html b/chrome/browser/resources/print_preview/ui/margins_settings.html index f02aa28..f0284da7 100644 --- a/chrome/browser/resources/print_preview/ui/margins_settings.html +++ b/chrome/browser/resources/print_preview/ui/margins_settings.html
@@ -19,8 +19,7 @@ settings.pagesPerSheet.value)]]" value="{{selectedValue::change}}"> <!-- The order of these options must match the natural order of their - values, which come from - print_preview.ticket_items.MarginsTypeValue. --> + values, which come from print_preview.MarginsTypeValue. --> <option value="[[MarginsValue.DEFAULT]]" selected> $i18n{defaultMargins} </option>
diff --git a/chrome/browser/resources/print_preview/ui/margins_settings.js b/chrome/browser/resources/print_preview/ui/margins_settings.js index 94732b72..98444fa 100644 --- a/chrome/browser/resources/print_preview/ui/margins_settings.js +++ b/chrome/browser/resources/print_preview/ui/margins_settings.js
@@ -18,7 +18,7 @@ /** @override */ ready: function() { - this.MarginsValue = print_preview.ticket_items.MarginsTypeValue; + this.MarginsValue = print_preview.MarginsTypeValue; }, /** @@ -27,8 +27,7 @@ */ onMarginsSettingChange_: function(newValue) { this.selectedValue = - /** @type {!print_preview.ticket_items.MarginsTypeValue} */ (newValue) - .toString(); + /** @type {!print_preview.MarginsTypeValue} */ (newValue).toString(); }, /** @param {string} value The new select value. */
diff --git a/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js b/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js index d581eee..6cc6d89 100644 --- a/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js +++ b/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js
@@ -19,8 +19,7 @@ */ onPagesPerSheetSettingChange_: function(newValue) { this.selectedValue = /** @type {number} */ (newValue).toString(); - this.setSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT); + this.setSetting('margins', print_preview.MarginsTypeValue.DEFAULT); }, /** @param {string} value The new select value. */
diff --git a/chrome/browser/resources/print_preview/ui/preview_area.js b/chrome/browser/resources/print_preview/ui/preview_area.js index 71f038f..487a40c5 100644 --- a/chrome/browser/resources/print_preview/ui/preview_area.js +++ b/chrome/browser/resources/print_preview/ui/preview_area.js
@@ -529,13 +529,12 @@ */ marginsValid_: function() { const type = this.getSettingValue('margins'); - if (!Object.values(print_preview.ticket_items.MarginsTypeValue) - .includes(type)) { + if (!Object.values(print_preview.MarginsTypeValue).includes(type)) { // Unrecognized margins type. return false; } - if (type !== print_preview.ticket_items.MarginsTypeValue.CUSTOM) { + if (type !== print_preview.MarginsTypeValue.CUSTOM) { return true; } @@ -567,11 +566,11 @@ // Margins const newMarginsType = this.getSettingValue('margins'); if (newMarginsType !== lastTicket.marginsType && - newMarginsType !== print_preview.ticket_items.MarginsTypeValue.CUSTOM) { + newMarginsType !== print_preview.MarginsTypeValue.CUSTOM) { return true; } - if (newMarginsType === print_preview.ticket_items.MarginsTypeValue.CUSTOM) { + if (newMarginsType === print_preview.MarginsTypeValue.CUSTOM) { const customMargins = /** @type {!print_preview.MarginsSetting} */ ( this.getSettingValue('customMargins')); @@ -595,11 +594,10 @@ } const customMarginsChanged = - Object.values(print_preview.ticket_items.CustomMarginsOrientation) - .some(side => { - return this.margins.get(side) !== - customMargins[print_preview.MARGIN_KEY_MAP.get(side)]; - }); + Object.values(print_preview.CustomMarginsOrientation).some(side => { + return this.margins.get(side) !== + customMargins[print_preview.MARGIN_KEY_MAP.get(side)]; + }); if (customMarginsChanged) { return true; } @@ -629,7 +627,7 @@ // default margins to trigger a request. if (this.getSettingValue('pagesPerSheet') !== lastTicket.pagesPerSheet && this.getSettingValue('margins') === - print_preview.ticket_items.MarginsTypeValue.DEFAULT) { + print_preview.MarginsTypeValue.DEFAULT) { return true; } @@ -641,7 +639,7 @@ newValue.width_microns != lastTicket.mediaSize.width_microns || (this.destination.id !== lastTicket.deviceName && this.getSettingValue('margins') === - print_preview.ticket_items.MarginsTypeValue.MINIMUM)) { + print_preview.MarginsTypeValue.MINIMUM)) { return true; } @@ -734,7 +732,7 @@ } if (this.getSettingValue('margins') == - print_preview.ticket_items.MarginsTypeValue.CUSTOM) { + print_preview.MarginsTypeValue.CUSTOM) { ticket.marginsCustom = this.getSettingValue('customMargins'); } this.lastTicket_ = ticket;
diff --git a/chrome/browser/resources/settings/autofill_page/autofill_section.js b/chrome/browser/resources/settings/autofill_page/autofill_section.js index 652a4aa..ba786243 100644 --- a/chrome/browser/resources/settings/autofill_page/autofill_section.js +++ b/chrome/browser/resources/settings/autofill_page/autofill_section.js
@@ -13,16 +13,18 @@ */ class AutofillManager { /** - * Add an observer to the list of addresses. - * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener + * Add an observer to the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - addAddressListChangedListener(listener) {} + setPersonalDataManagerListener(listener) {} /** - * Remove an observer from the list of addresses. - * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener + * Remove an observer from the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - removeAddressListChangedListener(listener) {} + removePersonalDataManagerListener(listener) {} /** * Request the list of addresses. @@ -49,13 +51,13 @@ */ class AutofillManagerImpl { /** @override */ - addAddressListChangedListener(listener) { - chrome.autofillPrivate.onAddressListChanged.addListener(listener); + setPersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.addListener(listener); } /** @override */ - removeAddressListChangedListener(listener) { - chrome.autofillPrivate.onAddressListChanged.removeListener(listener); + removePersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.removeListener(listener); } /** @override */ @@ -117,21 +119,30 @@ autofillManager_: null, /** - * @type {?function(!Array<!AutofillManager.AddressEntry>)} + * @type {?function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} * @private */ - setAddressesListener_: null, + setPersonalDataListener_: null, /** @override */ attached: function() { // Create listener functions. /** @type {function(!Array<!AutofillManager.AddressEntry>)} */ - const setAddressesListener = list => { - this.addresses = list; + const setAddressesListener = addressList => { + this.addresses = addressList; + }; + + /** + * @type {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} + */ + const setPersonalDataListener = (addressList, cardList) => { + this.addresses = addressList; }; // Remember the bound reference in order to detach. - this.setAddressesListener_ = setAddressesListener; + this.setPersonalDataListener_ = setPersonalDataListener; // Set the managers. These can be overridden by tests. this.autofillManager_ = AutofillManagerImpl.getInstance(); @@ -140,7 +151,8 @@ this.autofillManager_.getAddressList(setAddressesListener); // Listen for changes. - this.autofillManager_.addAddressListChangedListener(setAddressesListener); + this.autofillManager_.setPersonalDataManagerListener( + setPersonalDataListener); // Record that the user opened the address settings. chrome.metricsPrivate.recordUserAction('AutofillAddressesViewed'); @@ -148,9 +160,12 @@ /** @override */ detached: function() { - this.autofillManager_.removeAddressListChangedListener( - /** @type {function(!Array<!AutofillManager.AddressEntry>)} */ ( - this.setAddressesListener_)); + this.autofillManager_.removePersonalDataManagerListener( + /** + @type {function(!Array<!AutofillManager.AddressEntry>, + !Array<!PaymentsManager.CreditCardEntry>)} + */ + (this.setPersonalDataListener_)); }, /**
diff --git a/chrome/browser/resources/settings/autofill_page/payments_section.js b/chrome/browser/resources/settings/autofill_page/payments_section.js index ef245525..d5baeda 100644 --- a/chrome/browser/resources/settings/autofill_page/payments_section.js +++ b/chrome/browser/resources/settings/autofill_page/payments_section.js
@@ -13,16 +13,18 @@ */ class PaymentsManager { /** - * Add an observer to the list of credit cards. - * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener + * Add an observer to the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - addCreditCardListChangedListener(listener) {} + setPersonalDataManagerListener(listener) {} /** - * Remove an observer from the list of credit cards. - * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener + * Remove an observer from the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - removeCreditCardListChangedListener(listener) {} + removePersonalDataManagerListener(listener) {} /** * Request the list of credit cards. @@ -67,13 +69,13 @@ */ class PaymentsManagerImpl { /** @override */ - addCreditCardListChangedListener(listener) { - chrome.autofillPrivate.onCreditCardListChanged.addListener(listener); + setPersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.addListener(listener); } /** @override */ - removeCreditCardListChangedListener(listener) { - chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener); + removePersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.removeListener(listener); } /** @override */ @@ -192,21 +194,30 @@ PaymentsManager_: null, /** - * @type {?function(!Array<!PaymentsManager.CreditCardEntry>)} + * @type {?function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} * @private */ - setCreditCardsListener_: null, + setPersonalDataListener_: null, /** @override */ attached: function() { // Create listener function. /** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ - const setCreditCardsListener = list => { - this.creditCards = list; + const setCreditCardsListener = cardList => { + this.creditCards = cardList; + }; + + /** + * @type {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} + */ + const setPersonalDataListener = (addressList, cardList) => { + this.creditCards = cardList; }; // Remember the bound reference in order to detach. - this.setCreditCardsListener_ = setCreditCardsListener; + this.setPersonalDataListener_ = setPersonalDataListener; // Set the managers. These can be overridden by tests. this.paymentsManager_ = PaymentsManagerImpl.getInstance(); @@ -215,8 +226,8 @@ this.paymentsManager_.getCreditCardList(setCreditCardsListener); // Listen for changes. - this.paymentsManager_.addCreditCardListChangedListener( - setCreditCardsListener); + this.paymentsManager_.setPersonalDataManagerListener( + setPersonalDataListener); // Record that the user opened the payments settings. chrome.metricsPrivate.recordUserAction('AutofillCreditCardsViewed'); @@ -224,9 +235,12 @@ /** @override */ detached: function() { - this.paymentsManager_.removeCreditCardListChangedListener( - /** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ ( - this.setCreditCardsListener_)); + this.paymentsManager_.removePersonalDataManagerListener( + /** + @type {function(!Array<!AutofillManager.AddressEntry>, + !Array<!PaymentsManager.CreditCardEntry>)} + */ + (this.setPersonalDataListener_)); }, /**
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html index d4e38255..a1b6c1c 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html +++ b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html
@@ -136,14 +136,14 @@ <settings-bluetooth-page prefs="{{prefs}}"> </settings-bluetooth-page> </settings-section> - <template is="dom-if" if="[[!isGuestMode_]]"> + <template is="dom-if" if="[[!isGuestMode_]]" restamp> <settings-section page-title="$i18n{multidevicePageTitle}" section="multidevice"> <settings-multidevice-page prefs="{{prefs}}"> </settings-multidevice-page> </settings-section> </template> - <template is="dom-if" if="[[!isGuestMode_]]"> + <template is="dom-if" if="[[!isGuestMode_]]" restamp> <settings-section page-title="$i18n{peoplePageTitle}" section="people"> <os-settings-people-page prefs="{{prefs}}" @@ -157,7 +157,7 @@ show-crostini="[[showCrostini]]"> </settings-device-page> </settings-section> - <template is="dom-if" if="[[!isGuestMode_]]"> + <template is="dom-if" if="[[!isGuestMode_]]" restamp> <settings-section page-title="$i18n{personalizationPageTitle}" section="personalization"> <settings-personalization-page></settings-personalization-page>
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.js b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.js index 664a6c4..90b60ae1 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.js +++ b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.js
@@ -60,12 +60,11 @@ /** * Whether the user is in guest mode. - * @private{boolean} + * @private {boolean} */ isGuestMode_: { type: Boolean, value: loadTimeData.getBoolean('isGuest'), - readOnly: true, }, /**
diff --git a/chrome/browser/resources/settings/device_page/display.html b/chrome/browser/resources/settings/device_page/display.html index eb3ff4b..cee6faf 100644 --- a/chrome/browser/resources/settings/device_page/display.html +++ b/chrome/browser/resources/settings/device_page/display.html
@@ -65,10 +65,6 @@ margin-top: 20px; } - #nightLightOffSpacer { - padding-top: 28px; - } - iron-collapse { width: 100%; } @@ -246,63 +242,53 @@ sub-label="$i18n{displayNightLightText}"> </settings-toggle-button> - <template is="dom-if" if="[[prefs.ash.night_light.enabled.value]]"> - <div id="nightLightSettingsDiv" - class="settings-box continuation start layout vertical"> - <!-- Color temperature slider --> - <div id="nightLightTemperatureDiv" - class="settings-box indented continuation"> - <div class="start text-area" id="colorTemperatureLabel"> - $i18n{displayNightLightTemperatureLabel} - </div> - <settings-slider id="colorTemperatureSlider" - aria-labelledby="colorTemperatureLabel" min="0" max="100" - scale="100" label-min="$i18n{displayNightLightTempSliderMinLabel}" - label-max="$i18n{displayNightLightTempSliderMaxLabel}" - pref="{{prefs.ash.night_light.color_temperature}}"> - </settings-slider> + <div id="nightLightSettingsDiv" + class="settings-box continuation start layout vertical"> + <!-- Color temperature slider --> + <div id="nightLightTemperatureDiv" + class="settings-box indented continuation" + hidden$="[[!prefs.ash.night_light.enabled.value]]"> + <div class="start text-area" id="colorTemperatureLabel"> + $i18n{displayNightLightTemperatureLabel} </div> - <!-- Schedule settings --> - <div class="settings-box indented"> - <div class="start text-area"> - <div id="nightLightScheduleLabel" class="label"> - $i18n{displayNightLightScheduleLabel} - </div> - <div id="nightLightScheduleSubLabel" class="secondary label" - hidden$="[[!nightLightScheduleSubLabel_]]"> - [[nightLightScheduleSubLabel_]] - </div> - </div> - <settings-dropdown-menu - id="nightLightScheduleTypeDropDown" - aria-labelledby="nightLightScheduleLabel" - pref="{{prefs.ash.night_light.schedule_type}}" - menu-options="[[scheduleTypesList_]]"> - </settings-dropdown-menu> - </div> - <!-- Custom schedule slider --> - <iron-collapse id="nightLightCustomScheduleCollapse" - opened="[[shouldOpenCustomScheduleCollapse_]]"> - <div class="settings-box indented continuation"> - <div class="start text-area layout vertical"> - <div class="settings-box continuation self-stretch"> - <night-light-slider id="nightLightSlider" prefs="{{prefs}}"> - </night-light-slider> - </div> - </div> - </div> - </iron-collapse> + <settings-slider id="colorTemperatureSlider" + aria-labelledby="colorTemperatureLabel" min="0" max="100" + scale="100" label-min="$i18n{displayNightLightTempSliderMinLabel}" + label-max="$i18n{displayNightLightTempSliderMaxLabel}" + pref="{{prefs.ash.night_light.color_temperature}}"> + </settings-slider> </div> - </template> - <template is="dom-if" if="[[!prefs.ash.night_light.enabled.value]]"> - <!-- When the user scrolls to the bottom then enables Night Light ensure - that the "Schedule" select is at least partially visible so the user - knows they can scroll down for more controls. --> - <div id="nightLightOffSpacer"></div> - </template> - - <!-- NOTE: If you add more controls here you can remove the - nightLightOffSpacer div above. --> + <!-- Schedule settings --> + <div class="settings-box indented"> + <div class="start text-area"> + <div id="nightLightScheduleLabel" class="label"> + $i18n{displayNightLightScheduleLabel} + </div> + <div id="nightLightScheduleSubLabel" class="secondary label" + hidden$="[[!nightLightScheduleSubLabel_]]"> + [[nightLightScheduleSubLabel_]] + </div> + </div> + <settings-dropdown-menu + id="nightLightScheduleTypeDropDown" + aria-labelledby="nightLightScheduleLabel" + pref="{{prefs.ash.night_light.schedule_type}}" + menu-options="[[scheduleTypesList_]]"> + </settings-dropdown-menu> + </div> + <!-- Custom schedule slider --> + <iron-collapse id="nightLightCustomScheduleCollapse" + opened="[[shouldOpenCustomScheduleCollapse_]]"> + <div class="settings-box indented continuation"> + <div class="start text-area layout vertical"> + <div class="settings-box continuation self-stretch"> + <night-light-slider id="nightLightSlider" prefs="{{prefs}}"> + </night-light-slider> + </div> + </div> + </div> + </iron-collapse> + </div> </template> <script src="display.js"></script>
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc index 4ae8e5177..0e57121 100644 --- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc +++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc
@@ -419,7 +419,8 @@ base::BindOnce(&DeepScanningDialogDelegate::StringRequestCallback, weak_ptr_factory_.GetWeakPtr())); - PrepareRequest(request.get()); + PrepareRequest(DlpDeepScanningClientRequest::WEB_CONTENT_UPLOAD, + request.get()); UploadTextForDeepScanning(std::move(request)); } } else { @@ -434,7 +435,7 @@ base::BindOnce(&DeepScanningDialogDelegate::FileRequestCallback, weak_ptr_factory_.GetWeakPtr(), path)); - PrepareRequest(request.get()); + PrepareRequest(DlpDeepScanningClientRequest::FILE_UPLOAD, request.get()); UploadFileForDeepScanning(path, std::move(request)); } @@ -442,11 +443,11 @@ } void DeepScanningDialogDelegate::PrepareRequest( + DlpDeepScanningClientRequest::ContentSource trigger, BinaryUploadService::Request* request) { if (data_.do_dlp_scan) { DlpDeepScanningClientRequest dlp_request; - dlp_request.set_content_source( - DlpDeepScanningClientRequest::WEB_CONTENT_UPLOAD); + dlp_request.set_content_source(trigger); request->set_request_dlp_scan(std::move(dlp_request)); } @@ -467,6 +468,9 @@ void DeepScanningDialogDelegate::UploadTextForDeepScanning( std::unique_ptr<BinaryUploadService::Request> request) { + DCHECK_EQ( + DlpDeepScanningClientRequest::WEB_CONTENT_UPLOAD, + request->deep_scanning_request().dlp_scan_request().content_source()); BinaryUploadService* upload_service = g_browser_process->safe_browsing_service()->GetBinaryUploadService( Profile::FromBrowserContext(web_contents_->GetBrowserContext())); @@ -477,6 +481,9 @@ void DeepScanningDialogDelegate::UploadFileForDeepScanning( const base::FilePath& path, std::unique_ptr<BinaryUploadService::Request> request) { + DCHECK_EQ( + DlpDeepScanningClientRequest::FILE_UPLOAD, + request->deep_scanning_request().dlp_scan_request().content_source()); BinaryUploadService* upload_service = g_browser_process->safe_browsing_service()->GetBinaryUploadService( Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.h b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.h index 5eb164df..3be3dbb 100644 --- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.h +++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.h
@@ -176,7 +176,8 @@ // Adds required fields to |request| before sending it to the binary upload // service. - void PrepareRequest(BinaryUploadService::Request* request); + void PrepareRequest(DlpDeepScanningClientRequest::ContentSource trigger, + BinaryUploadService::Request* request); // Fills the arrays in |result_| with the given boolean status. void FillAllResultsWith(bool status);
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/fake_deep_scanning_dialog_delegate.cc b/chrome/browser/safe_browsing/cloud_content_scanning/fake_deep_scanning_dialog_delegate.cc index 83d0b85..9336a8f 100644 --- a/chrome/browser/safe_browsing/cloud_content_scanning/fake_deep_scanning_dialog_delegate.cc +++ b/chrome/browser/safe_browsing/cloud_content_scanning/fake_deep_scanning_dialog_delegate.cc
@@ -82,7 +82,7 @@ std::unique_ptr<BinaryUploadService::Request> request) { DCHECK(!path.empty()); DCHECK_EQ( - DlpDeepScanningClientRequest::WEB_CONTENT_UPLOAD, + DlpDeepScanningClientRequest::FILE_UPLOAD, request->deep_scanning_request().dlp_scan_request().content_source()); DCHECK_EQ(dm_token_, request->deep_scanning_request().dm_token());
diff --git a/chrome/browser/send_tab_to_self/send_tab_to_self_util.cc b/chrome/browser/send_tab_to_self/send_tab_to_self_util.cc index 13c3c2a..3817045a 100644 --- a/chrome/browser/send_tab_to_self/send_tab_to_self_util.cc +++ b/chrome/browser/send_tab_to_self/send_tab_to_self_util.cc
@@ -44,7 +44,7 @@ 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 @@ // 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 @@ // 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) {
diff --git a/chrome/browser/send_tab_to_self/send_tab_to_self_util.h b/chrome/browser/send_tab_to_self/send_tab_to_self_util.h index 8efab87..15b6d5d 100644 --- a/chrome/browser/send_tab_to_self/send_tab_to_self_util.h +++ b/chrome/browser/send_tab_to_self/send_tab_to_self_util.h
@@ -28,7 +28,7 @@ // 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);
diff --git a/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.cc b/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.cc index e85ff1e..46d0b34 100644 --- a/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.cc +++ b/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.cc
@@ -96,21 +96,21 @@ } 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) {
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc b/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc index de50199..d4270944 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc
@@ -16,6 +16,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/gcm/gcm_profile_service_factory.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" +#include "chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h" #include "chrome/browser/sharing/click_to_call/click_to_call_utils.h" #include "chrome/browser/sharing/click_to_call/feature.h" #include "chrome/browser/sharing/features.h" @@ -26,15 +27,20 @@ #include "chrome/browser/sharing/sharing_service_factory.h" #include "chrome/browser/sharing/sharing_sync_preference.h" #include "chrome/browser/sync/device_info_sync_service_factory.h" +#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/test/integration/sessions_helper.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/ui/browser.h" #include "components/gcm_driver/fake_gcm_profile_service.h" #include "components/sync/driver/profile_sync_service.h" +#include "components/sync/test/fake_server/fake_server.h" +#include "components/sync/test/fake_server/fake_server_network_resources.h" #include "components/sync_device_info/device_info_sync_service.h" #include "components/sync_device_info/fake_device_info_tracker.h" #include "components/ukm/test_ukm_recorder.h" +#include "content/public/test/test_navigation_observer.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "url/gurl.h" @@ -57,7 +63,10 @@ ~ClickToCallBrowserTest() override {} - void SetUpOnMainThread() override { SyncTest::SetUpOnMainThread(); } + void SetUpOnMainThread() override { + SyncTest::SetUpOnMainThread(); + host_resolver()->AddRule("mock.http", "127.0.0.1"); + } void Init(const std::vector<base::Feature>& enabled_features, const std::vector<base::Feature>& disabled_features) { @@ -65,9 +74,17 @@ ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; - sessions_helper::OpenTab(0, GURL("http://www.google.com/")); + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url = embedded_test_server()->GetURL("mock.http", "/sharing/tel.html"); + ASSERT_TRUE(sessions_helper::OpenTab(0, url)); + web_contents_ = GetBrowser(0)->tab_strip_model()->GetWebContentsAt(0); + // Ensure that the test page has loaded. + const base::string16 title = base::ASCIIToUTF16("Tel"); + content::TitleWatcher watcher(web_contents_, title); + EXPECT_EQ(title, watcher.WaitAndGetTitle()); + gcm_service_ = static_cast<gcm::FakeGCMProfileService*>( gcm::GCMProfileServiceFactory::GetForProfile(GetProfile(0))); gcm_service_->set_collect(true); @@ -110,7 +127,8 @@ device->chrome_version(), device->sync_user_agent(), device->device_type(), device->signin_scoped_device_id(), device->last_updated_timestamp(), - device->send_tab_to_self_receiving_enabled()); + device->send_tab_to_self_receiving_enabled(), + device->sharing_info()); fake_device_info_tracker_.Add(fake_device.get()); device_infos_.push_back(std::move(fake_device)); } @@ -164,6 +182,8 @@ SharingService* sharing_service() const { return sharing_service_; } + content::WebContents* web_contents() const { return web_contents_; } + private: gcm::GCMProfileServiceFactory::ScopedTestingFactoryInstaller scoped_testing_factory_installer_; @@ -394,3 +414,23 @@ *selection); // TODO(knollr): mock apps and verify |has_apps| here too. } + +IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, CloseTabWithBubble) { + Init({kSharingDeviceRegistration, kClickToCallUI}, {}); + SetUpDevices(/*count=*/1); + + base::RunLoop run_loop; + ClickToCallUiController::GetOrCreateFromWebContents(web_contents()) + ->set_on_dialog_shown_closure_for_testing(run_loop.QuitClosure()); + + // Click on the tel link to trigger the bubble view. + web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( + base::ASCIIToUTF16("document.querySelector('a').click();"), + base::NullCallback()); + // Wait until the bubble is visible. + run_loop.Run(); + + // Close the tab while the bubble is opened. + // Regression test for http://crbug.com/1000934. + sessions_helper::CloseTab(/*browser_index=*/0, /*tab_index=*/0); +}
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer_unittest.cc b/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer_unittest.cc index 3a1d715..a6e46a6 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer_unittest.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer_unittest.cc
@@ -115,8 +115,9 @@ base::StrCat({"guid", base::NumberToString(i)}), "name", "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false)); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt)); } return devices; }
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc index 7d810fd2..b9faf9c 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc
@@ -14,8 +14,6 @@ #include "chrome/browser/sharing/sharing_dialog.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/browser_window.h" #include "chrome/grit/theme_resources.h" #include "components/sync_device_info/device_info.h" #include "components/vector_icons/vector_icons.h" @@ -125,14 +123,14 @@ web_contents()); } -SharingDialog* ClickToCallUiController::DoShowDialog(BrowserWindow* window) { +void ClickToCallUiController::OnDialogShown(bool has_devices, bool has_apps) { if (!HasSendFailed()) { // Only left clicks open a dialog. ukm_recorder_ = base::BindOnce(&LogClickToCallUKM, web_contents(), SharingClickToCallEntryPoint::kLeftClickLink, - !devices().empty(), !apps().empty()); + has_devices, has_apps); } - return window->ShowSharingDialog(web_contents(), this); + SharingUiController::OnDialogShown(has_devices, has_apps); } base::string16 ClickToCallUiController::GetContentType() const {
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h index 4d28e57..dfe71666 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h +++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h
@@ -54,12 +54,12 @@ int GetHeaderImageId() const override; std::unique_ptr<views::StyledLabel> GetHelpTextLabel( views::StyledLabelListener* listener) override; + void OnDialogShown(bool has_devices, bool has_apps) override; protected: explicit ClickToCallUiController(content::WebContents* web_contents); // Overridden from SharingUiController: - SharingDialog* DoShowDialog(BrowserWindow* window) override; void DoUpdateApps(UpdateAppsCallback callback) override; private:
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc index e65fd3b..6d8d2213 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc
@@ -113,8 +113,9 @@ syncer::DeviceInfo device_info( kReceiverGuid, kReceiverName, "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); chrome_browser_sharing::SharingMessage sharing_message; sharing_message.mutable_click_to_call_message()->set_phone_number(
diff --git a/chrome/browser/sharing/fake_local_device_info_provider.cc b/chrome/browser/sharing/fake_local_device_info_provider.cc index 0380fcb9..d464e2b 100644 --- a/chrome/browser/sharing/fake_local_device_info_provider.cc +++ b/chrome/browser/sharing/fake_local_device_info_provider.cc
@@ -13,8 +13,9 @@ "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false) {} + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt) {} FakeLocalDeviceInfoProvider::~FakeLocalDeviceInfoProvider() = default;
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.cc index 5bb25d69..dbe8c64 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.cc +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "build/build_config.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" #include "chrome/browser/sharing/shared_clipboard/feature_flags.h" #include "chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h" @@ -77,7 +76,7 @@ l10n_util::GetStringFUTF16( IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_SINGLE_DEVICE, base::UTF8ToUTF16(devices[0]->client_name())), - kSendTabToSelfIcon); + controller_->GetVectorIcon()); #endif } else { BuildSubMenu(); @@ -91,7 +90,7 @@ proxy_->AddSubMenuWithStringIdAndIcon( IDC_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_MULTIPLE_DEVICES, IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_MULTIPLE_DEVICES, - sub_menu_model_.get(), kSendTabToSelfIcon); + sub_menu_model_.get(), controller_->GetVectorIcon()); #endif } }
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer_unittest.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer_unittest.cc index 3cc8a81..91deb6a 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer_unittest.cc +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer_unittest.cc
@@ -112,8 +112,9 @@ base::StrCat({"guid", base::NumberToString(i)}), "name", "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false)); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt)); } return devices; }
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_message_handler_desktop_unittest.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_message_handler_desktop_unittest.cc index 1a9641a..bc69371 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_message_handler_desktop_unittest.cc +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_message_handler_desktop_unittest.cc
@@ -115,12 +115,12 @@ [](const std::string& guid) -> std::unique_ptr<syncer::DeviceInfo> { return std::make_unique<syncer::DeviceInfo>( base::GenerateGUID(), kClientName, - /* chrome_version= */ "78.0.0.0", - /* sync_user_agent= */ "Chrome", - sync_pb::SyncEnums::TYPE_LINUX, - /* signin_scoped_device_id= */ base::GenerateGUID(), - base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ true); + /*chrome_version=*/"78.0.0.0", + /*sync_user_agent=*/"Chrome", sync_pb::SyncEnums::TYPE_LINUX, + /*signin_scoped_device_id=*/base::GenerateGUID(), + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); }); message_handler_->OnMessage(CreateMessage(guid)); }
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc index af3538e..441ea82 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc
@@ -11,7 +11,6 @@ #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/sharing/sharing_constants.h" #include "chrome/browser/sharing/sharing_dialog.h" -#include "chrome/browser/ui/browser_window.h" #include "components/sync_device_info/device_info.h" #include "content/public/browser/web_contents.h" #include "ui/base/l10n/l10n_util.h" @@ -57,12 +56,6 @@ std::move(callback).Run(std::vector<SharingApp>()); } -// Error message dialog. -SharingDialog* SharedClipboardUiController::DoShowDialog( - BrowserWindow* window) { - return window->ShowSharingDialog(web_contents(), this); -} - void SharedClipboardUiController::OnDeviceChosen( const syncer::DeviceInfo& device) { chrome_browser_sharing::SharingMessage sharing_message; @@ -99,7 +92,7 @@ } const gfx::VectorIcon& SharedClipboardUiController::GetVectorIcon() const { - return kSendTabToSelfIcon; + return kCopyIcon; } base::string16 SharedClipboardUiController::GetTextForTooltipAndAccessibleName()
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h index 3100708..951900c0 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h
@@ -51,7 +51,6 @@ explicit SharedClipboardUiController(content::WebContents* web_contents); // Overridden from SharingUiController: - SharingDialog* DoShowDialog(BrowserWindow* window) override; void DoUpdateApps(UpdateAppsCallback callback) override; private:
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc index b515573..000d05c7 100644 --- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc +++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller_unittest.cc
@@ -85,8 +85,9 @@ syncer::DeviceInfo device_info( kReceiverGuid, kReceiverName, "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); controller_ = SharedClipboardUiController::GetOrCreateFromWebContents( web_contents_.get()); controller_->OnDeviceSelected(base::UTF8ToUTF16(kText), device_info); @@ -117,8 +118,9 @@ syncer::DeviceInfo device_info( kReceiverGuid, kReceiverName, "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); chrome_browser_sharing::SharingMessage sharing_message; sharing_message.mutable_shared_clipboard_message()->set_text(kExpectedText);
diff --git a/chrome/browser/sharing/sharing_fcm_sender_unittest.cc b/chrome/browser/sharing/sharing_fcm_sender_unittest.cc index 9f3f65aa..a227311a 100644 --- a/chrome/browser/sharing/sharing_fcm_sender_unittest.cc +++ b/chrome/browser/sharing/sharing_fcm_sender_unittest.cc
@@ -91,8 +91,9 @@ "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time::Now(), - false) {} + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt) {} ~FakeLocalDeviceInfoProvider() override {} version_info::Channel GetChannel() const override {
diff --git a/chrome/browser/sharing/sharing_service_unittest.cc b/chrome/browser/sharing/sharing_service_unittest.cc index ceb23b7a..9ce4c35 100644 --- a/chrome/browser/sharing/sharing_service_unittest.cc +++ b/chrome/browser/sharing/sharing_service_unittest.cc
@@ -177,8 +177,9 @@ "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - base::Time::Now(), - false) {} + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt) {} ~FakeLocalDeviceInfoProvider() override {} version_info::Channel GetChannel() const override { @@ -242,8 +243,9 @@ return std::make_unique<syncer::DeviceInfo>( id, name, "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); } static SharingSyncPreference::Device CreateFakeSyncDevice() {
diff --git a/chrome/browser/sharing/sharing_ui_controller.cc b/chrome/browser/sharing/sharing_ui_controller.cc index 7655127..d6fd440 100644 --- a/chrome/browser/sharing/sharing_ui_controller.cc +++ b/chrome/browser/sharing/sharing_ui_controller.cc
@@ -61,8 +61,9 @@ if (!window) return; - dialog_ = DoShowDialog(window); + dialog_ = window->ShowSharingDialog(web_contents(), this); UpdateIcon(); + OnDialogShown(!devices_.empty(), !apps_.empty()); } void SharingUiController::UpdateIcon() { @@ -205,3 +206,8 @@ ShowSingletonTab(chrome::FindBrowserWithWebContents(web_contents()), GURL(chrome::kSyncLearnMoreURL)); } + +void SharingUiController::OnDialogShown(bool has_devices, bool has_apps) { + if (on_dialog_shown_closure_for_testing_) + std::move(on_dialog_shown_closure_for_testing_).Run(); +}
diff --git a/chrome/browser/sharing/sharing_ui_controller.h b/chrome/browser/sharing/sharing_ui_controller.h index 46255db0..db660c2 100644 --- a/chrome/browser/sharing/sharing_ui_controller.h +++ b/chrome/browser/sharing/sharing_ui_controller.h
@@ -24,7 +24,6 @@ #include "ui/views/controls/styled_label.h" #include "ui/views/controls/styled_label_listener.h" -class BrowserWindow; class SharingDialog; class SharingService; @@ -116,8 +115,14 @@ // Called by the SharingDialogView when the help text got clicked. virtual void OnHelpTextClicked(SharingDialogType dialog_type); + // Called when a new dialog is shown. + virtual void OnDialogShown(bool has_devices, bool has_apps); + + void set_on_dialog_shown_closure_for_testing(base::OnceClosure closure) { + on_dialog_shown_closure_for_testing_ = std::move(closure); + } + protected: - virtual SharingDialog* DoShowDialog(BrowserWindow* window) = 0; virtual void DoUpdateApps(UpdateAppsCallback callback) = 0; void SendMessageToDevice( @@ -155,6 +160,9 @@ // ID of the last shown dialog used to ignore events from old dialogs. int last_dialog_id_ = 0; + // Closure to call when a new dialog is shown. + base::OnceClosure on_dialog_shown_closure_for_testing_; + base::WeakPtrFactory<SharingUiController> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index a7bd5219..fdb4c9d 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h
@@ -92,6 +92,12 @@ // user. This method is very fast so it can be invoked in the UI thread. bool IsFirefoxDefaultBrowser(); +#if defined(OS_WIN) +// Returns true if IE is likely to be the default browser for the current +// user. This method is very fast so it can be invoked in the UI thread. +bool IsIEDefaultBrowser(); +#endif + // Attempt to determine if this instance of Chrome is the default client // application for the given protocol and return the appropriate state. DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol);
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 876c55a3..23dd8287 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc
@@ -598,6 +598,14 @@ app_cmd == L"FirefoxURL"; } +bool IsIEDefaultBrowser() { + base::string16 app_cmd; + base::win::RegKey key(HKEY_CURRENT_USER, ShellUtil::kRegVistaUrlPrefs, + KEY_READ); + return key.Valid() && key.ReadValue(L"Progid", &app_cmd) == ERROR_SUCCESS && + app_cmd == L"IE.HTTP"; +} + DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) { return GetDefaultWebClientStateFromShellUtilDefaultState( ShellUtil::GetChromeDefaultProtocolClientState(
diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc index 498bfb9..527c1b1 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc
@@ -497,7 +497,7 @@ // in the incognito profile. state->AllowCert(kWWWGoogleHost, *cert, net::ERR_CERT_DATE_INVALID); - std::unique_ptr<Profile> incognito(profile->CreateOffTheRecordProfile()); + Profile* incognito = profile->GetOffTheRecordProfile(); content::SSLHostStateDelegate* incognito_state = incognito->GetSSLHostStateDelegate(); @@ -534,7 +534,7 @@ content::SSLHostStateDelegate::ALLOWED, state->QueryPolicy(kWWWGoogleHost, *cert, net::ERR_CERT_DATE_INVALID)); - std::unique_ptr<Profile> incognito(profile->CreateOffTheRecordProfile()); + Profile* incognito = profile->GetOffTheRecordProfile(); content::SSLHostStateDelegate* incognito_state = incognito->GetSSLHostStateDelegate();
diff --git a/chrome/browser/sync/device_info_sync_service_factory.cc b/chrome/browser/sync/device_info_sync_service_factory.cc index 6de949e..67841982 100644 --- a/chrome/browser/sync/device_info_sync_service_factory.cc +++ b/chrome/browser/sync/device_info_sync_service_factory.cc
@@ -54,6 +54,13 @@ profile_->GetPrefs()); } + // syncer::DeviceInfoSyncClient: + base::Optional<syncer::DeviceInfo::SharingInfo> GetLocalSharingInfo() + const override { + // TODO(crbug.com/991971): Returns from SharingSyncPreference. + return base::nullopt; + } + private: Profile* const profile_; };
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index 63060de..44f8a8f 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -226,7 +226,7 @@ CHECK(extension_registry); const extensions::Extension* extension = extension_registry->GetExtensionById( - id, extensions::ExtensionRegistry::COMPATIBILITY); + id, extensions::ExtensionRegistry::EVERYTHING); if (extension) { if (!extension->is_theme()) { DVLOG(1) << "Extension " << id << " is not a theme; aborting"; @@ -273,9 +273,9 @@ const extensions::Extension* current_extension = theme_service_->UsingExtensionTheme() && !theme_service_->UsingDefaultTheme() - ? extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( - theme_service_->GetThemeID(), - extensions::ExtensionRegistry::ENABLED) + ? extensions::ExtensionRegistry::Get(profile_) + ->enabled_extensions() + .GetByID(theme_service_->GetThemeID()) : nullptr; if (current_extension && !extensions::sync_helper::IsSyncable(current_extension)) {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 79eca57..21b10fb0 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -429,7 +429,6 @@ "//components/data_reduction_proxy/core/browser", "//components/device_event_log", "//components/dom_distiller/content/browser", - "//components/dom_distiller/webui", "//components/domain_reliability", "//components/download/content/factory", "//components/download/content/public",
diff --git a/chrome/browser/ui/android/widget/java/src/org/chromium/chrome/browser/ui/widget/DualControlLayoutTest.java b/chrome/browser/ui/android/widget/java/src/org/chromium/chrome/browser/ui/widget/DualControlLayoutTest.java index cf3e4e8..e5ffe13 100644 --- a/chrome/browser/ui/android/widget/java/src/org/chromium/chrome/browser/ui/widget/DualControlLayoutTest.java +++ b/chrome/browser/ui/android/widget/java/src/org/chromium/chrome/browser/ui/widget/DualControlLayoutTest.java
@@ -49,7 +49,7 @@ public UiThreadTestRule mRule = new UiThreadTestRule(); @Before - public void setUp() throws Exception { + public void setUp() { mContext = InstrumentationRegistry.getTargetContext(); mTinyControlWidth = INFOBAR_WIDTH / 4; }
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index 7eef2148..4368d45 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -1263,7 +1263,7 @@ return false; const extensions::Extension* extension = extension_registry_->GetExtensionById( - id, extensions::ExtensionRegistry::COMPATIBILITY); + id, extensions::ExtensionRegistry::EVERYTHING); return extension && extension->was_installed_by_oem(); }
diff --git a/chrome/browser/ui/extensions/extension_enable_flow.cc b/chrome/browser/ui/extensions/extension_enable_flow.cc index 3383da3..868a11a 100644 --- a/chrome/browser/ui/extensions/extension_enable_flow.cc +++ b/chrome/browser/ui/extensions/extension_enable_flow.cc
@@ -54,11 +54,10 @@ extensions::ExtensionSystem::Get(profile_)->extension_service(); extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry::Get(profile_); - const Extension* extension = registry->GetExtensionById( - extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); + const Extension* extension = + registry->disabled_extensions().GetByID(extension_id_); if (!extension) { - extension = registry->GetExtensionById( - extension_id_, extensions::ExtensionRegistry::TERMINATED); + extension = registry->terminated_extensions().GetByID(extension_id_); // It's possible (though unlikely) the app could have been uninstalled since // the user clicked on it. if (!extension) @@ -67,8 +66,7 @@ service->ReloadExtension(extension_id_); // ReloadExtension reallocates the Extension object. - extension = registry->GetExtensionById( - extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); + extension = registry->disabled_extensions().GetByID(extension_id_); // |extension| could be NULL for asynchronous load, such as the case of // an unpacked extension. Wait for the load to continue the flow. @@ -87,8 +85,8 @@ extensions::ExtensionService* service = system->extension_service(); extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry::Get(profile_); - const Extension* extension = registry->GetExtensionById( - extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); + const Extension* extension = + registry->disabled_extensions().GetByID(extension_id_); bool abort = !extension || @@ -188,8 +186,8 @@ extensions::ExtensionRegistry::Get(profile_); // The extension can be uninstalled in another window while the UI was // showing. Treat it as a cancellation and notify |delegate_|. - const Extension* extension = registry->GetExtensionById( - extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); + const Extension* extension = + registry->disabled_extensions().GetByID(extension_id_); if (!extension) { delegate_->ExtensionEnableFlowAborted(true); return;
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc index 5337cb7..febd19e 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc
@@ -136,8 +136,9 @@ void ShowAppInfoForProfile(const std::string& app_id, Profile* profile) { const extensions::Extension* extension = - extensions::ExtensionRegistry::Get(profile)->GetExtensionById( - app_id, extensions::ExtensionRegistry::COMPATIBILITY); + extensions::ExtensionRegistry::Get(profile) + ->enabled_extensions() + .GetByID(app_id); DCHECK(extension); DCHECK(!widget_);
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc index e38cd45..aac667b2 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc
@@ -317,8 +317,7 @@ for (const auto& shared_module : imports) { const extensions::Extension* imported_module = registry->GetExtensionById( - shared_module.extension_id, - extensions::ExtensionRegistry::COMPATIBILITY); + shared_module.extension_id, extensions::ExtensionRegistry::EVERYTHING); DCHECK(imported_module); GURL about_page = extensions::ManifestURL::GetAboutPage(imported_module);
diff --git a/chrome/browser/ui/views/frame/browser_view_unittest.cc b/chrome/browser/ui/views/frame/browser_view_unittest.cc index bc7e78bb..a740b4b1 100644 --- a/chrome/browser/ui/views/frame/browser_view_unittest.cc +++ b/chrome/browser/ui/views/frame/browser_view_unittest.cc
@@ -98,7 +98,7 @@ } // Test layout of the top-of-window UI. -TEST_F(BrowserViewTest, BrowserViewLayout) { +TEST_F(BrowserViewTest, DISABLED_BrowserViewLayout) { BookmarkBarView::DisableAnimationsForTesting(true); // |browser_view_| owns the Browser, not the test class. @@ -193,7 +193,7 @@ // Test that repeated accelerators are processed or ignored depending on the // commands that they refer to. The behavior for different commands is dictated // by IsCommandRepeatable() in chrome/browser/ui/views/accelerator_table.h. -TEST_F(BrowserViewTest, RepeatedAccelerators) { +TEST_F(BrowserViewTest, DISABLED_RepeatedAccelerators) { // A non-repeated Ctrl-L accelerator should be processed. const ui::Accelerator kLocationAccel(ui::VKEY_L, ui::EF_PLATFORM_ACCELERATOR); EXPECT_TRUE(browser_view()->AcceleratorPressed(kLocationAccel)); @@ -239,7 +239,7 @@ BookmarkBarView::DisableAnimationsForTesting(false); } -TEST_F(BrowserViewTest, AccessibleWindowTitle) { +TEST_F(BrowserViewTest, DISABLED_AccessibleWindowTitle) { EXPECT_EQ(SubBrowserName("Untitled - %s"), browser_view()->GetAccessibleWindowTitleForChannelAndProfile( version_info::Channel::STABLE, browser()->profile()));
diff --git a/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc b/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc index 12821b8f..128d9ff 100644 --- a/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc +++ b/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc
@@ -96,8 +96,9 @@ base::StrCat({"device_guid_", base::NumberToString(i)}), base::StrCat({"device", base::NumberToString(i)}), "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false)); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt)); } return devices; } @@ -140,8 +141,9 @@ syncer::DeviceInfo device_info( "device_guid_1", "device1", "chrome_version", "user_agent", sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "device_id", - /* last_updated_timestamp= */ base::Time::Now(), - /* send_tab_to_self_receiving_enabled= */ false); + /*last_updated_timestamp=*/base::Time::Now(), + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); EXPECT_CALL(*controller_.get(), OnDeviceChosen(DeviceEquals(&device_info))); auto dialog = CreateDialogView(/*devices=*/3, /*apps=*/2);
diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc index 93c68e6c..0ece0de 100644 --- a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc +++ b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
@@ -287,8 +287,6 @@ // view inside the client view. set_margins(gfx::Insets()); - set_accept_events(false); - // Inset the tab hover cards anchor rect to bring the card closer to the tab. constexpr gfx::Insets kTabHoverCardAnchorInsets(2, 0); set_anchor_view_insets(kTabHoverCardAnchorInsets); @@ -376,6 +374,7 @@ GetBubbleFrameView()->set_preferred_arrow_adjustment( views::BubbleFrameView::PreferredArrowAdjustment::kOffset); + GetBubbleFrameView()->set_hit_test_transparent(true); if (CustomShadowsSupported()) { GetBubbleFrameView()->SetCornerRadius(
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.cc b/chrome/browser/ui/views/translate/translate_bubble_view.cc index 7266999e..e55f2c14 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view.cc +++ b/chrome/browser/ui/views/translate/translate_bubble_view.cc
@@ -46,6 +46,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/strings/grit/ui_strings.h" #include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/button/image_button.h" @@ -903,6 +904,8 @@ tab_translate_options_button->SetInkDropMode(views::Button::InkDropMode::ON); tab_translate_options_button->SetID(BUTTON_ID_OPTIONS_MENU_TAB); tab_translate_options_button->SetFocusForPlatform(); + tab_translate_options_button->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_OPTIONS_MENU_BUTTON)); tab_translate_options_button->set_request_focus_on_press(true); // Close button @@ -921,6 +924,7 @@ close_button->set_ink_drop_base_color(gfx::kChromeIconGrey); close_button->SetFocusForPlatform(); close_button->SetID(BUTTON_ID_CLOSE); + close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); constexpr int kColumnSetId = 0; views::ColumnSet* cs = layout->AddColumnSet(kColumnSetId); @@ -996,6 +1000,7 @@ gfx::CreateVectorIcon(*close_icon_id, 16, close_icon_color)); close_button->set_ink_drop_base_color(gfx::kChromeIconGrey); close_button->SetID(BUTTON_ID_CLOSE); + close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); // Initialize a columnset views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_TITLE); @@ -1564,6 +1569,7 @@ close_button->set_ink_drop_base_color(gfx::kChromeIconGrey); close_button->SetFocusForPlatform(); close_button->SetID(BUTTON_ID_CLOSE); + close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); auto view = std::make_unique<AdvancedViewContainer>(); views::GridLayout* layout = @@ -1701,7 +1707,13 @@ if ((view_state == TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE || view_state == TranslateBubbleModel::VIEW_STATE_TRANSLATING) && tabbed_pane_->GetSelectedTabIndex() != 1) { + // When switching to "after" or "during" translate view from something other + // than user interaction, |this| needs to unregister from listening to the + // tabbed pane events otherwise it'll trigger an additional translation as + // if the user had clicked the tabs. + tabbed_pane_->set_listener(nullptr); tabbed_pane_->SelectTabAt(1); + tabbed_pane_->set_listener(this); } else if (view_state == TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE && tabbed_pane_->GetSelectedTabIndex() != 0) { tabbed_pane_->SelectTabAt(0);
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index bca9be0..cde5b37 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -16,7 +16,6 @@ #include "chrome/browser/about_flags.h" #include "chrome/browser/accessibility/accessibility_ui.h" #include "chrome/browser/devtools/devtools_ui_bindings.h" -#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" #include "chrome/browser/engagement/site_engagement_service.h" #include "chrome/browser/media/media_engagement_service.h" #include "chrome/browser/profiles/profile.h" @@ -71,11 +70,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/common/webui_url_constants.h" -#include "components/dom_distiller/core/dom_distiller_constants.h" -#include "components/dom_distiller/core/dom_distiller_features.h" -#include "components/dom_distiller/core/dom_distiller_service.h" -#include "components/dom_distiller/core/url_constants.h" -#include "components/dom_distiller/webui/dom_distiller_ui.h" #include "components/favicon/core/favicon_service.h" #include "components/favicon_base/favicon_util.h" #include "components/favicon_base/select_favicon_frames.h" @@ -314,21 +308,6 @@ } #endif -// Special cases for DOM distiller. -template <> -WebUIController* NewWebUI<dom_distiller::DomDistillerUi>(WebUI* web_ui, - const GURL& url) { - // The DomDistillerUi can not depend on components/dom_distiller/content, - // so inject the correct DomDistillerService from chrome/. - content::BrowserContext* browser_context = - web_ui->GetWebContents()->GetBrowserContext(); - dom_distiller::DomDistillerService* service = - dom_distiller::DomDistillerServiceFactory::GetForBrowserContext( - browser_context); - return new dom_distiller::DomDistillerUi(web_ui, service, - dom_distiller::kDomDistillerScheme); -} - #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) template <> WebUIController* NewWebUI<WelcomeUI>(WebUI* web_ui, const GURL& url) { @@ -732,11 +711,6 @@ return &NewWebUI<security_interstitials::ConnectionHelpUI>; } - if (dom_distiller::IsDomDistillerEnabled() && - url.host_piece() == dom_distiller::kChromeUIDomDistillerHost) { - return &NewWebUI<dom_distiller::DomDistillerUi>; - } - if (SiteEngagementService::IsEnabled() && url.host_piece() == chrome::kChromeUISiteEngagementHost) { return &NewWebUI<SiteEngagementUI>;
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc index 02d74e4..5a38d8f 100644 --- a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc +++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
@@ -232,7 +232,7 @@ content::DownloadItemUtils::GetBrowserContext(download_item)); auto* registry = extensions::ExtensionRegistry::Get(profile); const extensions::Extension* extension = registry->GetExtensionById( - by_ext->id(), extensions::ExtensionRegistry::COMPATIBILITY); + by_ext->id(), extensions::ExtensionRegistry::EVERYTHING); if (extension) by_ext_name = extension->name(); }
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 6445f09..b12908a5 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -145,8 +145,8 @@ bool enabled = service->IsExtensionEnabled(extension->id()) && !extensions::ExtensionRegistry::Get(service->GetBrowserContext()) - ->GetExtensionById(extension->id(), - extensions::ExtensionRegistry::TERMINATED); + ->terminated_extensions() + .GetByID(extension->id()); extensions::GetExtensionBasicInfo(extension, enabled, value); value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( @@ -494,8 +494,8 @@ Profile* profile = extension_service_->profile(); const Extension* extension = - extensions::ExtensionRegistry::Get(profile)->GetExtensionById( - extension_id, extensions::ExtensionRegistry::ENABLED); + extensions::ExtensionRegistry::Get(profile)->enabled_extensions().GetByID( + extension_id); // Prompt the user to re-enable the application if disabled. if (!extension) { @@ -570,7 +570,9 @@ const Extension* extension = extensions::ExtensionRegistry::Get(extension_service_->profile()) ->GetExtensionById(extension_id, - extensions::ExtensionRegistry::COMPATIBILITY); + extensions::ExtensionRegistry::ENABLED | + extensions::ExtensionRegistry::DISABLED | + extensions::ExtensionRegistry::TERMINATED); if (!extension) return; @@ -625,7 +627,9 @@ const Extension* extension = extensions::ExtensionRegistry::Get(extension_service_->profile()) ->GetExtensionById(extension_id, - extensions::ExtensionRegistry::COMPATIBILITY); + extensions::ExtensionRegistry::ENABLED | + extensions::ExtensionRegistry::DISABLED | + extensions::ExtensionRegistry::TERMINATED); if (!extension) return; @@ -643,7 +647,9 @@ const Extension* extension = extensions::ExtensionRegistry::Get(extension_service_->profile()) ->GetExtensionById(extension_id, - extensions::ExtensionRegistry::COMPATIBILITY); + extensions::ExtensionRegistry::ENABLED | + extensions::ExtensionRegistry::DISABLED | + extensions::ExtensionRegistry::TERMINATED); if (!extension) return; @@ -668,7 +674,9 @@ const Extension* extension = extensions::ExtensionRegistry::Get(extension_service_->profile()) ->GetExtensionById(extension_id, - extensions::ExtensionRegistry::COMPATIBILITY); + extensions::ExtensionRegistry::ENABLED | + extensions::ExtensionRegistry::DISABLED | + extensions::ExtensionRegistry::TERMINATED); if (!extension) return; @@ -878,7 +886,9 @@ const Extension* extension = extensions::ExtensionRegistry::Get(extension_service_->profile()) ->GetExtensionById(extension_id_prompting_, - extensions::ExtensionRegistry::COMPATIBILITY); + extensions::ExtensionRegistry::ENABLED | + extensions::ExtensionRegistry::DISABLED | + extensions::ExtensionRegistry::TERMINATED); std::string histogram_name = user_initiated ? "ReEnableCancel" : "ReEnableAbort"; extensions::ExtensionService::RecordPermissionMessagesHistogram(
diff --git a/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc b/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc index d21278e..678c7cf9 100644 --- a/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc +++ b/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
@@ -52,7 +52,7 @@ // Join with human readable extension name. const extensions::Extension* extension = extension_registry->GetExtensionById( - extension_id, extensions::ExtensionRegistry::COMPATIBILITY); + extension_id, extensions::ExtensionRegistry::EVERYTHING); if (!extension) continue;
diff --git a/chrome/common/extensions/api/autofill_private.idl b/chrome/common/extensions/api/autofill_private.idl index b2709a5..18574a99 100644 --- a/chrome/common/extensions/api/autofill_private.idl +++ b/chrome/common/extensions/api/autofill_private.idl
@@ -245,14 +245,10 @@ }; interface Events { - // Fired when the address list has changed, meaning that an entry has been - // added, removed, or changed. - // |entries| The updated list of entries. - static void onAddressListChanged(AddressEntry[] entries); - - // Fired when the credit card list has changed, meaning that an entry has + // Fired when the personal data has changed, meaning that an entry has // been added, removed, or changed. // |entries| The updated list of entries. - static void onCreditCardListChanged(CreditCardEntry[] entries); + static void onPersonalDataChanged(AddressEntry[] addressEntries, + CreditCardEntry[] creditCardEntries); }; };
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc index cb5c87d..7351322 100644 --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -1701,7 +1701,7 @@ // Tests that TryToShowTouchToFill() works correctly for fillable and // non-fillable fields. -TEST_F(PasswordAutofillAgentTest, TryToShowTouchToFill) { +TEST_F(PasswordAutofillAgentTest, TryToShowTouchToFillUsername) { // Initially no fill data is available. WebInputElement random_element = GetInputElementByID("random_field"); EXPECT_FALSE( @@ -1718,13 +1718,40 @@ EXPECT_TRUE( password_autofill_agent_->TryToShowTouchToFill(username_element_)); base::RunLoop().RunUntilIdle(); +} + +TEST_F(PasswordAutofillAgentTest, TryToShowTouchToFillPassword) { + SimulateOnFillPasswordForm(fill_data_); EXPECT_CALL(fake_driver_, ShowTouchToFill); EXPECT_TRUE( password_autofill_agent_->TryToShowTouchToFill(password_element_)); base::RunLoop().RunUntilIdle(); +} - EXPECT_FALSE(password_autofill_agent_->TryToShowTouchToFill(random_element)); +TEST_F(PasswordAutofillAgentTest, TryToShowTouchToFillShownOnlyOnce) { + SimulateOnFillPasswordForm(fill_data_); + + password_autofill_agent_->TryToShowTouchToFill(username_element_); + base::RunLoop().RunUntilIdle(); + + // Touch to fill is shown not more than one time per page load. Check that. + EXPECT_FALSE( + password_autofill_agent_->TryToShowTouchToFill(username_element_)); + EXPECT_FALSE( + password_autofill_agent_->TryToShowTouchToFill(password_element_)); + + // Reload the page and simulate fill. + LoadHTML(kFormHTML); + UpdateOriginForHTML(kFormHTML); + UpdateUsernameAndPasswordElements(); + SimulateOnFillPasswordForm(fill_data_); + + // After the reload touch to fill is shown again. + EXPECT_CALL(fake_driver_, ShowTouchToFill); + EXPECT_TRUE( + password_autofill_agent_->TryToShowTouchToFill(password_element_)); + base::RunLoop().RunUntilIdle(); } // Tests that |FillIntoFocusedField| doesn't fill read-only text fields.
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java index 3e9717d..7a6d2e72 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java
@@ -243,7 +243,7 @@ Assert.assertNotNull("Activity reference is null.", activity); setActivity(activity); Log.d(TAG, "startActivityCompletely <<"); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { throw new RuntimeException(e); } finally { ApplicationStatus.unregisterActivityStateListener(stateListener); @@ -271,8 +271,7 @@ * @return FULL_PRERENDERED_PAGE_LOAD or PARTIAL_PRERENDERED_PAGE_LOAD if the page has been * prerendered. DEFAULT_PAGE_LOAD if it had not. */ - public int loadUrl(String url, long secondsToWait) - throws IllegalArgumentException, InterruptedException { + public int loadUrl(String url, long secondsToWait) throws IllegalArgumentException { return loadUrlInTab(url, PageTransition.TYPED | PageTransition.FROM_ADDRESS_BAR, getActivity().getActivityTab(), secondsToWait); } @@ -284,7 +283,7 @@ * @return FULL_PRERENDERED_PAGE_LOAD or PARTIAL_PRERENDERED_PAGE_LOAD if the page has been * prerendered. DEFAULT_PAGE_LOAD if it had not. */ - public int loadUrl(String url) throws IllegalArgumentException, InterruptedException { + public int loadUrl(String url) throws IllegalArgumentException { return loadUrlInTab(url, PageTransition.TYPED | PageTransition.FROM_ADDRESS_BAR, getActivity().getActivityTab()); } @@ -299,8 +298,7 @@ * @return FULL_PRERENDERED_PAGE_LOAD or PARTIAL_PRERENDERED_PAGE_LOAD if the * page has been prerendered. DEFAULT_PAGE_LOAD if it had not. */ - public int loadUrlInTab(String url, int pageTransition, Tab tab, long secondsToWait) - throws InterruptedException { + public int loadUrlInTab(String url, int pageTransition, Tab tab, long secondsToWait) { Assert.assertNotNull("Cannot load the URL in a null tab", tab); final AtomicInteger result = new AtomicInteger(); @@ -325,7 +323,7 @@ * @return FULL_PRERENDERED_PAGE_LOAD or PARTIAL_PRERENDERED_PAGE_LOAD if the * page has been prerendered. DEFAULT_PAGE_LOAD if it had not. */ - public int loadUrlInTab(String url, int pageTransition, Tab tab) throws InterruptedException { + public int loadUrlInTab(String url, int pageTransition, Tab tab) { return loadUrlInTab(url, pageTransition, tab, CallbackHelper.WAIT_TIMEOUT_SECONDS); } @@ -333,7 +331,7 @@ * Load a URL in a new tab. The {@link Tab} will pretend to be created from a link. * @param url The URL of the page to load. */ - public Tab loadUrlInNewTab(String url) throws InterruptedException { + public Tab loadUrlInNewTab(String url) { return loadUrlInNewTab(url, false); } @@ -342,8 +340,7 @@ * @param url The URL of the page to load. * @param incognito Whether the new tab should be incognito. */ - public Tab loadUrlInNewTab(final String url, final boolean incognito) - throws InterruptedException { + public Tab loadUrlInNewTab(final String url, final boolean incognito) { return loadUrlInNewTab(url, incognito, TabLaunchType.FROM_LINK); } @@ -353,13 +350,13 @@ * @param incognito Whether the new tab should be incognito. * @param launchType The type of Tab Launch. */ - public Tab loadUrlInNewTab(final String url, final boolean incognito, - final @TabLaunchType int launchType) throws InterruptedException { + public Tab loadUrlInNewTab( + final String url, final boolean incognito, final @TabLaunchType int launchType) { Tab tab = null; try { tab = TestThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override - public Tab call() throws Exception { + public Tab call() { return getActivity().getTabCreator(incognito).launchUrl(url, launchType); } }); @@ -375,7 +372,7 @@ /** * Simulates starting Main Activity from launcher, blocks until it is started. */ - public void startMainActivityFromLauncher() throws InterruptedException { + public void startMainActivityFromLauncher() { startMainActivityWithURL(null); } @@ -383,7 +380,7 @@ * Starts the Main activity on the specified URL. Passing a null URL ensures the default page is * loaded, which is the NTP with a new profile . */ - public void startMainActivityWithURL(String url) throws InterruptedException { + public void startMainActivityWithURL(String url) { // Only launch Chrome. Intent intent = new Intent(TextUtils.isEmpty(url) ? Intent.ACTION_MAIN : Intent.ACTION_VIEW); @@ -403,8 +400,7 @@ * Starts the Main activity as if it was started from an external application, on the * specified URL. */ - public void startMainActivityFromExternalApp(String url, String appId) - throws InterruptedException { + public void startMainActivityFromExternalApp(String url, String appId) { Intent intent = new Intent(Intent.ACTION_VIEW); if (appId != null) { intent.putExtra(Browser.EXTRA_APPLICATION_ID, appId); @@ -418,7 +414,7 @@ * idle-sync of the main looper thread, and the initial tab must either * complete its load or it must crash before this method will return. */ - public void startMainActivityFromIntent(Intent intent, String url) throws InterruptedException { + public void startMainActivityFromIntent(Intent intent, String url) { prepareUrlIntent(intent, url); startActivityCompletely(intent); @@ -478,7 +474,7 @@ * * TODO(yolandyan): split this into the seperate test rule, this only applies to tabbed mode */ - public void newIncognitoTabFromMenu() throws InterruptedException { + public void newIncognitoTabFromMenu() { Tab tab = null; final CallbackHelper createdCallback = new CallbackHelper(); @@ -527,7 +523,7 @@ * * TODO(yolandyan): split this into the seperate test rule, this only applies to tabbed mode */ - public void newIncognitoTabsFromMenu(int n) throws InterruptedException { + public void newIncognitoTabsFromMenu(int n) { while (n > 0) { newIncognitoTabFromMenu(); --n; @@ -585,7 +581,7 @@ public List<InfoBar> getInfoBars() { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<List<InfoBar>>() { @Override - public List<InfoBar> call() throws Exception { + public List<InfoBar> call() { Tab currentTab = getActivity().getActivityTab(); Assert.assertNotNull(currentTab); Assert.assertNotNull(InfoBarContainer.get(currentTab)); @@ -609,10 +605,8 @@ /** * Executes the given snippet of JavaScript code within the current tab. Returns the result of * its execution in JSON format. - * @throws InterruptedException */ - public String runJavaScriptCodeInCurrentTab(String code) - throws InterruptedException, TimeoutException { + public String runJavaScriptCodeInCurrentTab(String code) throws TimeoutException { return JavaScriptUtils.executeJavaScriptAndWaitForResult( getActivity().getCurrentWebContents(), code); }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java index e89efde8..13affc5 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java
@@ -35,7 +35,7 @@ } public void waitForFullLoad(final ChromeActivity activity, final String expectedTitle) - throws InterruptedException, TimeoutException { + throws TimeoutException { waitForTabCreation(activity); ApplicationTestUtils.assertWaitForPageScaleFactorMatch(activity, 0.5f); @@ -52,8 +52,7 @@ }); } - private void waitForTabCreation(ChromeActivity activity) - throws InterruptedException, TimeoutException { + private void waitForTabCreation(ChromeActivity activity) throws TimeoutException { final CallbackHelper newTabCreatorHelper = new CallbackHelper(); activity.getTabModelSelector().addObserver(new EmptyTabModelSelectorObserver() { @Override @@ -64,13 +63,13 @@ newTabCreatorHelper.waitForCallback(0); } - private void ruleSetUp() throws Exception { + private void ruleSetUp() { RecordHistogram.setDisabledForTests(true); mContext = InstrumentationRegistry.getTargetContext(); ApplicationTestUtils.setUp(mContext); } - private void ruleTearDown() throws Exception { + private void ruleTearDown() { ApplicationTestUtils.tearDown(mContext); RecordHistogram.setDisabledForTests(false); }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java index 102e2d1..596c11f2 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java
@@ -20,7 +20,6 @@ import org.chromium.base.annotations.MainDex; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.net.URLConnection; import java.util.HashMap; @@ -105,7 +104,7 @@ } @Override - public ParcelFileDescriptor openFile(final Uri uri, String mode) throws FileNotFoundException { + public ParcelFileDescriptor openFile(final Uri uri, String mode) { String resource = uri.getLastPathSegment(); synchronized (mLock) { if (mResourceRequestCount.containsKey(resource)) {
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/omaha/AttributeFinder.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/omaha/AttributeFinder.java index 4fdea1f82..749abfe2 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/omaha/AttributeFinder.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/omaha/AttributeFinder.java
@@ -51,8 +51,7 @@ } @Override - public void startElement(String uri, String localName, String tag, Attributes attributes) - throws SAXException { + public void startElement(String uri, String localName, String tag, Attributes attributes) { if (tag.equals(mDesiredTag)) { mTagFound = true; mValue = mDesiredAttribute != null ? attributes.getValue(mDesiredAttribute) : null;
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java index 3e81779..1455589 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java
@@ -66,7 +66,7 @@ VersionNumberGetter.setEnableUpdateDetection(false); } - public static void tearDown(Context context) throws Exception { + public static void tearDown(Context context) { Assert.assertNotNull("Uninitialized wake lock", sWakeLock); sWakeLock.release(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { @@ -80,7 +80,7 @@ // TODO(bauerb): make this function throw more specific exception and update // StartupLoadingMetricsTest correspondingly. /** Send the user to the Android home screen. */ - public static void fireHomeScreenIntent(Context context) throws Exception { + public static void fireHomeScreenIntent(Context context) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -89,7 +89,7 @@ } /** Simulate starting Chrome from the launcher with a Main Intent. */ - public static void launchChrome(Context context) throws Exception { + public static void launchChrome(Context context) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setPackage(context.getPackageName()); intent.addCategory(Intent.CATEGORY_LAUNCHER); @@ -273,7 +273,7 @@ T createdActivity = activityRef.get(); Assert.assertNotNull("Activity reference is null.", createdActivity); return createdActivity; - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { throw new RuntimeException(e); } finally { ApplicationStatus.unregisterActivityStateListener(stateListener);
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java index b96ee53..100f89d 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java
@@ -17,7 +17,7 @@ * Waits until the bookmark model is loaded, i.e. until * {@link BookmarkModel#isBookmarkModelLoaded()} is true. */ - public static void waitForBookmarkModelLoaded() throws InterruptedException { + public static void waitForBookmarkModelLoaded() { final BookmarkModel bookmarkModel = TestThreadUtils.runOnUiThreadBlockingNoException(BookmarkModel::new);
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java index c2219638..741a841 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeTabUtils.java
@@ -129,8 +129,7 @@ * @param url The URL that will be waited to load for. Pass in null if loading the * current page is sufficient. */ - public static void waitForTabPageLoaded(final Tab tab, @Nullable final String url) - throws InterruptedException { + public static void waitForTabPageLoaded(final Tab tab, @Nullable final String url) { waitForTabPageLoaded(tab, url, null, 10L); } @@ -144,8 +143,8 @@ * @param loadTrigger The trigger action that will result in a page load finished event * to be fired (not run on the UI thread by default). */ - public static void waitForTabPageLoaded(final Tab tab, @Nullable final String url, - @Nullable Runnable loadTrigger) throws InterruptedException { + public static void waitForTabPageLoaded( + final Tab tab, @Nullable final String url, @Nullable Runnable loadTrigger) { waitForTabPageLoaded(tab, url, loadTrigger, CallbackHelper.WAIT_TIMEOUT_SECONDS); } @@ -157,8 +156,8 @@ * to be fired (not run on the UI thread by default). * @param secondsToWait The number of seconds to wait for the page to be loaded. */ - public static void waitForTabPageLoaded(final Tab tab, Runnable loadTrigger, long secondsToWait) - throws InterruptedException { + public static void waitForTabPageLoaded( + final Tab tab, Runnable loadTrigger, long secondsToWait) { waitForTabPageLoaded(tab, null, loadTrigger, secondsToWait); } @@ -175,7 +174,7 @@ * @param secondsToWait The number of seconds to wait for the page to be loaded. */ public static void waitForTabPageLoaded(final Tab tab, @Nullable final String url, - @Nullable Runnable loadTrigger, long secondsToWait) throws InterruptedException { + @Nullable Runnable loadTrigger, long secondsToWait) { Assert.assertFalse(ThreadUtils.runningOnUiThread()); final CountDownLatch loadStoppedLatch = new CountDownLatch(1); @@ -228,8 +227,7 @@ * @param secondsToWait The number of seconds to wait for the page to be load to be started. */ public static void waitForTabPageLoadStart( - final Tab tab, Runnable loadTrigger, long secondsToWait) - throws InterruptedException { + final Tab tab, Runnable loadTrigger, long secondsToWait) { final CallbackHelper startedCallback = new CallbackHelper(); TestThreadUtils.runOnUiThreadBlocking(() -> { tab.addObserver(new EmptyTabObserver() { @@ -298,7 +296,7 @@ * * @param tab The tab to wait for interactability on. */ - public static void waitForInteractable(final Tab tab) throws InterruptedException { + public static void waitForInteractable(final Tab tab) { Assert.assertFalse(ThreadUtils.runningOnUiThread()); final CallbackHelper interactableCallback = new CallbackHelper(); @@ -334,8 +332,8 @@ * <p> * Does not wait for the tab to be loaded. */ - public static void clickNewTabButton(Instrumentation instrumentation, - ChromeTabbedActivity activity) throws InterruptedException { + public static void clickNewTabButton( + Instrumentation instrumentation, ChromeTabbedActivity activity) { final TabModel normalTabModel = activity.getTabModelSelector().getModel(false); final CallbackHelper createdCallback = new CallbackHelper(); normalTabModel.addObserver(new EmptyTabModelObserver() { @@ -368,8 +366,8 @@ * <p> * Returns when the tab has been created and has finished navigating. */ - public static void newTabFromMenu(Instrumentation instrumentation, - final ChromeActivity activity) throws InterruptedException { + public static void newTabFromMenu( + Instrumentation instrumentation, final ChromeActivity activity) { newTabFromMenu(instrumentation, activity, false, true); } @@ -379,8 +377,7 @@ * Returns when the tab has been created and has finished navigating. */ public static void newTabFromMenu(Instrumentation instrumentation, - final ChromeActivity activity, boolean incognito, boolean waitForNtpLoad) - throws InterruptedException { + final ChromeActivity activity, boolean incognito, boolean waitForNtpLoad) { final CallbackHelper createdCallback = new CallbackHelper(); final CallbackHelper selectedCallback = new CallbackHelper(); @@ -424,9 +421,8 @@ * New multiple tabs by invoking the 'new' menu item n times. * @param n The number of tabs you want to create. */ - public static void newTabsFromMenu(Instrumentation instrumentation, - ChromeTabbedActivity activity, int n) - throws InterruptedException { + public static void newTabsFromMenu( + Instrumentation instrumentation, ChromeTabbedActivity activity, int n) { while (n > 0) { newTabFromMenu(instrumentation, activity); --n; @@ -439,8 +435,7 @@ * Returns when the tab has been created and finishes loading. */ public static void fullyLoadUrlInNewTab(Instrumentation instrumentation, - final ChromeTabbedActivity activity, final String url, final boolean incognito) - throws InterruptedException { + final ChromeTabbedActivity activity, final String url, final boolean incognito) { newTabFromMenu(instrumentation, activity, incognito, false); final Tab tab = activity.getActivityTab(); @@ -460,8 +455,8 @@ /** * Ensure that at least some given number of tabs are open. */ - public static void ensureNumOpenTabs(Instrumentation instrumentation, - ChromeTabbedActivity activity, int newCount) throws InterruptedException { + public static void ensureNumOpenTabs( + Instrumentation instrumentation, ChromeTabbedActivity activity, int newCount) { int curCount = getNumOpenTabs(activity); if (curCount < newCount) { newTabsFromMenu(instrumentation, activity, newCount - curCount); @@ -474,7 +469,7 @@ public static int getNumOpenTabs(final ChromeActivity activity) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Integer>() { @Override - public Integer call() throws Exception { + public Integer call() { return activity.getCurrentTabModel().getCount(); } }); @@ -485,8 +480,8 @@ * <p> * Returns after the tab has been closed. */ - public static void closeCurrentTab(final Instrumentation instrumentation, - final ChromeActivity activity) throws InterruptedException { + public static void closeCurrentTab( + final Instrumentation instrumentation, final ChromeActivity activity) { closeTabWithAction(instrumentation, activity, new Runnable() { @Override public void run() { @@ -503,8 +498,8 @@ /** * Closes a tab with the given action and waits for a tab closure to be observed. */ - public static void closeTabWithAction(Instrumentation instrumentation, - final ChromeActivity activity, Runnable action) throws InterruptedException { + public static void closeTabWithAction( + Instrumentation instrumentation, final ChromeActivity activity, Runnable action) { final CallbackHelper closeCallback = new CallbackHelper(); final TabModelObserver observer = new EmptyTabModelObserver() { @Override @@ -545,8 +540,8 @@ /** * Close all tabs and waits for all tabs pending closure to be observed. */ - public static void closeAllTabs(Instrumentation instrumentation, - final ChromeTabbedActivity activity) throws InterruptedException { + public static void closeAllTabs( + Instrumentation instrumentation, final ChromeTabbedActivity activity) { final CallbackHelper closeCallback = new CallbackHelper(); final TabModelObserver observer = new EmptyTabModelObserver() { @Override @@ -587,8 +582,8 @@ /** * Selects a tab with the given action and waits for the selection event to be observed. */ - public static void selectTabWithAction(Instrumentation instrumentation, - final ChromeTabbedActivity activity, Runnable action) throws InterruptedException { + public static void selectTabWithAction( + Instrumentation instrumentation, final ChromeTabbedActivity activity, Runnable action) { final CallbackHelper selectCallback = new CallbackHelper(); final TabModelObserver observer = new EmptyTabModelObserver() { @Override @@ -638,7 +633,7 @@ */ public static void invokeContextMenuAndOpenInANewTab(ChromeTabbedActivityTestRule testRule, View view, int contextMenuItemId, boolean expectIncognito, final String expectedUrl) - throws InterruptedException, ExecutionException { + throws ExecutionException { final CallbackHelper createdCallback = new CallbackHelper(); final TabModel tabModel = testRule.getActivity().getTabModelSelector().getModel(expectIncognito); @@ -687,7 +682,7 @@ public static void invokeContextMenuAndOpenInOtherWindow( ChromeTabbedActivity foregroundActivity, ChromeTabbedActivity backgroundActivity, View view, int contextMenuItemId, boolean expectIncognito, final String expectedUrl) - throws InterruptedException, ExecutionException { + throws ExecutionException { final CallbackHelper createdCallback = new CallbackHelper(); final TabModel tabModel = backgroundActivity.getTabModelSelector().getModel(expectIncognito); @@ -733,7 +728,7 @@ } } - public static void waitForTitle(Tab tab, String newTitle) throws InterruptedException { + public static void waitForTitle(Tab tab, String newTitle) { TabTitleObserver titleObserver = new TabTitleObserver(tab, newTitle); try { titleObserver.waitForTitleUpdate(TITLE_UPDATE_TIMEOUT_MS);
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java index 3baf69f9..96821fb8 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/InfoBarTestAnimationListener.java
@@ -49,20 +49,17 @@ @Override public void notifyAllAnimationsFinished(Item frontInfoBar) {} - public void addInfoBarAnimationFinished(String msg) - throws InterruptedException, TimeoutException { + public void addInfoBarAnimationFinished(String msg) throws TimeoutException { mAddAnimationFinished.waitForCallback(msg, mAddCallCount); mAddCallCount++; } - public void swapInfoBarAnimationFinished(String msg) - throws InterruptedException, TimeoutException { + public void swapInfoBarAnimationFinished(String msg) throws TimeoutException { mSwapAnimationFinished.waitForCallback(msg, mSwapCallCount); mSwapCallCount++; } - public void removeInfoBarAnimationFinished(String msg) - throws InterruptedException, TimeoutException { + public void removeInfoBarAnimationFinished(String msg) throws TimeoutException { mRemoveAnimationFinished.waitForCallback(msg, mRemoveCallCount); mRemoveCallCount++; }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java index f2c63a73..1519607b 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java
@@ -232,10 +232,8 @@ * Checks and verifies that the URL bar can request and release focus X times without issue. * @param urlBar The view to focus. * @param times The number of times focus should be requested and released. - * @throws InterruptedException */ - public static void checkUrlBarRefocus(UrlBar urlBar, int times) - throws InterruptedException { + public static void checkUrlBarRefocus(UrlBar urlBar, int times) { for (int i = 0; i < times; i++) { toggleUrlBarFocus(urlBar, true); waitForFocusAndKeyboardActive(urlBar, true); @@ -252,7 +250,7 @@ public static boolean doesUrlBarHaveFocus(final UrlBar urlBar) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return urlBar.hasFocus(); } }); @@ -261,7 +259,7 @@ private static boolean isKeyboardActiveForView(final View view) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE);
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java index a535b333..987a231 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java
@@ -152,7 +152,7 @@ Bitmap testBitmap = ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Bitmap>() { @Override - public Bitmap call() throws Exception { + public Bitmap call() { int height = view.getMeasuredHeight(); int width = view.getMeasuredWidth(); if (height <= 0 || width <= 0) {
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/Features.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/Features.java index 6d7de622..3d11513 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/Features.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/Features.java
@@ -152,13 +152,13 @@ * to enable, or get rid of exceptions when the production code tries to check for enabled * features. */ - private static abstract class Processor extends AnnotationRule { + private abstract static class Processor extends AnnotationRule { public Processor() { super(EnableFeatures.class, DisableFeatures.class); } @Override - protected void before() throws Throwable { + protected void before() { collectFeatures(); applyFeatures(); } @@ -168,7 +168,7 @@ reset(); } - abstract protected void applyFeatures(); + protected abstract void applyFeatures(); private void collectFeatures() { for (Annotation annotation : getAnnotations()) {
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/RecyclerViewTestUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/RecyclerViewTestUtils.java index 8c7095b..35f58b3 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/RecyclerViewTestUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/RecyclerViewTestUtils.java
@@ -54,7 +54,7 @@ } public static void waitForViewToDetach(final RecyclerView recyclerView, final View view) - throws InterruptedException, TimeoutException { + throws TimeoutException { final CallbackHelper callback = new CallbackHelper(); recyclerView.addOnChildAttachStateChangeListener(
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabTitleObserver.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabTitleObserver.java index ac319d3..00e20976 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabTitleObserver.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/TabTitleObserver.java
@@ -41,10 +41,9 @@ * Wait for title update up to the given number of seconds. * * @param seconds The number of seconds to wait. - * @throws InterruptedException * @throws TimeoutException */ - public void waitForTitleUpdate(int seconds) throws InterruptedException, TimeoutException { + public void waitForTitleUpdate(int seconds) throws TimeoutException { mCallback.waitForCallback(0, 1, seconds, TimeUnit.SECONDS); }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java index 050e919..8cf8b02d 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java
@@ -51,11 +51,10 @@ * @param tab The tab to open a context menu for. * @param openerDOMNodeId The DOM node to long press to open the context menu for. * @return The {@link ContextMenu} that was opened. - * @throws InterruptedException * @throws TimeoutException */ public static ContextMenu openContextMenu(Tab tab, String openerDOMNodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { String jsCode = "document.getElementById('" + openerDOMNodeId + "')"; return openContextMenuByJs(tab, jsCode); } @@ -66,11 +65,9 @@ * @param jsCode The javascript to get the DOM node to long press to * open the context menu for. * @return The {@link ContextMenu} that was opened. - * @throws InterruptedException * @throws TimeoutException */ - public static ContextMenu openContextMenuByJs(Tab tab, String jsCode) - throws InterruptedException, TimeoutException { + public static ContextMenu openContextMenuByJs(Tab tab, String jsCode) throws TimeoutException { final OnContextMenuShownHelper helper = new OnContextMenuShownHelper(); tab.addObserver(new EmptyTabObserver() { @Override @@ -93,12 +90,11 @@ * @param tab The tab to open a context menu for. * @param openerDOMNodeId The DOM node to long press to open the context menu for. * @param itemId The context menu item ID to select. - * @throws InterruptedException * @throws TimeoutException */ public static void selectContextMenuItem(Instrumentation instrumentation, Activity expectedActivity, Tab tab, String openerDOMNodeId, final int itemId) - throws InterruptedException, TimeoutException { + throws TimeoutException { String jsCode = "document.getElementById('" + openerDOMNodeId + "')"; selectContextMenuItemByJs(instrumentation, expectedActivity, tab, jsCode, itemId, /* expectedIntentPackage= */ null); @@ -115,12 +111,11 @@ * @param itemId The context menu item ID to select. * @param expectedIntentPackage If firing an external intent the expected package name of the * target. - * @throws InterruptedException * @throws TimeoutException */ public static void selectContextMenuItemWithExpectedIntent(Instrumentation instrumentation, Activity expectedActivity, Tab tab, String openerDOMNodeId, final int itemId, - String expectedIntentPackage) throws InterruptedException, TimeoutException { + String expectedIntentPackage) throws TimeoutException { String jsCode = "document.getElementById('" + openerDOMNodeId + "')"; selectContextMenuItemByJs( instrumentation, expectedActivity, tab, jsCode, itemId, expectedIntentPackage); @@ -134,12 +129,11 @@ * @param jsCode The javascript to get the DOM node to long press * to open the context menu for. * @param itemId The context menu item ID to select. - * @throws InterruptedException * @throws TimeoutException */ public static void selectContextMenuItemByJs(Instrumentation instrumentation, Activity expectedActivity, Tab tab, String jsCode, final int itemId) - throws InterruptedException, TimeoutException { + throws TimeoutException { selectContextMenuItemByJs(instrumentation, expectedActivity, tab, jsCode, itemId, /*expectedIntentPackage=*/null); } @@ -153,12 +147,11 @@ * to open the context menu for. * @param itemId The context menu item ID to select. * @param expectedIntentPackage If expecting an external intent the expected package name. - * @throws InterruptedException * @throws TimeoutException */ public static void selectContextMenuItemByJs(Instrumentation instrumentation, Activity expectedActivity, Tab tab, String jsCode, final int itemId, - String expectedIntentPackage) throws InterruptedException, TimeoutException { + String expectedIntentPackage) throws TimeoutException { ContextMenu menu = openContextMenuByJs(tab, jsCode); Assert.assertNotNull("Failed to open context menu", menu); @@ -174,12 +167,11 @@ * @param openerDOMNodeId The DOM node to long press to open the context menu for. * @param itemTitle The title of the context menu item to select. * @param expectedIntentPackage If expecting an external intent the expected package name. - * @throws InterruptedException * @throws TimeoutException */ public static void selectContextMenuItemByTitle(Instrumentation instrumentation, Activity expectedActivity, Tab tab, String openerDOMNodeId, String itemTitle) - throws InterruptedException, TimeoutException { + throws TimeoutException { ContextMenu menu = openContextMenu(tab, openerDOMNodeId); Assert.assertNotNull("Failed to open context menu", menu);
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/RevampedContextMenuUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/RevampedContextMenuUtils.java index 43d0f6f..a6090d6 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/RevampedContextMenuUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/contextmenu/RevampedContextMenuUtils.java
@@ -45,11 +45,10 @@ * @param tab The tab to open a context menu for. * @param openerDOMNodeId The DOM node to long press to open the context menu for. * @return The {@link RevampedContextMenuCoordinator} of the context menu. - * @throws InterruptedException * @throws TimeoutException */ public static RevampedContextMenuCoordinator openContextMenu(Tab tab, String openerDOMNodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { String jsCode = "document.getElementById('" + openerDOMNodeId + "')"; return openContextMenuByJs(tab, jsCode); } @@ -60,11 +59,10 @@ * @param jsCode The javascript to get the DOM node to long press to * open the context menu for. * @return The {@link RevampedContextMenuCoordinator} of the context menu. - * @throws InterruptedException * @throws TimeoutException */ private static RevampedContextMenuCoordinator openContextMenuByJs(Tab tab, String jsCode) - throws InterruptedException, TimeoutException { + throws TimeoutException { final OnContextMenuShownHelper helper = new OnContextMenuShownHelper(); ContextMenuHelper.sRevampedContextMenuShownCallback = ((coordinator) -> { helper.notifyCalled(coordinator); @@ -84,12 +82,10 @@ * @param openerDOMNodeId The DOM node to long press to open the context menu for. * @param itemId The context menu item ID to select. * @param activity The activity to assert for gaining focus after click or null. - * @throws InterruptedException * @throws TimeoutException */ public static void selectContextMenuItem(Instrumentation instrumentation, Activity activity, - Tab tab, String openerDOMNodeId, final int itemId) - throws InterruptedException, TimeoutException { + Tab tab, String openerDOMNodeId, final int itemId) throws TimeoutException { String jsCode = "document.getElementById('" + openerDOMNodeId + "')"; selectContextMenuItemByJs(instrumentation, activity, tab, jsCode, itemId); } @@ -101,12 +97,10 @@ * to open the context menu for. * @param itemId The context menu item ID to select. * @param activity The activity to assert for gaining focus after click or null. - * @throws InterruptedException * @throws TimeoutException */ private static void selectContextMenuItemByJs(Instrumentation instrumentation, - Activity activity, Tab tab, String jsCode, final int itemId) - throws InterruptedException, TimeoutException { + Activity activity, Tab tab, String jsCode, final int itemId) throws TimeoutException { RevampedContextMenuCoordinator menuCoordinator = openContextMenuByJs(tab, jsCode); Assert.assertNotNull("Failed to open context menu", menuCoordinator);
diff --git a/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeDisabled-tab_switcher_action_menu.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeDisabled-tab_switcher_action_menu.Nexus_5-19.png.sha1 index eb93ba5..3ec48ed 100644 --- a/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeDisabled-tab_switcher_action_menu.Nexus_5-19.png.sha1 +++ b/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeDisabled-tab_switcher_action_menu.Nexus_5-19.png.sha1
@@ -1 +1 @@ -427f2319e43ad1c09a120b38fd7ce28ba6ac805e \ No newline at end of file +8066ac0ba94aefd4842aacb1e5a2acee2a77bed2 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeEnabled-tab_switcher_action_menu.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeEnabled-tab_switcher_action_menu.Nexus_5-19.png.sha1 index 0b96fe0a..d39b04e 100644 --- a/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeEnabled-tab_switcher_action_menu.Nexus_5-19.png.sha1 +++ b/chrome/test/data/android/render_tests/TabSwitcherActionMenuRenderTest.NightModeEnabled-tab_switcher_action_menu.Nexus_5-19.png.sha1
@@ -1 +1 @@ -b4774036e97a7adcd35305387231eb9bc13ab26c \ No newline at end of file +93819341dffff9c2cc27feec9bf0f7af798487db \ No newline at end of file
diff --git a/chrome/test/data/extensions/api_test/autofill_private/test.js b/chrome/test/data/extensions/api_test/autofill_private/test.js index d416d05..50ba8b3 100644 --- a/chrome/test/data/extensions/api_test/autofill_private/test.js +++ b/chrome/test/data/extensions/api_test/autofill_private/test.js
@@ -97,8 +97,8 @@ // Setup the callback that verifies that the address was correctly // added. chrome.test.listenOnce( - chrome.autofillPrivate.onAddressListChanged, - chrome.test.callbackPass(function(addressList) { + chrome.autofillPrivate.onPersonalDataChanged, + chrome.test.callbackPass(function(addressList, cardList) { chrome.test.assertEq( [{ fullNames: [NAME], @@ -154,8 +154,8 @@ // Setup the callback that verifies that the address was correctly // updated. chrome.test.listenOnce( - chrome.autofillPrivate.onAddressListChanged, - chrome.test.callbackPass(function(addressList) { + chrome.autofillPrivate.onPersonalDataChanged, + chrome.test.callbackPass(function(addressList, cardList) { chrome.test.assertEq( [{ guid: addressGuid, @@ -199,8 +199,8 @@ // Setup the callback that verifies that the card was correctly added. chrome.test.listenOnce( - chrome.autofillPrivate.onCreditCardListChanged, - chrome.test.callbackPass(function(cardList) { + chrome.autofillPrivate.onPersonalDataChanged, + chrome.test.callbackPass(function(addressList, cardList) { chrome.test.assertEq( [{ name: CARD_NAME, @@ -244,8 +244,8 @@ // Setup the callback that verifies that the address was correctly // updated. chrome.test.listenOnce( - chrome.autofillPrivate.onCreditCardListChanged, - chrome.test.callbackPass(function(cardList) { + chrome.autofillPrivate.onPersonalDataChanged, + chrome.test.callbackPass(function(addressList, cardList) { chrome.test.assertEq( [{ guid: cardGuid, @@ -289,7 +289,7 @@ } } - chrome.autofillPrivate.onCreditCardListChanged.addListener(handler); + chrome.autofillPrivate.onPersonalDataChanged.addListener(handler); chrome.autofillPrivate.getCreditCardList(handler); chrome.autofillPrivate.saveCreditCard({name: NAME}); },
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 2679964..d7d87750 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -4069,6 +4069,12 @@ "DeviceLoginScreenAutoclickEnabled" : { }, + "DeviceLoginScreenStickyKeysEnabled" : { + }, + + "DeviceLoginScreenKeyboardFocusHighlightEnabled" : { + }, + "DeviceLoginScreenLocales" : { },
diff --git a/chrome/test/data/sharing/tel.html b/chrome/test/data/sharing/tel.html new file mode 100644 index 0000000..f9a171e --- /dev/null +++ b/chrome/test/data/sharing/tel.html
@@ -0,0 +1,8 @@ +<html> + <head> + <title>Tel</title> + </head> + <body style="margin=0;"> + <a href="tel:0123456789" style="width:100%;height:100%;display:block;">Tel</a> + </body> +</html>
diff --git a/chrome/test/data/webui/print_preview/custom_margins_test.js b/chrome/test/data/webui/print_preview/custom_margins_test.js index 3e62355..3782fe3 100644 --- a/chrome/test/data/webui/print_preview/custom_margins_test.js +++ b/chrome/test/data/webui/print_preview/custom_margins_test.js
@@ -28,7 +28,7 @@ /** @type {?PrintPreviewModelElement} */ let model = null; - /** @type {!Array<!print_preview.ticket_items.CustomMarginsOrientation>} */ + /** @type {!Array<!print_preview.CustomMarginsOrientation>} */ let sides = []; /** @type {!print_preview.MeasurementSystem} */ @@ -56,10 +56,10 @@ model.set('settings.mediaSize.available', true); sides = [ - print_preview.ticket_items.CustomMarginsOrientation.TOP, - print_preview.ticket_items.CustomMarginsOrientation.RIGHT, - print_preview.ticket_items.CustomMarginsOrientation.BOTTOM, - print_preview.ticket_items.CustomMarginsOrientation.LEFT + print_preview.CustomMarginsOrientation.TOP, + print_preview.CustomMarginsOrientation.RIGHT, + print_preview.CustomMarginsOrientation.BOTTOM, + print_preview.CustomMarginsOrientation.LEFT ]; container = @@ -131,19 +131,19 @@ let xEnd = 0; let yEnd = 0; switch (control.side) { - case print_preview.ticket_items.CustomMarginsOrientation.TOP: + case print_preview.CustomMarginsOrientation.TOP: yStart = start; yEnd = end; break; - case print_preview.ticket_items.CustomMarginsOrientation.RIGHT: + case print_preview.CustomMarginsOrientation.RIGHT: xStart = control.clipSize.width - start; xEnd = control.clipSize.width - end; break; - case print_preview.ticket_items.CustomMarginsOrientation.BOTTOM: + case print_preview.CustomMarginsOrientation.BOTTOM: yStart = control.clipSize.height - start; yEnd = control.clipSize.height - end; break; - case print_preview.ticket_items.CustomMarginsOrientation.LEFT: + case print_preview.CustomMarginsOrientation.LEFT: xStart = start; xEnd = end; break; @@ -202,12 +202,11 @@ /* * Initializes the settings custom margins to some test values, and returns * a map with the values. - * @return {!Map<!print_preview.ticket_items.CustomMarginsOrientation, + * @return {!Map<!print_preview.CustomMarginsOrientation, * number>} */ function setupCustomMargins() { - const orientationEnum = - print_preview.ticket_items.CustomMarginsOrientation; + const orientationEnum = print_preview.CustomMarginsOrientation; const marginValues = new Map([ [orientationEnum.TOP, 72], [orientationEnum.RIGHT, 36], [orientationEnum.BOTTOM, 108], [orientationEnum.LEFT, 18] @@ -233,8 +232,7 @@ return finishSetup().then(() => { // Simulate setting custom margins. model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); // Validate control positions are set based on the custom values. const controls = getControls(); @@ -251,7 +249,7 @@ // Margins should be reset to default and custom margins values should // be cleared. expectEquals( - print_preview.ticket_items.MarginsTypeValue.DEFAULT, + print_preview.MarginsTypeValue.DEFAULT, container.getSettingValue('margins')); expectEquals( '{}', JSON.stringify(container.getSettingValue('customMargins'))); @@ -282,7 +280,7 @@ // Controls become visible when margin type CUSTOM is selected. model.set( 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + print_preview.MarginsTypeValue.CUSTOM); // Wait for the opacity transitions to finish. return onTransitionEnd; @@ -339,8 +337,7 @@ // Simulate setting custom margins from sticky settings. model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); const marginValues = setupCustomMargins(); model.notifyPath('settings.customMargins.value'); Polymer.dom.flush(); @@ -386,8 +383,7 @@ return finishSetup().then(() => { const controls = getControls(); model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); Polymer.dom.flush(); @@ -446,8 +442,7 @@ c.getInput().setAttribute('data-timeout-delay', 1); }); model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); Polymer.dom.flush(); // Verify entering a new value updates the settings. @@ -493,8 +488,7 @@ c.getInput().setAttribute('data-timeout-delay', 1); }); model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); Polymer.dom.flush(); // Verify entering a new value updates the settings. @@ -545,8 +539,7 @@ // Simulate setting custom margins. const controls = getControls(); model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); // Validate control positions are set based on the custom values. controls.forEach((control, index) => { @@ -557,8 +550,7 @@ // Simulate setting minimum margins. model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.MINIMUM); + 'settings.margins.value', print_preview.MarginsTypeValue.MINIMUM); // Validate control positions still reflect the custom values. controls.forEach((control, index) => { @@ -577,7 +569,7 @@ // Simulate setting custom margins again. model.set( 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + print_preview.MarginsTypeValue.CUSTOM); // Validate control positions are initialized based on the default // values. @@ -595,8 +587,7 @@ return validateMarginsClearedForSetting('layout', true).then(() => { // Simulate setting custom margins again model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); // Validate control positions are initialized based on the default // values. @@ -647,7 +638,7 @@ // Controls become visible when margin type CUSTOM is selected. model.set( 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + print_preview.MarginsTypeValue.CUSTOM); container.notifyPath('settings.customMargins.value'); Polymer.dom.flush(); return onTransitionEnd; @@ -693,8 +684,7 @@ return finishSetup().then(() => { // Simulate setting custom margins. model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); const controls = getControls(); controls.forEach(control => assertFalse(control.disabled));
diff --git a/chrome/test/data/webui/print_preview/margins_settings_test.js b/chrome/test/data/webui/print_preview/margins_settings_test.js index a05b611..4b63882 100644 --- a/chrome/test/data/webui/print_preview/margins_settings_test.js +++ b/chrome/test/data/webui/print_preview/margins_settings_test.js
@@ -19,7 +19,7 @@ marginsSection.settings = model.settings; marginsSection.disabled = false; test_util.fakeDataBind(model, marginsSection, 'settings'); - marginsTypeEnum = print_preview.ticket_items.MarginsTypeValue; + marginsTypeEnum = print_preview.MarginsTypeValue; }); // Tests that setting the setting updates the UI.
diff --git a/chrome/test/data/webui/print_preview/model_settings_availability_test.js b/chrome/test/data/webui/print_preview/model_settings_availability_test.js index 985713c..dd28b14 100644 --- a/chrome/test/data/webui/print_preview/model_settings_availability_test.js +++ b/chrome/test/data/webui/print_preview/model_settings_availability_test.js
@@ -376,14 +376,12 @@ // Set margins to NONE model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); + 'settings.margins.value', print_preview.MarginsTypeValue.NO_MARGINS); assertFalse(model.settings.headerFooter.available); // Custom margins of 0. model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.CUSTOM); + 'settings.margins.value', print_preview.MarginsTypeValue.CUSTOM); model.set( 'settings.customMargins.value', {marginTop: 0, marginLeft: 0, marginRight: 0, marginBottom: 0}); @@ -429,8 +427,7 @@ }; model.set('destination.capabilities', capabilities); model.set( - 'settings.margins.value', - print_preview.ticket_items.MarginsTypeValue.DEFAULT); + 'settings.margins.value', print_preview.MarginsTypeValue.DEFAULT); // Header/footer should be available for default big label with // default margins.
diff --git a/chrome/test/data/webui/print_preview/model_test.js b/chrome/test/data/webui/print_preview/model_test.js index 305e8eb..63773b1 100644 --- a/chrome/test/data/webui/print_preview/model_test.js +++ b/chrome/test/data/webui/print_preview/model_test.js
@@ -188,7 +188,7 @@ layout: true, color: false, mediaSize: testDestination.capabilities.printer.media_size.option[1], - margins: print_preview.ticket_items.MarginsTypeValue.CUSTOM, + margins: print_preview.MarginsTypeValue.CUSTOM, customMargins: { marginTop: 100, marginRight: 200, @@ -278,7 +278,7 @@ landscape: false, color: testDestination.getNativeColorModel(true), headerFooterEnabled: false, // Only used in print preview - marginsType: print_preview.ticket_items.MarginsTypeValue.DEFAULT, + marginsType: print_preview.MarginsTypeValue.DEFAULT, duplex: print_preview.DuplexMode.SIMPLEX, copies: 1, collate: true, @@ -319,7 +319,7 @@ landscape: true, color: testDestination.getNativeColorModel(false), headerFooterEnabled: false, - marginsType: print_preview.ticket_items.MarginsTypeValue.CUSTOM, + marginsType: print_preview.MarginsTypeValue.CUSTOM, duplex: print_preview.DuplexMode.SHORT_EDGE, copies: 2, collate: false,
diff --git a/chrome/test/data/webui/print_preview/pages_per_sheet_settings_test.js b/chrome/test/data/webui/print_preview/pages_per_sheet_settings_test.js index 0283e19..26e62d42 100644 --- a/chrome/test/data/webui/print_preview/pages_per_sheet_settings_test.js +++ b/chrome/test/data/webui/print_preview/pages_per_sheet_settings_test.js
@@ -34,14 +34,14 @@ // Tests that setting the pages per sheet setting resets margins to DEFAULT. test('resets margins setting', async () => { pagesPerSheetSection.setSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); + 'margins', print_preview.MarginsTypeValue.NO_MARGINS); assertEquals(1, pagesPerSheetSection.getSettingValue('pagesPerSheet')); pagesPerSheetSection.setSetting('pagesPerSheet', 4); await test_util.eventToPromise( 'process-select-change', pagesPerSheetSection); assertEquals(4, pagesPerSheetSection.getSettingValue('pagesPerSheet')); assertEquals( - print_preview.ticket_items.MarginsTypeValue.DEFAULT, + print_preview.MarginsTypeValue.DEFAULT, pagesPerSheetSection.getSettingValue('margins')); });
diff --git a/chrome/test/data/webui/print_preview/preview_generation_test.js b/chrome/test/data/webui/print_preview/preview_generation_test.js index df9ceb19..8d6d57b 100644 --- a/chrome/test/data/webui/print_preview/preview_generation_test.js +++ b/chrome/test/data/webui/print_preview/preview_generation_test.js
@@ -151,10 +151,10 @@ /** Validate changing the margins updates the preview. */ test(assert(TestNames.Margins), function() { return testSimpleSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT, - print_preview.ticket_items.MarginsTypeValue.MINIMUM, 'marginsType', - print_preview.ticket_items.MarginsTypeValue.DEFAULT, - print_preview.ticket_items.MarginsTypeValue.MINIMUM); + 'margins', print_preview.MarginsTypeValue.DEFAULT, + print_preview.MarginsTypeValue.MINIMUM, 'marginsType', + print_preview.MarginsTypeValue.DEFAULT, + print_preview.MarginsTypeValue.MINIMUM); }); /** @@ -166,15 +166,14 @@ .then(function(args) { const originalTicket = JSON.parse(args.printTicket); assertEquals( - print_preview.ticket_items.MarginsTypeValue.DEFAULT, + print_preview.MarginsTypeValue.DEFAULT, originalTicket.marginsType); // Custom margins should not be set in the ticket. assertEquals(undefined, originalTicket.marginsCustom); assertEquals(0, originalTicket.requestID); // This should do nothing. - page.setSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.CUSTOM); + page.setSetting('margins', print_preview.MarginsTypeValue.CUSTOM); // Sets only 1 side, not valid. page.setSetting('customMargins', {marginTop: 25}); // 2 sides, still not valid. @@ -192,19 +191,16 @@ .then(function(args) { const ticket = JSON.parse(args.printTicket); assertEquals( - print_preview.ticket_items.MarginsTypeValue.CUSTOM, - ticket.marginsType); + print_preview.MarginsTypeValue.CUSTOM, ticket.marginsType); assertEquals(25, ticket.marginsCustom.marginTop); assertEquals(40, ticket.marginsCustom.marginRight); assertEquals(20, ticket.marginsCustom.marginBottom); assertEquals(50, ticket.marginsCustom.marginLeft); assertEquals(1, ticket.requestID); - page.setSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT); + page.setSetting('margins', print_preview.MarginsTypeValue.DEFAULT); // Set setting to something invalid and then set margins to CUSTOM. page.setSetting('customMargins', {marginTop: 25, marginRight: 40}); - page.setSetting( - 'margins', print_preview.ticket_items.MarginsTypeValue.CUSTOM); + page.setSetting('margins', print_preview.MarginsTypeValue.CUSTOM); nativeLayer.resetResolver('getPreview'); page.setSetting('customMargins', { marginTop: 25, @@ -217,8 +213,7 @@ .then(function(args) { const ticket = JSON.parse(args.printTicket); assertEquals( - print_preview.ticket_items.MarginsTypeValue.CUSTOM, - ticket.marginsType); + print_preview.MarginsTypeValue.CUSTOM, ticket.marginsType); assertEquals(25, ticket.marginsCustom.marginTop); assertEquals(40, ticket.marginsCustom.marginRight); assertEquals(20, ticket.marginsCustom.marginBottom); @@ -232,10 +227,10 @@ /** * Validate changing the pages per sheet updates the preview, and resets - * margins to print_preview.ticket_items.MarginsTypeValue.DEFAULT. + * margins to print_preview.MarginsTypeValue.DEFAULT. */ test(assert(TestNames.ChangeMarginsByPagesPerSheet), function() { - const MarginsTypeEnum = print_preview.ticket_items.MarginsTypeValue; + const MarginsTypeEnum = print_preview.MarginsTypeValue; return initialize() .then(function(args) { const originalTicket = JSON.parse(args.printTicket); @@ -471,7 +466,7 @@ /** * @param {Object} ticket The parsed print ticket * @param {number} expectedId The expected ticket request ID - * @param {!print_preview.ticket_items.MarginsTypeValue} expectedMargins + * @param {!print_preview.MarginsTypeValue} expectedMargins * The expected ticket margins type * @param {boolean} expectedHeaderFooter The expected ticket * header/footer value @@ -496,7 +491,7 @@ printableAreaHeight: 792, }); - const MarginsTypeEnum = print_preview.ticket_items.MarginsTypeValue; + const MarginsTypeEnum = print_preview.MarginsTypeValue; let previewArgs = await initialize(); let ticket = JSON.parse(previewArgs.printTicket);
diff --git a/chrome/test/data/webui/print_preview/restore_state_test.js b/chrome/test/data/webui/print_preview/restore_state_test.js index 7824eb7..6435f5e55 100644 --- a/chrome/test/data/webui/print_preview/restore_state_test.js +++ b/chrome/test/data/webui/print_preview/restore_state_test.js
@@ -219,7 +219,7 @@ section: 'print-preview-margins-settings', settingName: 'margins', key: 'marginsType', - value: print_preview.ticket_items.MarginsTypeValue.MINIMUM, + value: print_preview.MarginsTypeValue.MINIMUM, }, { section: 'print-preview-dpi-settings',
diff --git a/chrome/test/data/webui/settings/autofill_page_test.js b/chrome/test/data/webui/settings/autofill_page_test.js index b7cf98b..faf2546 100644 --- a/chrome/test/data/webui/settings/autofill_page_test.js +++ b/chrome/test/data/webui/settings/autofill_page_test.js
@@ -217,12 +217,15 @@ return createPrefs(true, true).then(function(prefs) { const element = createAutofillElement(prefs); - const list = + const addressList = [FakeDataMaker.addressEntry(), FakeDataMaker.addressEntry()]; - autofillManager.lastCallback.addAddressListChangedListener(list); + const cardList = + [FakeDataMaker.creditCardEntry(), FakeDataMaker.creditCardEntry()]; + autofillManager.lastCallback.setPersonalDataManagerListener( + addressList, cardList); Polymer.dom.flush(); - assertEquals(list, element.$$('#autofillSection').addresses); + assertEquals(addressList, element.$$('#autofillSection').addresses); // The callback is coming from the manager, so the element shouldn't // have additional calls to the manager after the base expectations. @@ -238,12 +241,15 @@ return createPrefs(true, true).then(function(prefs) { const element = createAutofillElement(prefs); - const list = + const addressList = + [FakeDataMaker.addressEntry(), FakeDataMaker.addressEntry()]; + const cardList = [FakeDataMaker.creditCardEntry(), FakeDataMaker.creditCardEntry()]; - paymentsManager.lastCallback.addCreditCardListChangedListener(list); + paymentsManager.lastCallback.setPersonalDataManagerListener( + addressList, cardList); Polymer.dom.flush(); - assertEquals(list, element.$$('#paymentsSection').creditCards); + assertEquals(cardList, element.$$('#paymentsSection').creditCards); // The callback is coming from the manager, so the element shouldn't // have additional calls to the manager after the base expectations.
diff --git a/chrome/test/data/webui/settings/chromeos/device_page_tests.js b/chrome/test/data/webui/settings/chromeos/device_page_tests.js index d2b71f3..e741f5c 100644 --- a/chrome/test/data/webui/settings/chromeos/device_page_tests.js +++ b/chrome/test/data/webui/settings/chromeos/device_page_tests.js
@@ -907,9 +907,12 @@ await fakeSystemDisplay.getLayoutCalled.promise; expectEquals(1, displayPage.displays.length); - // Night Light is off, so advanced controls are hidden. - expectFalse(!!displayPage.$$('#nightLightTemperatureDiv')); - expectFalse(!!displayPage.$$('#nightLightScheduleTypeDropDown')); + const temperature = displayPage.$$('#nightLightTemperatureDiv'); + const schedule = displayPage.$$('#nightLightScheduleTypeDropDown'); + + // Night Light is off, so temperature is hidden. Schedule is always shown. + expectTrue(temperature.hidden); + expectFalse(schedule.hidden); // Enable Night Light. Use an atomic update of |displayPage.prefs| so // Polymer notices the change. @@ -918,9 +921,9 @@ displayPage.prefs = newPrefs; Polymer.dom.flush(); - // Advanced Night Light controls are available. - expectTrue(!!displayPage.$$('#nightLightTemperatureDiv')); - expectTrue(!!displayPage.$$('#nightLightScheduleTypeDropDown')); + // Night Light is on, so temperature is visible. + expectFalse(temperature.hidden); + expectFalse(schedule.hidden); }); suite(assert(TestNames.Power), function() {
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js b/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js index 9fae323..300a250 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js
@@ -5,8 +5,8 @@ /** @fileoverview Suite of tests for the OS Settings main page. */ suite('OSSettingsPage', function() { - /** @type {?OsSettingsMainElement} */ let settingsMain = null; + let settingsPage = null; suiteSetup(async function() { await CrSettingsPrefs.initialized; @@ -15,6 +15,9 @@ document.querySelector('os-settings-ui').$$('os-settings-main'); assert(!!settingsMain); + settingsPage = settingsMain.$$('os-settings-page'); + assertTrue(!!settingsPage); + const idleRender = settingsMain.$$('os-settings-page').$$('settings-idle-load'); assert(!!idleRender); @@ -22,18 +25,6 @@ Polymer.dom.flush(); }); - function getSection(page, section) { - const sections = page.shadowRoot.querySelectorAll('settings-section'); - assertTrue(!!sections); - for (let i = 0; i < sections.length; ++i) { - const s = sections[i]; - if (s.section == section) { - return s; - } - } - return undefined; - } - /** * Verifies the section has a visible #main element and that any possible * sub-pages are hidden. @@ -73,21 +64,61 @@ } } + test('Basic sections', function() { + const sectionNames = [ + 'internet', 'bluetooth', 'multidevice', 'people', 'device', + 'personalization', 'search', 'apps' + ]; + + for (let name of sectionNames) { + const section = settingsPage.shadowRoot.querySelector( + `settings-section[section=${name}]`); + assertTrue(!!section, 'Did not find ' + name); + verifySubpagesHidden(section); + } + }); + test('AdvancedSections', async function() { // Open the Advanced section. settingsMain.advancedToggleExpanded = true; Polymer.dom.flush(); await test_util.flushTasks(); - const page = settingsMain.$$('os-settings-page'); - assertTrue(!!page); - let sections = + const sectionNames = ['privacy', 'languages', 'files', 'reset', 'dateTime', 'a11y']; - for (let i = 0; i < sections.length; i++) { - const section = getSection(page, sections[i]); - assertTrue(!!section, 'Did not find ' + sections[i]); + for (let name of sectionNames) { + const section = settingsPage.shadowRoot.querySelector( + `settings-section[section=${name}]`); + assertTrue(!!section, 'Did not find ' + name); verifySubpagesHidden(section); } }); + + test('Guest mode', async function() { + // Simulate guest mode. + settingsPage.isGuestMode_ = true; + + // Ensure Advanced is open. + settingsMain.advancedToggleExpanded = true; + Polymer.dom.flush(); + await test_util.flushTasks(); + + const hiddenSections = ['multidevice', 'people', 'personalization']; + for (let name of hiddenSections) { + const section = settingsPage.shadowRoot.querySelector( + `settings-section[section=${name}]`); + assertFalse(!!section, 'Found unexpected section ' + name); + } + + const visibleSections = [ + 'internet', 'bluetooth', 'device', 'search', 'apps', 'privacy', + 'languages', 'files', 'reset', 'dateTime', 'a11y' + ]; + for (let name of visibleSections) { + const section = settingsPage.shadowRoot.querySelector( + `settings-section[section=${name}]`); + assertTrue(!!section, 'Expected section ' + name); + } + }); });
diff --git a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js index e9a2077..22097a7 100644 --- a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js +++ b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js
@@ -276,19 +276,19 @@ // Holds the last callbacks so they can be called when needed. this.lastCallback = { - addAddressListChangedListener: null, + setPersonalDataManagerListener: null, }; } TestAutofillManager.prototype = { /** @override */ - addAddressListChangedListener: function(listener) { + setPersonalDataManagerListener: function(listener) { this.actual_.listeningAddresses++; - this.lastCallback.addAddressListChangedListener = listener; + this.lastCallback.setPersonalDataManagerListener = listener; }, /** @override */ - removeAddressListChangedListener: function(listener) { + removePersonalDataManagerListener: function(listener) { this.actual_.listeningAddresses--; }, @@ -332,19 +332,19 @@ // Holds the last callbacks so they can be called when needed. this.lastCallback = { - addCreditCardListChangedListener: null, + setPersonalDataManagerListener: null, }; } TestPaymentsManager.prototype = { /** @override */ - addCreditCardListChangedListener: function(listener) { + setPersonalDataManagerListener: function(listener) { this.actual_.listeningCreditCards++; - this.lastCallback.addCreditCardListChangedListener = listener; + this.lastCallback.setPersonalDataManagerListener = listener; }, /** @override */ - removeCreditCardListChangedListener: function(listener) { + removePersonalDataManagerListener: function(listener) { this.actual_.listeningCreditCards--; },
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc index 686ecf0..5905a5dd 100644 --- a/chromeos/dbus/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon_client.cc
@@ -555,21 +555,10 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } - void SetSchedulerConfiguration(const std::string& config_name, - VoidDBusMethodCallback callback) override { - dbus::MethodCall method_call(debugd::kDebugdInterface, - debugd::kSetSchedulerConfiguration); - dbus::MessageWriter writer(&method_call); - writer.AppendString(config_name); - debugdaemon_proxy_->CallMethod( - &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::BindOnce(&DebugDaemonClientImpl::OnVoidMethod, - weak_ptr_factory_.GetWeakPtr(), std::move(callback))); - } - - void SetSchedulerConfigurationV2(const std::string& config_name, - bool lock_policy, - VoidDBusMethodCallback callback) override { + void SetSchedulerConfigurationV2( + const std::string& config_name, + bool lock_policy, + SetSchedulerConfigurationV2Callback callback) override { dbus::MethodCall method_call(debugd::kDebugdInterface, debugd::kSetSchedulerConfigurationV2); dbus::MessageWriter writer(&method_call); @@ -577,7 +566,7 @@ writer.AppendBool(lock_policy); debugdaemon_proxy_->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::BindOnce(&DebugDaemonClientImpl::OnVoidMethod, + base::BindOnce(&DebugDaemonClientImpl::OnSetSchedulerConfigurationV2, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } @@ -862,6 +851,26 @@ std::move(callback).Run(result); } + void OnSetSchedulerConfigurationV2( + SetSchedulerConfigurationV2Callback callback, + dbus::Response* response) { + if (!response) { + std::move(callback).Run(false, 0); + return; + } + + bool result = false; + uint32_t num_cores_disabled = 0; + dbus::MessageReader reader(response); + if (!reader.PopBool(&result) || !reader.PopUint32(&num_cores_disabled)) { + LOG(ERROR) << "Failed to read SetSchedulerConfigurationV2 response"; + std::move(callback).Run(false, 0); + return; + } + + std::move(callback).Run(result, num_cores_disabled); + } + void OnGetU2fFlags(DBusMethodCallback<std::set<std::string>> callback, dbus::Response* response) { if (!response) {
diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h index 507a027..e23537f 100644 --- a/chromeos/dbus/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon_client.h
@@ -248,18 +248,17 @@ // to 0. virtual void SetRlzPingSent(SetRlzPingSentCallback callback) = 0; - // Deprecated. Use SetSchedulerConfigurationV2 instead. - // TODO(abhishekbh): Remove the method. - virtual void SetSchedulerConfiguration(const std::string& config_name, - VoidDBusMethodCallback callback) = 0; - + // A callback to handle the result of SetSchedulerConfigurationV2. + using SetSchedulerConfigurationV2Callback = + base::OnceCallback<void(bool success, size_t num_cores_disabled)>; // Request switching to the scheduler configuration profile indicated. The // profile names are defined by debugd, which adjusts various knobs affecting // kernel level task scheduling (see debugd source code for details). When // |lock_policy| is true, the policy is locked until the device is rebooted. - virtual void SetSchedulerConfigurationV2(const std::string& config_name, - bool lock_policy, - VoidDBusMethodCallback callback) = 0; + virtual void SetSchedulerConfigurationV2( + const std::string& config_name, + bool lock_policy, + SetSchedulerConfigurationV2Callback callback) = 0; // Set U2F flags. virtual void SetU2fFlags(const std::set<std::string>& flags,
diff --git a/chromeos/dbus/fake_debug_daemon_client.cc b/chromeos/dbus/fake_debug_daemon_client.cc index 45e0a35..f08c61d 100644 --- a/chromeos/dbus/fake_debug_daemon_client.cc +++ b/chromeos/dbus/fake_debug_daemon_client.cc
@@ -260,21 +260,14 @@ FROM_HERE, base::BindOnce(std::move(callback), true)); } -void FakeDebugDaemonClient::SetSchedulerConfiguration( - const std::string& config_name, - VoidDBusMethodCallback callback) { - scheduler_configuration_name_ = config_name; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), true)); -} - void FakeDebugDaemonClient::SetSchedulerConfigurationV2( const std::string& config_name, bool lock_policy, - VoidDBusMethodCallback callback) { + SetSchedulerConfigurationV2Callback callback) { scheduler_configuration_name_ = config_name; base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), true)); + FROM_HERE, + base::BindOnce(std::move(callback), true, /*num_cores_disabled=*/0)); } void FakeDebugDaemonClient::SetU2fFlags(const std::set<std::string>& flags,
diff --git a/chromeos/dbus/fake_debug_daemon_client.h b/chromeos/dbus/fake_debug_daemon_client.h index e467cb3..34edb31e8 100644 --- a/chromeos/dbus/fake_debug_daemon_client.h +++ b/chromeos/dbus/fake_debug_daemon_client.h
@@ -89,11 +89,10 @@ void StartPluginVmDispatcher(PluginVmDispatcherCallback callback) override; void StopPluginVmDispatcher(PluginVmDispatcherCallback callback) override; void SetRlzPingSent(SetRlzPingSentCallback callback) override; - void SetSchedulerConfiguration(const std::string& config_name, - VoidDBusMethodCallback callback) override; - void SetSchedulerConfigurationV2(const std::string& config_name, - bool lock_policy, - VoidDBusMethodCallback callback) override; + void SetSchedulerConfigurationV2( + const std::string& config_name, + bool lock_policy, + SetSchedulerConfigurationV2Callback callback) override; void SetU2fFlags(const std::set<std::string>& flags, VoidDBusMethodCallback callback) override; void GetU2fFlags(DBusMethodCallback<std::set<std::string>> callback) override;
diff --git a/chromeos/dbus/fake_update_engine_client.cc b/chromeos/dbus/fake_update_engine_client.cc index c411c53..26c3a8d1 100644 --- a/chromeos/dbus/fake_update_engine_client.cc +++ b/chromeos/dbus/fake_update_engine_client.cc
@@ -85,6 +85,11 @@ update_engine::EndOfLifeStatus::kSupported)); } +void FakeUpdateEngineClient::GetEolInfo(GetEolInfoCallback callback) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), EolInfo())); +} + void FakeUpdateEngineClient::SetUpdateOverCellularPermission( bool allowed, const base::Closure& callback) {
diff --git a/chromeos/dbus/fake_update_engine_client.h b/chromeos/dbus/fake_update_engine_client.h index 957b07d4..bd3977a 100644 --- a/chromeos/dbus/fake_update_engine_client.h +++ b/chromeos/dbus/fake_update_engine_client.h
@@ -38,6 +38,7 @@ void GetChannel(bool get_current_channel, const GetChannelCallback& callback) override; void GetEolStatus(GetEolStatusCallback callback) override; + void GetEolInfo(GetEolInfoCallback callback) override; void SetUpdateOverCellularPermission(bool allowed, const base::Closure& callback) override; void SetUpdateOverCellularOneTimePermission(
diff --git a/chromeos/dbus/update_engine_client.cc b/chromeos/dbus/update_engine_client.cc index 8079beb..4637536 100644 --- a/chromeos/dbus/update_engine_client.cc +++ b/chromeos/dbus/update_engine_client.cc
@@ -199,6 +199,17 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } + void GetEolInfo(GetEolInfoCallback callback) override { + dbus::MethodCall method_call(update_engine::kUpdateEngineInterface, + update_engine::kGetStatusAdvanced); + + VLOG(1) << "Requesting to get end of life status"; + update_engine_proxy_->CallMethod( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::BindOnce(&UpdateEngineClientImpl::OnGetEolInfo, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + } + void SetUpdateOverCellularPermission(bool allowed, const base::Closure& callback) override { dbus::MethodCall method_call( @@ -401,6 +412,7 @@ callback.Run(channel); } + // TODO(crbug.com/1005511): Deprecate with GetEolStatus(). // Called when a response for GetEolStatus() is received. void OnGetEolStatus(GetEolStatusCallback callback, dbus::Response* response) { if (!response) { @@ -429,6 +441,31 @@ static_cast<update_engine::EndOfLifeStatus>(status)); } + // TODO(crbug.com/1005511): Called when a response for GetStatusAdvanced() is + // received instead of a response from GetEolStatus(). A transition is being + // made to handle the deprecation of GetEolStatus() within update_engine. + void OnGetEolInfo(GetEolInfoCallback callback, dbus::Response* response) { + if (!response) { + LOG(ERROR) << "Failed to request getting eol info."; + std::move(callback).Run(EolInfo()); + return; + } + + dbus::MessageReader reader(response); + update_engine::StatusResult status; + if (!reader.PopArrayOfBytesAsProto(&status)) { + LOG(ERROR) << "Failed to parse proto from DBus Response."; + std::move(callback).Run(EolInfo()); + return; + } + + EolInfo eol_info; + eol_info.days_from_epoch = status.eol_date(); + + VLOG(1) << "Eol date received: " << eol_info.days_from_epoch; + std::move(callback).Run(eol_info); + } + // Called when a response for SetUpdateOverCellularPermission() is received. void OnSetUpdateOverCellularPermission(const base::Closure& callback, dbus::Response* response) { @@ -585,10 +622,15 @@ callback.Run(target_channel_); } + // TODO(crbug.com/1005511): Deprecate with GetEolStatus(). void GetEolStatus(GetEolStatusCallback callback) override { std::move(callback).Run(update_engine::EndOfLifeStatus::kSupported); } + void GetEolInfo(GetEolInfoCallback callback) override { + std::move(callback).Run(EolInfo()); + } + void SetUpdateOverCellularPermission(bool allowed, const base::Closure& callback) override { callback.Run();
diff --git a/chromeos/dbus/update_engine_client.h b/chromeos/dbus/update_engine_client.h index bc3d713..833fc99 100644 --- a/chromeos/dbus/update_engine_client.h +++ b/chromeos/dbus/update_engine_client.h
@@ -31,6 +31,13 @@ UPDATE_RESULT_NOTIMPLEMENTED, }; + // Holds information related to end-of-life. + struct EolInfo { + // The number of days since Unix Epoch, all negative values signify an + // invalid value. + int64_t days_from_epoch = -1; + }; + // Interface for observing changes from the update engine. class Observer { public: @@ -106,14 +113,25 @@ virtual void GetChannel(bool get_current_channel, const GetChannelCallback& callback) = 0; + // TODO(crbug.com/1005511): Deprecate with GetEolStatus(). // Called once GetEolStatus() is complete. Takes one parameter; // - EndOfLife Status: the end of life status of the device. using GetEolStatusCallback = base::OnceCallback<void(update_engine::EndOfLifeStatus status)>; + // TODO(crbug.com/1005511): Deprecate GetEolStatus() use GetEolInfo(). // Get EndOfLife status of the device and calls |callback| when completed. virtual void GetEolStatus(GetEolStatusCallback callback) = 0; + // Called once GetStatusAdvanced() is complete. Takes one parameter; + // - EolInfo: Please look at EolInfo for param details, all params related to + // end-of-life will be place within this struct. + using GetEolInfoCallback = base::OnceCallback<void(EolInfo eol_info)>; + + // Get EndOfLife info for the device and calls |callback| when completed. This + // method should be used in place of GetEolInfo. + virtual void GetEolInfo(GetEolInfoCallback callback) = 0; + // Either allow or disallow receiving updates over cellular connections. // Synchronous (blocking) method. virtual void SetUpdateOverCellularPermission(
diff --git a/chromeos/services/assistant/BUILD.gn b/chromeos/services/assistant/BUILD.gn index 511fcee..a3212361 100644 --- a/chromeos/services/assistant/BUILD.gn +++ b/chromeos/services/assistant/BUILD.gn
@@ -68,6 +68,9 @@ if (enable_cros_libassistant) { sources += [ + "assistant_manager_service_delegate.h", + "assistant_manager_service_delegate_impl.cc", + "assistant_manager_service_delegate_impl.h", "assistant_manager_service_impl.cc", "assistant_manager_service_impl.h", "assistant_settings_manager_impl.cc", @@ -76,6 +79,7 @@ "chromium_api_delegate.h", "chromium_http_connection.cc", "chromium_http_connection.h", + "cros_platform_api.h", "media_session/assistant_media_session.cc", "media_session/assistant_media_session.h", "platform/audio_device_owner.cc", @@ -161,21 +165,32 @@ "fake_client.cc", "fake_client.h", "service_unittest.cc", + "test_support/fully_initialized_assistant_state.cc", + "test_support/fully_initialized_assistant_state.h", ] if (enable_cros_libassistant) { sources += [ + "assistant_manager_service_impl_unittest.cc", "platform/audio_input_impl_unittest.cc", "platform/audio_output_provider_impl_unittest.cc", "platform/network_provider_impl_unittest.cc", "platform/power_manager_provider_impl_unittest.cc", "platform/system_provider_impl_unittest.cc", + "test_support/fake_assistant_manager_service_delegate.cc", + "test_support/fake_assistant_manager_service_delegate.h", + "test_support/fake_platform_api.cc", + "test_support/fake_platform_api.h", + "test_support/mock_media_manager.cc", + "test_support/mock_media_manager.h", ] deps += [ + "//chromeos/assistant/internal", + "//chromeos/assistant/internal:test_support", + "//chromeos/assistant/internal/proto/google3", "//chromeos/dbus", "//chromeos/services/network_config/public/mojom", - "//libassistant/shared/public", "//services/audio/public/cpp:test_support", "//services/device/public/cpp:test_support", ]
diff --git a/chromeos/services/assistant/assistant_manager_service.h b/chromeos/services/assistant/assistant_manager_service.h index d108474..16e6aaf 100644 --- a/chromeos/services/assistant/assistant_manager_service.h +++ b/chromeos/services/assistant/assistant_manager_service.h
@@ -26,10 +26,14 @@ enum State { // Initial state, the service is created but not started yet. STOPPED = 0, - // The service is started, it takes a little time to be fully running. - STARTED = 1, + // Start has been called but libassistant creation is still in progress. + // Calling |assistant_manager()| will still return a nullptr. + STARTING = 1, + // The service is started, libassistant has been created, but libassistant + // is not ready yet to take requests. + STARTED = 2, // The service is fully running and ready to take requests. - RUNNING = 2 + RUNNING = 3 }; ~AssistantManagerService() override = default;
diff --git a/chromeos/services/assistant/assistant_manager_service_delegate.h b/chromeos/services/assistant/assistant_manager_service_delegate.h new file mode 100644 index 0000000..ddb5dd3 --- /dev/null +++ b/chromeos/services/assistant/assistant_manager_service_delegate.h
@@ -0,0 +1,52 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_MANAGER_SERVICE_DELEGATE_H_ +#define CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_MANAGER_SERVICE_DELEGATE_H_ + +#include <memory> + +#include "base/macros.h" +#include "base/single_thread_task_runner.h" + +namespace assistant_client { +class AssistantManager; +class AssistantManagerInternal; +class PlatformApi; +} // namespace assistant_client + +namespace chromeos { +namespace assistant { + +class AssistantMediaSession; +class CrosPlatformApi; + +// Interface class that provides factory methods for assistant internal +// functionality. +class AssistantManagerServiceDelegate { + public: + AssistantManagerServiceDelegate() = default; + virtual ~AssistantManagerServiceDelegate() = default; + + virtual std::unique_ptr<CrosPlatformApi> CreatePlatformApi( + AssistantMediaSession* media_session, + scoped_refptr<base::SingleThreadTaskRunner> + background_thread_task_runner) = 0; + + virtual std::unique_ptr<assistant_client::AssistantManager> + CreateAssistantManager(assistant_client::PlatformApi* platform_api, + const std::string& lib_assistant_config) = 0; + + virtual assistant_client::AssistantManagerInternal* + UnwrapAssistantManagerInternal( + assistant_client::AssistantManager* assistant_manager) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(AssistantManagerServiceDelegate); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_MANAGER_SERVICE_DELEGATE_H_
diff --git a/chromeos/services/assistant/assistant_manager_service_delegate_impl.cc b/chromeos/services/assistant/assistant_manager_service_delegate_impl.cc new file mode 100644 index 0000000..e59766a --- /dev/null +++ b/chromeos/services/assistant/assistant_manager_service_delegate_impl.cc
@@ -0,0 +1,59 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/assistant_manager_service_delegate_impl.h" + +#include "ash/public/cpp/assistant/assistant_state_base.h" +#include "chromeos/services/assistant/platform_api_impl.h" +#include "chromeos/services/assistant/service_context.h" +#include "libassistant/shared/internal_api/assistant_manager_internal.h" +#include "libassistant/shared/public/assistant_manager.h" + +namespace chromeos { +namespace assistant { + +AssistantManagerServiceDelegateImpl::AssistantManagerServiceDelegateImpl( + mojo::PendingRemote<device::mojom::BatteryMonitor> battery_monitor, + mojom::Client* client, + ServiceContext* context) + : battery_monitor_(std::move(battery_monitor)), + client_(client), + context_(context) {} + +AssistantManagerServiceDelegateImpl::~AssistantManagerServiceDelegateImpl() = + default; + +std::unique_ptr<CrosPlatformApi> +AssistantManagerServiceDelegateImpl::CreatePlatformApi( + AssistantMediaSession* media_session, + scoped_refptr<base::SingleThreadTaskRunner> background_thread_task_runner) { + return std::make_unique<PlatformApiImpl>( + client_, media_session, context_->power_manager_client(), + context_->cras_audio_handler(), std::move(battery_monitor_), + context_->main_task_runner(), background_thread_task_runner, + context_->assistant_state()->locale().value()); +} + +std::unique_ptr<assistant_client::AssistantManager> +AssistantManagerServiceDelegateImpl::CreateAssistantManager( + assistant_client::PlatformApi* platform_api, + const std::string& lib_assistant_config) { + // This circumnvent way of creating the unique_ptr is required because + // |AssistantManager::Create| returns a raw pointer, and passing that in the + // constructor of unique_ptr is blocked by our presubmit checks that try to + // force us to use make_unique, which we can't use here. + std::unique_ptr<assistant_client::AssistantManager> result; + result.reset(assistant_client::AssistantManager::Create( + platform_api, lib_assistant_config)); + return result; +} + +assistant_client::AssistantManagerInternal* +AssistantManagerServiceDelegateImpl::UnwrapAssistantManagerInternal( + assistant_client::AssistantManager* assistant_manager) { + return assistant_client::UnwrapAssistantManagerInternal(assistant_manager); +} + +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/assistant_manager_service_delegate_impl.h b/chromeos/services/assistant/assistant_manager_service_delegate_impl.h new file mode 100644 index 0000000..662caf8 --- /dev/null +++ b/chromeos/services/assistant/assistant_manager_service_delegate_impl.h
@@ -0,0 +1,58 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_MANAGER_SERVICE_DELEGATE_IMPL_H_ +#define CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_MANAGER_SERVICE_DELEGATE_IMPL_H_ + +#include "chromeos/services/assistant/assistant_manager_service_delegate.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "services/device/public/mojom/battery_monitor.mojom.h" + +namespace chromeos { +namespace assistant { +namespace mojom { +class Client; +} // namespace mojom +} // namespace assistant +} // namespace chromeos + +namespace chromeos { +namespace assistant { + +class ServiceContext; + +class AssistantManagerServiceDelegateImpl + : public AssistantManagerServiceDelegate { + public: + AssistantManagerServiceDelegateImpl( + mojo::PendingRemote<device::mojom::BatteryMonitor> battery_monitor, + mojom::Client* client, + ServiceContext* context); + ~AssistantManagerServiceDelegateImpl() override; + + std::unique_ptr<CrosPlatformApi> CreatePlatformApi( + AssistantMediaSession* media_session, + scoped_refptr<base::SingleThreadTaskRunner> background_thread_task_runner) + override; + + std::unique_ptr<assistant_client::AssistantManager> CreateAssistantManager( + assistant_client::PlatformApi* platform_api, + const std::string& lib_assistant_config) override; + + assistant_client::AssistantManagerInternal* UnwrapAssistantManagerInternal( + assistant_client::AssistantManager* assistant_manager) override; + + private: + mojo::PendingRemote<device::mojom::BatteryMonitor> battery_monitor_; + // Owned by the parent |Service| which will destroy |this| before |context_|. + mojom::Client* client_; + ServiceContext* context_; + + DISALLOW_COPY_AND_ASSIGN(AssistantManagerServiceDelegateImpl); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_MANAGER_SERVICE_DELEGATE_IMPL_H_
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.cc b/chromeos/services/assistant/assistant_manager_service_impl.cc index 52c12941..73ec821 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/assistant_manager_service_impl.cc
@@ -5,6 +5,7 @@ #include "chromeos/services/assistant/assistant_manager_service_impl.h" #include <algorithm> +#include <memory> #include <utility> #include "ash/public/cpp/assistant/assistant_state_base.h" @@ -14,6 +15,7 @@ #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" @@ -24,8 +26,10 @@ #include "chromeos/assistant/internal/proto/google3/assistant/api/client_op/device_args.pb.h" #include "chromeos/dbus/util/version_loader.h" #include "chromeos/services/assistant/assistant_communication_error_observer.h" +#include "chromeos/services/assistant/assistant_manager_service_delegate.h" #include "chromeos/services/assistant/constants.h" #include "chromeos/services/assistant/media_session/assistant_media_session.h" +#include "chromeos/services/assistant/platform_api_impl.h" #include "chromeos/services/assistant/public/features.h" #include "chromeos/services/assistant/service_context.h" #include "chromeos/services/assistant/utils.h" @@ -34,6 +38,7 @@ #include "libassistant/shared/internal_api/alarm_timer_types.h" #include "libassistant/shared/internal_api/assistant_manager_delegate.h" #include "libassistant/shared/internal_api/assistant_manager_internal.h" +#include "libassistant/shared/public/assistant_manager.h" #include "libassistant/shared/public/media_manager.h" #include "mojo/public/mojom/base/time.mojom.h" #include "services/media_session/public/mojom/media_session.mojom.h" @@ -136,8 +141,8 @@ AssistantManagerServiceImpl::AssistantManagerServiceImpl( mojom::Client* client, - mojo::PendingRemote<device::mojom::BatteryMonitor> battery_monitor, ServiceContext* context, + std::unique_ptr<AssistantManagerServiceDelegate> delegate, std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info, bool is_signed_out_mode) @@ -151,16 +156,15 @@ assistant_settings_manager_( std::make_unique<AssistantSettingsManagerImpl>(context, this)), context_(context), + delegate_(std::move(delegate)), background_thread_("background thread"), is_signed_out_mode_(is_signed_out_mode), app_list_subscriber_binding_(this), weak_factory_(this) { background_thread_.Start(); - platform_api_ = std::make_unique<PlatformApiImpl>( - client_, media_session_.get(), context_->power_manager_client(), - context_->cras_audio_handler(), std::move(battery_monitor), - main_task_runner(), background_thread_.task_runner(), - assistant_state()->locale().value()); + + platform_api_ = delegate_->CreatePlatformApi( + media_session_.get(), background_thread_.task_runner()); mojo::Remote<media_session::mojom::MediaControllerManager> media_controller_manager; @@ -182,7 +186,7 @@ DCHECK_EQ(state_, State::STOPPED); // Set the flag to avoid starting the service multiple times. - state_ = State::STARTED; + state_ = State::STARTING; started_time_ = base::TimeTicks::Now(); @@ -201,10 +205,9 @@ void AssistantManagerServiceImpl::Stop() { // We cannot cleanly stop the service if it is in the process of starting up. - DCHECK_NE(state_, State::STARTED); + DCHECK_NE(state_, State::STARTING); state_ = State::STOPPED; - start_finished_ = false; // When user disables the feature, we also deletes all data. if (!assistant_state()->settings_enabled().value() && assistant_manager_) @@ -282,6 +285,14 @@ } } +void AssistantManagerServiceImpl::WaitUntilStartIsFinishedForTesting() { + // First we wait until |StartAssistantInternal| is finished. + background_thread_.FlushForTesting(); + // Then we wait until |PostInitAssistant| finishes. + // (which runs on the main thread). + base::RunLoop().RunUntilIdle(); +} + void AssistantManagerServiceImpl::AddMediaControllerObserver() { if (features::IsMediaSessionIntegrationEnabled()) { media_controller_->AddObserver( @@ -296,6 +307,10 @@ auto* alarm_timer_manager = assistant_manager_internal_->GetAlarmTimerManager(); + // Can be nullptr during unittests. + if (!alarm_timer_manager) + return; + alarm_timer_manager->RegisterRingingStateListener([this]() { main_task_runner()->PostTask( FROM_HERE, @@ -314,7 +329,7 @@ } void AssistantManagerServiceImpl::SetArcPlayStoreEnabled(bool enable) { - if (!start_finished_) { + if (!HasStartFinished()) { // Skip setting play store status if libassistant is not ready. The status // will be set when it is ready. return; @@ -1009,27 +1024,29 @@ this, assistant::features::IsFeedbackUiEnabled(), assistant::features::IsMediaSessionIntegrationEnabled()); - new_assistant_manager_.reset(assistant_client::AssistantManager::Create( - platform_api_.get(), CreateLibAssistantConfig())); - auto* assistant_manager_internal = - UnwrapAssistantManagerInternal(new_assistant_manager_.get()); + new_assistant_manager_ = delegate_->CreateAssistantManager( + platform_api_.get(), CreateLibAssistantConfig()); + new_assistant_manager_internal_ = + delegate_->UnwrapAssistantManagerInternal(new_assistant_manager_.get()); - UpdateInternalOptions(assistant_manager_internal); + UpdateInternalOptions(new_assistant_manager_internal_); - assistant_manager_internal->SetDisplayConnection( + new_assistant_manager_internal_->SetDisplayConnection( new_display_connection_.get()); - assistant_manager_internal->RegisterActionModule(action_module_.get()); - assistant_manager_internal->SetAssistantManagerDelegate(this); - assistant_manager_internal->GetFuchsiaApiHelperOrDie()->SetFuchsiaApiDelegate( - &chromium_api_delegate_); + new_assistant_manager_internal_->RegisterActionModule(action_module_.get()); + new_assistant_manager_internal_->SetAssistantManagerDelegate(this); + new_assistant_manager_internal_->GetFuchsiaApiHelperOrDie() + ->SetFuchsiaApiDelegate(&chromium_api_delegate_); new_assistant_manager_->AddConversationStateListener(this); new_assistant_manager_->AddDeviceStateListener(this); std::vector<std::string> server_experiment_ids; FillServerExperimentIds(&server_experiment_ids); - if (server_experiment_ids.size() > 0) - assistant_manager_internal->AddExtraExperimentIds(server_experiment_ids); + if (server_experiment_ids.size() > 0) { + new_assistant_manager_internal_->AddExtraExperimentIds( + server_experiment_ids); + } if (!is_signed_out_mode_) { new_assistant_manager_->SetAuthTokens( @@ -1041,7 +1058,7 @@ void AssistantManagerServiceImpl::PostInitAssistant( base::OnceClosure post_init_callback) { DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); - DCHECK_EQ(state_, State::STARTED); + DCHECK_EQ(state_, State::STARTING); { base::AutoLock lock(new_assistant_manager_lock_); @@ -1058,11 +1075,11 @@ display_connection_ = std::move(new_display_connection_); assistant_manager_ = std::move(new_assistant_manager_); + assistant_manager_internal_ = new_assistant_manager_internal_; + new_assistant_manager_internal_ = nullptr; } - assistant_manager_internal_ = - UnwrapAssistantManagerInternal(assistant_manager_.get()); - state_ = State::RUNNING; + state_ = State::STARTED; const base::TimeDelta time_since_started = base::TimeTicks::Now() - started_time_; @@ -1119,21 +1136,18 @@ interaction_proto, "verify_provider_response", options, [](auto) {}); } -// assistant_client::DeviceStateListener overrides -// Run on LibAssistant threads -// This method currently only triggered as the callback of libassistant bootup -// checkin. For example, it won't get triggered for opted-out users. +// This method runs on the LibAssistant thread. +// This method is triggered as the callback of libassistant bootup checkin. void AssistantManagerServiceImpl::OnStartFinished() { ENSURE_MAIN_THREAD(&AssistantManagerServiceImpl::OnStartFinished); // It is possible the |assistant_manager_| was destructed before the // rescheduled main thread task got a chance to run. We check this and also - // try to avoid double run by check |start_finished_|. - if (!assistant_manager_ || start_finished_) + // try to avoid double run by check |HasStartFinished()|. + if (!assistant_manager_ || HasStartFinished()) return; - // TODO(b/129896357): find a better place for additional setups. - start_finished_ = true; + SetStartFinished(); if (is_first_init) { is_first_init = false; @@ -1229,9 +1243,7 @@ void AssistantManagerServiceImpl::OnConversationTurnStartedOnMainThread( const assistant_client::ConversationTurnMetadata& metadata) { - platform_api_->GetAudioInputProvider() - .GetAudioInput() - .OnConversationTurnStarted(); + platform_api_->OnConversationTurnStarted(); // Retrieve the cached interaction metadata associated with this conversation // turn or construct a new instance if there's no match in the cache. @@ -1260,9 +1272,7 @@ platform_api_->SetMicState(false); } - platform_api_->GetAudioInputProvider() - .GetAudioInput() - .OnConversationTurnFinished(); + platform_api_->OnConversationTurnFinished(); switch (resolution) { // Interaction ended normally. @@ -1711,5 +1721,13 @@ return context_->main_task_runner(); } +bool AssistantManagerServiceImpl::HasStartFinished() const { + return state_ == State::RUNNING; +} + +void AssistantManagerServiceImpl::SetStartFinished() { + state_ = State::RUNNING; +} + } // namespace assistant } // namespace chromeos
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.h b/chromeos/services/assistant/assistant_manager_service_impl.h index 83b8f72..dd0747c 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.h +++ b/chromeos/services/assistant/assistant_manager_service_impl.h
@@ -20,7 +20,6 @@ #include "chromeos/services/assistant/assistant_manager_service.h" #include "chromeos/services/assistant/assistant_settings_manager_impl.h" #include "chromeos/services/assistant/chromium_api_delegate.h" -#include "chromeos/services/assistant/platform_api_impl.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom.h" #include "libassistant/shared/internal_api/assistant_manager_delegate.h" #include "libassistant/shared/public/conversation_state_listener.h" @@ -53,7 +52,9 @@ namespace assistant { class AssistantMediaSession; +class CrosPlatformApi; class ServiceContext; +class AssistantManagerServiceDelegate; // Enumeration of Assistant query response type, also recorded in histograms. // These values are persisted to logs. Entries should not be renumbered and @@ -83,7 +84,7 @@ // Since LibAssistant is a standalone library, all callbacks come from it // running on threads not owned by Chrome. Thus we need to post the callbacks // onto the main thread. -class AssistantManagerServiceImpl +class COMPONENT_EXPORT(ASSISTANT_SERVICE) AssistantManagerServiceImpl : public AssistantManagerService, public ::chromeos::assistant::action::AssistantActionObserver, public AssistantEventObserver, @@ -97,8 +98,8 @@ // |service| owns this class and must outlive this class. AssistantManagerServiceImpl( mojom::Client* client, - mojo::PendingRemote<device::mojom::BatteryMonitor> battery_monitor, ServiceContext* context, + std::unique_ptr<AssistantManagerServiceDelegate> delegate, std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info, bool is_signed_out_mode); @@ -222,6 +223,10 @@ void UpdateInternalMediaPlayerStatus( media_session::mojom::MediaSessionAction action); + // The start runs in the background. This will wait until the background + // thread is finished. + void WaitUntilStartIsFinishedForTesting(); + private: void StartAssistantInternal(const base::Optional<std::string>& access_token); void PostInitAssistant(base::OnceClosure post_init_callback); @@ -309,10 +314,13 @@ mojom::DeviceActions* device_actions(); scoped_refptr<base::SequencedTaskRunner> main_task_runner(); + bool HasStartFinished() const; + void SetStartFinished(); + mojom::Client* const client_; State state_ = State::STOPPED; std::unique_ptr<AssistantMediaSession> media_session_; - std::unique_ptr<PlatformApiImpl> platform_api_; + std::unique_ptr<CrosPlatformApi> platform_api_; std::unique_ptr<action::CrosActionModule> action_module_; ChromiumApiDelegate chromium_api_delegate_; // NOTE: |display_connection_| is used by |assistant_manager_| and must be @@ -324,11 +332,14 @@ std::unique_ptr<CrosDisplayConnection> new_display_connection_; std::unique_ptr<assistant_client::AssistantManager> assistant_manager_; std::unique_ptr<AssistantSettingsManagerImpl> assistant_settings_manager_; - // |new_asssistant_manager_| is created on |background_thread_| then posted to + // |new_assistant_manager_| is created on |background_thread_| then posted to // main thread to finish initialization then move to |assistant_manager_|. std::unique_ptr<assistant_client::AssistantManager> new_assistant_manager_; + // Same ownership as |new_assistant_manager_|. + assistant_client::AssistantManagerInternal* new_assistant_manager_internal_ = + nullptr; base::Lock new_assistant_manager_lock_; - // same ownership as assistant_manager_. + // same ownership as |assistant_manager_|. assistant_client::AssistantManagerInternal* assistant_manager_internal_ = nullptr; mojo::RemoteSet<mojom::AssistantInteractionSubscriber> @@ -338,6 +349,8 @@ // Owned by the parent |Service| which will destroy |this| before |context_|. ServiceContext* const context_; + std::unique_ptr<AssistantManagerServiceDelegate> delegate_; + bool spoken_feedback_enabled_ = false; ax::mojom::AssistantExtraPtr assistant_extra_; @@ -372,8 +385,6 @@ base::UnguessableToken media_session_audio_focus_id_ = base::UnguessableToken::Null(); - bool start_finished_ = false; - mojo::Binding<mojom::AppListEventSubscriber> app_list_subscriber_binding_; base::ObserverList<AssistantCommunicationErrorObserver> error_observers_;
diff --git a/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc b/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc new file mode 100644 index 0000000..804b699 --- /dev/null +++ b/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc
@@ -0,0 +1,434 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/assistant_manager_service_impl.h" +#include "base/logging.h" +#include "base/test/bind_test_util.h" +#include "base/test/task_environment.h" +#include "chromeos/assistant/internal/internal_util.h" +#include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" +#include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" +#include "chromeos/dbus/power/fake_power_manager_client.h" +#include "chromeos/services/assistant/assistant_communication_error_observer.h" +#include "chromeos/services/assistant/constants.h" +#include "chromeos/services/assistant/fake_client.h" +#include "chromeos/services/assistant/public/mojom/assistant.mojom.h" +#include "chromeos/services/assistant/service_context.h" +#include "chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.h" +#include "chromeos/services/assistant/test_support/fully_initialized_assistant_state.h" +#include "chromeos/services/assistant/test_support/mock_media_manager.h" +#include "libassistant/shared/internal_api/assistant_manager_internal.h" +#include "libassistant/shared/public/assistant_manager.h" +#include "services/media_session/public/mojom/media_session.mojom-shared.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace assistant { + +using media_session::mojom::MediaSessionAction; + +namespace { +// Return the list of all libassistant error codes that are considered to be +// authentication errors. This list is created on demand as there is no clear +// enum that defines these, and we don't want to hard code this list in the +// test. +static std::vector<int> GetAuthenticationErrorCodes() { + const int kMinErrorCode = GetLowestErrorCode(); + const int kMaxErrorCode = GetHighestErrorCode(); + + std::vector<int> result; + for (int code = kMinErrorCode; code <= kMaxErrorCode; ++code) { + if (IsAuthError(code)) + result.push_back(code); + } + + return result; +} + +// Return a list of some libassistant error codes that are not considered to be +// authentication errors. Note we do not return all such codes as there are +// simply too many and testing them all significantly slows down the tests. +static std::vector<int> GetNonAuthenticationErrorCodes() { + return {-99999, 0, 1}; +} + +class FakeAssistantClient : public FakeClient { + public: + FakeAssistantClient() = default; + + void RequestBatteryMonitor( + mojo::PendingReceiver<device::mojom::BatteryMonitor> receiver) override {} + + private: + DISALLOW_COPY_AND_ASSIGN(FakeAssistantClient); +}; + +class FakeServiceContext : public ServiceContext { + public: + FakeServiceContext( + scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, + ash::AssistantState* assistant_state, + PowerManagerClient* power_manager_client) + : main_task_runner_(main_task_runner), + assistant_state_(assistant_state), + power_manager_client_(power_manager_client) {} + ~FakeServiceContext() override = default; + + ash::mojom::AssistantAlarmTimerController* assistant_alarm_timer_controller() + override { + NOTIMPLEMENTED(); + return nullptr; + } + + mojom::AssistantController* assistant_controller() override { + NOTIMPLEMENTED(); + return nullptr; + } + + ash::mojom::AssistantNotificationController* + assistant_notification_controller() override { + NOTIMPLEMENTED(); + return nullptr; + } + + ash::mojom::AssistantScreenContextController* + assistant_screen_context_controller() override { + NOTIMPLEMENTED(); + return nullptr; + } + + ash::AssistantStateBase* assistant_state() override { + return assistant_state_; + } + + CrasAudioHandler* cras_audio_handler() override { + NOTIMPLEMENTED(); + return nullptr; + } + + mojom::DeviceActions* device_actions() override { + NOTIMPLEMENTED(); + return nullptr; + } + + scoped_refptr<base::SequencedTaskRunner> main_task_runner() override { + return main_task_runner_; + } + + PowerManagerClient* power_manager_client() override { + return power_manager_client_; + } + + private: + scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; + ash::AssistantState* const assistant_state_; + PowerManagerClient* const power_manager_client_; + + DISALLOW_COPY_AND_ASSIGN(FakeServiceContext); +}; + +class AssistantCommunicationErrorObserverMock + : public AssistantCommunicationErrorObserver { + public: + AssistantCommunicationErrorObserverMock() = default; + ~AssistantCommunicationErrorObserverMock() override = default; + + MOCK_METHOD(void, OnCommunicationError, (CommunicationErrorType error)); + + private: + DISALLOW_COPY_AND_ASSIGN(AssistantCommunicationErrorObserverMock); +}; + +class AssistantManagerServiceImplTest : public testing::Test { + public: + AssistantManagerServiceImplTest() = default; + ~AssistantManagerServiceImplTest() override = default; + + void SetUp() override { + PowerManagerClient::InitializeFake(); + FakePowerManagerClient::Get()->SetTabletMode( + PowerManagerClient::TabletMode::OFF, base::TimeTicks()); + + mojo::PendingRemote<device::mojom::BatteryMonitor> battery_monitor; + assistant_client_.RequestBatteryMonitor( + battery_monitor.InitWithNewPipeAndPassReceiver()); + + shared_url_loader_factory_ = + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &url_loader_factory_); + + service_context_ = std::make_unique<FakeServiceContext>( + task_environment.GetMainThreadTaskRunner(), &assistant_state_, + PowerManagerClient::Get()); + + auto delegate = std::make_unique<FakeAssistantManagerServiceDelegate>(); + delegate_ = delegate.get(); + + assistant_manager_service_ = std::make_unique<AssistantManagerServiceImpl>( + &assistant_client_, service_context_.get(), std::move(delegate), + shared_url_loader_factory_->Clone(), + /*is_signed_out_mode=*/false); + } + + void TearDown() override { + assistant_manager_service_.reset(); + PowerManagerClient::Shutdown(); + } + + AssistantManagerServiceImpl* assistant_manager_service() { + return assistant_manager_service_.get(); + } + + ash::AssistantState* assistant_state() { return &assistant_state_; } + + FakeAssistantManager* fake_assistant_manager() { + return delegate_->assistant_manager(); + } + + FakeAssistantManagerInternal* fake_assistant_manager_internal() { + return delegate_->assistant_manager_internal(); + } + + base::OnceClosure GetDummyCallback() { + return base::BindOnce([] {}); + } + + void Start() { Start(GetDummyCallback()); } + + void Start(base::OnceClosure callback) { + assistant_manager_service()->Start("dummy-access-token", + /*enable_hotword=*/false, + std::move(callback)); + } + + void RunUntilIdle() { base::RunLoop().RunUntilIdle(); } + + void WaitUntilStartIsFinished() { + assistant_manager_service()->WaitUntilStartIsFinishedForTesting(); + } + + // Raise all the |libassistant_error_codes| as communication errors from + // libassistant, and check that they are reported to our + // |AssistantCommunicationErrorObserver| as errors of type |expected_type|. + void TestCommunicationErrors(const std::vector<int>& libassistant_error_codes, + CommunicationErrorType expected_error) { + Start(); + WaitUntilStartIsFinished(); + + auto* delegate = + fake_assistant_manager_internal()->assistant_manager_delegate(); + + for (int code : libassistant_error_codes) { + AssistantCommunicationErrorObserverMock observer; + assistant_manager_service()->AddCommunicationErrorObserver(&observer); + + EXPECT_CALL(observer, OnCommunicationError(expected_error)); + + delegate->OnCommunicationError(code); + RunUntilIdle(); + + assistant_manager_service()->RemoveCommunicationErrorObserver(&observer); + + ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(&observer)) + << "Failure for error code " << code; + } + } + + private: + base::test::SingleThreadTaskEnvironment task_environment; + + FakeAssistantClient assistant_client_{}; + FullyInitializedAssistantState assistant_state_; + + std::unique_ptr<FakeServiceContext> service_context_; + + network::TestURLLoaderFactory url_loader_factory_; + scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; + + FakeAssistantManagerServiceDelegate* delegate_; + + std::unique_ptr<AssistantManagerServiceImpl> assistant_manager_service_; + + DISALLOW_COPY_AND_ASSIGN(AssistantManagerServiceImplTest); +}; +} // namespace + +TEST_F(AssistantManagerServiceImplTest, StateShouldStartAsStopped) { + EXPECT_EQ(AssistantManagerService::STOPPED, + assistant_manager_service()->GetState()); +} + +TEST_F(AssistantManagerServiceImplTest, + StateShouldChangeToStartingAfterCallingStart) { + Start(); + + EXPECT_EQ(AssistantManagerService::STARTING, + assistant_manager_service()->GetState()); +} + +TEST_F(AssistantManagerServiceImplTest, + StateShouldRemainStartingUntilLibassistantIsStarted) { + Start(); + + fake_assistant_manager()->BlockStartCalls(); + RunUntilIdle(); + + EXPECT_EQ(AssistantManagerService::STARTING, + assistant_manager_service()->GetState()); + + fake_assistant_manager()->UnblockStartCalls(); + WaitUntilStartIsFinished(); + + EXPECT_EQ(AssistantManagerService::STARTED, + assistant_manager_service()->GetState()); +} + +TEST_F(AssistantManagerServiceImplTest, + StateShouldBecomeRunningAfterLibassistantSignalsOnStartFinished) { + Start(); + WaitUntilStartIsFinished(); + + fake_assistant_manager()->device_state_listener()->OnStartFinished(); + + EXPECT_EQ(AssistantManagerService::RUNNING, + assistant_manager_service()->GetState()); +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldInvokeStartCallbackWhenLibassistantStartFinishes) { + bool callback_invoked = false; + base::OnceClosure callback = base::BindLambdaForTesting( + [&callback_invoked]() { callback_invoked = true; }); + + Start(std::move(callback)); + + fake_assistant_manager()->BlockStartCalls(); + RunUntilIdle(); + + EXPECT_EQ(callback_invoked, false); + + fake_assistant_manager()->UnblockStartCalls(); + WaitUntilStartIsFinished(); + + EXPECT_EQ(callback_invoked, true); +} + +TEST_F(AssistantManagerServiceImplTest, ShouldSetStateToStoppedAfterStopping) { + Start(); + WaitUntilStartIsFinished(); + ASSERT_EQ(AssistantManagerService::STARTED, + assistant_manager_service()->GetState()); + + assistant_manager_service()->Stop(); + EXPECT_EQ(AssistantManagerService::STOPPED, + assistant_manager_service()->GetState()); +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldReportAuthenticationErrorsToCommunicationErrorObservers) { + TestCommunicationErrors(GetAuthenticationErrorCodes(), + CommunicationErrorType::AuthenticationError); +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldReportNonAuthenticationErrorsToCommunicationErrorObservers) { + std::vector<int> non_authentication_errors = GetNonAuthenticationErrorCodes(); + + // check to ensure these are not authentication errors. + for (int code : non_authentication_errors) + ASSERT_FALSE(IsAuthError(code)); + + // Run the actual unittest + TestCommunicationErrors(non_authentication_errors, + CommunicationErrorType::Other); +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldNotCrashWhenSettingAuthTokenBeforeStartFinished) { + Start(); + + assistant_manager_service()->SetAccessToken("<this-should-not-crash>"); +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldPassAccessTokenToAssistantManager) { + Start(); + WaitUntilStartIsFinished(); + + assistant_manager_service()->SetAccessToken("<the-access-token>"); + + EXPECT_EQ("<the-access-token>", fake_assistant_manager()->access_token()); +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldPassDefaultUserIdToAssistantManagerWhenSettingAccessToken) { + Start(); + WaitUntilStartIsFinished(); + + assistant_manager_service()->SetAccessToken("<the-access-token>"); + + EXPECT_EQ(kUserID, fake_assistant_manager()->user_id()); +} + +TEST_F(AssistantManagerServiceImplTest, ShouldPauseMediaManagerOnPause) { + testing::StrictMock<MockMediaManager> mock; + fake_assistant_manager()->SetMediaManager(&mock); + + Start(); + WaitUntilStartIsFinished(); + + EXPECT_CALL(mock, Pause); + + assistant_manager_service()->UpdateInternalMediaPlayerStatus( + MediaSessionAction::kPause); +} + +TEST_F(AssistantManagerServiceImplTest, ShouldResumeMediaManagerOnPlay) { + testing::StrictMock<MockMediaManager> mock; + fake_assistant_manager()->SetMediaManager(&mock); + + Start(); + WaitUntilStartIsFinished(); + + EXPECT_CALL(mock, Resume); + + assistant_manager_service()->UpdateInternalMediaPlayerStatus( + MediaSessionAction::kPlay); +} + +TEST_F(AssistantManagerServiceImplTest, ShouldIgnoreOtherMediaManagerActions) { + const auto unsupported_media_session_actions = { + MediaSessionAction::kPreviousTrack, MediaSessionAction::kNextTrack, + MediaSessionAction::kSeekBackward, MediaSessionAction::kSeekForward, + MediaSessionAction::kSkipAd, MediaSessionAction::kStop, + MediaSessionAction::kSeekTo, MediaSessionAction::kScrubTo, + }; + + testing::StrictMock<MockMediaManager> mock; + fake_assistant_manager()->SetMediaManager(&mock); + + Start(); + WaitUntilStartIsFinished(); + + for (auto action : unsupported_media_session_actions) { + // If this is not ignored, |mock| will complain about an uninterested call. + assistant_manager_service()->UpdateInternalMediaPlayerStatus(action); + } +} + +TEST_F(AssistantManagerServiceImplTest, + ShouldNotCrashWhenMediaManagerIsAbsent) { + Start(); + WaitUntilStartIsFinished(); + + assistant_manager_service()->UpdateInternalMediaPlayerStatus( + media_session::mojom::MediaSessionAction::kPlay); +} + +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/assistant_settings_manager_impl.cc b/chromeos/services/assistant/assistant_settings_manager_impl.cc index 3d1a4a82..3471ace4 100644 --- a/chromeos/services/assistant/assistant_settings_manager_impl.cc +++ b/chromeos/services/assistant/assistant_settings_manager_impl.cc
@@ -24,6 +24,17 @@ namespace chromeos { namespace assistant { +namespace { + +bool HasStarted(const AssistantManagerService* assistant_manager_service) { + return (assistant_manager_service->GetState() == + AssistantManagerService::STARTED || + assistant_manager_service->GetState() == + AssistantManagerService::RUNNING); +} + +} // namespace + AssistantSettingsManagerImpl::AssistantSettingsManagerImpl( ServiceContext* context, AssistantManagerServiceImpl* assistant_manager_service) @@ -40,8 +51,7 @@ void AssistantSettingsManagerImpl::GetSettings(const std::string& selector, GetSettingsCallback callback) { - DCHECK(assistant_manager_service_->GetState() == - AssistantManagerService::State::RUNNING); + DCHECK(HasStarted(assistant_manager_service_)); DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); // TODO(xiaohuic): libassistant could be restarting for various reasons. In @@ -79,8 +89,7 @@ void AssistantSettingsManagerImpl::UpdateSettings( const std::string& update, GetSettingsCallback callback) { - DCHECK(assistant_manager_service_->GetState() == - AssistantManagerService::State::RUNNING); + DCHECK(HasStarted(assistant_manager_service_)); DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); if (!assistant_manager_service_->assistant_manager_internal()) { @@ -114,8 +123,7 @@ void AssistantSettingsManagerImpl::StartSpeakerIdEnrollment( bool skip_cloud_enrollment, mojom::SpeakerIdEnrollmentClientPtr client) { - DCHECK(assistant_manager_service_->GetState() == - AssistantManagerService::State::RUNNING); + DCHECK(HasStarted(assistant_manager_service_)); DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); if (!assistant_manager_service_->assistant_manager_internal()) @@ -142,8 +150,7 @@ void AssistantSettingsManagerImpl::StopSpeakerIdEnrollment( StopSpeakerIdEnrollmentCallback callback) { - DCHECK(assistant_manager_service_->GetState() == - AssistantManagerService::State::RUNNING); + DCHECK(HasStarted(assistant_manager_service_)); DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); if (!assistant_manager_service_->assistant_manager_internal()) {
diff --git a/chromeos/services/assistant/constants.h b/chromeos/services/assistant/constants.h index 51e3f67..819fb4d 100644 --- a/chromeos/services/assistant/constants.h +++ b/chromeos/services/assistant/constants.h
@@ -5,9 +5,12 @@ #ifndef CHROMEOS_SERVICES_ASSISTANT_CONSTANTS_H_ #define CHROMEOS_SERVICES_ASSISTANT_CONSTANTS_H_ +#include "base/component_export.h" + namespace chromeos { namespace assistant { +COMPONENT_EXPORT(ASSISTANT_SERVICE) extern const char kUserID[]; } // namespace assistant
diff --git a/chromeos/services/assistant/cros_platform_api.h b/chromeos/services/assistant/cros_platform_api.h new file mode 100644 index 0000000..82d39a8 --- /dev/null +++ b/chromeos/services/assistant/cros_platform_api.h
@@ -0,0 +1,37 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_CROS_PLATFORM_API_H_ +#define CHROMEOS_SERVICES_ASSISTANT_CROS_PLATFORM_API_H_ + +#include "base/macros.h" +#include "libassistant/shared/public/platform_api.h" + +namespace chromeos { +namespace assistant { + +// Platform API required by the voice assistant, extended with some methods used +// when ChromeOS needs to make changes to the platform state. +class CrosPlatformApi : public assistant_client::PlatformApi { + public: + CrosPlatformApi() = default; + ~CrosPlatformApi() override = default; + + // Called when the mic state associated with the interaction is changed. + virtual void SetMicState(bool mic_open) = 0; + + virtual void OnConversationTurnStarted() = 0; + virtual void OnConversationTurnFinished() = 0; + + // Called when hotword enabled status changed. + virtual void OnHotwordEnabled(bool enable) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(CrosPlatformApi); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_CROS_PLATFORM_API_H_
diff --git a/chromeos/services/assistant/fake_assistant_manager_service_impl.cc b/chromeos/services/assistant/fake_assistant_manager_service_impl.cc index 755edb5b..429cd1f 100644 --- a/chromeos/services/assistant/fake_assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/fake_assistant_manager_service_impl.cc
@@ -23,7 +23,7 @@ const base::Optional<std::string>& access_token, bool enable_hotword, base::OnceClosure callback) { - state_ = State::STARTED; + state_ = State::STARTING; start_callback_ = std::move(callback); }
diff --git a/chromeos/services/assistant/platform_api_impl.cc b/chromeos/services/assistant/platform_api_impl.cc index 7084351..90143a85 100644 --- a/chromeos/services/assistant/platform_api_impl.cc +++ b/chromeos/services/assistant/platform_api_impl.cc
@@ -184,6 +184,14 @@ audio_input_provider_.SetMicState(mic_open); } +void PlatformApiImpl::OnConversationTurnStarted() { + audio_input_provider_.GetAudioInput().OnConversationTurnStarted(); +} + +void PlatformApiImpl::OnConversationTurnFinished() { + audio_input_provider_.GetAudioInput().OnConversationTurnFinished(); +} + void PlatformApiImpl::OnHotwordEnabled(bool enable) { audio_input_provider_.OnHotwordEnabled(enable); }
diff --git a/chromeos/services/assistant/platform_api_impl.h b/chromeos/services/assistant/platform_api_impl.h index 633bcdf8..a276fb2 100644 --- a/chromeos/services/assistant/platform_api_impl.h +++ b/chromeos/services/assistant/platform_api_impl.h
@@ -11,13 +11,13 @@ #include <vector> #include "chromeos/audio/cras_audio_handler.h" +#include "chromeos/services/assistant/cros_platform_api.h" #include "chromeos/services/assistant/platform/audio_input_provider_impl.h" #include "chromeos/services/assistant/platform/audio_output_provider_impl.h" #include "chromeos/services/assistant/platform/file_provider_impl.h" #include "chromeos/services/assistant/platform/network_provider_impl.h" #include "chromeos/services/assistant/platform/system_provider_impl.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom.h" -#include "libassistant/shared/public/platform_api.h" #include "libassistant/shared/public/platform_auth.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "services/device/public/mojom/battery_monitor.mojom.h" @@ -30,7 +30,7 @@ class AssistantMediaSession; // Platform API required by the voice assistant. -class PlatformApiImpl : public assistant_client::PlatformApi, +class PlatformApiImpl : public CrosPlatformApi, CrasAudioHandler::AudioObserver { public: PlatformApiImpl( @@ -56,10 +56,13 @@ void OnAudioNodesChanged() override; // Called when the mic state associated with the interaction is changed. - void SetMicState(bool mic_open); + void SetMicState(bool mic_open) override; + + void OnConversationTurnStarted() override; + void OnConversationTurnFinished() override; // Called when hotword enabled status changed. - void OnHotwordEnabled(bool enable); + void OnHotwordEnabled(bool enable) override; private: // ChromeOS does not use auth manager, so we don't yet need to implement a
diff --git a/chromeos/services/assistant/service.cc b/chromeos/services/assistant/service.cc index 5e2a112..489ab433 100644 --- a/chromeos/services/assistant/service.cc +++ b/chromeos/services/assistant/service.cc
@@ -24,6 +24,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" #include "chromeos/services/assistant/assistant_manager_service.h" +#include "chromeos/services/assistant/assistant_manager_service_delegate_impl.h" #include "chromeos/services/assistant/assistant_settings_manager.h" #include "chromeos/services/assistant/fake_assistant_manager_service_impl.h" #include "chromeos/services/assistant/fake_assistant_settings_manager_impl.h" @@ -314,6 +315,7 @@ DVLOG(1) << "Request Assistant start"; } break; + case AssistantManagerService::State::STARTING: case AssistantManagerService::State::STARTED: // Wait if |assistant_manager_service_| is not at a stable state. update_assistant_manager_callback_.Cancel(); @@ -435,10 +437,13 @@ client_->RequestBatteryMonitor( battery_monitor.InitWithNewPipeAndPassReceiver()); + auto delegate = std::make_unique<AssistantManagerServiceDelegateImpl>( + std::move(battery_monitor), client_.get(), context()); + // |assistant_manager_service_| is only created once. DCHECK(url_loader_factory_info_); assistant_manager_service_ = std::make_unique<AssistantManagerServiceImpl>( - client_.get(), std::move(battery_monitor), context(), + client_.get(), context(), std::move(delegate), std::move(url_loader_factory_info_), is_signed_out_mode_); #else assistant_manager_service_ = @@ -450,9 +455,10 @@ void Service::FinalizeAssistantManagerService() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(assistant_manager_service_->GetState() == - AssistantManagerService::State::RUNNING); + AssistantManagerService::STARTED || + assistant_manager_service_->GetState() == + AssistantManagerService::RUNNING); // Using session_observer_binding_ as a flag to control onetime initialization if (!observing_ash_session_) {
diff --git a/chromeos/services/assistant/service_unittest.cc b/chromeos/services/assistant/service_unittest.cc index f354b05..4c2d82b 100644 --- a/chromeos/services/assistant/service_unittest.cc +++ b/chromeos/services/assistant/service_unittest.cc
@@ -8,7 +8,6 @@ #include <utility> #include <vector> -#include "ash/public/cpp/assistant/assistant_state.h" #include "ash/public/mojom/assistant_state_controller.mojom.h" #include "base/bind.h" #include "base/logging.h" @@ -27,6 +26,7 @@ #include "chromeos/services/assistant/fake_client.h" #include "chromeos/services/assistant/pref_connection_delegate.h" #include "chromeos/services/assistant/public/cpp/assistant_prefs.h" +#include "chromeos/services/assistant/test_support/fully_initialized_assistant_state.h" #include "components/prefs/testing_pref_service.h" #include "mojo/public/cpp/bindings/interface_ptr_set.h" #include "services/identity/public/mojom/identity_accessor.mojom.h" @@ -131,12 +131,6 @@ explicit FakeAssistantClient(ash::AssistantState* assistant_state) : assistant_state_(assistant_state) {} - mojom::ClientPtr CreatePendingRemoteAndBind() { - mojom::ClientPtr ptr; - binding_.Bind(mojo::MakeRequest(&ptr)); - return ptr; - } - private: // FakeClient: void RequestAssistantStateController( @@ -146,7 +140,6 @@ } ash::AssistantState* const assistant_state_; - mojo::Binding<mojom::Client> binding_{this}; DISALLOW_COPY_AND_ASSIGN(FakeAssistantClient); }; @@ -201,11 +194,6 @@ base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &url_loader_factory_); - assistant_state()->NotifyArcPlayStoreEnabledChanged(true); - assistant_state()->NotifyFeatureAllowed( - ash::mojom::AssistantAllowedState::ALLOWED); - assistant_state()->NotifyLocaleChanged("en_US"); - auto fake_pref_connection = std::make_unique<FakePrefConnectionDelegate>(); pref_service_ = fake_pref_connection->pref_service(); @@ -265,7 +253,7 @@ std::unique_ptr<Service> service_; mojo::Remote<mojom::AssistantService> remote_service_; - ash::AssistantState assistant_state_; + FullyInitializedAssistantState assistant_state_; FakeIdentityAccessor fake_identity_accessor_; FakeAssistantClient fake_assistant_client_{&assistant_state_}; @@ -342,19 +330,19 @@ } TEST_F(AssistantServiceTest, StopDelayedIfAssistantNotFinishedStarting) { - // Test is set up as |State::STARTED|, turning settings off will trigger + // Test is set up as |State::STARTING|, turning settings off will trigger // logic to try to stop it. pref_service()->SetBoolean(prefs::kAssistantEnabled, false); EXPECT_EQ(assistant_manager()->GetState(), - AssistantManagerService::State::STARTED); + AssistantManagerService::State::STARTING); mock_task_runner()->FastForwardBy(kUpdateAssistantManagerDelay); base::RunLoop().RunUntilIdle(); // No change of state because it is still starting. EXPECT_EQ(assistant_manager()->GetState(), - AssistantManagerService::State::STARTED); + AssistantManagerService::State::STARTING); assistant_manager()->FinishStart();
diff --git a/chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.cc b/chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.cc new file mode 100644 index 0000000..0602e91 --- /dev/null +++ b/chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.cc
@@ -0,0 +1,45 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.h" + +#include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" +#include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" +#include "chromeos/services/assistant/test_support/fake_platform_api.h" + +namespace chromeos { +namespace assistant { + +FakeAssistantManagerServiceDelegate::FakeAssistantManagerServiceDelegate() + : assistant_manager_(std::make_unique<FakeAssistantManager>()), + assistant_manager_internal_( + std::make_unique<FakeAssistantManagerInternal>()), + assistant_manager_ptr_(assistant_manager_.get()) {} + +FakeAssistantManagerServiceDelegate::~FakeAssistantManagerServiceDelegate() = + default; + +std::unique_ptr<CrosPlatformApi> +FakeAssistantManagerServiceDelegate::CreatePlatformApi( + AssistantMediaSession* media_session, + scoped_refptr<base::SingleThreadTaskRunner> background_thread_task_runner) { + return std::make_unique<FakePlatformApi>(); +} + +std::unique_ptr<assistant_client::AssistantManager> +FakeAssistantManagerServiceDelegate::CreateAssistantManager( + assistant_client::PlatformApi* platform_api, + const std::string& lib_assistant_config) { + DCHECK(assistant_manager_); + return std::move(assistant_manager_); +} + +assistant_client::AssistantManagerInternal* +FakeAssistantManagerServiceDelegate::UnwrapAssistantManagerInternal( + assistant_client::AssistantManager* assistant_manager) { + return assistant_manager_internal_.get(); +} + +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.h b/chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.h new file mode 100644 index 0000000..2d8d65e --- /dev/null +++ b/chromeos/services/assistant/test_support/fake_assistant_manager_service_delegate.h
@@ -0,0 +1,54 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_MANAGER_SERVICE_DELEGATE_H_ +#define CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_MANAGER_SERVICE_DELEGATE_H_ + +#include "chromeos/services/assistant/assistant_manager_service_delegate.h" + +namespace chromeos { +namespace assistant { + +class FakeAssistantManager; +class FakeAssistantManagerInternal; + +// Implementation of |AssistantManagerServiceDelegate| that returns fake +// instances for all of the member methods. Used during unittests. +class FakeAssistantManagerServiceDelegate + : public AssistantManagerServiceDelegate { + public: + FakeAssistantManagerServiceDelegate(); + ~FakeAssistantManagerServiceDelegate() override; + + FakeAssistantManager* assistant_manager() { return assistant_manager_ptr_; } + + FakeAssistantManagerInternal* assistant_manager_internal() { + return assistant_manager_internal_.get(); + } + + // AssistantManagerServiceDelegate: + std::unique_ptr<CrosPlatformApi> CreatePlatformApi( + AssistantMediaSession* media_session, + scoped_refptr<base::SingleThreadTaskRunner> background_thread_task_runner) + override; + std::unique_ptr<assistant_client::AssistantManager> CreateAssistantManager( + assistant_client::PlatformApi* platform_api, + const std::string& lib_assistant_config) override; + assistant_client::AssistantManagerInternal* UnwrapAssistantManagerInternal( + assistant_client::AssistantManager* assistant_manager) override; + + private: + // Will be initialized in the constructor and moved out when + // |CreateAssistantManager| is called. + std::unique_ptr<FakeAssistantManager> assistant_manager_; + std::unique_ptr<FakeAssistantManagerInternal> assistant_manager_internal_; + FakeAssistantManager* assistant_manager_ptr_; + + DISALLOW_COPY_AND_ASSIGN(FakeAssistantManagerServiceDelegate); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_MANAGER_SERVICE_DELEGATE_H_
diff --git a/chromeos/services/assistant/test_support/fake_platform_api.cc b/chromeos/services/assistant/test_support/fake_platform_api.cc new file mode 100644 index 0000000..823be66 --- /dev/null +++ b/chromeos/services/assistant/test_support/fake_platform_api.cc
@@ -0,0 +1,43 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/test_support/fake_platform_api.h" +#include "base/logging.h" + +namespace chromeos { +namespace assistant { + +assistant_client::AudioInputProvider& FakePlatformApi::GetAudioInputProvider() { + NOTIMPLEMENTED(); + abort(); +} + +assistant_client::AudioOutputProvider& +FakePlatformApi::GetAudioOutputProvider() { + NOTIMPLEMENTED(); + abort(); +} + +assistant_client::AuthProvider& FakePlatformApi::GetAuthProvider() { + NOTIMPLEMENTED(); + abort(); +} + +assistant_client::FileProvider& FakePlatformApi::GetFileProvider() { + NOTIMPLEMENTED(); + abort(); +} + +assistant_client::NetworkProvider& FakePlatformApi::GetNetworkProvider() { + NOTIMPLEMENTED(); + abort(); +} + +assistant_client::SystemProvider& FakePlatformApi::GetSystemProvider() { + NOTIMPLEMENTED(); + abort(); +} + +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/test_support/fake_platform_api.h b/chromeos/services/assistant/test_support/fake_platform_api.h new file mode 100644 index 0000000..6a15e85 --- /dev/null +++ b/chromeos/services/assistant/test_support/fake_platform_api.h
@@ -0,0 +1,41 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_API_H_ +#define CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_API_H_ + +#include "base/macros.h" +#include "chromeos/services/assistant/cros_platform_api.h" + +namespace chromeos { +namespace assistant { + +// Fake implementation of the |CrosPlatformApi| used during the unittests. +// As of now the |assistant_client::PlatformApi| methods are not implemented +// and will assert when called. +class FakePlatformApi : public CrosPlatformApi { + public: + FakePlatformApi() = default; + ~FakePlatformApi() override = default; + + // CrosPlatformApi overrides + assistant_client::AudioInputProvider& GetAudioInputProvider() override; + assistant_client::AudioOutputProvider& GetAudioOutputProvider() override; + assistant_client::AuthProvider& GetAuthProvider() override; + assistant_client::FileProvider& GetFileProvider() override; + assistant_client::NetworkProvider& GetNetworkProvider() override; + assistant_client::SystemProvider& GetSystemProvider() override; + void SetMicState(bool mic_open) override {} + void OnHotwordEnabled(bool enable) override {} + void OnConversationTurnStarted() override {} + void OnConversationTurnFinished() override {} + + private: + DISALLOW_COPY_AND_ASSIGN(FakePlatformApi); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_API_H_
diff --git a/chromeos/services/assistant/test_support/fully_initialized_assistant_state.cc b/chromeos/services/assistant/test_support/fully_initialized_assistant_state.cc new file mode 100644 index 0000000..6550b140 --- /dev/null +++ b/chromeos/services/assistant/test_support/fully_initialized_assistant_state.cc
@@ -0,0 +1,30 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/test_support/fully_initialized_assistant_state.h" + +namespace chromeos { +namespace assistant { + +FullyInitializedAssistantState::FullyInitializedAssistantState() { + InitializeAllValues(); +} + +void FullyInitializedAssistantState::InitializeAllValues() { + settings_enabled_ = true; + consent_status_ = + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted; + context_enabled_ = true; + hotword_enabled_ = true; + hotword_always_on_ = true; + launch_with_mic_open_ = true; + notification_enabled_ = true; + allowed_state_ = ash::mojom::AssistantAllowedState::ALLOWED; + locale_ = "en_US"; + arc_play_store_enabled_ = true; + locked_full_screen_enabled_ = true; +} + +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/test_support/fully_initialized_assistant_state.h b/chromeos/services/assistant/test_support/fully_initialized_assistant_state.h new file mode 100644 index 0000000..4a509ff3 --- /dev/null +++ b/chromeos/services/assistant/test_support/fully_initialized_assistant_state.h
@@ -0,0 +1,29 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FULLY_INITIALIZED_ASSISTANT_STATE_H_ +#define CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FULLY_INITIALIZED_ASSISTANT_STATE_H_ + +#include "ash/public/cpp/assistant/assistant_state.h" + +namespace chromeos { +namespace assistant { + +// Instance of |AssistantState| where every base::Optional value has a non-null +// value. All values will be set to their equivalent of enabled. +class FullyInitializedAssistantState : public ash::AssistantState { + public: + FullyInitializedAssistantState(); + ~FullyInitializedAssistantState() override = default; + + private: + void InitializeAllValues(); + + DISALLOW_COPY_AND_ASSIGN(FullyInitializedAssistantState); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_FULLY_INITIALIZED_ASSISTANT_STATE_H_
diff --git a/chromeos/services/assistant/test_support/mock_media_manager.cc b/chromeos/services/assistant/test_support/mock_media_manager.cc new file mode 100644 index 0000000..ff0ee5bd --- /dev/null +++ b/chromeos/services/assistant/test_support/mock_media_manager.cc
@@ -0,0 +1,14 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/test_support/mock_media_manager.h" + +namespace chromeos { +namespace assistant { + +MockMediaManager::MockMediaManager() = default; +MockMediaManager::~MockMediaManager() = default; + +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/test_support/mock_media_manager.h b/chromeos/services/assistant/test_support/mock_media_manager.h new file mode 100644 index 0000000..2ab2dce --- /dev/null +++ b/chromeos/services/assistant/test_support/mock_media_manager.h
@@ -0,0 +1,34 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_MOCK_MEDIA_MANAGER_H_ +#define CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_MOCK_MEDIA_MANAGER_H_ + +#include "libassistant/shared/public/media_manager.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace chromeos { +namespace assistant { + +class MockMediaManager : public assistant_client::MediaManager { + public: + MockMediaManager(); + ~MockMediaManager() override; + + // MediaManager: + MOCK_METHOD1(AddListener, void(Listener*)); + MOCK_METHOD0(Next, void()); + MOCK_METHOD0(Previous, void()); + MOCK_METHOD0(Pause, void()); + MOCK_METHOD0(Resume, void()); + MOCK_METHOD0(StopAndClearPlaylist, void()); + MOCK_METHOD0(PlayPause, void()); + MOCK_METHOD1(SetExternalPlaybackState, + void(const assistant_client::MediaStatus&)); +}; + +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_TEST_SUPPORT_MOCK_MEDIA_MANAGER_H_
diff --git a/chromeos/system/BUILD.gn b/chromeos/system/BUILD.gn index 1b64308c..a4766b3a 100644 --- a/chromeos/system/BUILD.gn +++ b/chromeos/system/BUILD.gn
@@ -26,6 +26,8 @@ "fake_statistics_provider.h", "name_value_pairs_parser.cc", "name_value_pairs_parser.h", + "scheduler_configuration_manager_base.cc", + "scheduler_configuration_manager_base.h", "statistics_provider.cc", "statistics_provider.h", ]
diff --git a/chromeos/system/scheduler_configuration_manager_base.cc b/chromeos/system/scheduler_configuration_manager_base.cc new file mode 100644 index 0000000..b206b830 --- /dev/null +++ b/chromeos/system/scheduler_configuration_manager_base.cc
@@ -0,0 +1,24 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/system/scheduler_configuration_manager_base.h" + +namespace chromeos { + +SchedulerConfigurationManagerBase::SchedulerConfigurationManagerBase() = + default; +SchedulerConfigurationManagerBase::~SchedulerConfigurationManagerBase() = + default; + +void SchedulerConfigurationManagerBase::AddObserver( + SchedulerConfigurationManagerBase::Observer* obs) { + observer_list_.AddObserver(obs); +} + +void SchedulerConfigurationManagerBase::RemoveObserver( + const SchedulerConfigurationManagerBase::Observer* obs) { + observer_list_.RemoveObserver(obs); +} + +} // namespace chromeos
diff --git a/chromeos/system/scheduler_configuration_manager_base.h b/chromeos/system/scheduler_configuration_manager_base.h new file mode 100644 index 0000000..5262943 --- /dev/null +++ b/chromeos/system/scheduler_configuration_manager_base.h
@@ -0,0 +1,41 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SYSTEM_SCHEDULER_CONFIGURATION_MANAGER_BASE_H_ +#define CHROMEOS_SYSTEM_SCHEDULER_CONFIGURATION_MANAGER_BASE_H_ + +#include <stddef.h> + +#include "base/component_export.h" +#include "base/macros.h" +#include "base/observer_list.h" + +namespace chromeos { + +// A base class for SchedulerConfigurationManager. +class COMPONENT_EXPORT(CHROMEOS_SYSTEM) SchedulerConfigurationManagerBase { + public: + class Observer : public base::CheckedObserver { + public: + // Called when SetSchedulerConfiguration D-Bus call to debugd returns. + virtual void OnConfigurationSet(bool success, + size_t num_cores_disabled) = 0; + }; + + SchedulerConfigurationManagerBase(); + virtual ~SchedulerConfigurationManagerBase(); + + void AddObserver(Observer* obs); + void RemoveObserver(const Observer* obs); + + protected: + base::ObserverList<Observer> observer_list_; + + private: + DISALLOW_COPY_AND_ASSIGN(SchedulerConfigurationManagerBase); +}; + +} // namespace chromeos + +#endif // CHROMEOS_SYSTEM_SCHEDULER_CONFIGURATION_MANAGER_BASE_H_
diff --git a/components/BUILD.gn b/components/BUILD.gn index 61d4b09..395ee3f4 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -95,6 +95,7 @@ "//components/feed:unit_tests", "//components/filename_generation:unit_tests", "//components/flags_ui:unit_tests", + "//components/games/core:unit_tests", "//components/gcm_driver:unit_tests", "//components/gcm_driver/crypto:unit_tests", "//components/google/core/common:unit_tests",
diff --git a/components/arc/arc_features.cc b/components/arc/arc_features.cc index 280b29ce..e550289 100644 --- a/components/arc/arc_features.cc +++ b/components/arc/arc_features.cc
@@ -62,7 +62,7 @@ // Controls experimental print spooler feature for ARC. const base::Feature kPrintSpoolerExperimentFeature{ - "ArcPrintSpoolerExperiment", base::FEATURE_ENABLED_BY_DEFAULT}; + "ArcPrintSpoolerExperiment", base::FEATURE_DISABLED_BY_DEFAULT}; // Controls Smart Text Selection for Chrome. // When enabled, the context menu will show contextual quick actions based on
diff --git a/components/arc/session/arc_session_impl.cc b/components/arc/session/arc_session_impl.cc index 5870377..164fa208 100644 --- a/components/arc/session/arc_session_impl.cc +++ b/components/arc/session/arc_session_impl.cc
@@ -376,7 +376,8 @@ request.set_arc_custom_tabs_experiment(is_custom_tab_enabled); const bool is_arc_print_spooler_enabled = base::FeatureList::IsEnabled(arc::kPrintSpoolerExperimentFeature) && - delegate_->GetChannel() != version_info::Channel::STABLE; + delegate_->GetChannel() != version_info::Channel::STABLE && + delegate_->GetChannel() != version_info::Channel::BETA; request.set_arc_print_spooler_experiment(is_arc_print_spooler_enabled); request.set_lcd_density(lcd_density);
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 011f1b8..f3c62f2 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -772,6 +772,9 @@ !base::Contains(password_to_username_, *element))) { return false; } + if (was_touch_to_fill_ui_shown_) + return false; + was_touch_to_fill_ui_shown_ = true; GetPasswordManagerDriver()->ShowTouchToFill(); return true; @@ -1340,6 +1343,7 @@ autofilled_elements_cache_.clear(); last_updated_field_renderer_id_ = FormData::kNotSetFormRendererId; last_updated_form_renderer_id_ = FormData::kNotSetFormRendererId; + was_touch_to_fill_ui_shown_ = false; #if !defined(OS_ANDROID) && !defined(OS_IOS) page_passwords_analyser_.Reset(); #endif
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h index b62e536..8f910d4 100644 --- a/components/autofill/content/renderer/password_autofill_agent.h +++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -533,6 +533,8 @@ // Contains renderer id of the form of the last updated input element. uint32_t last_updated_form_renderer_id_ = FormData::kNotSetFormRendererId; + bool was_touch_to_fill_ui_shown_ = false; + DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); };
diff --git a/components/autofill/core/common/save_password_progress_logger.cc b/components/autofill/core/common/save_password_progress_logger.cc index 88dde64..b26b6c6 100644 --- a/components/autofill/core/common/save_password_progress_logger.cc +++ b/components/autofill/core/common/save_password_progress_logger.cc
@@ -460,6 +460,8 @@ return "PasswordManager::DidNavigateMainFrame"; case STRING_NAVIGATION_NTP: return "Navigation to New Tab page"; + case STRING_SERVER_PREDICTIONS: + return "Server predictions"; case SavePasswordProgressLogger::STRING_INVALID: return "INVALID"; // Intentionally no default: clause here -- all IDs need to get covered.
diff --git a/components/autofill/core/common/save_password_progress_logger.h b/components/autofill/core/common/save_password_progress_logger.h index f93cf80a..28ad6d90 100644 --- a/components/autofill/core/common/save_password_progress_logger.h +++ b/components/autofill/core/common/save_password_progress_logger.h
@@ -163,6 +163,7 @@ STRING_SAVE_PASSWORD_HASH, STRING_DID_NAVIGATE_MAIN_FRAME, STRING_NAVIGATION_NTP, + STRING_SERVER_PREDICTIONS, STRING_INVALID, // Represents a string returned in a case of an error. STRING_MAX = STRING_INVALID };
diff --git a/components/bookmarks/browser/bookmark_node_data_unittest.cc b/components/bookmarks/browser/bookmark_node_data_unittest.cc index 401a336..7bd9ea89 100644 --- a/components/bookmarks/browser/bookmark_node_data_unittest.cc +++ b/components/bookmarks/browser/bookmark_node_data_unittest.cc
@@ -278,7 +278,7 @@ EXPECT_TRUE(read_data.GetFirstNode(model(), GetProfilePath()) == nullptr); } -TEST_F(BookmarkNodeDataTest, WriteToClipboardURL) { +TEST_F(BookmarkNodeDataTest, DISABLED_WriteToClipboardURL) { BookmarkNodeData data; GURL url(GURL("http://foo.com")); const base::string16 title(ASCIIToUTF16("blah"));
diff --git a/components/data_reduction_proxy/OWNERS b/components/data_reduction_proxy/OWNERS index cb082f9..d6083f2 100644 --- a/components/data_reduction_proxy/OWNERS +++ b/components/data_reduction_proxy/OWNERS
@@ -2,6 +2,7 @@ tbansal@chromium.org dougarnett@chromium.org mcrouse@chromium.org +megjablon@chromium.org rajendrant@chromium.org robertogden@chromium.org ryansturm@chromium.org
diff --git a/components/discardable_memory/common/discardable_shared_memory_heap_perftest.cc b/components/discardable_memory/common/discardable_shared_memory_heap_perftest.cc index 7ddb426..165d190 100644 --- a/components/discardable_memory/common/discardable_shared_memory_heap_perftest.cc +++ b/components/discardable_memory/common/discardable_shared_memory_heap_perftest.cc
@@ -16,7 +16,7 @@ #include "base/memory/discardable_shared_memory.h" #include "base/process/process_metrics.h" #include "testing/gtest/include/gtest/gtest.h" -#include "testing/perf/perf_test.h" +#include "testing/perf/perf_result_reporter.h" namespace discardable_memory { namespace { @@ -92,8 +92,10 @@ spans.clear(); - perf_test::PrintResult("search_free_list", "", "", - count / accumulator.InSecondsF(), "runs/s", true); + perf_test::PerfResultReporter reporter("DiscardableSharedMemoryHeap.", + "search_free_list"); + reporter.RegisterImportantMetric("throughput", "runs/s"); + reporter.AddResult("throughput", count / accumulator.InSecondsF()); } } // namespace
diff --git a/components/dom_distiller/content/browser/web_contents_main_frame_observer_unittest.cc b/components/dom_distiller/content/browser/web_contents_main_frame_observer_unittest.cc index 58b0674..db2a728 100644 --- a/components/dom_distiller/content/browser/web_contents_main_frame_observer_unittest.cc +++ b/components/dom_distiller/content/browser/web_contents_main_frame_observer_unittest.cc
@@ -59,7 +59,7 @@ EXPECT_TRUE(main_frame_observer_->is_document_loaded_in_main_frame()); } -TEST_F(WebContentsMainFrameObserverTest, IgnoresChildFrameNavigation) { +TEST_F(WebContentsMainFrameObserverTest, DISABLED_IgnoresChildFrameNavigation) { Navigate(kChildFrame, kDifferentDocument); EXPECT_FALSE(main_frame_observer_->is_initialized()); EXPECT_FALSE(main_frame_observer_->is_document_loaded_in_main_frame());
diff --git a/components/dom_distiller/webui/BUILD.gn b/components/dom_distiller/webui/BUILD.gn deleted file mode 100644 index 242e09a..0000000 --- a/components/dom_distiller/webui/BUILD.gn +++ /dev/null
@@ -1,25 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("webui") { - sources = [ - "dom_distiller_handler.cc", - "dom_distiller_handler.h", - "dom_distiller_ui.cc", - "dom_distiller_ui.h", - ] - - deps = [ - "//base", - "//components/dom_distiller/core", - "//components/dom_distiller/core/proto", - "//components/resources", - "//components/strings", - "//components/sync", - "//content/public/browser", - "//net", - "//skia", - "//url", - ] -}
diff --git a/components/dom_distiller/webui/DEPS b/components/dom_distiller/webui/DEPS deleted file mode 100644 index 524cef9a..0000000 --- a/components/dom_distiller/webui/DEPS +++ /dev/null
@@ -1,14 +0,0 @@ -include_rules = [ - "+components/dom_distiller/webui", - "+net/base", - "+ui/webui/resources", - # The webui of this component needs to depend on content, but since it is - # also supposed to be working on iOS, and there is currently no concrete plan - # yet for extracting webui as something that is reusable across iOS and other - # platforms, this DEPS rule is kept instead. - # To ensure this DEPS rule is not a nuisance to engineers refactoring the - # content layer, it is currently quite broad instead of the more strict - # approach directly allowing the header files that are currently included from - # content. - "+content/public/browser", -]
diff --git a/components/dom_distiller/webui/dom_distiller_handler.cc b/components/dom_distiller/webui/dom_distiller_handler.cc deleted file mode 100644 index 89927da..0000000 --- a/components/dom_distiller/webui/dom_distiller_handler.cc +++ /dev/null
@@ -1,131 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/dom_distiller/webui/dom_distiller_handler.h" - -#include <utility> -#include <vector> - -#include "base/bind.h" -#include "base/values.h" -#include "components/dom_distiller/core/dom_distiller_service.h" -#include "components/dom_distiller/core/proto/distilled_page.pb.h" -#include "components/dom_distiller/core/url_utils.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_ui.h" -#include "net/base/escape.h" -#include "url/gurl.h" - -namespace dom_distiller { - -namespace { - -GURL GetViewUrlFromArgs(const std::string& scheme, - const base::ListValue* args) { - std::string url; - if (args->GetString(0, &url)) { - const GURL gurl(url); - if (url_utils::IsUrlDistillable(gurl)) { - return url_utils::GetDistillerViewUrlFromUrl(scheme, gurl); - } - } - return GURL(); -} - -} // namespace - -DomDistillerHandler::DomDistillerHandler(DomDistillerService* service, - const std::string& scheme) - : service_(service), article_scheme_(scheme) {} - -DomDistillerHandler::~DomDistillerHandler() {} - -void DomDistillerHandler::RegisterMessages() { - web_ui()->RegisterMessageCallback( - "requestEntries", - base::BindRepeating(&DomDistillerHandler::HandleRequestEntries, - base::Unretained(this))); - web_ui()->RegisterMessageCallback( - "addArticle", base::BindRepeating(&DomDistillerHandler::HandleAddArticle, - base::Unretained(this))); - web_ui()->RegisterMessageCallback( - "selectArticle", - base::BindRepeating(&DomDistillerHandler::HandleSelectArticle, - base::Unretained(this))); - web_ui()->RegisterMessageCallback( - "viewUrl", base::BindRepeating(&DomDistillerHandler::HandleViewUrl, - base::Unretained(this))); -} - -void DomDistillerHandler::HandleAddArticle(const base::ListValue* args) { - std::string url; - args->GetString(0, &url); - GURL gurl(url); - if (gurl.is_valid()) { - service_->AddToList( - gurl, service_->CreateDefaultDistillerPage( - web_ui()->GetWebContents()->GetContainerBounds().size()), - base::Bind(&DomDistillerHandler::OnArticleAdded, - base::Unretained(this))); - } else { - web_ui()->CallJavascriptFunctionUnsafe("domDistiller.onArticleAddFailed"); - } -} - -void DomDistillerHandler::HandleViewUrl(const base::ListValue* args) { - GURL view_url = GetViewUrlFromArgs(article_scheme_, args); - if (view_url.is_valid()) { - web_ui()->GetWebContents()->GetController().LoadURL( - view_url, - content::Referrer(), - ui::PAGE_TRANSITION_GENERATED, - std::string()); - } else { - web_ui()->CallJavascriptFunctionUnsafe("domDistiller.onViewUrlFailed"); - } -} - -void DomDistillerHandler::HandleSelectArticle(const base::ListValue* args) { - std::string entry_id; - args->GetString(0, &entry_id); - GURL url = - url_utils::GetDistillerViewUrlFromEntryId(article_scheme_, entry_id); - DCHECK(url.is_valid()); - web_ui()->GetWebContents()->GetController().LoadURL( - url, - content::Referrer(), - ui::PAGE_TRANSITION_GENERATED, - std::string()); -} - -void DomDistillerHandler::HandleRequestEntries(const base::ListValue* args) { - base::ListValue entries; - const std::vector<ArticleEntry>& entries_specifics = service_->GetEntries(); - for (auto it = entries_specifics.begin(); it != entries_specifics.end(); - ++it) { - const ArticleEntry& article = *it; - DCHECK(IsEntryValid(article)); - std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); - entry->SetString("entry_id", article.entry_id()); - std::string title = (!article.has_title() || article.title().empty()) - ? article.entry_id() - : article.title(); - entry->SetString("title", net::EscapeForHTML(title)); - entries.Append(std::move(entry)); - } - // TODO(nyquist): Write a test that ensures we sanitize the data we send. - web_ui()->CallJavascriptFunctionUnsafe("domDistiller.onReceivedEntries", - entries); -} - -void DomDistillerHandler::OnArticleAdded(bool article_available) { - // TODO(nyquist): Update this function. - if (article_available) { - HandleRequestEntries(nullptr); - } else { - web_ui()->CallJavascriptFunctionUnsafe("domDistiller.onArticleAddFailed"); - } -} - -} // namespace dom_distiller
diff --git a/components/dom_distiller/webui/dom_distiller_handler.h b/components/dom_distiller/webui/dom_distiller_handler.h deleted file mode 100644 index 555ebd2..0000000 --- a/components/dom_distiller/webui/dom_distiller_handler.h +++ /dev/null
@@ -1,65 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ -#define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ - -#include <string> - -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "base/values.h" -#include "content/public/browser/web_ui_message_handler.h" - -namespace dom_distiller { - -class DomDistillerService; - -// Handler class for DOM Distiller list operations. -class DomDistillerHandler : public content::WebUIMessageHandler { - public: - // The lifetime of |service| has to outlive this handler. - DomDistillerHandler(DomDistillerService* service, const std::string& scheme); - ~DomDistillerHandler() override; - - // content::WebUIMessageHandler implementation. - void RegisterMessages() override; - - // Callback from JavaScript for the "requestEntries" message. This - // requests the list of entries and returns it to the front end by calling - // "onReceivedEntries". There are no JavaScript arguments to this method. - void HandleRequestEntries(const base::ListValue* args); - - // Callback from JavaScript for when an article should be added. The first - // element in |args| should be a string representing the URL to be added. - void HandleAddArticle(const base::ListValue* args); - - // Callback from JavaScript for when an article is selected. The first element - // in |args| should be a string representing the ID of the entry to be - // selected. - void HandleSelectArticle(const base::ListValue* args); - - // Callback from JavaScript for when viewing a URL is requested. The first - // element in |args| should be a string representing the URL to be viewed. - void HandleViewUrl(const base::ListValue* args); - - private: - // Callback from DomDistillerService when an article is available. - void OnArticleAdded(bool article_available); - - // The DomDistillerService. - DomDistillerService* service_; - - // The scheme for DOM distiller articles. - std::string article_scheme_; - - // Factory for the creating refs in callbacks. - base::WeakPtrFactory<DomDistillerHandler> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DomDistillerHandler); -}; - -} // namespace dom_distiller - -#endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_
diff --git a/components/dom_distiller/webui/dom_distiller_ui.cc b/components/dom_distiller/webui/dom_distiller_ui.cc deleted file mode 100644 index c9c8672..0000000 --- a/components/dom_distiller/webui/dom_distiller_ui.cc +++ /dev/null
@@ -1,62 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/dom_distiller/webui/dom_distiller_ui.h" - -#include <memory> - -#include "components/dom_distiller/core/dom_distiller_constants.h" -#include "components/dom_distiller/core/dom_distiller_service.h" -#include "components/dom_distiller/webui/dom_distiller_handler.h" -#include "components/grit/components_resources.h" -#include "components/strings/grit/components_strings.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_ui.h" -#include "content/public/browser/web_ui_data_source.h" - -namespace dom_distiller { - -DomDistillerUi::DomDistillerUi(content::WebUI* web_ui, - DomDistillerService* service, - const std::string& scheme) - : content::WebUIController(web_ui) { - // Set up WebUIDataSource. - content::WebUIDataSource* source = - content::WebUIDataSource::Create(kChromeUIDomDistillerHost); - source->SetDefaultResource(IDR_ABOUT_DOM_DISTILLER_HTML); - source->AddResourcePath("about_dom_distiller.css", - IDR_ABOUT_DOM_DISTILLER_CSS); - source->AddResourcePath("about_dom_distiller.js", IDR_ABOUT_DOM_DISTILLER_JS); - - source->AddLocalizedString("domDistillerTitle", - IDS_DOM_DISTILLER_WEBUI_TITLE); - source->AddLocalizedString("addArticleUrl", - IDS_DOM_DISTILLER_WEBUI_ENTRY_URL); - source->AddLocalizedString("addArticleAddButtonLabel", - IDS_DOM_DISTILLER_WEBUI_ENTRY_ADD); - source->AddLocalizedString("addArticleFailedLabel", - IDS_DOM_DISTILLER_WEBUI_ENTRY_ADD_FAILED); - source->AddLocalizedString("viewUrlButtonLabel", - IDS_DOM_DISTILLER_WEBUI_VIEW_URL); - source->AddLocalizedString("viewUrlFailedLabel", - IDS_DOM_DISTILLER_WEBUI_VIEW_URL_FAILED); - source->AddLocalizedString("loadingEntries", - IDS_DOM_DISTILLER_WEBUI_FETCHING_ENTRIES); - source->AddLocalizedString("refreshButtonLabel", - IDS_DOM_DISTILLER_WEBUI_REFRESH); - - content::BrowserContext* browser_context = - web_ui->GetWebContents()->GetBrowserContext(); - content::WebUIDataSource::Add(browser_context, source); - source->UseStringsJs(); - - // Add message handler. - web_ui->AddMessageHandler( - std::make_unique<DomDistillerHandler>(service, scheme)); -} - -DomDistillerUi::~DomDistillerUi() {} - -} // namespace dom_distiller
diff --git a/components/dom_distiller/webui/dom_distiller_ui.h b/components/dom_distiller/webui/dom_distiller_ui.h deleted file mode 100644 index 1462482..0000000 --- a/components/dom_distiller/webui/dom_distiller_ui.h +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_UI_H_ -#define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_UI_H_ - -#include <string> - -#include "base/macros.h" -#include "content/public/browser/web_ui_controller.h" - -namespace dom_distiller { - -class DomDistillerService; - -// The WebUI controller for chrome://dom-distiller. -class DomDistillerUi : public content::WebUIController { - public: - DomDistillerUi(content::WebUI* web_ui, - DomDistillerService* service, - const std::string& scheme); - ~DomDistillerUi() override; - - private: - DISALLOW_COPY_AND_ASSIGN(DomDistillerUi); -}; - -} // namespace dom_distiller - -#endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_UI_H_
diff --git a/components/dom_distiller/webui/resources/OWNERS b/components/dom_distiller/webui/resources/OWNERS deleted file mode 100644 index c05db2e..0000000 --- a/components/dom_distiller/webui/resources/OWNERS +++ /dev/null
@@ -1,2 +0,0 @@ -# For trivial or mechanical horizontal JS/CSS/HTML changes. -file://ui/webui/PLATFORM_OWNERS
diff --git a/components/dom_distiller/webui/resources/about_dom_distiller.css b/components/dom_distiller/webui/resources/about_dom_distiller.css deleted file mode 100644 index 065ad72..0000000 --- a/components/dom_distiller/webui/resources/about_dom_distiller.css +++ /dev/null
@@ -1,12 +0,0 @@ -/* Copyright 2013 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -a:visited { - color: orange; -} - -.hidden { - visibility: hidden; -}
diff --git a/components/dom_distiller/webui/resources/about_dom_distiller.html b/components/dom_distiller/webui/resources/about_dom_distiller.html deleted file mode 100644 index 4b740266..0000000 --- a/components/dom_distiller/webui/resources/about_dom_distiller.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!DOCTYPE HTML> -<!-- -Copyright 2013 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> -<html> -<head> - <meta charset="utf-8"> - <title>$i18n{domDistillerTitle}</title> - <link rel="stylesheet" href="chrome://resources/css/chrome_shared.css"> - <link rel="stylesheet" href="chrome://resources/css/overlay.css"> - <link rel="stylesheet" href="about_dom_distiller.css"> - - <if expr="is_ios"> - <script src="chrome://resources/js/ios/chrome.js"></script> - </if> - <script src="chrome://resources/js/cr.js"></script> - <script src="chrome://resources/js/util.js"></script> - <script src="chrome://resources/js/load_time_data.js"></script> - <script src="chrome://resources/js/cr/ui/overlay.js"></script> - <script src="about_dom_distiller.js"></script> - <script src="strings.js"></script> -</head> -<body> - <div id="mainContent"> - <div id="list-section"> - <header> - <h1 id="listTitle">$i18n{domDistillerTitle}</h1> - </header> - <div id="add-entry"> - <label for="article_url">$i18n{addArticleUrl}</label> - <input type="text" id="article_url" /> - <br/> - <button id="addbutton">$i18n{addArticleAddButtonLabel}</button> - <button id="viewbutton">$i18n{viewUrlButtonLabel}</button> - <span id="add-entry-error">$i18n{addArticleFailedLabel}</span> - <span id="view-url-error">$i18n{viewUrlFailedLabel}</span> - </div> - <div id="update-list"> - <form> - <button id="refreshbutton">$i18n{refreshButtonLabel}</button> - <span id="entries-list-loading">$i18n{loadingEntries}</span> - </form> - </div> - <ul id="entries-list"> - </ul> - </div> - </div> -</body> -</html>
diff --git a/components/dom_distiller/webui/resources/about_dom_distiller.js b/components/dom_distiller/webui/resources/about_dom_distiller.js deleted file mode 100644 index 8c84eb8..0000000 --- a/components/dom_distiller/webui/resources/about_dom_distiller.js +++ /dev/null
@@ -1,106 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var domDistiller = { - /** - * Callback from the backend with the list of entries to display. - * This call will build the entries section of the DOM distiller page, or hide - * that section if there are none to display. - * @param {!Array<string>} entries The entries. - */ - onReceivedEntries: function(entries) { - $('entries-list-loading').classList.add('hidden'); - if (!entries.length) $('entries-list').classList.add('hidden'); - - var list = $('entries-list'); - domDistiller.removeAllChildren(list); - for (var i = 0; i < entries.length; i++) { - var listItem = document.createElement('li'); - var link = document.createElement('a'); - var entry_id = entries[i].entry_id; - link.setAttribute('id', 'entry-' + entry_id); - link.setAttribute('href', '#'); - link.innerText = entries[i].title; - link.addEventListener('click', function(event) { - domDistiller.onSelectArticle(event.target.id.substr("entry-".length)); - }, true); - listItem.appendChild(link); - list.appendChild(listItem); - } - }, - - /** - * Callback from the backend when adding an article failed. - */ - onArticleAddFailed: function() { - $('add-entry-error').classList.remove('hidden'); - }, - - /** - * Callback from the backend when viewing a URL failed. - */ - onViewUrlFailed: function() { - $('view-url-error').classList.remove('hidden'); - }, - - removeAllChildren: function(root) { - while(root.firstChild) { - root.removeChild(root.firstChild); - } - }, - - /** - * Sends a request to the browser process to add the URL specified to the list - * of articles. - */ - onAddArticle: function() { - $('add-entry-error').classList.add('hidden'); - var url = $('article_url').value; - chrome.send('addArticle', [url]); - }, - - /** - * Sends a request to the browser process to view a distilled version of the - * URL specified. - */ - onViewUrl: function() { - $('view-url-error').classList.add('hidden'); - var url = $('article_url').value; - chrome.send('viewUrl', [url]); - }, - - /** - * Sends a request to the browser process to view a distilled version of the - * selected article. - */ - onSelectArticle: function(articleId) { - chrome.send('selectArticle', [articleId]); - }, - - /* All the work we do on load. */ - onLoadWork: function() { - $('list-section').classList.remove('hidden'); - $('entries-list-loading').classList.add('hidden'); - $('add-entry-error').classList.add('hidden'); - $('view-url-error').classList.add('hidden'); - - $('refreshbutton').addEventListener('click', function(event) { - domDistiller.onRequestEntries(); - }, false); - $('addbutton').addEventListener('click', function(event) { - domDistiller.onAddArticle(); - }, false); - $('viewbutton').addEventListener('click', function(event) { - domDistiller.onViewUrl(); - }, false); - domDistiller.onRequestEntries(); - }, - - onRequestEntries: function() { - $('entries-list-loading').classList.remove('hidden'); - chrome.send('requestEntries'); - }, -} - -document.addEventListener('DOMContentLoaded', domDistiller.onLoadWork);
diff --git a/components/feed/tools/.style.yapf b/components/feed/tools/.style.yapf new file mode 100644 index 0000000..de0c6a70 --- /dev/null +++ b/components/feed/tools/.style.yapf
@@ -0,0 +1,2 @@ +[style] +based_on_style = chromium
diff --git a/components/feed/tools/content_dump.py b/components/feed/tools/content_dump.py new file mode 100755 index 0000000..53ee984 --- /dev/null +++ b/components/feed/tools/content_dump.py
@@ -0,0 +1,214 @@ +#!/usr/bin/python3 +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Usage: +# Dump the feed content database from a connected device to a directory on this +# computer. +# > content_dump.py --device=FA77D0303076 --apk='com.chrome.canary' +# > ls /tmp/feed_dump +# +# Files are output as textproto. +# +# Make any desired modifications, and then upload the dump back to the connected +# device. +# > content_dump.py --device=FA77D0303076 --apk='com.chrome.canary' --reverse +import os +import re +import sys +import argparse +import subprocess +import glob +from os.path import join, dirname, realpath + +import plyvel + +# A dynamic import for encoding and decoding of escaped textproto strings. +_prototext_mod = None + + +# Import text proto escape/unescape functions from third_party/protobuf. +def prototext(): + global _prototext_mod + import importlib.util + if _prototext_mod: + return _prototext_mod + source_path = join( + dirname(__file__), + "../../../third_party/protobuf/python/google/protobuf/text_encoding.py") + spec = importlib.util.spec_from_file_location("protobuf.textutil", + source_path) + _prototext_mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(_prototext_mod) + return _prototext_mod + + +parser = argparse.ArgumentParser() +parser.add_argument("--db", help="Path to db", default='/tmp/feed_dump/db') +parser.add_argument( + "--dump_to", help="Dump output directory", default='/tmp/feed_dump') +parser.add_argument( + "--reverse", help="Write dump back to database", action='store_true') +parser.add_argument("--device", help="adb device to use") +parser.add_argument( + "--apk", help="APK to dump from/to", default='com.chrome.canary') + +args = parser.parse_args() + +ROOT_DIR = realpath(join(dirname(__file__), "../../..")) +DUMP_DIR = args.dump_to +DB_PATH = args.db +CONTENT_DB_PATH = join(DB_PATH, 'content') +DEVICE_DB_PATH = "/data/data/{}/app_chrome/Default/feed".format(args.apk) +_protoc_path = None + + +# Returns the path to the proto compiler, protoc. +def protoc_path(): + global _protoc_path + if not _protoc_path: + protoc_list = list(glob.glob(join(ROOT_DIR, "out") + "/*/protoc")) + list( + glob.glob(join(ROOT_DIR, "out") + "/*/*/protoc")) + if not len(protoc_list): + print("Can't find a suitable build output directory", + "(it should have protoc)") + sys.exit(1) + _protoc_path = protoc_list[0] + return _protoc_path + + +def adb_base_args(): + adb_path = join(ROOT_DIR, "third_party/android_sdk/public/platform-tools/adb") + adb_device = args.device + if adb_device: + return [adb_path, "-s", adb_device] + return [adb_path] + + +def adb_pull_db(): + subprocess.check_call( + adb_base_args() + + ["pull", join(DEVICE_DB_PATH, 'content'), DB_PATH]) + + +def adb_push_db(): + subprocess.check_call(adb_base_args() + + ["push", CONTENT_DB_PATH, DEVICE_DB_PATH]) + + +def get_feed_protos(): + result = [join(ROOT_DIR, 'components/feed/core/proto/content_storage.proto')] + for root, _, files in os.walk(join(ROOT_DIR, "third_party/feed")): + result += [join(root, f) for f in files if f.endswith('.proto')] + + return result + + +protoc_common_args = [ + '-I' + join(ROOT_DIR, 'third_party/feed/src'), '-I' + join(ROOT_DIR) +] + get_feed_protos() + + +def run_command(args, input): + proc = subprocess.run( + args, + input=input, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + check=True) + return proc.stdout + + +# Decode a binary proto into textproto format. +def decode_proto(data, message_name): + return run_command( + [protoc_path(), '--decode=' + message_name] + protoc_common_args, + data).decode('utf-8') + + +# Encode a textproto into binary proto format. +def encode_proto(text, message_name): + return run_command( + [protoc_path(), '--encode=' + message_name] + protoc_common_args, + text.encode()) + + +# Ignore DB entries with the 'sp::' prefix, as they are not yet supported. +def is_key_supported(key): + return not key.startswith('sp::') + + +# Return the proto message stored under the given db key. +def proto_message_from_db_key(key): + if key.startswith('ss::'): + return 'search.now.feed.client.StreamSharedState' + if key.startswith('FEATURE::') or key.startswith('FSM::'): + return 'search.now.feed.client.StreamPayload' + print("Unknown Key kind", key) + sys.exit(1) + + +# Extract a binary proto database entry into textproto. +def extract_db_entry(key, data): + # DB entries are feed.ContentStorageProto messages. First extract + # the content_data contained within. + text_proto = decode_proto(data, 'feed.ContentStorageProto') + m = re.search(r"content_data: \"((?:\\\"|[^\"])*)\"", text_proto) + raw_data = prototext().CUnescape(m.group(1)) + + # Next, convert raw_data into a textproto. The DB key informs which message + # is stored. + result = decode_proto(raw_data, proto_message_from_db_key(key)) + return result + + +# Dump the content database to a local directory as textproto files. +def dump(): + os.makedirs(DUMP_DIR, exist_ok=True) + os.makedirs(DB_PATH, exist_ok=True) + adb_pull_db() + db = plyvel.DB(CONTENT_DB_PATH, create_if_missing=False) + with db.iterator() as it: + for i, (k, v) in enumerate(it): + k = k.decode('utf-8') + if not is_key_supported(k): + continue + with open(join(DUMP_DIR, 'entry{:03d}.key'.format(i)), 'w') as f: + f.write(k) + with open(join(DUMP_DIR, 'entry{:03d}.textproto'.format(i)), 'w') as f: + f.write(extract_db_entry(k, v)) + print('Finished dumping to', DUMP_DIR) + db.close() + + +# Reverse of dump(). +def load(): + db = plyvel.DB(CONTENT_DB_PATH, create_if_missing=False) + # For each textproto file, update its database entry. + # No attempt is made to delete keys for deleted files. + for f in os.listdir(DUMP_DIR): + if f.endswith('.textproto'): + f_base, _ = os.path.splitext(f) + with open(join(DUMP_DIR, f_base + '.key'), 'r') as file: + key = file.read().strip() + with open(join(DUMP_DIR, f), 'r') as file: + value_text_proto = file.read() + value_encoded = encode_proto(value_text_proto, + proto_message_from_db_key(key)) + # Create binary feed.ContentStorageProto by encoding its textproto. + content_storage_text = 'key: "{}"\ncontent_data: "{}"'.format( + prototext().CEscape(key, False), + prototext().CEscape(value_encoded, False)) + + store_encoded = encode_proto(content_storage_text, + 'feed.ContentStorageProto') + db.put(key.encode(), store_encoded) + db.close() + adb_push_db() + + +if not args.reverse: + dump() +else: + load()
diff --git a/components/games/OWNERS b/components/games/OWNERS new file mode 100644 index 0000000..a4835a53 --- /dev/null +++ b/components/games/OWNERS
@@ -0,0 +1,5 @@ +csharp@chromium.org +seblalancette@chromium.org +tmartino@chromium.org + +# COMPONENT: UI>Browser>Joy
diff --git a/components/games/README b/components/games/README new file mode 100644 index 0000000..19bb05d --- /dev/null +++ b/components/games/README
@@ -0,0 +1,5 @@ +This component will be used by surfaces in Chrome that want to expose Web games. +Surfaces need to take a dependency on this component and use APIs offered by +the GamesService. + +- core/: shared code that will run on the browser process.
diff --git a/components/games/core/BUILD.gn b/components/games/core/BUILD.gn new file mode 100644 index 0000000..5387f68a --- /dev/null +++ b/components/games/core/BUILD.gn
@@ -0,0 +1,32 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +static_library("core") { + sources = [ + "games_service.h", + "games_service_impl.cc", + "games_service_impl.h", + "games_types.h", + ] + + deps = [ + "//base", + "//components/games/core/proto", + ] +} + +source_set("unit_tests") { + testonly = true + sources = [ + "games_service_impl_unittest.cc", + ] + deps = [ + ":core", + "//base", + "//base/test:test_support", + "//components/games/core/proto", + "//testing/gmock", + "//testing/gtest", + ] +}
diff --git a/components/games/core/DEPS b/components/games/core/DEPS new file mode 100644 index 0000000..97db67c --- /dev/null +++ b/components/games/core/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+third_party/protobuf", +]
diff --git a/components/games/core/games_service.h b/components/games/core/games_service.h new file mode 100644 index 0000000..b56f0d0 --- /dev/null +++ b/components/games/core/games_service.h
@@ -0,0 +1,21 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_GAMES_CORE_GAMES_SERVICE_H_ +#define COMPONENTS_GAMES_CORE_GAMES_SERVICE_H_ + +#include "components/games/core/games_types.h" + +namespace games { + +class GamesService { + public: + virtual ~GamesService() = default; + + virtual void GetHighlightedGame(HighlightedGameCallback callback) = 0; +}; + +} // namespace games + +#endif // COMPONENTS_GAMES_CORE_GAMES_SERVICE_H_
diff --git a/components/games/core/games_service_impl.cc b/components/games/core/games_service_impl.cc new file mode 100644 index 0000000..1d80068a --- /dev/null +++ b/components/games/core/games_service_impl.cc
@@ -0,0 +1,25 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/games/core/games_service_impl.h" + +#include <memory> + +#include "base/callback.h" +#include "components/games/core/games_types.h" +#include "components/games/core/proto/game.pb.h" + +namespace games { + +GamesServiceImpl::GamesServiceImpl() {} + +GamesServiceImpl::~GamesServiceImpl() = default; + +void GamesServiceImpl::GetHighlightedGame(HighlightedGameCallback callback) { + auto game_proto = std::make_unique<Game>(); + game_proto->set_title("Some Game!"); + std::move(callback).Run(std::move(game_proto)); +} + +} // namespace games
diff --git a/components/games/core/games_service_impl.h b/components/games/core/games_service_impl.h new file mode 100644 index 0000000..72cf71e --- /dev/null +++ b/components/games/core/games_service_impl.h
@@ -0,0 +1,25 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_GAMES_CORE_GAMES_SERVICE_IMPL_H_ +#define COMPONENTS_GAMES_CORE_GAMES_SERVICE_IMPL_H_ + +#include <memory> + +#include "components/games/core/games_service.h" +#include "components/games/core/games_types.h" + +namespace games { + +class GamesServiceImpl : public GamesService { + public: + GamesServiceImpl(); + ~GamesServiceImpl() override; + + void GetHighlightedGame(HighlightedGameCallback callback) override; +}; + +} // namespace games + +#endif // COMPONENTS_GAMES_CORE_GAMES_SERVICE_IMPL_H_
diff --git a/components/games/core/games_service_impl_unittest.cc b/components/games/core/games_service_impl_unittest.cc new file mode 100644 index 0000000..023fb04 --- /dev/null +++ b/components/games/core/games_service_impl_unittest.cc
@@ -0,0 +1,37 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include "components/games/core/games_service_impl.h" + +#include <memory> +#include <string> + +#include "base/bind.h" +#include "base/test/bind_test_util.h" +#include "components/games/core/games_types.h" +#include "components/games/core/proto/game.pb.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace games { + +class GamesServiceImplTest : public testing::Test { + protected: + GamesServiceImplTest() {} + + GamesServiceImpl service; +}; + +TEST_F(GamesServiceImplTest, GetHighlightedGame_SameTitle) { + std::string expected_title = "Some Game!"; + std::string result_title = "not the same"; + + service.GetHighlightedGame( + base::BindLambdaForTesting([&](std::unique_ptr<Game> given_game) { + ASSERT_NE(nullptr, given_game); + result_title = given_game->title(); + })); + + ASSERT_EQ(expected_title, result_title); +} + +} // namespace games
diff --git a/components/games/core/games_types.h b/components/games/core/games_types.h new file mode 100644 index 0000000..cae511c --- /dev/null +++ b/components/games/core/games_types.h
@@ -0,0 +1,19 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_GAMES_CORE_GAMES_TYPES_H_ +#define COMPONENTS_GAMES_CORE_GAMES_TYPES_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "components/games/core/proto/game.pb.h" + +namespace games { +using HighlightedGameCallback = base::OnceCallback<void(std::unique_ptr<Game>)>; + +} // namespace games + +#endif // COMPONENTS_GAMES_CORE_GAMES_TYPES_H_
diff --git a/components/games/core/proto/BUILD.gn b/components/games/core/proto/BUILD.gn new file mode 100644 index 0000000..c85af9e --- /dev/null +++ b/components/games/core/proto/BUILD.gn
@@ -0,0 +1,11 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/protobuf/proto_library.gni") + +proto_library("proto") { + sources = [ + "game.proto", + ] +}
diff --git a/components/games/core/proto/game.proto b/components/games/core/proto/game.proto new file mode 100644 index 0000000..8de1851e --- /dev/null +++ b/components/games/core/proto/game.proto
@@ -0,0 +1,20 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto3"; + +package games; + +option optimize_for = LITE_RUNTIME; + +message Game { + // URL at which the Web game can be played. + string url = 1; + + // Title of the Web game. + string title = 2; + + // Bytes for the image to be associated with this game. + bytes image = 3; +}
diff --git a/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java b/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java index 806b25f..1b1008d 100644 --- a/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java +++ b/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java
@@ -219,7 +219,7 @@ * filled byte array when data has been provided. */ @Test - public void testRawDataSerializationToJSON() throws JSONException { + public void testRawDataSerializationToJSON() { Bundle extras = new Bundle(); extras.putString("subtype", "MyAppId"); @@ -259,7 +259,7 @@ * Tests that getOriginalPriority returns Priority.NONE if it was not set in the bundle. */ @Test - public void testNullOriginalPriority() throws JSONException { + public void testNullOriginalPriority() { Bundle extras = new Bundle(); // Compose a simple message that lacks all optional fields.
diff --git a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc index 62517a9d..4eb6626 100644 --- a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc +++ b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
@@ -251,7 +251,7 @@ } } -TEST(EncryptionHeaderParsersTest, ParseInvalidCryptoKeyHeaders) { +TEST(EncryptionHeaderParsersTest, DISABLED_ParseInvalidCryptoKeyHeaders) { const char* const expected_failures[] = { // Values in the name-value pairs are not optional. "keyid",
diff --git a/components/gcm_driver/gcm_client_impl_unittest.cc b/components/gcm_driver/gcm_client_impl_unittest.cc index f3f29ed..941ba30 100644 --- a/components/gcm_driver/gcm_client_impl_unittest.cc +++ b/components/gcm_driver/gcm_client_impl_unittest.cc
@@ -950,7 +950,7 @@ EXPECT_TRUE(ExistsRegistration(kExtensionAppId)); } -TEST_F(GCMClientImplTest, RegisterAgainWhenTokenIsFresh) { +TEST_F(GCMClientImplTest, DISABLED_RegisterAgainWhenTokenIsFresh) { // Register a sender. std::vector<std::string> senders; senders.push_back("sender"); @@ -1102,7 +1102,7 @@ EXPECT_EQ(kRawData, last_message().raw_data); } -TEST_F(GCMClientImplTest, DispatchDownstreamMessageSendError) { +TEST_F(GCMClientImplTest, DISABLED_DispatchDownstreamMessageSendError) { std::map<std::string, std::string> expected_data = { {"message_type", "send_error"}, {"error_details", "some details"}}; @@ -1429,7 +1429,7 @@ PumpLoopUntilIdle(); } -TEST_F(GCMClientImplStartAndStopTest, StartStopAndRestart) { +TEST_F(GCMClientImplStartAndStopTest, DISABLED_StartStopAndRestart) { // GCMClientImpl should be in INITIALIZED state at first. EXPECT_EQ(GCMClientImpl::INITIALIZED, gcm_client_state()); @@ -1543,7 +1543,7 @@ EXPECT_EQ(GCMClientImpl::LOADED, gcm_client_state()); } -TEST_F(GCMClientImplStartAndStopTest, DelayedStartRace) { +TEST_F(GCMClientImplStartAndStopTest, DISABLED_DelayedStartRace) { // GCMClientImpl should be in INITIALIZED state at first. EXPECT_EQ(GCMClientImpl::INITIALIZED, gcm_client_state()); @@ -1849,7 +1849,7 @@ EXPECT_EQ(GCMClient::INVALID_PARAMETER, last_result()); } -TEST_F(GCMClientInstanceIDTest, DeleteAllTokens) { +TEST_F(GCMClientInstanceIDTest, DISABLED_DeleteAllTokens) { AddInstanceID(kExtensionAppId, kInstanceID); // Get a token.
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc index 271d2a7..0bb3d063 100644 --- a/components/gcm_driver/gcm_driver_desktop_unittest.cc +++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -520,7 +520,7 @@ EXPECT_EQ(GCMClient::GCM_DISABLED, send_result()); } -TEST_F(GCMDriverTest, GCMClientNotReadyBeforeRegistration) { +TEST_F(GCMDriverTest, DISABLED_GCMClientNotReadyBeforeRegistration) { CreateDriver(); PumpIOLoop(); PumpUILoop(); @@ -607,7 +607,7 @@ PumpUILoop(); } -TEST_F(GCMDriverFunctionalTest, Register) { +TEST_F(GCMDriverFunctionalTest, DISABLED_Register) { std::vector<std::string> sender_ids; sender_ids.push_back("sender1"); Register(kTestAppID1, sender_ids, GCMDriverTest::WAIT); @@ -728,7 +728,7 @@ EXPECT_NE(app_auth_secret, auth_secret()); } -TEST_F(GCMDriverFunctionalTest, UnregisterWhenAsyncOperationPending) { +TEST_F(GCMDriverFunctionalTest, DISABLED_UnregisterWhenAsyncOperationPending) { std::vector<std::string> sender_ids; sender_ids.push_back("sender1"); // First start registration without waiting for it to complete. @@ -1306,7 +1306,7 @@ EXPECT_EQ("Bar", extra_data()); } -TEST_F(GCMDriverInstanceIDTest, GetToken) { +TEST_F(GCMDriverInstanceIDTest, DISABLED_GetToken) { GetReady(); const std::string expected_token =
diff --git a/components/leveldb_proto/internal/proto_database_perftest.cc b/components/leveldb_proto/internal/proto_database_perftest.cc index 029f3b8..c6d0a16 100644 --- a/components/leveldb_proto/internal/proto_database_perftest.cc +++ b/components/leveldb_proto/internal/proto_database_perftest.cc
@@ -31,7 +31,7 @@ #include "components/leveldb_proto/testing/proto/test_db.pb.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "testing/perf/perf_test.h" +#include "testing/perf/perf_result_reporter.h" #include "third_party/leveldatabase/env_chromium.h" #include "third_party/leveldatabase/leveldb_chrome.h" @@ -70,6 +70,16 @@ }; static const std::string kSingleDBName = "singledb"; +static constexpr char kMetricNumRunsCount[] = "num_runs"; +static constexpr char kMetricTimeMs[] = "time"; +static constexpr char kMetricMaxMemoryUseBytes[] = "max_memory_use"; +static constexpr char kMetricAverageMemoryUseBytes[] = "average_memory_use"; +static constexpr char kMetricTotalMemoryUseBytes[] = "total_memory_use"; +static constexpr char kMetricMemUseAfterWritesBytes[] = + "memory_use_after_writes"; +static constexpr char kMetricMemUseAfterLoadBytes[] = "memory_use_after_load"; +static constexpr char kMetricTotalTimeTakenMs[] = "total_time_taken"; +static constexpr char kMetricMaxIndTimeTakenMs[] = "max_individual_time_taken"; static const int kSmallDataSize = 10; static const int kMediumDataSize = 100; @@ -237,7 +247,7 @@ // Runs a test to alternately insert elements with different prefixes into // either a database for each prefix or a single DB. void RunAlternatingInsertTest(const std::string& test_name, - const std::string& test_modifier, + const std::string& story_name, const std::vector<std::string>& prefixes, const TestParams& params) { // Make the entries for each database first. @@ -266,23 +276,21 @@ remaining -= params.batch_size; } - perf_test::PrintResult(test_name, test_modifier, "num_runs", - static_cast<size_t>(stats.num_runs), "", true); - perf_test::PrintResult(test_name, test_modifier, "time", stats.time_ms, - "ms", true); - perf_test::PrintResult(test_name, test_modifier, "max memory use", - static_cast<size_t>(stats.max_memory_used_bytes), - "bytes", true); + perf_test::PerfResultReporter reporter = + SetUpReporter(test_name, story_name); + reporter.AddResult(kMetricNumRunsCount, + static_cast<size_t>(stats.num_runs)); + reporter.AddResult(kMetricTimeMs, stats.time_ms); + reporter.AddResult(kMetricMaxMemoryUseBytes, + static_cast<size_t>(stats.max_memory_used_bytes)); uint64_t average_memory_use = stats.memory_summed_bytes / stats.num_runs; - perf_test::PrintResult(test_name, test_modifier, "average memory use", - static_cast<size_t>(average_memory_use), "bytes", - true); + reporter.AddResult(kMetricAverageMemoryUseBytes, + static_cast<size_t>(average_memory_use)); } // Used to measure the impact on memory in the case where the distribution of // entries isn't equal amongst individual databases. - void RunDistributionTestAndCleanup(const std::string& test_name, - const std::string& test_modifier, + void RunDistributionTestAndCleanup(const std::string& story_name, const std::vector<TestParams>& test_params, bool single_db) { std::vector<std::string> prefixes; @@ -314,9 +322,10 @@ } } - perf_test::PrintResult(test_name, test_modifier, "Total memory use", - static_cast<size_t>(stats.max_memory_used_bytes), - "bytes", true); + perf_test::PerfResultReporter reporter = + SetUpReporter("Distribution", story_name); + reporter.AddResult(kMetricTotalMemoryUseBytes, + static_cast<size_t>(stats.max_memory_used_bytes)); ShutdownDBs(); } @@ -362,20 +371,17 @@ uint64_t memory_use_after; GetApproximateMemoryUsage(&memory_use_after); - auto test_modifier_str = base::StringPrintf( - "%s_%u_%u_%zu", test_modifier.c_str(), num_dbs, num_entries, data_size); - perf_test::PrintResult( - "ProtoDBPerfTest", test_modifier_str, "Memory use after writes", - static_cast<size_t>(memory_use_before), "bytes", true); - perf_test::PrintResult( - "ProtoDBPerfTest", test_modifier_str, "Memory use after load", - static_cast<size_t>(memory_use_after), "bytes", true); - perf_test::PrintResult("ProtoDBPerfTest", test_modifier_str, - "Total time taken", static_cast<size_t>(time_ms), - "ms", true); - perf_test::PrintResult("ProtoDBPerfTest", test_modifier_str, - "Max individual time taken", - static_cast<size_t>(max_time_ms), "ms", true); + auto story_name = + base::StringPrintf("%u_%u_%zu", num_dbs, num_entries, data_size); + perf_test::PerfResultReporter reporter = + SetUpReporter(test_modifier, story_name); + reporter.AddResult(kMetricMemUseAfterWritesBytes, + static_cast<size_t>(memory_use_before)); + reporter.AddResult(kMetricMemUseAfterLoadBytes, + static_cast<size_t>(memory_use_after)); + reporter.AddResult(kMetricTotalTimeTakenMs, static_cast<size_t>(time_ms)); + reporter.AddResult(kMetricMaxIndTimeTakenMs, + static_cast<size_t>(max_time_ms)); ShutdownDBs(); } @@ -421,20 +427,17 @@ uint64_t memory_use_after; GetApproximateMemoryUsage(&memory_use_after); - auto test_modifier_str = base::StringPrintf( - "%s_%u_%u_%zu", test_modifier.c_str(), num_dbs, num_entries, data_size); - perf_test::PrintResult( - "ProtoDBPerfTest", test_modifier_str, "Memory use after writes", - static_cast<size_t>(memory_use_before), "bytes", true); - perf_test::PrintResult( - "ProtoDBPerfTest", test_modifier_str, "Memory use after load", - static_cast<size_t>(memory_use_after), "bytes", true); - perf_test::PrintResult("ProtoDBPerfTest", test_modifier_str, - "Total time taken", static_cast<size_t>(time_ms), - "ms", true); - perf_test::PrintResult("ProtoDBPerfTest", test_modifier_str, - "Max individual time taken", - static_cast<size_t>(max_time_ms), "ms", true); + auto story_name = + base::StringPrintf("%u_%u_%zu", num_dbs, num_entries, data_size); + perf_test::PerfResultReporter reporter = + SetUpReporter(test_modifier, story_name); + reporter.AddResult(kMetricMemUseAfterWritesBytes, + static_cast<size_t>(memory_use_before)); + reporter.AddResult(kMetricMemUseAfterLoadBytes, + static_cast<size_t>(memory_use_after)); + reporter.AddResult(kMetricTotalTimeTakenMs, static_cast<size_t>(time_ms)); + reporter.AddResult(kMetricMaxIndTimeTakenMs, + static_cast<size_t>(max_time_ms)); ShutdownDBs(); } @@ -555,6 +558,22 @@ ->GetApproximateMemoryUse(memory_use); } + perf_test::PerfResultReporter SetUpReporter(const std::string& test_type, + const std::string& story_name) { + perf_test::PerfResultReporter reporter("ProtoDB_" + test_type + ".", + story_name); + reporter.RegisterImportantMetric(kMetricNumRunsCount, "count"); + reporter.RegisterImportantMetric(kMetricTimeMs, "ms"); + reporter.RegisterImportantMetric(kMetricMaxMemoryUseBytes, "bytes"); + reporter.RegisterImportantMetric(kMetricAverageMemoryUseBytes, "bytes"); + reporter.RegisterImportantMetric(kMetricTotalMemoryUseBytes, "bytes"); + reporter.RegisterImportantMetric(kMetricMemUseAfterWritesBytes, "bytes"); + reporter.RegisterImportantMetric(kMetricMemUseAfterLoadBytes, "bytes"); + reporter.RegisterImportantMetric(kMetricTotalTimeTakenMs, "ms"); + reporter.RegisterImportantMetric(kMetricMaxIndTimeTakenMs, "ms"); + return reporter; + } + std::map<std::string, std::unique_ptr<TestDatabase>> dbs_; std::unique_ptr<MessageLoop> main_loop_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; @@ -649,35 +668,33 @@ } TEST_F(ProtoDBPerfTest, DistributionTestSmall_FewEntries_Single) { - RunDistributionTestAndCleanup("DistributionTestSmall_FewEntries", "Single", + RunDistributionTestAndCleanup("Small_FewEntries_Single", kFewEntriesDistributionTestParams, true); } TEST_F(ProtoDBPerfTest, DistributionTestSmall_FewEntries_Multi) { - RunDistributionTestAndCleanup("DistributionTestSmall_FewEntries", "Multi", + RunDistributionTestAndCleanup("Small_FewEntries_Multi", kFewEntriesDistributionTestParams, false); } TEST_F(ProtoDBPerfTest, DistributionTestSmall_ManyEntries_Single) { - RunDistributionTestAndCleanup("DistributionTestSmall_ManyEntries", "Single", + RunDistributionTestAndCleanup("Small_ManyEntries_Single", kManyEntriesDistributionTestParams, true); } TEST_F(ProtoDBPerfTest, DistributionTestSmall_ManyEntries_Multi) { - RunDistributionTestAndCleanup("DistributionTestSmall_ManyEntries", "Multi", + RunDistributionTestAndCleanup("Small_ManyEntries_Multi", kManyEntriesDistributionTestParams, false); } TEST_F(ProtoDBPerfTest, DistributionTestSmall_ManyEntries_Batch_Single) { - RunDistributionTestAndCleanup("DistributionTestSmall_ManyEntries_Batch", - "Single", kManyEntriesDistributionTestParams, - true); + RunDistributionTestAndCleanup("Small_ManyEntries_Batch_Single", + kManyEntriesDistributionTestParams, true); } TEST_F(ProtoDBPerfTest, DistributionTestSmall_ManyEntries_Batch_Multi) { - RunDistributionTestAndCleanup("DistributionTestSmall_ManyEntries_Batch", - "Multi", kManyEntriesDistributionTestParams, - false); + RunDistributionTestAndCleanup("Small_ManyEntries_Batch_Multi", + kManyEntriesDistributionTestParams, false); } TEST_F(ProtoDBPerfTest, LoadEntriesSingle_Small) {
diff --git a/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashTestRule.java b/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashTestRule.java index 6ccb813..8a2d1c60 100644 --- a/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashTestRule.java +++ b/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashTestRule.java
@@ -69,7 +69,7 @@ return ContextUtils.getApplicationContext().getCacheDir(); } - private void tearDown() throws Exception { + private void tearDown() { File[] crashFiles = mCrashDir.listFiles(); if (crashFiles == null) { return;
diff --git a/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/MinidumpUploadCallableTest.java b/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/MinidumpUploadCallableTest.java index 69d06cd..c8b00ce 100644 --- a/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/MinidumpUploadCallableTest.java +++ b/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/MinidumpUploadCallableTest.java
@@ -83,7 +83,7 @@ } @Override - public OutputStream getOutputStream() throws IOException { + public OutputStream getOutputStream() { return new ByteArrayOutputStream(); } @@ -181,7 +181,7 @@ CrashTestRule.setUpMinidumpFile(mTestUpload, BOUNDARY); } - private void setForcedUpload() throws Exception { + private void setForcedUpload() { File renamed = new File(mTestRule.getCrashDir(), mTestUpload.getName().replace(".dmp", ".forced")); mTestUpload.renameTo(renamed); @@ -227,7 +227,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testCallNotPermittedByUser() throws Exception { + public void testCallNotPermittedByUser() { CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { { @@ -254,7 +254,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testCallPermittedButNotInSample() throws Exception { + public void testCallPermittedButNotInSample() { CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { { @@ -281,7 +281,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testCallPermittedButNotUnderCurrentCircumstances() throws Exception { + public void testCallPermittedButNotUnderCurrentCircumstances() { CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { { @@ -350,7 +350,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testCallNotPermittedByUser_ForcedUpload() throws Exception { + public void testCallNotPermittedByUser_ForcedUpload() { setForcedUpload(); CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { @@ -377,7 +377,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testCallPermittedButNotInSample_ForcedUpload() throws Exception { + public void testCallPermittedButNotInSample_ForcedUpload() { setForcedUpload(); CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { @@ -404,7 +404,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testCallPermittedButNotUnderCurrentCircumstances_ForcedUpload() throws Exception { + public void testCallPermittedButNotUnderCurrentCircumstances_ForcedUpload() { setForcedUpload(); CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { @@ -479,7 +479,7 @@ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testReceivingErrorCodes() throws Exception { + public void testReceivingErrorCodes() { CrashReportingPermissionManager testPermManager = new MockCrashReportingPermissionManager() { {
diff --git a/components/navigation_interception/intercept_navigation_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_throttle_unittest.cc index 2f239b17..3c7a149 100644 --- a/components/navigation_interception/intercept_navigation_throttle_unittest.cc +++ b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
@@ -122,7 +122,7 @@ }; TEST_P(InterceptNavigationThrottleTest, - RequestCompletesIfNavigationNotIgnored) { + DISABLED_RequestCompletesIfNavigationNotIgnored) { ON_CALL(*mock_callback_receiver_, ShouldIgnoreNavigation(_, _)) .WillByDefault(Return(false)); EXPECT_CALL(
diff --git a/components/omnibox/browser/history_quick_provider_performance_unittest.cc b/components/omnibox/browser/history_quick_provider_performance_unittest.cc index 4dd5876..144dc509 100644 --- a/components/omnibox/browser/history_quick_provider_performance_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
@@ -21,7 +21,7 @@ #include "components/omnibox/browser/history_test_util.h" #include "components/omnibox/browser/in_memory_url_index_test_util.h" #include "testing/gtest/include/gtest/gtest.h" -#include "testing/perf/perf_test.h" +#include "testing/perf/perf_result_reporter.h" namespace history { @@ -150,16 +150,21 @@ } void HQPPerfTestOnePopularURL::PrintMeasurements( - const std::string& trace_name, + const std::string& story_name, const std::vector<base::TimeDelta>& measurements) { auto* test_info = ::testing::UnitTest::GetInstance()->current_test_info(); std::string durations; for (const auto& measurement : measurements) durations += std::to_string(measurement.InMillisecondsRoundedUp()) + ','; + // Strip off trailing comma. + durations.pop_back(); - perf_test::PrintResultList(test_info->test_case_name(), test_info->name(), - trace_name, durations, "ms", true); + auto metric_prefix = std::string(test_info->test_case_name()) + "_" + + std::string(test_info->name()); + perf_test::PerfResultReporter reporter(metric_prefix, story_name); + reporter.RegisterImportantMetric(".duration", "ms"); + reporter.AddResultList(".duration", durations); } base::TimeDelta HQPPerfTestOnePopularURL::RunTest(const base::string16& text) {
diff --git a/components/omnibox/browser/in_memory_url_index_types_unittest.cc b/components/omnibox/browser/in_memory_url_index_types_unittest.cc index 52d05d4..3ccadf3 100644 --- a/components/omnibox/browser/in_memory_url_index_types_unittest.cc +++ b/components/omnibox/browser/in_memory_url_index_types_unittest.cc
@@ -141,7 +141,7 @@ EXPECT_EQ(expected_offsets[i], matches_g[i].offset); } -TEST_F(InMemoryURLIndexTypesTest, OffsetsAndTermMatches) { +TEST_F(InMemoryURLIndexTypesTest, DISABLED_OffsetsAndTermMatches) { // Test OffsetsFromTermMatches TermMatches matches_a; matches_a.push_back(TermMatch(1, 1, 2));
diff --git a/components/omnibox/browser/in_memory_url_index_unittest.cc b/components/omnibox/browser/in_memory_url_index_unittest.cc index 4809846..539df385 100644 --- a/components/omnibox/browser/in_memory_url_index_unittest.cc +++ b/components/omnibox/browser/in_memory_url_index_unittest.cc
@@ -488,7 +488,7 @@ .size()); } -TEST_F(InMemoryURLIndexTest, Retrieval) { +TEST_F(InMemoryURLIndexTest, DISABLED_Retrieval) { // See if a very specific term gives a single result. ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms( ASCIIToUTF16("DrudgeReport"), base::string16::npos, kProviderMaxMatches); @@ -956,7 +956,7 @@ CheckTerm(cache, ASCIIToUTF16("rec")); } -TEST_F(InMemoryURLIndexTest, AddNewRows) { +TEST_F(InMemoryURLIndexTest, DISABLED_AddNewRows) { // Verify that the row we're going to add does not already exist. history::URLID new_row_id = 87654321; // Newly created history::URLRows get a last_visit time of 'right now' so it @@ -1158,7 +1158,7 @@ } } -TEST_F(InMemoryURLIndexTest, CacheSaveRestore) { +TEST_F(InMemoryURLIndexTest, DISABLED_CacheSaveRestore) { base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); set_history_dir(temp_directory.GetPath());
diff --git a/components/omnibox/browser/keyword_provider_unittest.cc b/components/omnibox/browser/keyword_provider_unittest.cc index 2aeadaa..e54922e 100644 --- a/components/omnibox/browser/keyword_provider_unittest.cc +++ b/components/omnibox/browser/keyword_provider_unittest.cc
@@ -367,7 +367,7 @@ &AutocompleteMatch::fill_into_edit); } -TEST_F(KeywordProviderTest, URL) { +TEST_F(KeywordProviderTest, DISABLED_URL) { const MatchType<GURL> kEmptyMatch = { GURL(), false }; TestData<GURL> url_cases[] = { // No query input -> empty destination URL.
diff --git a/components/omnibox/browser/omnibox_edit_model_unittest.cc b/components/omnibox/browser/omnibox_edit_model_unittest.cc index dda6b050..a6a8a8b 100644 --- a/components/omnibox/browser/omnibox_edit_model_unittest.cc +++ b/components/omnibox/browser/omnibox_edit_model_unittest.cc
@@ -223,7 +223,7 @@ } } -TEST_F(OmniboxEditModelTest, InlineAutocompleteText) { +TEST_F(OmniboxEditModelTest, DISABLED_InlineAutocompleteText) { // Test if the model updates the inline autocomplete text in the view. EXPECT_EQ(base::string16(), view()->inline_autocomplete_text()); model()->SetUserText(base::ASCIIToUTF16("he"));
diff --git a/components/optimization_guide/hints_fetcher.cc b/components/optimization_guide/hints_fetcher.cc index 8321502..11f4de3 100644 --- a/components/optimization_guide/hints_fetcher.cc +++ b/components/optimization_guide/hints_fetcher.cc
@@ -67,31 +67,26 @@ } // static -void HintsFetcher::RecordHintsFetcherCoverage(PrefService* pref_service, - const std::string& host) { - HintsFetcher::RecordHintsFetcherCoverage(pref_service, host, - base::DefaultClock::GetInstance()); +bool HintsFetcher::WasHostCoveredByFetch(PrefService* pref_service, + const std::string& host) { + return WasHostCoveredByFetch(pref_service, host, + base::DefaultClock::GetInstance()); } // static -void HintsFetcher::RecordHintsFetcherCoverage(PrefService* pref_service, - const std::string& host, - const base::Clock* time_clock) { +bool HintsFetcher::WasHostCoveredByFetch(PrefService* pref_service, + const std::string& host, + const base::Clock* time_clock) { DictionaryPrefUpdate hosts_fetched( pref_service, prefs::kHintsFetcherHostsSuccessfullyFetched); base::Optional<double> value = hosts_fetched->FindDoubleKey(HashHostForDictionary(host)); - if (!value) { - UMA_HISTOGRAM_BOOLEAN( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", false); - return; - } + if (!value) + return false; base::Time host_valid_time = base::Time::FromDeltaSinceWindowsEpoch( base::TimeDelta::FromSecondsD(*value)); - UMA_HISTOGRAM_BOOLEAN( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", - host_valid_time > time_clock->Now()); + return host_valid_time > time_clock->Now(); } bool HintsFetcher::FetchOptimizationGuideServiceHints(
diff --git a/components/optimization_guide/hints_fetcher.h b/components/optimization_guide/hints_fetcher.h index 34568e0..113c7cd6 100644 --- a/components/optimization_guide/hints_fetcher.h +++ b/components/optimization_guide/hints_fetcher.h
@@ -65,13 +65,13 @@ // HintsFetcherHostsSuccessfullyFetched dictionary pref. static void ClearHostsSuccessfullyFetched(PrefService* pref_service); - // Record whether the host was covered by a hints fetch and any returned - // hints would not have expired. - static void RecordHintsFetcherCoverage(PrefService* pref_service, - const std::string& host, - const base::Clock* clock); - static void RecordHintsFetcherCoverage(PrefService* pref_service, - const std::string& host); + // Return whether the host was covered by a hints fetch and any returned hints + // would not have expired. + static bool WasHostCoveredByFetch(PrefService* pref_service, + const std::string& host); + static bool WasHostCoveredByFetch(PrefService* pref_service, + const std::string& host, + const base::Clock* clock); private: // URL loader completion callback.
diff --git a/components/optimization_guide/hints_fetcher_unittest.cc b/components/optimization_guide/hints_fetcher_unittest.cc index b5a89f09..f49455f8 100644 --- a/components/optimization_guide/hints_fetcher_unittest.cc +++ b/components/optimization_guide/hints_fetcher_unittest.cc
@@ -125,9 +125,9 @@ } } - void SimulateNavigation(const std::string& host) { - HintsFetcher::RecordHintsFetcherCoverage(pref_service(), host, - GetMockClock()); + bool WasHostCoveredByFetch(const std::string& host) { + return HintsFetcher::WasHostCoveredByFetch(pref_service(), host, + GetMockClock()); } private: @@ -275,10 +275,8 @@ SeedCoveredHosts(hosts, host_invalid_time); - SimulateNavigation(hosts[0]); - SimulateNavigation(hosts[1]); - histogram_tester.ExpectBucketCount( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", true, 2); + EXPECT_TRUE(WasHostCoveredByFetch(hosts[0])); + EXPECT_TRUE(WasHostCoveredByFetch(hosts[1])); } TEST_F(HintsFetcherTest, HintsFetcherCoveredHostExpired) { @@ -299,10 +297,8 @@ // The first pair of hosts should be recorded as failed to be // covered by a recent hints fetcher as they have expired. - SimulateNavigation(hosts[0]); - SimulateNavigation(hosts[1]); - histogram_tester.ExpectUniqueSample( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", false, 2); + EXPECT_FALSE(WasHostCoveredByFetch(hosts[0])); + EXPECT_FALSE(WasHostCoveredByFetch(hosts[1])); // The first pair of hosts should be removed from the dictionary // pref as they have expired. @@ -312,10 +308,8 @@ // Navigations to the valid hosts should be recorded as successfully // covered. - SimulateNavigation(hosts_valid[0]); - SimulateNavigation(hosts_valid[1]); - histogram_tester.ExpectBucketCount( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", true, 2); + EXPECT_TRUE(WasHostCoveredByFetch(hosts_valid[0])); + EXPECT_TRUE(WasHostCoveredByFetch(hosts_valid[1])); } TEST_F(HintsFetcherTest, HintsFetcherHostNotCovered) { @@ -329,13 +323,9 @@ pref_service(), prefs::kHintsFetcherHostsSuccessfullyFetched); EXPECT_EQ(2u, hosts_fetched->size()); - SimulateNavigation(hosts[0]); - SimulateNavigation(hosts[1]); - SimulateNavigation("newhost.com"); - histogram_tester.ExpectBucketCount( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", true, 2); - histogram_tester.ExpectBucketCount( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", false, 1); + EXPECT_TRUE(WasHostCoveredByFetch(hosts[0])); + EXPECT_TRUE(WasHostCoveredByFetch(hosts[1])); + EXPECT_FALSE(WasHostCoveredByFetch("newhost.com")); } TEST_F(HintsFetcherTest, HintsFetcherRemoveExpiredOnSuccessfullyFetched) { @@ -360,15 +350,11 @@ pref_service(), prefs::kHintsFetcherHostsSuccessfullyFetched); EXPECT_EQ(2u, hosts_fetched->size()); - SimulateNavigation(hosts_expired[0]); - SimulateNavigation(hosts_expired[1]); - histogram_tester.ExpectBucketCount( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", false, 2); + EXPECT_FALSE(WasHostCoveredByFetch(hosts_expired[0])); + EXPECT_FALSE(WasHostCoveredByFetch(hosts_expired[1])); - SimulateNavigation(hosts_valid[0]); - SimulateNavigation(hosts_valid[1]); - histogram_tester.ExpectBucketCount( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", true, 2); + EXPECT_TRUE(WasHostCoveredByFetch(hosts_valid[0])); + EXPECT_TRUE(WasHostCoveredByFetch(hosts_valid[1])); } TEST_F(HintsFetcherTest, HintsFetcherSuccessfullyFetchedHostsFull) { @@ -397,10 +383,8 @@ pref_service(), prefs::kHintsFetcherHostsSuccessfullyFetched); EXPECT_EQ(200u, hosts_fetched->size()); - SimulateNavigation(extra_hosts[0]); - SimulateNavigation(extra_hosts[1]); - histogram_tester.ExpectUniqueSample( - "OptimizationGuide.HintsFetcher.NavigationHostCoveredByFetch", true, 2); + EXPECT_TRUE(WasHostCoveredByFetch(extra_hosts[0])); + EXPECT_TRUE(WasHostCoveredByFetch(extra_hosts[1])); } } // namespace optimization_guide
diff --git a/components/optimization_guide/proto/models.proto b/components/optimization_guide/proto/models.proto index 5588fb5..98d66fd 100644 --- a/components/optimization_guide/proto/models.proto +++ b/components/optimization_guide/proto/models.proto
@@ -11,12 +11,15 @@ // A generic handle for any type of model. message Model { - reserved 3; + reserved 3, 4; oneof model { DecisionTree decision_tree = 1; Ensemble ensemble = 2; } + // The tag number is high to allow models to be added and an uncommon number + // in case the proto this is generated from adds a similar functionality. + optional DoubleValue threshold = 123; } // An ensemble prediction model consisting of an ordered sequence of models. @@ -25,6 +28,8 @@ reserved 2, 3, 4; message Member { optional Model submodel = 1; } + // The tag number is set by the proto this is generated from and cannot be + // changed. repeated Member members = 100; } @@ -132,6 +137,14 @@ optional string value = 1; } +// Wrapper message for `double`. +// +// The JSON representation for `DoubleValue` is JSON number. +message DoubleValue { + // The double value. + optional double value = 1; +} + // Requests prediction models to be used for a set of optimization targets. message GetModelsRequest { // Information about the requested models.
diff --git a/components/page_load_metrics/OWNERS b/components/page_load_metrics/OWNERS index 3d18229..782650ae5 100644 --- a/components/page_load_metrics/OWNERS +++ b/components/page_load_metrics/OWNERS
@@ -7,7 +7,3 @@ # For straightforward addition/removal to existing observers only (for # APAC). kinuko@chromium.org - -# For QUIC version changes in ConnectionInfo switch statmenets. -per-file protocol_util.cc=file://net/quic/OWNERS -# COMPONENT: Speed>Metrics
diff --git a/components/page_load_metrics/browser/OWNERS b/components/page_load_metrics/browser/OWNERS new file mode 100644 index 0000000..b43050aa --- /dev/null +++ b/components/page_load_metrics/browser/OWNERS
@@ -0,0 +1,3 @@ +# For QUIC version changes in ConnectionInfo switch statmenets. +per-file protocol_util.cc=file://net/quic/OWNERS +# COMPONENT: Speed>Metrics
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index 74f52f40..76d63f18 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc
@@ -938,32 +938,33 @@ new BrowserSavePasswordProgressLogger(client_->GetLogManager())); } - for (const FormStructure* form : forms) - predictions_[form->form_signature()] = ConvertToFormPredictions(*form); - for (auto& manager : form_managers_) - manager->ProcessServerPredictions(predictions_); + for (const FormStructure* form : forms) + predictions_[form->form_signature()] = ConvertToFormPredictions(*form); + for (auto& manager : form_managers_) + manager->ProcessServerPredictions(predictions_); - // Create form managers for non-password forms with single usernames. - for (const FormStructure* form : forms) { - if (form->has_password_field()) - continue; + // Create form managers for non-password forms with single usernames. + for (const FormStructure* form : forms) { + if (logger) + logger->LogFormStructure(Logger::STRING_SERVER_PREDICTIONS, *form); + if (form->has_password_field()) + continue; - // Do not skip the form if it either contains a field for the Username - // first flow or a clear-text password field. - if (!(HasSingleUsernameVote(*form) || HasNewPasswordVote(*form))) - continue; + // Do not skip the form if it either contains a field for the Username + // first flow or a clear-text password field. + if (!(HasSingleUsernameVote(*form) || HasNewPasswordVote(*form))) + continue; - if (FindMatchedManagerByRendererId(form->unique_renderer_id(), - form_managers_, driver)) { - // The form manager is already created. - continue; - } - - FormData form_data = form->ToFormData(); - auto* manager = CreateFormManager(driver, form_data); - manager->ProcessServerPredictions(predictions_); + if (FindMatchedManagerByRendererId(form->unique_renderer_id(), + form_managers_, driver)) { + // The form manager is already created. + continue; } + FormData form_data = form->ToFormData(); + auto* manager = CreateFormManager(driver, form_data); + manager->ProcessServerPredictions(predictions_); + } } PasswordFormManager* PasswordManager::GetSubmittedManager() const {
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentDetailsConverter.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentDetailsConverter.java index 883ed6f..d48bdb2 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentDetailsConverter.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentDetailsConverter.java
@@ -8,6 +8,7 @@ import org.chromium.payments.mojom.PaymentHandlerMethodData; import org.chromium.payments.mojom.PaymentHandlerModifier; import org.chromium.payments.mojom.PaymentMethodChangeResponse; +import org.chromium.payments.mojom.PaymentShippingOption; import java.util.ArrayList; @@ -44,7 +45,7 @@ * valid for the given payment method identifier. Should not be null. * @return The data structure that can be sent to the invoked payment handler. */ - static public PaymentMethodChangeResponse convertToPaymentMethodChangeResponse( + public static PaymentMethodChangeResponse convertToPaymentMethodChangeResponse( PaymentDetails details, MethodChecker methodChecker) { // Keep in sync with components/payments/content/payment_details_converter.cc. assert details != null; @@ -53,30 +54,49 @@ PaymentMethodChangeResponse response = new PaymentMethodChangeResponse(); response.error = details.error; response.stringifiedPaymentMethodErrors = details.stringifiedPaymentMethodErrors; + response.shippingAddressErrors = details.shippingAddressErrors; if (details.total != null) response.total = details.total.amount; - ArrayList<PaymentHandlerModifier> modifiers = new ArrayList<>(); + if (details.modifiers != null) { + ArrayList<PaymentHandlerModifier> modifiers = new ArrayList<>(); - for (int i = 0; i < details.modifiers.length; i++) { - if (!methodChecker.isInvokedInstrumentValidForPaymentMethodIdentifier( - details.modifiers[i].methodData.supportedMethod)) { - continue; + for (int i = 0; i < details.modifiers.length; i++) { + if (!methodChecker.isInvokedInstrumentValidForPaymentMethodIdentifier( + details.modifiers[i].methodData.supportedMethod)) { + continue; + } + + PaymentHandlerModifier modifier = new PaymentHandlerModifier(); + modifier.methodData = new PaymentHandlerMethodData(); + modifier.methodData.methodName = details.modifiers[i].methodData.supportedMethod; + modifier.methodData.stringifiedData = + details.modifiers[i].methodData.stringifiedData; + + if (details.modifiers[i].total != null) { + modifier.total = details.modifiers[i].total.amount; + } + + modifiers.add(modifier); } - PaymentHandlerModifier modifier = new PaymentHandlerModifier(); - modifier.methodData = new PaymentHandlerMethodData(); - modifier.methodData.methodName = details.modifiers[i].methodData.supportedMethod; - modifier.methodData.stringifiedData = details.modifiers[i].methodData.stringifiedData; - - if (details.modifiers[i].total != null) { - modifier.total = details.modifiers[i].total.amount; - } - - modifiers.add(modifier); + response.modifiers = modifiers.toArray(new PaymentHandlerModifier[modifiers.size()]); } - response.modifiers = modifiers.toArray(new PaymentHandlerModifier[modifiers.size()]); + if (details.shippingOptions != null) { + ArrayList<PaymentShippingOption> options = new ArrayList<>(); + for (int i = 0; i < details.shippingOptions.length; i++) { + PaymentShippingOption option = new PaymentShippingOption(); + option.amount = details.shippingOptions[i].amount; + option.id = details.shippingOptions[i].id; + option.label = details.shippingOptions[i].label; + option.selected = details.shippingOptions[i].selected; + + options.add(option); + } + + response.shippingOptions = options.toArray(new PaymentShippingOption[options.size()]); + } return response; }
diff --git a/components/payments/content/android/payment_handler_host.cc b/components/payments/content/android/payment_handler_host.cc index 55591be..0bedd52 100644 --- a/components/payments/content/android/payment_handler_host.cc +++ b/components/payments/content/android/payment_handler_host.cc
@@ -34,7 +34,7 @@ PaymentHandlerHost::~PaymentHandlerHost() {} jboolean PaymentHandlerHost::IsChangingPaymentMethod(JNIEnv* env) const { - return payment_handler_host_.is_changing_payment_method(); + return payment_handler_host_.is_changing(); } jlong PaymentHandlerHost::GetNativePaymentHandlerHost(JNIEnv* env) { @@ -69,5 +69,21 @@ base::android::ConvertUTF8ToJavaString(env, stringified_data)); } +bool PaymentHandlerHost::ChangeShippingOption( + const std::string& shipping_option_id) { + // Shipping and contact info delegation is not implemented on Android yet. + // TODO(sahel): crbug.com/984694 + NOTREACHED(); + return false; +} + +bool PaymentHandlerHost::ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address) { + // Shipping and contact info delegation is not implemented on Android yet. + // TODO(sahel): crbug.com/984694 + NOTREACHED(); + return false; +} + } // namespace android } // namespace payments
diff --git a/components/payments/content/android/payment_handler_host.h b/components/payments/content/android/payment_handler_host.h index 4643ccd..2ad6a67 100644 --- a/components/payments/content/android/payment_handler_host.h +++ b/components/payments/content/android/payment_handler_host.h
@@ -66,6 +66,9 @@ // PaymentHandlerHost::Delegate implementation: bool ChangePaymentMethod(const std::string& method_name, const std::string& stringified_data) override; + bool ChangeShippingOption(const std::string& shipping_option_id) override; + bool ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address) override; base::android::ScopedJavaGlobalRef<jobject> delegate_; payments::PaymentHandlerHost payment_handler_host_;
diff --git a/components/payments/content/payment_details_converter.cc b/components/payments/content/payment_details_converter.cc index 2242483a..dd46ec9d 100644 --- a/components/payments/content/payment_details_converter.cc +++ b/components/payments/content/payment_details_converter.cc
@@ -23,31 +23,41 @@ response->error = details->error; response->stringified_payment_method_errors = details->stringified_payment_method_errors; + if (details->shipping_address_errors) { + response->shipping_address_errors = + details->shipping_address_errors.Clone(); + } if (details->total) response->total = details->total->amount.Clone(); - if (!details->modifiers) - return response; + if (details->modifiers) { + response->modifiers = std::vector<mojom::PaymentHandlerModifierPtr>(); - response->modifiers = std::vector<mojom::PaymentHandlerModifierPtr>(); + for (const auto& merchant : *details->modifiers) { + bool is_valid = false; + method_checker.Run(merchant->method_data->supported_method, &is_valid); + if (!is_valid) + continue; - for (const auto& merchant : *details->modifiers) { - bool is_valid = false; - method_checker.Run(merchant->method_data->supported_method, &is_valid); - if (!is_valid) - continue; + mojom::PaymentHandlerModifierPtr mod = + mojom::PaymentHandlerModifier::New(); + mod->method_data = mojom::PaymentHandlerMethodData::New(); + mod->method_data->method_name = merchant->method_data->supported_method; + mod->method_data->stringified_data = + merchant->method_data->stringified_data; - mojom::PaymentHandlerModifierPtr mod = mojom::PaymentHandlerModifier::New(); - mod->method_data = mojom::PaymentHandlerMethodData::New(); - mod->method_data->method_name = merchant->method_data->supported_method; - mod->method_data->stringified_data = - merchant->method_data->stringified_data; + if (merchant->total) + mod->total = merchant->total->amount.Clone(); - if (merchant->total) - mod->total = merchant->total->amount.Clone(); + response->modifiers->emplace_back(std::move(mod)); + } + } - response->modifiers->emplace_back(std::move(mod)); + if (details->shipping_options) { + response->shipping_options = std::vector<mojom::PaymentShippingOptionPtr>(); + for (const auto& option : *details->shipping_options) + response->shipping_options->emplace_back(option.Clone()); } return response;
diff --git a/components/payments/content/payment_handler_host.cc b/components/payments/content/payment_handler_host.cc index fdb0a82c..7fdadbb7 100644 --- a/components/payments/content/payment_handler_host.cc +++ b/components/payments/content/payment_handler_host.cc
@@ -10,6 +10,8 @@ #include "base/strings/string_number_conversions.h" #include "components/payments/core/error_strings.h" #include "components/payments/core/native_error_strings.h" +#include "components/payments/core/payment_address.h" +#include "components/payments/core/payments_validators.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_background_services_context.h" @@ -36,6 +38,16 @@ : nullptr; } +// Generates a PaymentResponse with the given error, then runs the provided +// callback. +void RunCallbackWithError(const std::string& error, + ChangePaymentRequestDetailsCallback callback) { + mojom::PaymentMethodChangeResponsePtr response = + mojom::PaymentMethodChangeResponse::New(); + response->error = error; + std::move(callback).Run(std::move(response)); +} + } // namespace PaymentHandlerHost::PaymentHandlerHost(content::WebContents* web_contents, @@ -61,7 +73,7 @@ void PaymentHandlerHost::UpdateWith( mojom::PaymentMethodChangeResponsePtr response) { - if (!change_payment_method_callback_) + if (!change_payment_request_details_callback_) return; auto* dev_tools = @@ -79,6 +91,29 @@ *response->stringified_payment_method_errors; } + if (response->shipping_address_errors) { + data["Shipping Address Address Line Error"] = + response->shipping_address_errors->address_line; + data["Shipping Address City Error"] = + response->shipping_address_errors->city; + data["Shipping Address Country Error"] = + response->shipping_address_errors->country; + data["Shipping Address Dependent Locality Error"] = + response->shipping_address_errors->dependent_locality; + data["Shipping Address Organization Error"] = + response->shipping_address_errors->organization; + data["Shipping Address Phone Error"] = + response->shipping_address_errors->phone; + data["Shipping Address Postal Code Error"] = + response->shipping_address_errors->postal_code; + data["Shipping Address Recipient Error"] = + response->shipping_address_errors->recipient; + data["Shipping Address Region Error"] = + response->shipping_address_errors->region; + data["Shipping Address Sorting Code Error"] = + response->shipping_address_errors->sorting_code; + } + if (response->modifiers) { for (size_t i = 0; i < response->modifiers->size(); ++i) { std::string prefix = @@ -97,20 +132,35 @@ } } + if (response->shipping_options) { + for (size_t i = 0; i < response->shipping_options->size(); ++i) { + std::string prefix = + "Shipping Option" + (response->shipping_options->size() == 1 + ? "" + : " #" + base::NumberToString(i)); + const auto& option = response->shipping_options->at(i); + data.emplace(prefix + " Id", option->id); + data.emplace(prefix + " Label", option->label); + data.emplace(prefix + " Amount Currency", option->amount->currency); + data.emplace(prefix + " Amount Value", option->amount->value); + data.emplace(prefix + " Selected", option->selected ? "true" : "false"); + } + } + dev_tools->LogBackgroundServiceEvent( registration_id_for_logs_, sw_origin_for_logs_, content::DevToolsBackgroundService::kPaymentHandler, "Update with", /*instance_id=*/payment_request_id_for_logs_, data); } - std::move(change_payment_method_callback_).Run(std::move(response)); + std::move(change_payment_request_details_callback_).Run(std::move(response)); } void PaymentHandlerHost::NoUpdatedPaymentDetails() { - if (!change_payment_method_callback_) + if (!change_payment_request_details_callback_) return; - std::move(change_payment_method_callback_) + std::move(change_payment_request_details_callback_) .Run(mojom::PaymentMethodChangeResponse::New()); } @@ -124,31 +174,22 @@ void PaymentHandlerHost::ChangePaymentMethod( mojom::PaymentHandlerMethodDataPtr method_data, - mojom::PaymentHandlerHost::ChangePaymentMethodCallback callback) { + ChangePaymentRequestDetailsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!method_data) { - mojom::PaymentMethodChangeResponsePtr response = - mojom::PaymentMethodChangeResponse::New(); - response->error = errors::kMethodDataRequired; - std::move(callback).Run(std::move(response)); + RunCallbackWithError(errors::kMethodDataRequired, std::move(callback)); return; } if (method_data->method_name.empty()) { - mojom::PaymentMethodChangeResponsePtr response = - mojom::PaymentMethodChangeResponse::New(); - response->error = errors::kMethodNameRequired; - std::move(callback).Run(std::move(response)); + RunCallbackWithError(errors::kMethodNameRequired, std::move(callback)); return; } if (!delegate_->ChangePaymentMethod(method_data->method_name, method_data->stringified_data)) { - mojom::PaymentMethodChangeResponsePtr response = - mojom::PaymentMethodChangeResponse::New(); - response->error = errors::kInvalidState; - std::move(callback).Run(std::move(response)); + RunCallbackWithError(errors::kInvalidState, std::move(callback)); return; } @@ -164,7 +205,88 @@ {"Method Data", method_data->stringified_data}}); } - change_payment_method_callback_ = std::move(callback); + change_payment_request_details_callback_ = std::move(callback); +} + +void PaymentHandlerHost::ChangeShippingOption( + const std::string& shipping_option_id, + ChangePaymentRequestDetailsCallback callback) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (shipping_option_id.empty()) { + RunCallbackWithError(errors::kShippingOptionIdRequired, + std::move(callback)); + return; + } + + if (!delegate_->ChangeShippingOption(shipping_option_id)) { + RunCallbackWithError(errors::kInvalidState, std::move(callback)); + return; + } + + auto* dev_tools = + GetDevTools(web_contents_->GetBrowserContext(), sw_origin_for_logs_); + if (dev_tools) { + dev_tools->LogBackgroundServiceEvent( + registration_id_for_logs_, sw_origin_for_logs_, + content::DevToolsBackgroundService::kPaymentHandler, + "Change shipping option", + /*instance_id=*/payment_request_id_for_logs_, + {{"Shipping Option Id", shipping_option_id}}); + } + + change_payment_request_details_callback_ = std::move(callback); +} + +void PaymentHandlerHost::ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address, + ChangePaymentRequestDetailsCallback callback) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (!shipping_address || !PaymentsValidators::IsValidCountryCodeFormat( + shipping_address->country, nullptr)) { + RunCallbackWithError(errors::kShippingAddressInvalid, std::move(callback)); + return; + } + + if (!delegate_->ChangeShippingAddress(shipping_address.Clone())) { + RunCallbackWithError(errors::kInvalidState, std::move(callback)); + return; + } + + auto* dev_tools = + GetDevTools(web_contents_->GetBrowserContext(), sw_origin_for_logs_); + if (dev_tools) { + std::map<std::string, std::string> shipping_address_map; + shipping_address_map.emplace("Country", shipping_address->country); + for (size_t i = 0; i < shipping_address->address_line.size(); ++i) { + std::string key = + "Address Line" + (shipping_address->address_line.size() == 1 + ? "" + : " #" + base::NumberToString(i)); + shipping_address_map.emplace(key, shipping_address->address_line[i]); + } + + shipping_address_map.emplace("Region", shipping_address->region); + shipping_address_map.emplace("City", shipping_address->city); + shipping_address_map.emplace("Dependent Locality", + shipping_address->dependent_locality); + shipping_address_map.emplace("Postal Code", shipping_address->postal_code); + shipping_address_map.emplace("Sorting Code", + shipping_address->sorting_code); + shipping_address_map.emplace("Organization", + shipping_address->organization); + shipping_address_map.emplace("Recipient", shipping_address->recipient); + shipping_address_map.emplace("Phone", shipping_address->phone); + + dev_tools->LogBackgroundServiceEvent( + registration_id_for_logs_, sw_origin_for_logs_, + content::DevToolsBackgroundService::kPaymentHandler, + "Change shipping address", + /*instance_id=*/payment_request_id_for_logs_, shipping_address_map); + } + + change_payment_request_details_callback_ = std::move(callback); } } // namespace payments
diff --git a/components/payments/content/payment_handler_host.h b/components/payments/content/payment_handler_host.h index 427a18b..0ce84ee 100644 --- a/components/payments/content/payment_handler_host.h +++ b/components/payments/content/payment_handler_host.h
@@ -22,6 +22,9 @@ namespace payments { +using ChangePaymentRequestDetailsCallback = + base::OnceCallback<void(mojom::PaymentMethodChangeResponsePtr)>; + // Handles the communication from the payment handler renderer process to the // merchant renderer process. class PaymentHandlerHost : public mojom::PaymentHandlerHost { @@ -36,6 +39,17 @@ // "false" if the state is invalid. virtual bool ChangePaymentMethod(const std::string& method_name, const std::string& stringified_data) = 0; + + // Notifies the merchant that the shipping option has changed. Returns + // "false" if the state is invalid. + virtual bool ChangeShippingOption( + const std::string& shipping_option_id) = 0; + + // Notifies the merchant that the shipping address has changed after + // redacting the address whenever needed. Returns "false" if the state is + // invalid. + virtual bool ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address) = 0; }; // The |delegate| cannot be null and must outlive this object. Typically this @@ -63,21 +77,24 @@ payment_request_id_for_logs_ = id; } - // Returns "true" when the payment handler has changed the payment method, but - // has not received the response from the merchant yet. - bool is_changing_payment_method() const { - return !!change_payment_method_callback_; + // Returns "true" when the payment handler has changed any of the payment + // method, shipping address or shipping option, but has not received the + // response from the merchant yet. + bool is_changing() const { + return !!change_payment_request_details_callback_; } // Binds to an IPC endpoint and returns it. mojo::PendingRemote<mojom::PaymentHandlerHost> Bind(); // Notifies the payment handler of the updated details, such as updated total, - // in response to the change of the payment method. + // in response to the change of any of the following: payment method, shipping + // address, or shipping option. void UpdateWith(mojom::PaymentMethodChangeResponsePtr response); // Notifies the payment handler that the merchant did not handle the payment - // method change event, so the payment details are unchanged. + // method, shipping option, or shipping address change events, so the payment + // details are unchanged. void NoUpdatedPaymentDetails(); // Disconnects from the payment handler. @@ -89,12 +106,22 @@ // mojom::PaymentHandlerHost void ChangePaymentMethod( mojom::PaymentHandlerMethodDataPtr method_data, - mojom::PaymentHandlerHost::ChangePaymentMethodCallback callback) override; + ChangePaymentRequestDetailsCallback callback) override; - // Payment handler's callback to invoke after merchant responds to the - // "payment method change" event. - mojom::PaymentHandlerHost::ChangePaymentMethodCallback - change_payment_method_callback_; + // mojom::PaymentHandlerHost + void ChangeShippingOption( + const std::string& shipping_option_id, + ChangePaymentRequestDetailsCallback callback) override; + + // mojom::PaymentHandlerHost + void ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address, + ChangePaymentRequestDetailsCallback callback) override; + + // Payment handler's callback to invoke after merchant responds to any of the + // "payment method change", "shipping option change", or "shipping address + // change" events. + ChangePaymentRequestDetailsCallback change_payment_request_details_callback_; // The end-point for the payment handler renderer process to call into the // browser process.
diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc index d69d1ca..3d75a590 100644 --- a/components/payments/content/payment_request.cc +++ b/components/payments/content/payment_request.cc
@@ -70,6 +70,22 @@ return output; } +// Redact shipping address before exposing it in ShippingAddressChangeEvent. +// https://w3c.github.io/payment-request/#shipping-address-changed-algorithm +mojom::PaymentAddressPtr RedactShippingAddress( + mojom::PaymentAddressPtr address) { + DCHECK(address); + if (!PaymentsExperimentalFeatures::IsEnabled( + features::kWebPaymentsRedactShippingAddress)) { + return address; + } + address->organization.clear(); + address->phone.clear(); + address->recipient.clear(); + address->address_line.clear(); + return address; +} + } // namespace PaymentRequest::PaymentRequest( @@ -326,7 +342,7 @@ } if (state()->selected_instrument() && state()->IsPaymentAppInvoked() && - payment_handler_host_.is_changing_payment_method()) { + payment_handler_host_.is_changing()) { payment_handler_host_.UpdateWith( PaymentDetailsConverter::ConvertToPaymentMethodChangeResponse( details, base::BindRepeating( @@ -369,8 +385,7 @@ spec_->RecomputeSpecForDetails(); - if (state()->IsPaymentAppInvoked() && - payment_handler_host_.is_changing_payment_method()) { + if (state()->IsPaymentAppInvoked() && payment_handler_host_.is_changing()) { payment_handler_host_.NoUpdatedPaymentDetails(); } } @@ -498,6 +513,45 @@ return true; } +bool PaymentRequest::ChangeShippingOption( + const std::string& shipping_option_id) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK(!shipping_option_id.empty()); + + bool is_valid_id = false; + if (spec_->details().shipping_options) { + for (const auto& option : spec_->GetShippingOptions()) { + if (option->id == shipping_option_id) { + is_valid_id = true; + break; + } + } + } + + if (!state_ || !state_->IsPaymentAppInvoked() || !client_ || !spec_ || + !spec_->request_shipping() || !is_valid_id) { + return false; + } + + client_->OnShippingOptionChange(shipping_option_id); + return true; +} + +bool PaymentRequest::ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK(shipping_address); + + if (!state_ || !state_->IsPaymentAppInvoked() || !client_ || !spec_ || + !spec_->request_shipping()) { + return false; + } + + client_->OnShippingAddressChange( + RedactShippingAddress(std::move(shipping_address))); + return true; +} + void PaymentRequest::AreRequestedMethodsSupportedCallback( bool methods_supported, const std::string& error_message) { @@ -613,16 +667,7 @@ void PaymentRequest::OnShippingAddressSelected( mojom::PaymentAddressPtr address) { - // Redact shipping address before exposing it in ShippingAddressChangeEvent. - // https://w3c.github.io/payment-request/#shipping-address-changed-algorithm - if (PaymentsExperimentalFeatures::IsEnabled( - features::kWebPaymentsRedactShippingAddress)) { - address->organization.clear(); - address->phone.clear(); - address->recipient.clear(); - address->address_line.clear(); - } - client_->OnShippingAddressChange(std::move(address)); + client_->OnShippingAddressChange(RedactShippingAddress(std::move(address))); } void PaymentRequest::OnPayerInfoSelected(mojom::PayerDetailPtr payer_info) {
diff --git a/components/payments/content/payment_request.h b/components/payments/content/payment_request.h index aaae0a6..9e303d74 100644 --- a/components/payments/content/payment_request.h +++ b/components/payments/content/payment_request.h
@@ -84,6 +84,9 @@ // PaymentHandlerHost::Delegate bool ChangePaymentMethod(const std::string& method_name, const std::string& stringified_data) override; + bool ChangeShippingOption(const std::string& shipping_option_id) override; + bool ChangeShippingAddress( + mojom::PaymentAddressPtr shipping_address) override; // PaymentRequestSpec::Observer: void OnSpecUpdated() override {}
diff --git a/components/payments/core/BUILD.gn b/components/payments/core/BUILD.gn index aa419eb6..d63ab7b 100644 --- a/components/payments/core/BUILD.gn +++ b/components/payments/core/BUILD.gn
@@ -16,6 +16,8 @@ "features.h", "journey_logger.cc", "journey_logger.h", + "payment_address.cc", + "payment_address.h", "payment_currency_amount.cc", "payment_currency_amount.h", "payment_details.cc", @@ -50,8 +52,6 @@ "basic_card_response.h", "payer_data.cc", "payer_data.h", - "payment_address.cc", - "payment_address.h", "payment_instrument.cc", "payment_instrument.h", "payment_options.cc",
diff --git a/components/payments/core/native_error_strings.cc b/components/payments/core/native_error_strings.cc index 7399a9d..bc57957 100644 --- a/components/payments/core/native_error_strings.cc +++ b/components/payments/core/native_error_strings.cc
@@ -155,6 +155,8 @@ const char kSinglePaymentMethodNotSupportedFormat[] = "The payment method $ is not supported."; +const char kShippingOptionIdRequired[] = "Shipping option identifier required."; + const char kShippingAddressInvalid[] = "Payment app returned invalid shipping address in response.";
diff --git a/components/payments/core/native_error_strings.h b/components/payments/core/native_error_strings.h index 140cc715..fb234c3 100644 --- a/components/payments/core/native_error_strings.h +++ b/components/payments/core/native_error_strings.h
@@ -187,6 +187,9 @@ // where "$" is the character to replace. extern const char kSinglePaymentMethodNotSupportedFormat[]; +// Used when non-empty "shippingOptionId": "" is required, but not provided. +extern const char kShippingOptionIdRequired[]; + // The payment handler responded with an invalid shipping address. extern const char kShippingAddressInvalid[];
diff --git a/components/policy/android/java/src/org/chromium/policy/CombinedPolicyProvider.java b/components/policy/android/java/src/org/chromium/policy/CombinedPolicyProvider.java index 95272c02..700891d7 100644 --- a/components/policy/android/java/src/org/chromium/policy/CombinedPolicyProvider.java +++ b/components/policy/android/java/src/org/chromium/policy/CombinedPolicyProvider.java
@@ -10,6 +10,7 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.NativeMethods; import java.util.ArrayList; import java.util.List; @@ -92,7 +93,7 @@ mPolicyConverter.setPolicy(key, settings.get(key)); } } - nativeFlushPolicies(mNativeCombinedPolicyProvider); + CombinedPolicyProviderJni.get().flushPolicies(mNativeCombinedPolicyProvider, get()); } void terminateIncognitoSession() { @@ -132,14 +133,12 @@ void terminateIncognitoSession(); } - @VisibleForTesting - public static void set(CombinedPolicyProvider p) { + static void setForTesting(CombinedPolicyProvider p) { sInstance = p; } - @VisibleForTesting - CombinedPolicyProvider() {} - - @VisibleForTesting - protected native void nativeFlushPolicies(long nativeAndroidCombinedPolicyProvider); + @NativeMethods + interface Natives { + void flushPolicies(long nativeAndroidCombinedPolicyProvider, CombinedPolicyProvider caller); + } }
diff --git a/components/policy/android/java/src/org/chromium/policy/PolicyConverter.java b/components/policy/android/java/src/org/chromium/policy/PolicyConverter.java index 8097156..bf4e005 100644 --- a/components/policy/android/java/src/org/chromium/policy/PolicyConverter.java +++ b/components/policy/android/java/src/org/chromium/policy/PolicyConverter.java
@@ -16,6 +16,7 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.NativeMethods; import java.util.Arrays; import java.util.Set; @@ -44,19 +45,23 @@ assert mNativePolicyConverter != 0; if (value instanceof Boolean) { - nativeSetPolicyBoolean(mNativePolicyConverter, key, (Boolean) value); + PolicyConverterJni.get().setPolicyBoolean( + mNativePolicyConverter, PolicyConverter.this, key, (Boolean) value); return; } if (value instanceof String) { - nativeSetPolicyString(mNativePolicyConverter, key, (String) value); + PolicyConverterJni.get().setPolicyString( + mNativePolicyConverter, PolicyConverter.this, key, (String) value); return; } if (value instanceof Integer) { - nativeSetPolicyInteger(mNativePolicyConverter, key, (Integer) value); + PolicyConverterJni.get().setPolicyInteger( + mNativePolicyConverter, PolicyConverter.this, key, (Integer) value); return; } if (value instanceof String[]) { - nativeSetPolicyStringArray(mNativePolicyConverter, key, (String[]) value); + PolicyConverterJni.get().setPolicyStringArray( + mNativePolicyConverter, PolicyConverter.this, key, (String[]) value); return; } // App restrictions can only contain bundles and bundle arrays on Android M, however our @@ -68,8 +73,8 @@ // JNI can't take a Bundle argument without a lot of extra work, but the native code // already accepts arbitrary JSON strings, so convert to JSON. try { - nativeSetPolicyString( - mNativePolicyConverter, key, convertBundleToJson(bundle).toString()); + PolicyConverterJni.get().setPolicyString(mNativePolicyConverter, + PolicyConverter.this, key, convertBundleToJson(bundle).toString()); } catch (JSONException e) { // Chrome requires all policies to be expressible as JSON, so this can't be a // valid policy. @@ -83,7 +88,8 @@ // JNI can't take a Bundle[] argument without a lot of extra work, but the native // code already accepts arbitrary JSON strings, so convert to JSON. try { - nativeSetPolicyString(mNativePolicyConverter, key, + PolicyConverterJni.get().setPolicyString(mNativePolicyConverter, + PolicyConverter.this, key, convertBundleArrayToJson(bundleArray).toString()); } catch (JSONException e) { // Chrome requires all policies to be expressible as JSON, so this can't be a @@ -130,13 +136,15 @@ mNativePolicyConverter = 0; } - @VisibleForTesting - native void nativeSetPolicyBoolean(long nativePolicyConverter, String policyKey, boolean value); - @VisibleForTesting - native void nativeSetPolicyInteger(long nativePolicyConverter, String policyKey, int value); - @VisibleForTesting - native void nativeSetPolicyString(long nativePolicyConverter, String policyKey, String value); - @VisibleForTesting - native void nativeSetPolicyStringArray( - long nativePolicyConverter, String policyKey, String[] value); + @NativeMethods + interface Natives { + void setPolicyBoolean(long nativePolicyConverter, PolicyConverter caller, String policyKey, + boolean value); + void setPolicyInteger( + long nativePolicyConverter, PolicyConverter caller, String policyKey, int value); + void setPolicyString( + long nativePolicyConverter, PolicyConverter caller, String policyKey, String value); + void setPolicyStringArray(long nativePolicyConverter, PolicyConverter caller, + String policyKey, String[] value); + } }
diff --git a/components/policy/android/junit/src/org/chromium/policy/CombinedPolicyProviderTest.java b/components/policy/android/junit/src/org/chromium/policy/CombinedPolicyProviderTest.java index e9c20ec3..e19bfd9 100644 --- a/components/policy/android/junit/src/org/chromium/policy/CombinedPolicyProviderTest.java +++ b/components/policy/android/junit/src/org/chromium/policy/CombinedPolicyProviderTest.java
@@ -8,9 +8,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; @@ -20,11 +18,15 @@ import android.os.Bundle; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.robolectric.annotation.Config; import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.JniMocker; /** * Robolectric tests for CombinedPolicyProvider @@ -32,16 +34,18 @@ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE) public class CombinedPolicyProviderTest { + @Rule + public JniMocker mocker = new JniMocker(); + @Mock private PolicyConverter mPolicyConverter; + @Mock + private CombinedPolicyProvider.Natives mCombinedPolicyConverterJniMock; @Before public void setup() { - // Stub out the native calls - CombinedPolicyProvider provider = spy(new CombinedPolicyProvider()); - mPolicyConverter = mock(PolicyConverter.class); - doNothing().when(mPolicyConverter).setPolicy(anyString(), any()); - doNothing().when(provider).nativeFlushPolicies(anyLong()); - CombinedPolicyProvider.set(provider); + MockitoAnnotations.initMocks(this); + mocker.mock(CombinedPolicyProviderJni.TEST_HOOKS, mCombinedPolicyConverterJniMock); + CombinedPolicyProvider.setForTesting(new CombinedPolicyProvider()); } /** @@ -85,7 +89,7 @@ b.putBoolean("BoolPolicy", true); CombinedPolicyProvider.get().onSettingsAvailable(0, b); verify(mPolicyConverter, never()).setPolicy(anyString(), any()); - verify(CombinedPolicyProvider.get(), never()).nativeFlushPolicies(anyInt()); + verify(mCombinedPolicyConverterJniMock, never()).flushPolicies(anyInt(), any()); } @Test @@ -104,7 +108,7 @@ verify(mPolicyConverter).setPolicy("StringPolicy", "A string"); verify(mPolicyConverter) .setPolicy("StringArrayPolicy", new String[] {"String1", "String2"}); - verify(CombinedPolicyProvider.get()).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock).flushPolicies(1234, CombinedPolicyProvider.get()); } @Test @@ -114,7 +118,7 @@ CombinedPolicyProvider.get().registerProvider(provider); Bundle b = new Bundle(); CombinedPolicyProvider.get().onSettingsAvailable(0, b); - verify(CombinedPolicyProvider.get()).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock).flushPolicies(1234, CombinedPolicyProvider.get()); // Second policy provider registered but no settings. PolicyProvider provider2 = new DummyPolicyProvider(); @@ -126,14 +130,15 @@ // Second call should have been ignored, so nothing should have been set verify(mPolicyConverter, never()).setPolicy(anyString(), anyBoolean()); // and flush should have been called precisely once. - verify(CombinedPolicyProvider.get()).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock).flushPolicies(1234, CombinedPolicyProvider.get()); // Empty but valid bundle from second policy provider should set the policy and push it // to the native code b = new Bundle(); CombinedPolicyProvider.get().onSettingsAvailable(1, b); verify(mPolicyConverter).setPolicy("BoolPolicy", true); - verify(CombinedPolicyProvider.get(), times(2)).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock, times(2)) + .flushPolicies(1234, CombinedPolicyProvider.get()); } @Test @@ -147,19 +152,22 @@ b.putBoolean("BoolPolicy", true); CombinedPolicyProvider.get().onSettingsAvailable(0, b); CombinedPolicyProvider.get().onSettingsAvailable(1, b); - verify(CombinedPolicyProvider.get(), times(1)).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock, times(1)) + .flushPolicies(1234, CombinedPolicyProvider.get()); CombinedPolicyProvider.get().refreshPolicies(); // This should have cleared the cached policies, so onSettingsAvailable should now do // nothing until both providers have settings. CombinedPolicyProvider.get().onSettingsAvailable(0, b); // Still only one call. - verify(CombinedPolicyProvider.get(), times(1)).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock, times(1)) + .flushPolicies(1234, CombinedPolicyProvider.get()); b = new Bundle(); b.putBoolean("BoolPolicy", false); CombinedPolicyProvider.get().onSettingsAvailable(1, b); // That should have caused the second flush. - verify(CombinedPolicyProvider.get(), times(2)).nativeFlushPolicies(1234); + verify(mCombinedPolicyConverterJniMock, times(2)) + .flushPolicies(1234, CombinedPolicyProvider.get()); // And the policy should have been set to the new value. verify(mPolicyConverter).setPolicy("BoolPolicy", false); }
diff --git a/components/policy/android/junit/src/org/chromium/policy/PolicyConverterTest.java b/components/policy/android/junit/src/org/chromium/policy/PolicyConverterTest.java index 9a0b197..5fddb6f 100644 --- a/components/policy/android/junit/src/org/chromium/policy/PolicyConverterTest.java +++ b/components/policy/android/junit/src/org/chromium/policy/PolicyConverterTest.java
@@ -4,23 +4,21 @@ package org.chromium.policy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import android.os.Build; import android.os.Bundle; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.robolectric.annotation.Config; import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.JniMocker; /** * Robolectric test for AbstractAppRestrictionsProvider. @@ -28,6 +26,18 @@ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE, sdk = Build.VERSION_CODES.LOLLIPOP) public class PolicyConverterTest { + @Rule + public JniMocker mocker = new JniMocker(); + + @Mock + private PolicyConverter.Natives mPolicyConverterJniMock; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + mocker.mock(PolicyConverterJni.TEST_HOOKS, mPolicyConverterJniMock); + } + /** * Test method for * {@link org.chromium.policy.PolicyConverter#setPolicy(java.lang.String, java.lang.Object)}. @@ -35,27 +45,18 @@ @Test public void testSetPolicy() { // Stub out the native methods. - PolicyConverter policyConverter = spy(PolicyConverter.create(1234)); - doNothing() - .when(policyConverter) - .nativeSetPolicyBoolean(anyLong(), anyString(), anyBoolean()); - doNothing().when(policyConverter).nativeSetPolicyInteger(anyLong(), anyString(), anyInt()); - doNothing() - .when(policyConverter) - .nativeSetPolicyString(anyLong(), anyString(), anyString()); - doNothing() - .when(policyConverter) - .nativeSetPolicyStringArray(anyLong(), anyString(), any(String[].class)); + PolicyConverter policyConverter = PolicyConverter.create(1234); policyConverter.setPolicy("p1", true); - verify(policyConverter).nativeSetPolicyBoolean(1234, "p1", true); + verify(mPolicyConverterJniMock).setPolicyBoolean(1234, policyConverter, "p1", true); policyConverter.setPolicy("p1", 5678); - verify(policyConverter).nativeSetPolicyInteger(1234, "p1", 5678); + verify(mPolicyConverterJniMock).setPolicyInteger(1234, policyConverter, "p1", 5678); policyConverter.setPolicy("p1", "hello"); - verify(policyConverter).nativeSetPolicyString(1234, "p1", "hello"); + verify(mPolicyConverterJniMock).setPolicyString(1234, policyConverter, "p1", "hello"); policyConverter.setPolicy("p1", new String[] {"hello", "goodbye"}); - verify(policyConverter) - .nativeSetPolicyStringArray(1234, "p1", new String[] {"hello", "goodbye"}); + verify(mPolicyConverterJniMock) + .setPolicyStringArray( + 1234, policyConverter, "p1", new String[] {"hello", "goodbye"}); Bundle b1 = new Bundle(); b1.putInt("i1", 23); b1.putString("s1", "a string"); @@ -65,11 +66,13 @@ ba[0].putString("ba1s", "another string"); b1.putParcelableArray("b1b", ba); policyConverter.setPolicy("p1", b1); - verify(policyConverter) - .nativeSetPolicyString(1234, "p1", "{\"i1\":23,\"s1\":\"a string\"," + verify(mPolicyConverterJniMock) + .setPolicyString(1234, policyConverter, "p1", + "{\"i1\":23,\"s1\":\"a string\"," + "\"b1b\":[{\"ba1b\":true,\"ba1s\":\"another string\"}]}"); policyConverter.setPolicy("p1", ba); - verify(policyConverter) - .nativeSetPolicyString(1234, "p1", "[{\"ba1b\":true,\"ba1s\":\"another string\"}]"); + verify(mPolicyConverterJniMock) + .setPolicyString(1234, policyConverter, "p1", + "[{\"ba1b\":true,\"ba1s\":\"another string\"}]"); } }
diff --git a/components/policy/core/common/cloud/external_policy_data_fetcher.cc b/components/policy/core/common/cloud/external_policy_data_fetcher.cc index 42823fd..7e1ecf3 100644 --- a/components/policy/core/common/cloud/external_policy_data_fetcher.cc +++ b/components/policy/core/common/cloud/external_policy_data_fetcher.cc
@@ -227,13 +227,7 @@ } ExternalPolicyDataFetcher::~ExternalPolicyDataFetcher() { - // No RunsTasksInCurrentSequence() check to avoid unit tests failures. - // In unit tests the browser process instance is deleted only after test ends - // and test task scheduler is shutted down. Therefore we need to delete some - // components of BrowserPolicyConnector (ResourceCache and - // CloudExternalDataManagerBase::Backend) manually when task runner doesn't - // accept new tasks (DeleteSoon in this case). This leads to the situation - // when this destructor is called not on |task_runner|. + DCHECK(task_runner_->RunsTasksInCurrentSequence()); for (auto it = jobs_.begin(); it != jobs_.end(); ++it) CancelJob(*it);
diff --git a/components/policy/proto/chrome_device_policy.proto b/components/policy/proto/chrome_device_policy.proto index 310241b..b1e29703 100644 --- a/components/policy/proto/chrome_device_policy.proto +++ b/components/policy/proto/chrome_device_policy.proto
@@ -753,6 +753,40 @@ // status on the login screen is persisted between users. optional bool login_screen_autoclick_enabled = 24; optional PolicyOptions login_screen_autoclick_enabled_options = 25; + + // Sets the state of the sticky keys accessibility feature on the login + // screen. If this policy is set to true, the sticky keys will be enabled + // when the login screen is shown. If this policy is set to false, the + // sticky keys will be disabled when the sticky keys is shown. If the + // PolicyOptions mode was being mandatory then the user won't be able to + // change these settings. Only if PolicyOptions was being set as recommended + // users can temporarily override this setting by enabling or disabling the + // sticky keys. However, the user's choice is not persistent and the + // default is restored whenever the login screen is shown anew or the user + // remains idle on the login screen for a minute. If this policy is left + // unset, the sticky keys is disabled when the login screen is first + // shown. Users can enable or disable the sticky keys anytime and its + // status on the login screen is persisted between users. + optional bool login_screen_sticky_keys_enabled = 26; + optional PolicyOptions login_screen_sticky_keys_enabled_options = 27; + + // Sets the state of the keyboard focus highlight accessibility feature on the + // login screen. If this policy is set to true, the keyboard focus highlight + // will be enabled when the login screen is shown. If this policy is set to + // false, the keyboard focus highlight will be disabled when the keyboard + // focus highlight is shown. If the PolicyOptions mode was being mandatory + // then the user won't be able to change these settings. Only if PolicyOptions + // was being set as recommended users can temporarily override this setting by + // enabling or disabling the keyboard focus highlight. However, the user's + // choice is not persistent and the default is restored whenever the login + // screen is shown anew or the user remains idle on the login screen for a + // minute. If this policy is left unset, the keyboard focus highlight is + // disabled when the login screen is first shown. Users can enable or disable + // the keyboard focus highlight anytime and its status on the login screen is + // persisted between users. + optional bool login_screen_keyboard_focus_highlight_enabled = 28; + optional PolicyOptions login_screen_keyboard_focus_highlight_enabled_options = + 29; } message SupervisedUsersSettingsProto {
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 074b716..97dc43c8 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -651,6 +651,8 @@ 'DeviceLoginScreenCaretHighlightEnabled', 'DeviceLoginScreenMonoAudioEnabled', 'DeviceLoginScreenAutoclickEnabled', + 'DeviceLoginScreenStickyKeysEnabled', + 'DeviceLoginScreenKeyboardFocusHighlightEnabled', ], }, { @@ -10536,6 +10538,58 @@ If this policy is left unset, the autoclick is disabled on the login screen initially but can be enabled by the user anytime.''', }, { + 'name': 'DeviceLoginScreenStickyKeysEnabled', + 'owners': ['amraboelkher@chromium.org', 'emaxx@chromium.org'], + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome_os:79-'], + 'device_only': True, + 'features': { + 'can_be_recommended': True, + 'dynamic_refresh': True, + }, + 'example_value': True, + 'id': 618, + 'caption': '''Enable the sticky keys on the login screen''', + 'tags': [], + 'desc': '''Enable the sticky keys accessibility feature on the login screen. + + If this policy is set to true, the sticky keys will always be enabled on the login screen. + + If this policy is set to false, the sticky keys will always be disabled on the login screen. + + If you set this policy, users cannot change or override it. + + If this policy is left unset, the sticky keys is disabled on the login screen initially but can be enabled by the user anytime.''', + }, + { + 'name': 'DeviceLoginScreenKeyboardFocusHighlightEnabled', + 'owners': ['amraboelkher@chromium.org'], + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome_os:79-'], + 'features': { + 'can_be_recommended': True, + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': True, + 'id': 619, + 'caption': '''Enable the keyboard focus highlighting accessibility feature''', + 'tags': [], + 'desc': '''Enable the keyboard focus highlighting accessibility feature on the login screen. + + This feature is responsible for highlighting the object that is focused by the keyboard. + + If this policy is set to enabled, the keyboard focus highlighting will always be enabled. + + If this policy is set to disabled, the keyboard focus highlighting will always be disabled. + + If you set this policy, users cannot change or override it. + + If this policy is left unset, the keyboard focus highlighting is disabled initially but can be enabled by the user anytime.''' + }, + { 'name': 'HideWebStoreIcon', 'owners': ['file://components/policy/resources/OWNERS'], 'type': 'main', @@ -18356,6 +18410,8 @@ 'DeviceLoginScreenCaretHighlightEnabled': 'accessibility_settings.login_screen_caret_highlight_enabled', 'DeviceLoginScreenMonoAudioEnabled': 'accessibility_settings.login_screen_mono_audio_enabled', 'DeviceLoginScreenAutoclickEnabled': 'accessibility_settings.login_screen_autoclick_enabled', + 'DeviceLoginScreenStickyKeysEnabled': 'accessibility_settings.login_screen_sticky_keys_enabled', + 'DeviceLoginScreenKeyboardFocusHighlightEnabled': 'accessibility_settings.login_screen_keyboard_focus_highlight_enabled', 'AttestationEnabledForDevice': 'attestation_settings.attestation_enabled', 'AttestationForContentProtectionEnabled': 'attestation_settings.content_protection_enabled', 'SystemTimezone': 'system_timezone.timezone', @@ -18856,6 +18912,6 @@ ], 'placeholders': [], 'deleted_policy_ids': [412, 546, 562, 569], - 'highest_id_currently_used': 617, + 'highest_id_currently_used': 619, 'highest_atomic_group_id_currently_used': 37 }
diff --git a/components/previews/content/previews_decider_impl.cc b/components/previews/content/previews_decider_impl.cc index 21fd7360..f1685267 100644 --- a/components/previews/content/previews_decider_impl.cc +++ b/components/previews/content/previews_decider_impl.cc
@@ -70,9 +70,8 @@ return false; } -// Returns true if ECT should be checked for |type| only at the commit time. If -// true is returned, then ECT need not be checked at the navigation time. -bool CheckECTOnlyAtCommitTime(PreviewsType type) { +// Returns true if the decision to apply |type| can wait until commit time. +bool IsCommitTimePreview(PreviewsType type) { switch (type) { case PreviewsType::NOSCRIPT: case PreviewsType::RESOURCE_LOADING_HINTS: @@ -266,10 +265,6 @@ // Skip blacklist checks if the blacklist is ignored. if (!blacklist_ignored_) { - if (!previews_black_list_) - return PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE; - passed_reasons->push_back(PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE); - // Trigger the USER_RECENTLY_OPTED_OUT rule when a reload on a preview has // occurred recently. No need to push_back the eligibility reason as it will // be added in IsLoadedAndAllowed as the first check. @@ -279,19 +274,31 @@ return PreviewsEligibilityReason::USER_RECENTLY_OPTED_OUT; } + // If the blacklist is unavailable and we are checking a commit-time + // preview, we will check for the blacklist at commit-time. + if (!IsCommitTimePreview(type)) { + if (!previews_black_list_) + return PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE; + passed_reasons->push_back( + PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE); + } + // The blacklist will disallow certain hosts for periods of time based on // user's opting out of the preview. - PreviewsEligibilityReason status = previews_black_list_->IsLoadedAndAllowed( - url, type, - is_drp_server_preview && - ignore_long_term_blacklist_for_server_previews_, - passed_reasons); + if (previews_black_list_) { + PreviewsEligibilityReason status = + previews_black_list_->IsLoadedAndAllowed( + url, type, + is_drp_server_preview && + ignore_long_term_blacklist_for_server_previews_, + passed_reasons); - if (status != PreviewsEligibilityReason::ALLOWED) { - if (type == PreviewsType::LITE_PAGE) { - previews_data->set_black_listed_for_lite_page(true); + if (status != PreviewsEligibilityReason::ALLOWED) { + if (type == PreviewsType::LITE_PAGE) { + previews_data->set_black_listed_for_lite_page(true); + } + return status; } - return status; } } @@ -299,7 +306,7 @@ // hints. This defers checking ECT for server previews because the server will // perform its own ECT check and for previews with hints because the hints may // specify variable ECT thresholds for slow page hints. - if (!is_drp_server_preview && !CheckECTOnlyAtCommitTime(type)) { + if (!is_drp_server_preview && !IsCommitTimePreview(type)) { if (effective_connection_type_ == net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) { return PreviewsEligibilityReason::NETWORK_QUALITY_UNAVAILABLE; } @@ -393,7 +400,13 @@ const GURL committed_url = navigation_handle->GetURL(); - if (previews_black_list_ && !blacklist_ignored_) { + if (!blacklist_ignored_) { + if (!previews_black_list_) { + LogPreviewDecisionMade(PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE, + committed_url, clock_->Now(), type, {}, + previews_data); + return false; + } std::vector<PreviewsEligibilityReason> passed_reasons; // The blacklist will disallow certain hosts for periods of time based on // user's opting out of the preview. @@ -507,7 +520,7 @@ // connectivity as null. See https://crbug.com/838969. So, we do not trigger // previews when |ect| is net::EFFECTIVE_CONNECTION_TYPE_OFFLINE. net::EffectiveConnectionType ect = previews_data->navigation_ect(); - if (CheckECTOnlyAtCommitTime(type) && + if (IsCommitTimePreview(type) && ect == net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) { // Update the |ect| to the current value. ect = effective_connection_type_;
diff --git a/components/previews/content/previews_decider_impl_unittest.cc b/components/previews/content/previews_decider_impl_unittest.cc index 38ae4312..65cdffe 100644 --- a/components/previews/content/previews_decider_impl_unittest.cc +++ b/components/previews/content/previews_decider_impl_unittest.cc
@@ -1159,6 +1159,23 @@ histogram_tester.ExpectTotalCount("Previews.EligibilityReason.NoScript", 0); } + + // Verify preview not allowed when blacklist is unavailable. + { + ReportEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_2G); + base::HistogramTester histogram_tester; + previews_decider_impl()->InjectTestBlacklist(nullptr /* blacklist */); + PreviewsUserData user_data(kDefaultPageId); + user_data.set_navigation_ect(net::EFFECTIVE_CONNECTION_TYPE_2G); + content::MockNavigationHandle navigation_handle; + navigation_handle.set_url(GURL("https://whitelisted.example.com")); + EXPECT_FALSE(previews_decider_impl()->ShouldCommitPreview( + &user_data, &navigation_handle, PreviewsType::NOSCRIPT)); + + histogram_tester.ExpectUniqueSample( + "Previews.EligibilityReason.NoScript", + static_cast<int>(PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE), 1); + } } TEST_F(PreviewsDeciderImplTest, @@ -1771,7 +1788,9 @@ } } // namespace -TEST_F(PreviewsDeciderImplTest, LogDecisionMadeBlacklistNotAvailable) { +TEST_F( + PreviewsDeciderImplTest, + LogDecisionMadeBlacklistUnavailableAtNavigationStartForNonCommitTimePreview) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitWithFeatures( {features::kPreviews, features::kOfflinePreviews}, {}); @@ -1794,6 +1813,33 @@ ::testing::Contains(expected_type)); } +TEST_F( + PreviewsDeciderImplTest, + LogDecisionMadeBlacklistUnavailableAtNavigationStartForCommitTimePreview) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kPreviews, features::kNoScriptPreviews, + optimization_guide::features::kOptimizationHints}, + {}); + + InitializeUIService(); + auto expected_reason = PreviewsEligibilityReason::ALLOWED; + auto expected_type = PreviewsType::NOSCRIPT; + + previews_decider_impl()->InjectTestBlacklist(nullptr /* blacklist */); + PreviewsUserData user_data(kDefaultPageId); + content::MockNavigationHandle navigation_handle; + navigation_handle.set_url(GURL("https://www.google.com")); + previews_decider_impl()->ShouldAllowPreviewAtNavigationStart( + &user_data, &navigation_handle, false, expected_type); + base::RunLoop().RunUntilIdle(); + // Testing correct log method is called. + EXPECT_THAT(ui_service()->decision_reasons(), + ::testing::Contains(expected_reason)); + EXPECT_THAT(ui_service()->decision_types(), + ::testing::Contains(expected_type)); +} + TEST_F(PreviewsDeciderImplTest, LogDecisionMadeBlacklistStatusesDefault) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitWithFeatures( @@ -2027,7 +2073,6 @@ std::vector<PreviewsEligibilityReason> checked_decisions = { PreviewsEligibilityReason::URL_HAS_BASIC_AUTH, PreviewsEligibilityReason::EXCLUDED_BY_MEDIA_SUFFIX, - PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE, PreviewsEligibilityReason::BLACKLIST_DATA_NOT_LOADED, PreviewsEligibilityReason::USER_RECENTLY_OPTED_OUT, PreviewsEligibilityReason::USER_BLACKLISTED, @@ -2255,7 +2300,6 @@ std::vector<PreviewsEligibilityReason> checked_decisions = { PreviewsEligibilityReason::URL_HAS_BASIC_AUTH, PreviewsEligibilityReason::EXCLUDED_BY_MEDIA_SUFFIX, - PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE, PreviewsEligibilityReason::BLACKLIST_DATA_NOT_LOADED, PreviewsEligibilityReason::USER_RECENTLY_OPTED_OUT, PreviewsEligibilityReason::USER_BLACKLISTED,
diff --git a/components/printing/browser/print_media_l10n.cc b/components/printing/browser/print_media_l10n.cc index ca19d26..e9ffc3fb 100644 --- a/components/printing/browser/print_media_l10n.cc +++ b/components/printing/browser/print_media_l10n.cc
@@ -5,13 +5,8 @@ #include "components/printing/browser/print_media_l10n.h" #include <map> -#include <vector> -#include "base/logging.h" #include "base/no_destructor.h" -#include "base/strings/string_piece.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -162,45 +157,17 @@ return it != media_map->end() ? it->second : -1; } -std::string SplitMediaName(const base::StringPiece& vendor_id) { - // <name>_<width>x<height>{in,mm} - // e.g. na_letter_8.5x11in, iso_a4_210x297mm - std::vector<base::StringPiece> pieces = base::SplitStringPiece( - vendor_id, "_", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - if (pieces.size() < 2) - return std::string(); - - // Append all tokens split out of the vendor ID. The last token is - // usually the <width>x<height> token, so skip it. - pieces.pop_back(); - return base::JoinString(pieces, " "); -} - } // namespace std::string LocalizePaperDisplayName(const std::string& vendor_id) { - std::string localized; // We can't do anything without a vendor ID. if (vendor_id.empty()) { - return localized; + return std::string(); } int translation_id = VendorIdToTranslatedId(vendor_id); - // If we can't get a localized media name, we do our best to parse it - // on our own. - if (translation_id < 0) { - localized = SplitMediaName(base::StringPiece(vendor_id)); - } else { - localized = l10n_util::GetStringUTF8(translation_id); - } - - // If we still don't have a sane display name, fall back on showing - // the vendor ID. - if (localized.empty()) { - VLOG(1) << "No display name for " << vendor_id; - localized = vendor_id; - } - return localized; + return translation_id < 0 ? std::string() + : l10n_util::GetStringUTF8(translation_id); } } // namespace printing
diff --git a/components/printing/browser/print_media_l10n.h b/components/printing/browser/print_media_l10n.h index e012b99..2d3d507 100644 --- a/components/printing/browser/print_media_l10n.h +++ b/components/printing/browser/print_media_l10n.h
@@ -9,7 +9,8 @@ namespace printing { -// Map a paper vendor ID to a localized name. +// Maps a paper vendor ID to a localized name; returns the localized +// name if any is found, else returns an empty string. std::string LocalizePaperDisplayName(const std::string& vendor_id); } // namespace printing
diff --git a/components/printing/browser/print_media_l10n_unittest.cc b/components/printing/browser/print_media_l10n_unittest.cc index 226d365b..9ae4682 100644 --- a/components/printing/browser/print_media_l10n_unittest.cc +++ b/components/printing/browser/print_media_l10n_unittest.cc
@@ -13,7 +13,7 @@ namespace printing { -// Verify that we localize some common names. +// Verifies that we localize some common names. TEST(PrintMediaL10N, LocalizeSomeCommonNames) { const struct { const char* vendor_id; @@ -31,15 +31,16 @@ } } -// Verify that we attempt to split and prettify a vendor ID for which -// we don't have a localization. +// Verifies that we return the empty string when no localization is +// found for a given media name. TEST(PrintMediaL10N, DoWithoutCommonName) { const struct { const char* vendor_id; const char* expected_localized_name; } kTestCases[] = { - {"lorem_ipsum_8x10in", "lorem ipsum"}, - {"q_e_d_130x200mm", "q e d"}, + {"lorem_ipsum_8x10in", ""}, + {"q_e_d_130x200mm", ""}, + {"not at all a valid vendor ID", ""}, }; for (const auto& test_case : kTestCases) { @@ -48,13 +49,4 @@ } } -// Verify that we return the vendor ID itself -// 1. when we don't have a localization and -// 2. when we don't see it split into at least 2 tokens (for name and -// dimensions). -TEST(PrintMediaL10N, FallbackToVendorId) { - const std::string no_dim = "I-BE-NAME-SANS-DIMENSIONS"; - EXPECT_EQ(LocalizePaperDisplayName(no_dim), no_dim); -} - } // namespace printing
diff --git a/components/printing/browser/printer_capabilities.cc b/components/printing/browser/printer_capabilities.cc index e1cefa09..7f7f48a 100644 --- a/components/printing/browser/printer_capabilities.cc +++ b/components/printing/browser/printer_capabilities.cc
@@ -51,12 +51,21 @@ #if BUILDFLAG(PRINT_MEDIA_L10N_ENABLED) // Iterate on the Papers of a given printer |info| and set the -// display_name members, localizing where possible. +// display_name members, localizing where possible. We expect the +// backend to have populated non-empty display names already, so we +// don't touch media display names that we can't localize. void PopulateAllPaperDisplayNames(PrinterSemanticCapsAndDefaults* info) { - info->default_paper.display_name = + std::string default_paper_display = LocalizePaperDisplayName(info->default_paper.vendor_id); + if (!default_paper_display.empty()) { + info->default_paper.display_name = default_paper_display; + } + for (PrinterSemanticCapsAndDefaults::Paper& paper : info->papers) { - paper.display_name = LocalizePaperDisplayName(paper.vendor_id); + std::string display = LocalizePaperDisplayName(paper.vendor_id); + if (!display.empty()) { + paper.display_name = display; + } } } #endif // BUILDFLAG(PRINT_MEDIA_L10N_ENABLED)
diff --git a/components/resources/dom_distiller_resources.grdp b/components/resources/dom_distiller_resources.grdp index 5e999ca..acac03c6 100644 --- a/components/resources/dom_distiller_resources.grdp +++ b/components/resources/dom_distiller_resources.grdp
@@ -1,8 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <grit-part> - <include name="IDR_ABOUT_DOM_DISTILLER_HTML" file="../dom_distiller/webui/resources/about_dom_distiller.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> - <include name="IDR_ABOUT_DOM_DISTILLER_CSS" file="../dom_distiller/webui/resources/about_dom_distiller.css" type="BINDATA" compress="gzip" /> - <include name="IDR_ABOUT_DOM_DISTILLER_JS" file="../dom_distiller/webui/resources/about_dom_distiller.js" type="BINDATA" compress="gzip" /> <include name="IDR_DOM_DISTILLER_VIEWER_HTML" file="../dom_distiller/core/html/dom_distiller_viewer.html" type="BINDATA" compress="gzip" /> <include name="IDR_DOM_DISTILLER_VIEWER_JS" file="../dom_distiller/core/javascript/dom_distiller_viewer.js" type="BINDATA" compress="gzip" /> <include name="IDR_DISTILLER_JS" file="../dom_distiller/core/javascript/domdistiller.js" flattenhtml="true" type="BINDATA" compress="gzip" />
diff --git a/components/safe_browsing/db/v4_store_perftest.cc b/components/safe_browsing/db/v4_store_perftest.cc index 4db3783c..3282b16 100644 --- a/components/safe_browsing/db/v4_store_perftest.cc +++ b/components/safe_browsing/db/v4_store_perftest.cc
@@ -17,10 +17,23 @@ #include "components/safe_browsing/db/v4_test_util.h" #include "crypto/sha2.h" #include "testing/gtest/include/gtest/gtest.h" -#include "testing/perf/perf_test.h" +#include "testing/perf/perf_result_reporter.h" namespace safe_browsing { +namespace { + +constexpr char kMetricPrefixV4Store[] = "V4Store."; +constexpr char kMetricGetMatchingHashPrefixMs[] = "get_matching_hash_prefix"; + +perf_test::PerfResultReporter SetUpV4StoreReporter(const std::string& story) { + perf_test::PerfResultReporter reporter(kMetricPrefixV4Store, story); + reporter.RegisterImportantMetric(kMetricGetMatchingHashPrefixMs, "ms"); + return reporter; +} + +} // namespace + class V4StorePerftest : public testing::Test {}; TEST_F(V4StorePerftest, StressTest) { @@ -53,6 +66,7 @@ store->SetPrefixes(std::move(prefixes), kMinHashPrefixLength); size_t matches = 0; + auto reporter = SetUpV4StoreReporter("stress_test"); base::ElapsedTimer timer; for (size_t i = 0; i < kNumPrefixes; i++) { size_t index = i * kMaxHashPrefixLength; @@ -60,8 +74,8 @@ full_hashes_piece.substr(index, kMaxHashPrefixLength); matches += !store->GetMatchingHashPrefix(full_hash).empty(); } - perf_test::PrintResult("GetMatchingHashPrefix", "", "", - timer.Elapsed().InMillisecondsF(), "ms", true); + reporter.AddResult(kMetricGetMatchingHashPrefixMs, + timer.Elapsed().InMillisecondsF()); EXPECT_EQ(kNumPrefixes, matches); }
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json index af61d0c5..b134602 100644 --- a/components/search_engines/prepopulated_engines.json +++ b/components/search_engines/prepopulated_engines.json
@@ -635,7 +635,6 @@ "alternate_urls": [ "http://hladaj.atlas.sk/fulltext/?phrase={searchTerms}" ], - "type": "SEARCH_ENGINE_ATLAS", "id": 27 }, @@ -1010,9 +1009,5 @@ "type": "SEARCH_ENGINE_ZOZNAM", "id": 85 } - }, - - "generate_array": { - "array_name": "kAllEngines" } }
diff --git a/components/search_engines/prepopulated_engines_schema.json b/components/search_engines/prepopulated_engines_schema.json index bffe770e2..c46435e 100644 --- a/components/search_engines/prepopulated_engines_schema.json +++ b/components/search_engines/prepopulated_engines_schema.json
@@ -9,7 +9,6 @@ { "type_name": "PrepopulatedEngine", "headers": [ - "base/stl_util.h", "components/search_engines/search_engine_type.h" ], "schema": [
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc index 52dd123a..5fd11a9 100644 --- a/components/search_engines/template_url_prepopulate_data.cc +++ b/components/search_engines/template_url_prepopulate_data.cc
@@ -889,6 +889,96 @@ }; // ---------------------------------------------------------------------------- +// A list of all the engines that we know about. +const PrepopulatedEngine* const kAllEngines[] = { + // Prepopulated engines: + &ask, + &baidu, + &bing, + &coccoc, + &daum, + &duckduckgo, + &google, + &mail_ru, + &naver, + &qwant, + &seznam, + &sogou, + &yahoo, + &yahoo_ar, + &yahoo_at, + &yahoo_au, + &yahoo_br, + &yahoo_ca, + &yahoo_ch, + &yahoo_cl, + &yahoo_co, + &yahoo_de, + &yahoo_dk, + &yahoo_es, + &yahoo_fi, + &yahoo_fr, + &yahoo_hk, + &yahoo_id, + &yahoo_in, + &yahoo_jp, + &yahoo_mx, + &yahoo_my, + &yahoo_nl, + &yahoo_nz, + &yahoo_pe, + &yahoo_ph, + &yahoo_qc, + &yahoo_se, + &yahoo_sg, + &yahoo_th, + &yahoo_tr, + &yahoo_tw, + &yahoo_uk, + &yahoo_ve, + &yahoo_vn, + &yandex_by, + &yandex_com, + &yandex_kz, + &yandex_ru, + &yandex_tr, + &yandex_ua, + + // UMA-only engines: + &atlas_cz, + &atlas_sk, + &avg, + &babylon, + &conduit, + &delfi_lt, + &delfi_lv, + &delta, + &funmoods, + &goo, + &imesh, + &iminent, + &in, + &incredibar, + &libero, + &neti, + &nigma, + &ok, + &rambler, + &sapo, + &search_results, + &searchnu, + &snapdo, + &softonic, + &sweetim, + &sweetpacks, + &terra_ar, + &terra_es, + &tut, + &walla, + &wp, + &zoznam, +}; + std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulationSetFromCountryID( int country_id) { const PrepopulatedEngine* const* engines; @@ -1314,8 +1404,8 @@ #endif std::vector<const PrepopulatedEngine*> GetAllPrepopulatedEngines() { - return std::vector<const PrepopulatedEngine*>( - &kAllEngines[0], &kAllEngines[0] + kAllEnginesLength); + return std::vector<const PrepopulatedEngine*>(std::begin(kAllEngines), + std::end(kAllEngines)); } void ClearPrepopulatedEnginesInPrefs(PrefService* prefs) { @@ -1352,7 +1442,7 @@ return google.type; // Now check the rest of the prepopulate data. - for (size_t i = 0; i < kAllEnginesLength; ++i) { + for (size_t i = 0; i < base::size(kAllEngines); ++i) { // First check the main search URL. if (SameDomain(url, GURL(kAllEngines[i]->search_url))) return kAllEngines[i]->type;
diff --git a/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc b/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc index d626cf7a..e722877 100644 --- a/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc +++ b/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc
@@ -98,7 +98,8 @@ kLocalDeviceCacheGuid, "device", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", clock()->Now() - base::TimeDelta::FromDays(1), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(local_device_.get(), /*local=*/true); } @@ -655,21 +656,24 @@ kRecentGuid, "device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", clock()->Now() - base::TimeDelta::FromDays(1), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&recent_device); syncer::DeviceInfo old_device( kOldGuid, "device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now() - base::TimeDelta::FromDays(3), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&old_device); syncer::DeviceInfo older_device( kOlderGuid, "device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now() - base::TimeDelta::FromDays(5), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&older_device); TargetDeviceInfo target_device_info( @@ -690,14 +694,16 @@ "enabled_guid", "enabled_device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&enabled_device); syncer::DeviceInfo disabled_device( "disabled_guid", "disabled_device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/false); + /*send_tab_to_self_receiving_enabled=*/false, + /*sharing_info=*/base::nullopt); AddTestDevice(&disabled_device); TargetDeviceInfo target_device_info( @@ -717,14 +723,16 @@ "expired_guid", "expired_device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now() - base::TimeDelta::FromDays(11), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&expired_device); syncer::DeviceInfo valid_device( "valid_guid", "valid_device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now() - base::TimeDelta::FromDays(1), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&valid_device); TargetDeviceInfo target_device_info( @@ -744,21 +752,24 @@ kLocalDeviceCacheGuid, kLocalDeviceName, "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&local_device); syncer::DeviceInfo other_local_device( "other_local_guid", kLocalDeviceName, "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&local_device); syncer::DeviceInfo other_device( "other_guid", "other_device_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&other_device); TargetDeviceInfo target_device_info( @@ -779,14 +790,16 @@ "older_guid", "older_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now() - base::TimeDelta::FromDays(9), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&older_device); syncer::DeviceInfo recent_device( "recent_guid", "recent_name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now() - base::TimeDelta::FromDays(1), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&recent_device); TargetDeviceInfo older_device_info( @@ -817,7 +830,8 @@ syncer::DeviceInfo device( "guid", "name", "72", "agent", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&device); // Set the map by calling it. Make sure it has the device. @@ -833,7 +847,8 @@ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is", /*last_updated_timestamp=*/clock()->Now(), - /*send_tab_to_self_receiving_enabled=*/true); + /*send_tab_to_self_receiving_enabled=*/true, + /*sharing_info=*/base::nullopt); AddTestDevice(&new_device); // Make sure both devices are in the map.
diff --git a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java index 874aeead..b64cf3ea 100644 --- a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java +++ b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java
@@ -33,7 +33,7 @@ FakeAccountManagerDelegate.ENABLE_BLOCK_GET_ACCOUNTS); @Before - public void setUp() throws Exception { + public void setUp() { AccountManagerFacade.overrideAccountManagerFacadeForTests(mDelegate); }
diff --git a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java index 20816f3..9b48534b 100644 --- a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java +++ b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java
@@ -19,7 +19,6 @@ import org.chromium.base.ObserverList; import org.chromium.base.ThreadUtils; import org.chromium.components.signin.AccountManagerDelegate; -import org.chromium.components.signin.AccountManagerDelegateException; import org.chromium.components.signin.AccountManagerFacade; import org.chromium.components.signin.AccountsChangeObserver; import org.chromium.components.signin.AuthException; @@ -123,7 +122,7 @@ } @Override - public Account[] getAccountsSync() throws AccountManagerDelegateException { + public Account[] getAccountsSync() { // Blocks thread that's trying to get accounts from the delegate. try { mBlockGetAccounts.await();
diff --git a/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java b/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java index 081634c..e97d60d 100644 --- a/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java +++ b/components/signin/core/browser/android/junit/src/org/chromium/components/signin/test/AccountManagerFacadeRobolectricTest.java
@@ -53,7 +53,7 @@ private AccountManagerFacade mFacade; @Before - public void setUp() throws Exception { + public void setUp() { Context context = RuntimeEnvironment.application; UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE); mShadowUserManager = (CustomShadowUserManager) shadowOf(userManager); @@ -223,7 +223,7 @@ @Test @SmallTest - public void testCheckChildAccount() throws AccountManagerDelegateException { + public void testCheckChildAccount() { Account testAccount = addTestAccount("test@gmail.com"); Account ucaAccount = addTestAccount("uca@gmail.com", AccountManagerFacade.FEATURE_IS_CHILD_ACCOUNT_KEY);
diff --git a/components/subresource_filter/core/common/perftests/indexed_ruleset_perftest.cc b/components/subresource_filter/core/common/perftests/indexed_ruleset_perftest.cc index 10c118b..4a3b31d 100644 --- a/components/subresource_filter/core/common/perftests/indexed_ruleset_perftest.cc +++ b/components/subresource_filter/core/common/perftests/indexed_ruleset_perftest.cc
@@ -23,10 +23,17 @@ #include "components/subresource_filter/tools/filter_tool.h" #include "components/subresource_filter/tools/indexing_tool.h" #include "testing/gtest/include/gtest/gtest.h" -#include "testing/perf/perf_test.h" +#include "testing/perf/perf_result_reporter.h" namespace subresource_filter { +namespace { + +static constexpr char kMetricIndexAndWriteTimeUs[] = "index_and_write_time"; +static constexpr char kMetricMedianMatchTimeUs[] = "median_match_time"; + +} // namespace + class IndexedRulesetPerftest : public testing::Test { public: IndexedRulesetPerftest() {} @@ -69,6 +76,13 @@ const base::FilePath& unindexed_path() const { return unindexed_path_; } + perf_test::PerfResultReporter SetUpReporter(const std::string& story_name) { + perf_test::PerfResultReporter reporter("IndexedRuleset.", story_name); + reporter.RegisterImportantMetric(kMetricIndexAndWriteTimeUs, "us"); + reporter.RegisterImportantMetric(kMetricMedianMatchTimeUs, "us"); + return reporter; + } + private: base::ScopedTempDir scoped_dir_; base::FilePath unindexed_path_; @@ -91,9 +105,9 @@ base::ElapsedTimer timer; ASSERT_TRUE(IndexAndWriteRuleset(unindexed_path(), indexed_path)); - perf_test::PrintResult("index_and_write_time", "", "", - static_cast<size_t>(timer.Elapsed().InMicroseconds()), - "microseconds", true /* important */); + perf_test::PerfResultReporter reporter = SetUpReporter("IndexRuleset"); + reporter.AddResult(kMetricIndexAndWriteTimeUs, + static_cast<size_t>(timer.Elapsed().InMicroseconds())); } TEST_F(IndexedRulesetPerftest, MatchAll) { @@ -105,9 +119,8 @@ results.push_back(timer.Elapsed().InMicroseconds()); } std::sort(results.begin(), results.end()); - perf_test::PrintResult("median_match_time", "", "", - static_cast<size_t>(results[2]), "microseconds", - true /* important */); + perf_test::PerfResultReporter reporter = SetUpReporter("MatchAll"); + reporter.AddResult(kMetricMedianMatchTimeUs, static_cast<size_t>(results[2])); } } // namespace subresource_filter
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn index 382d2c6e39..3a00ddb 100644 --- a/components/sync/BUILD.gn +++ b/components/sync/BUILD.gn
@@ -323,6 +323,8 @@ "nigori/nigori_local_change_processor.h", "nigori/nigori_model_type_processor.cc", "nigori/nigori_model_type_processor.h", + "nigori/nigori_state.cc", + "nigori/nigori_state.h", "nigori/nigori_storage.h", "nigori/nigori_storage_impl.cc", "nigori/nigori_storage_impl.h",
diff --git a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java index 1ca912e..4148c6f 100644 --- a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java +++ b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java
@@ -174,7 +174,7 @@ }); } - private void updateAccountSync(Account account) throws InterruptedException, TimeoutException { + private void updateAccountSync(Account account) throws TimeoutException { updateAccount(account); mCallbackHelper.waitForCallback(0, mNumberOfCallsToWait); } @@ -193,7 +193,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testAccountInitialization() throws InterruptedException, TimeoutException { + public void testAccountInitialization() throws TimeoutException { // mAccount was set to be syncable and not have periodic syncs. Assert.assertEquals(1, mSyncContentResolverDelegate.mSetIsSyncableCalls.get()); Assert.assertEquals(1, mSyncContentResolverDelegate.mRemovePeriodicSyncCalls.get()); @@ -365,7 +365,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testGetContractAuthority() throws Exception { + public void testGetContractAuthority() { Assert.assertEquals("The contract authority should be the package name.", InstrumentationRegistry.getTargetContext().getPackageName(), AndroidSyncSettings.get().getContractAuthority()); @@ -413,8 +413,7 @@ @Test @SmallTest @Feature({"Sync"}) - public void testIsSyncableOnSigninAndNotOnSignout() - throws InterruptedException, TimeoutException { + public void testIsSyncableOnSigninAndNotOnSignout() throws TimeoutException { Assert.assertEquals(1, mSyncContentResolverDelegate.getIsSyncable(mAccount, mAuthority)); updateAccountWithCallback(null, (Boolean result) -> {
diff --git a/components/sync/nigori/nigori_state.cc b/components/sync/nigori/nigori_state.cc new file mode 100644 index 0000000..9afe92e --- /dev/null +++ b/components/sync/nigori/nigori_state.cc
@@ -0,0 +1,133 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/sync/nigori/nigori_state.h" + +#include "components/sync/base/model_type.h" +#include "components/sync/base/time.h" +#include "components/sync/engine/sync_encryption_handler.h" +#include "components/sync/nigori/cryptographer_impl.h" +#include "components/sync/protocol/nigori_local_data.pb.h" + +namespace syncer { + +namespace { + +std::string ComputePbkdf2KeyName(const std::string& password) { + std::string key_name; + Nigori::CreateByDerivation(KeyDerivationParams::CreateForPbkdf2(), password) + ->Permute(Nigori::Password, kNigoriKeyName, &key_name); + return key_name; +} + +sync_pb::CustomPassphraseKeyDerivationParams +CustomPassphraseKeyDerivationParamsToProto(const KeyDerivationParams& params) { + sync_pb::CustomPassphraseKeyDerivationParams output; + output.set_custom_passphrase_key_derivation_method( + EnumKeyDerivationMethodToProto(params.method())); + if (params.method() == KeyDerivationMethod::SCRYPT_8192_8_11) { + output.set_custom_passphrase_key_derivation_salt(params.scrypt_salt()); + } + return output; +} + +KeyDerivationParams CustomPassphraseKeyDerivationParamsFromProto( + const sync_pb::CustomPassphraseKeyDerivationParams& proto) { + switch (ProtoKeyDerivationMethodToEnum( + proto.custom_passphrase_key_derivation_method())) { + case KeyDerivationMethod::PBKDF2_HMAC_SHA1_1003: + return KeyDerivationParams::CreateForPbkdf2(); + case KeyDerivationMethod::SCRYPT_8192_8_11: + return KeyDerivationParams::CreateForScrypt( + proto.custom_passphrase_key_derivation_salt()); + case KeyDerivationMethod::UNSUPPORTED: + break; + } + NOTREACHED(); + return KeyDerivationParams::CreateWithUnsupportedMethod(); +} + +} // namespace + +// static +NigoriState NigoriState::CreateFromProto(const sync_pb::NigoriModel& proto) { + NigoriState state; + + state.cryptographer = + CryptographerImpl::FromProto(proto.cryptographer_data()); + + if (proto.has_pending_keys()) { + state.pending_keys = proto.pending_keys(); + } + + state.passphrase_type = proto.passphrase_type(); + state.keystore_migration_time = + ProtoTimeToTime(proto.keystore_migration_time()); + state.custom_passphrase_time = + ProtoTimeToTime(proto.custom_passphrase_time()); + if (proto.has_custom_passphrase_key_derivation_params()) { + state.custom_passphrase_key_derivation_params = + CustomPassphraseKeyDerivationParamsFromProto( + proto.custom_passphrase_key_derivation_params()); + } + state.encrypt_everything = proto.encrypt_everything(); + for (int i = 0; i < proto.keystore_key_size(); ++i) { + state.keystore_keys.push_back(proto.keystore_key(i)); + } + return state; +} + +NigoriState::NigoriState() + : cryptographer(CryptographerImpl::CreateEmpty()), + passphrase_type(kInitialPassphraseType), + encrypt_everything(kInitialEncryptEverything) {} + +NigoriState::NigoriState(NigoriState&& other) = default; + +NigoriState::~NigoriState() = default; + +NigoriState& NigoriState::operator=(NigoriState&& other) = default; + +sync_pb::NigoriModel NigoriState::ToProto() const { + sync_pb::NigoriModel proto; + *proto.mutable_cryptographer_data() = cryptographer->ToProto(); + if (pending_keys.has_value()) { + *proto.mutable_pending_keys() = *pending_keys; + } + if (!keystore_keys.empty()) { + proto.set_current_keystore_key_name( + ComputePbkdf2KeyName(keystore_keys.back())); + } + proto.set_passphrase_type(passphrase_type); + if (!keystore_migration_time.is_null()) { + proto.set_keystore_migration_time(TimeToProtoTime(keystore_migration_time)); + } + if (!custom_passphrase_time.is_null()) { + proto.set_custom_passphrase_time(TimeToProtoTime(custom_passphrase_time)); + } + if (custom_passphrase_key_derivation_params) { + *proto.mutable_custom_passphrase_key_derivation_params() = + CustomPassphraseKeyDerivationParamsToProto( + *custom_passphrase_key_derivation_params); + } + proto.set_encrypt_everything(encrypt_everything); + ModelTypeSet encrypted_types = SyncEncryptionHandler::SensitiveTypes(); + if (encrypt_everything) { + encrypted_types = EncryptableUserTypes(); + } + for (ModelType model_type : encrypted_types) { + proto.add_encrypted_types_specifics_field_number( + GetSpecificsFieldNumberFromModelType(model_type)); + } + // TODO(crbug.com/970213): we currently store keystore keys in proto only to + // allow rollback of USS Nigori. Having keybag with all keystore keys and + // |current_keystore_key_name| is enough to support all logic. We should + // remove them few milestones after USS migration completed. + for (const std::string& keystore_key : keystore_keys) { + proto.add_keystore_key(keystore_key); + } + return proto; +} + +} // namespace syncer
diff --git a/components/sync/nigori/nigori_state.h b/components/sync/nigori/nigori_state.h new file mode 100644 index 0000000..b23922ca --- /dev/null +++ b/components/sync/nigori/nigori_state.h
@@ -0,0 +1,75 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_SYNC_NIGORI_NIGORI_STATE_H_ +#define COMPONENTS_SYNC_NIGORI_NIGORI_STATE_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "base/macros.h" +#include "base/optional.h" +#include "base/time/time.h" +#include "components/sync/nigori/nigori.h" +#include "components/sync/protocol/encryption.pb.h" +#include "components/sync/protocol/nigori_specifics.pb.h" + +namespace sync_pb { +class NigoriModel; +} // namespace sync_pb + +namespace syncer { + +class CryptographerImpl; + +struct NigoriState { + static constexpr sync_pb::NigoriSpecifics::PassphraseType + kInitialPassphraseType = sync_pb::NigoriSpecifics::UNKNOWN; + + static constexpr bool kInitialEncryptEverything = false; + + // Deserialization from proto. + static NigoriState CreateFromProto(const sync_pb::NigoriModel& proto); + + NigoriState(); + NigoriState(NigoriState&& other); + ~NigoriState(); + + NigoriState& operator=(NigoriState&& other); + + // Serialization to proto. + sync_pb::NigoriModel ToProto() const; + + std::unique_ptr<CryptographerImpl> cryptographer; + + // Pending keys represent a remote update that contained a keybag that cannot + // be decrypted (e.g. user needs to enter a custom passphrase). If pending + // keys are present, |*cryptographer| does not have a default encryption key + // set and instead the should-be default encryption key is determined by the + // key in |pending_keys_|. + base::Optional<sync_pb::EncryptedData> pending_keys; + + // TODO(mmoskvitin): Consider adopting the C++ enum PassphraseType here and + // if so remove function ProtoPassphraseInt32ToProtoEnum() from + // passphrase_enums.h. + sync_pb::NigoriSpecifics::PassphraseType passphrase_type; + base::Time keystore_migration_time; + base::Time custom_passphrase_time; + + // The key derivation params we are using for the custom passphrase. Set iff + // |passphrase_type| is CUSTOM_PASSPHRASE, otherwise key derivation method + // is always PBKDF2. + base::Optional<KeyDerivationParams> custom_passphrase_key_derivation_params; + bool encrypt_everything; + + // Base64 encoded keystore keys. The last element is the current keystore + // key. These keys are not a part of Nigori node and are persisted + // separately. Must be encrypted with OSCrypt before persisting. + std::vector<std::string> keystore_keys; +}; + +} // namespace syncer + +#endif // COMPONENTS_SYNC_NIGORI_NIGORI_STATE_H_
diff --git a/components/sync/nigori/nigori_sync_bridge_impl.cc b/components/sync/nigori/nigori_sync_bridge_impl.cc index 2c3abac..6d4c2b66 100644 --- a/components/sync/nigori/nigori_sync_bridge_impl.cc +++ b/components/sync/nigori/nigori_sync_bridge_impl.cc
@@ -482,39 +482,6 @@ return key; } -std::string ComputePbkdf2KeyName(const std::string& password) { - std::string key_name; - Nigori::CreateByDerivation(KeyDerivationParams::CreateForPbkdf2(), password) - ->Permute(Nigori::Password, kNigoriKeyName, &key_name); - return key_name; -} - -sync_pb::CustomPassphraseKeyDerivationParams -CustomPassphraseKeyDerivationParamsToProto(const KeyDerivationParams& params) { - sync_pb::CustomPassphraseKeyDerivationParams output; - output.set_custom_passphrase_key_derivation_method( - EnumKeyDerivationMethodToProto(params.method())); - if (params.method() == KeyDerivationMethod::SCRYPT_8192_8_11) { - output.set_custom_passphrase_key_derivation_salt(params.scrypt_salt()); - } - return output; -} - -KeyDerivationParams CustomPassphraseKeyDerivationParamsFromProto( - const sync_pb::CustomPassphraseKeyDerivationParams& proto) { - switch (ProtoKeyDerivationMethodToEnum( - proto.custom_passphrase_key_derivation_method())) { - case KeyDerivationMethod::PBKDF2_HMAC_SHA1_1003: - return KeyDerivationParams::CreateForPbkdf2(); - case KeyDerivationMethod::SCRYPT_8192_8_11: - return KeyDerivationParams::CreateForScrypt( - proto.custom_passphrase_key_derivation_salt()); - case KeyDerivationMethod::UNSUPPORTED: - NOTREACHED(); - return KeyDerivationParams::CreateWithUnsupportedMethod(); - } -} - ModelTypeSet GetEncryptedTypes(bool encrypt_everything) { if (encrypt_everything) { return EncryptableUserTypes(); @@ -536,10 +503,7 @@ random_salt_generator_(random_salt_generator), explicit_passphrase_key_( UnpackExplicitPassphraseKey(*encryptor, - packed_explicit_passphrase_key)), - cryptographer_(CryptographerImpl::CreateEmpty()), - passphrase_type_(NigoriSpecifics::UNKNOWN), - encrypt_everything_(false) { + packed_explicit_passphrase_key)) { DCHECK(encryptor); // TODO(crbug.com/922900): we currently don't verify |deserialized_data|. @@ -558,46 +522,9 @@ return; } - // TODO(crbug.com/922900): consider factoring-out model state to a struct and - // introducing helper function for deserialization instead of having it in - // ctor. - // Restore state of the bridge. - const sync_pb::NigoriModel& nigori_model = deserialized_data->nigori_model(); - - // Restore |cryptographer_|. - cryptographer_ = - CryptographerImpl::FromProto(nigori_model.cryptographer_data()); - - if (nigori_model.has_pending_keys()) { - pending_keys_ = nigori_model.pending_keys(); - } - - if (!cryptographer_ || - (pending_keys_ && cryptographer_->CanDecrypt(*pending_keys_)) || - (pending_keys_ && - !cryptographer_->GetDefaultEncryptionKeyName().empty())) { - // We either have no Nigori node stored locally or it was corrupted. - cryptographer_ = CryptographerImpl::CreateEmpty(); - pending_keys_.reset(); - processor_->ModelReadyToSync(this, NigoriMetadataBatch()); - return; - } - - // Restore rest of the state. - passphrase_type_ = nigori_model.passphrase_type(); - keystore_migration_time_ = - ProtoTimeToTime(nigori_model.keystore_migration_time()); - custom_passphrase_time_ = - ProtoTimeToTime(nigori_model.custom_passphrase_time()); - if (nigori_model.has_custom_passphrase_key_derivation_params()) { - custom_passphrase_key_derivation_params_ = - CustomPassphraseKeyDerivationParamsFromProto( - nigori_model.custom_passphrase_key_derivation_params()); - } - encrypt_everything_ = nigori_model.encrypt_everything(); - for (int i = 0; i < nigori_model.keystore_key_size(); ++i) { - keystore_keys_.push_back(nigori_model.keystore_key(i)); - } + // Restore data. + state_ = + syncer::NigoriState::CreateFromProto(deserialized_data->nigori_model()); // Restore metadata. NigoriMetadataBatch metadata_batch; @@ -627,26 +554,27 @@ // completeness of first sync cycle (which happens before Init() call). // TODO(crbug.com/922900): try to avoid double notification (second one can // happen during UpdateLocalState() call). - if (pending_keys_) { + if (state_.pending_keys.has_value()) { for (auto& observer : observers_) { observer.OnPassphraseRequired(REASON_DECRYPTION, GetKeyDerivationParamsForPendingKeys(), - *pending_keys_); + *state_.pending_keys); } } for (auto& observer : observers_) { - observer.OnEncryptedTypesChanged(GetEncryptedTypes(encrypt_everything_), - encrypt_everything_); + observer.OnEncryptedTypesChanged( + GetEncryptedTypes(state_.encrypt_everything), + state_.encrypt_everything); } for (auto& observer : observers_) { - observer.OnCryptographerStateChanged(cryptographer_.get(), - pending_keys_.has_value()); + observer.OnCryptographerStateChanged(state_.cryptographer.get(), + state_.pending_keys.has_value()); } - if (passphrase_type_ != NigoriSpecifics::UNKNOWN) { - // if |passphrase_type_| is unknown, it is not yet initialized and we + if (state_.passphrase_type != NigoriSpecifics::UNKNOWN) { + // if |passphrase_type| is unknown, it is not yet initialized and we // shouldn't expose it. PassphraseType enum_passphrase_type = - *ProtoPassphraseInt32ToEnum(passphrase_type_); + *ProtoPassphraseInt32ToEnum(state_.passphrase_type); for (auto& observer : observers_) { observer.OnPassphraseTypeChanged(enum_passphrase_type, GetExplicitPassphraseTime()); @@ -654,17 +582,17 @@ UMA_HISTOGRAM_ENUMERATION("Sync.PassphraseType", enum_passphrase_type); } UMA_HISTOGRAM_BOOLEAN("Sync.CryptographerReady", - cryptographer_->CanEncrypt()); + state_.cryptographer->CanEncrypt()); UMA_HISTOGRAM_BOOLEAN("Sync.CryptographerPendingKeys", - pending_keys_.has_value()); - if (pending_keys_ && - passphrase_type_ == NigoriSpecifics::KEYSTORE_PASSPHRASE) { + state_.pending_keys.has_value()); + if (state_.pending_keys.has_value() && + state_.passphrase_type == NigoriSpecifics::KEYSTORE_PASSPHRASE) { // If this is happening, it means the keystore decryptor is either // undecryptable with the available keystore keys or does not match the // nigori keybag's encryption key. Otherwise we're simply missing the // keystore key. UMA_HISTOGRAM_BOOLEAN("Sync.KeystoreDecryptionFailed", - !keystore_keys_.empty()); + !state_.keystore_keys.empty()); } return true; } @@ -672,7 +600,7 @@ void NigoriSyncBridgeImpl::SetEncryptionPassphrase( const std::string& passphrase) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - switch (passphrase_type_) { + switch (state_.passphrase_type) { case NigoriSpecifics::IMPLICIT_PASSPHRASE: case NigoriSpecifics::UNKNOWN: NOTREACHED(); @@ -691,25 +619,25 @@ case NigoriSpecifics::TRUSTED_VAULT_PASSPHRASE: break; } - DCHECK(cryptographer_->CanEncrypt()); + DCHECK(state_.cryptographer->CanEncrypt()); const KeyDerivationParams custom_passphrase_key_derivation_params = CreateKeyDerivationParamsForCustomPassphrase(random_salt_generator_); - const std::string default_key_name = cryptographer_->EmplaceKey( + const std::string default_key_name = state_.cryptographer->EmplaceKey( passphrase, custom_passphrase_key_derivation_params); if (default_key_name.empty()) { DLOG(ERROR) << "Failed to set encryption passphrase"; return; } - cryptographer_->SelectDefaultEncryptionKey(default_key_name); - passphrase_type_ = NigoriSpecifics::CUSTOM_PASSPHRASE; - custom_passphrase_key_derivation_params_ = + state_.cryptographer->SelectDefaultEncryptionKey(default_key_name); + state_.passphrase_type = NigoriSpecifics::CUSTOM_PASSPHRASE; + state_.custom_passphrase_key_derivation_params = custom_passphrase_key_derivation_params; - encrypt_everything_ = true; - custom_passphrase_time_ = base::Time::Now(); + state_.encrypt_everything = true; + state_.custom_passphrase_time = base::Time::Now(); processor_->Put(GetData()); storage_->StoreData(SerializeAsNigoriLocalData()); for (auto& observer : observers_) { @@ -717,15 +645,15 @@ } for (auto& observer : observers_) { observer.OnPassphraseTypeChanged(PassphraseType::kCustomPassphrase, - custom_passphrase_time_); + state_.custom_passphrase_time); } for (auto& observer : observers_) { - observer.OnCryptographerStateChanged(cryptographer_.get(), - pending_keys_.has_value()); + observer.OnCryptographerStateChanged(state_.cryptographer.get(), + state_.pending_keys.has_value()); } for (auto& observer : observers_) { observer.OnEncryptedTypesChanged(EncryptableUserTypes(), - encrypt_everything_); + state_.encrypt_everything); } MaybeNotifyBootstrapTokenUpdated(); UMA_HISTOGRAM_BOOLEAN("Sync.CustomEncryption", true); @@ -739,9 +667,9 @@ // |passphrase| should be a valid one already (verified by SyncServiceCrypto, // using pending keys exposed by OnPassphraseRequired()). DCHECK(!passphrase.empty()); - DCHECK(pending_keys_); + DCHECK(state_.pending_keys); - const std::string new_key_name = cryptographer_->EmplaceKey( + const std::string new_key_name = state_.cryptographer->EmplaceKey( passphrase, GetKeyDerivationParamsForPendingKeys()); if (new_key_name.empty()) { processor_->ReportError(ModelError( @@ -750,7 +678,8 @@ } sync_pb::NigoriKeyBag decrypted_pending_keys; - if (!cryptographer_->Decrypt(*pending_keys_, &decrypted_pending_keys)) { + if (!state_.cryptographer->Decrypt(*state_.pending_keys, + &decrypted_pending_keys)) { // TODO(crbug.com/922900): old implementation assumes that pending keys // encryption key may change in between of OnPassphraseRequired() and // SetDecryptionPassphrase() calls, verify whether it's really possible. @@ -762,15 +691,15 @@ return; } - cryptographer_->EmplaceKeysFrom( + state_.cryptographer->EmplaceKeysFrom( NigoriKeyBag::CreateFromProto(decrypted_pending_keys)); - cryptographer_->SelectDefaultEncryptionKey(new_key_name); - pending_keys_.reset(); + state_.cryptographer->SelectDefaultEncryptionKey(new_key_name); + state_.pending_keys.reset(); storage_->StoreData(SerializeAsNigoriLocalData()); for (auto& observer : observers_) { - observer.OnCryptographerStateChanged(cryptographer_.get(), - pending_keys_.has_value()); + observer.OnCryptographerStateChanged(state_.cryptographer.get(), + state_.pending_keys.has_value()); } for (auto& observer : observers_) { observer.OnPassphraseAccepted(); @@ -795,8 +724,7 @@ base::Time NigoriSyncBridgeImpl::GetKeystoreMigrationTime() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - NOTIMPLEMENTED(); - return base::Time(); + return state_.keystore_migration_time; } KeystoreKeysHandler* NigoriSyncBridgeImpl::GetKeystoreKeysHandler() { @@ -811,7 +739,7 @@ // server responsibility to send updated keystore keys. |keystore_keys_| is // expected to be non-empty before MergeSyncData() call, regardless of // passphrase type. - return keystore_keys_.empty(); + return state_.keystore_keys.empty(); } bool NigoriSyncBridgeImpl::SetKeystoreKeys( @@ -821,13 +749,13 @@ return false; } - keystore_keys_.resize(keys.size()); + state_.keystore_keys.resize(keys.size()); for (size_t i = 0; i < keys.size(); ++i) { // We need to apply base64 encoding before using the keys to provide // backward compatibility with non-USS implementation. It's actually needed // only for the keys persisting, but was applied before passing keys to // cryptographer, so we have to do the same. - base::Base64Encode(keys[i], &keystore_keys_[i]); + base::Base64Encode(keys[i], &state_.keystore_keys[i]); } // Note: we don't need to persist keystore keys here, because we will receive @@ -858,11 +786,11 @@ "sync of Nigori."); } DCHECK(data->specifics.has_nigori()); - // Ensure we have |keystore_keys_| during the initial download, requested to + // Ensure we have |keystore_keys| during the initial download, requested to // the server as per NeedKeystoreKey(), and required for decrypting the // keystore_decryptor_token in specifics or initializing the default keystore // Nigori. - if (keystore_keys_.empty()) { + if (state_.keystore_keys.empty()) { // TODO(crbug.com/922900): verify, whether it's a valid behavior for custom // passphrase. return ModelError(FROM_HERE, @@ -875,7 +803,7 @@ // We received uninitialized Nigori and need to initialize it as default // keystore Nigori. base::Optional<NigoriSpecifics> initialized_specifics = - MakeDefaultKeystoreNigori(keystore_keys_); + MakeDefaultKeystoreNigori(state_.keystore_keys); if (!initialized_specifics) { return ModelError(FROM_HERE, "Failed to initialize keystore Nigori."); } @@ -887,7 +815,7 @@ base::Optional<ModelError> NigoriSyncBridgeImpl::ApplySyncChanges( base::Optional<EntityData> data) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_NE(passphrase_type_, NigoriSpecifics::UNKNOWN); + DCHECK_NE(state_.passphrase_type, NigoriSpecifics::UNKNOWN); if (!data) { // Receiving empty |data| means metadata-only change, we need to persist // its state. @@ -909,33 +837,34 @@ DCHECK_NE(new_passphrase_type, NigoriSpecifics::UNKNOWN); if (!IsValidPassphraseTransition( - /*old_passphrase_type=*/passphrase_type_, new_passphrase_type)) { + /*old_passphrase_type=*/state_.passphrase_type, + new_passphrase_type)) { return ModelError(FROM_HERE, "Invalid passphrase type transition."); } - if (!IsValidEncryptedTypesTransition(encrypt_everything_, specifics)) { + if (!IsValidEncryptedTypesTransition(state_.encrypt_everything, specifics)) { return ModelError(FROM_HERE, "Invalid encrypted types transition."); } const bool passphrase_type_changed = - UpdatePassphraseType(new_passphrase_type, &passphrase_type_); - DCHECK_NE(passphrase_type_, NigoriSpecifics::UNKNOWN); + UpdatePassphraseType(new_passphrase_type, &state_.passphrase_type); + DCHECK_NE(state_.passphrase_type, NigoriSpecifics::UNKNOWN); const bool encrypted_types_changed = - UpdateEncryptedTypes(specifics, &encrypt_everything_); + UpdateEncryptedTypes(specifics, &state_.encrypt_everything); if (specifics.has_custom_passphrase_time()) { - custom_passphrase_time_ = + state_.custom_passphrase_time = ProtoTimeToTime(specifics.custom_passphrase_time()); } if (specifics.has_keystore_migration_time()) { - keystore_migration_time_ = + state_.keystore_migration_time = ProtoTimeToTime(specifics.keystore_migration_time()); } - DCHECK(!keystore_keys_.empty()); + DCHECK(!state_.keystore_keys.empty()); const sync_pb::EncryptedData& encryption_keybag = specifics.encryption_keybag(); - switch (passphrase_type_) { + switch (state_.passphrase_type) { case NigoriSpecifics::UNKNOWN: case NigoriSpecifics::IMPLICIT_PASSPHRASE: // NigoriSpecifics with UNKNOWN or IMPLICIT_PASSPHRASE type is not valid @@ -952,7 +881,7 @@ break; } case NigoriSpecifics::CUSTOM_PASSPHRASE: - custom_passphrase_key_derivation_params_ = + state_.custom_passphrase_key_derivation_params = GetKeyDerivationParamsFromSpecifics(specifics); FALLTHROUGH; case NigoriSpecifics::FROZEN_IMPLICIT_PASSPHRASE: @@ -964,30 +893,30 @@ if (passphrase_type_changed) { for (auto& observer : observers_) { observer.OnPassphraseTypeChanged( - *ProtoPassphraseInt32ToEnum(passphrase_type_), + *ProtoPassphraseInt32ToEnum(state_.passphrase_type), GetExplicitPassphraseTime()); } } if (encrypted_types_changed) { // Currently the only way to change encrypted types is to enable // encrypt_everything. - DCHECK(encrypt_everything_); + DCHECK(state_.encrypt_everything); for (auto& observer : observers_) { observer.OnEncryptedTypesChanged(EncryptableUserTypes(), - encrypt_everything_); + state_.encrypt_everything); } } for (auto& observer : observers_) { - observer.OnCryptographerStateChanged(cryptographer_.get(), - pending_keys_.has_value()); + observer.OnCryptographerStateChanged(state_.cryptographer.get(), + state_.pending_keys.has_value()); } - if (pending_keys_) { + if (state_.pending_keys.has_value()) { // Update with keystore Nigori shouldn't reach this point, since it should // report model error if it has pending keys. for (auto& observer : observers_) { observer.OnPassphraseRequired(REASON_DECRYPTION, GetKeyDerivationParamsForPendingKeys(), - *pending_keys_); + *state_.pending_keys); } } return base::nullopt; @@ -1000,17 +929,18 @@ DCHECK(!encryption_keybag.blob().empty()); DCHECK(!keystore_decryptor_token.blob().empty()); - cryptographer_->EmplaceKeysFrom( - DecryptKeystoreDecryptorToken(keystore_keys_, keystore_decryptor_token)); + state_.cryptographer->EmplaceKeysFrom(DecryptKeystoreDecryptorToken( + state_.keystore_keys, keystore_decryptor_token)); sync_pb::NigoriKeyBag key_bag; - if (!cryptographer_->Decrypt(encryption_keybag, &key_bag)) { + if (!state_.cryptographer->Decrypt(encryption_keybag, &key_bag)) { return ModelError(FROM_HERE, "Failed to decrypt incoming keystore nigori."); } - cryptographer_->EmplaceKeysFrom(NigoriKeyBag::CreateFromProto(key_bag)); - pending_keys_.reset(); - cryptographer_->SelectDefaultEncryptionKey(encryption_keybag.key_name()); + state_.cryptographer->EmplaceKeysFrom(NigoriKeyBag::CreateFromProto(key_bag)); + state_.pending_keys.reset(); + state_.cryptographer->SelectDefaultEncryptionKey( + encryption_keybag.key_name()); return base::nullopt; } @@ -1019,20 +949,20 @@ // TODO(crbug.com/922900): support the case when client knows passphrase. NOTIMPLEMENTED(); DCHECK(!encryption_keybag.blob().empty()); - if (!cryptographer_->CanDecrypt(encryption_keybag)) { + if (!state_.cryptographer->CanDecrypt(encryption_keybag)) { // Historically, prior to USS, key derived from explicit passphrase was // stored in prefs and effectively we do migration here. NigoriKeyBag key_bag = NigoriKeyBag::CreateEmpty(); const std::string key_name = key_bag.AddKeyFromProto(explicit_passphrase_key_); if (key_bag.CanDecrypt(encryption_keybag)) { - cryptographer_->EmplaceKeysFrom(key_bag); - DCHECK(cryptographer_->CanDecrypt(encryption_keybag)); - cryptographer_->SelectDefaultEncryptionKey(key_name); + state_.cryptographer->EmplaceKeysFrom(key_bag); + DCHECK(state_.cryptographer->CanDecrypt(encryption_keybag)); + state_.cryptographer->SelectDefaultEncryptionKey(key_name); } else { // This will lead to OnPassphraseRequired() call later. - pending_keys_ = encryption_keybag; - cryptographer_->ClearDefaultEncryptionKey(); + state_.pending_keys = encryption_keybag; + state_.cryptographer->ClearDefaultEncryptionKey(); return; } } @@ -1045,53 +975,53 @@ // TODO(crbug.com/922900): we may also need to rewrite Nigori with keys // currently stored in cryptographer, in case it doesn't have them already. sync_pb::NigoriKeyBag key_bag; - cryptographer_->Decrypt(encryption_keybag, &key_bag); - cryptographer_->EmplaceKeysFrom(NigoriKeyBag::CreateFromProto(key_bag)); + state_.cryptographer->Decrypt(encryption_keybag, &key_bag); + state_.cryptographer->EmplaceKeysFrom(NigoriKeyBag::CreateFromProto(key_bag)); } std::unique_ptr<EntityData> NigoriSyncBridgeImpl::GetData() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (passphrase_type_ == NigoriSpecifics::UNKNOWN) { + if (state_.passphrase_type == NigoriSpecifics::UNKNOWN) { // Bridge never received NigoriSpecifics from the server. This line should // be reachable only from processor's GetAllNodesForDebugging(). - DCHECK(!cryptographer_->CanEncrypt()); - DCHECK(!pending_keys_.has_value()); + DCHECK(!state_.cryptographer->CanEncrypt()); + DCHECK(!state_.pending_keys.has_value()); return nullptr; } NigoriSpecifics specifics; - if (cryptographer_->CanEncrypt()) { - EncryptKeyBag(*cryptographer_, specifics.mutable_encryption_keybag()); + if (state_.cryptographer->CanEncrypt()) { + EncryptKeyBag(*state_.cryptographer, specifics.mutable_encryption_keybag()); } else { - DCHECK(pending_keys_.has_value()); + DCHECK(state_.pending_keys.has_value()); // This case is reachable only from processor's GetAllNodesForDebugging(), // since currently commit is never issued while bridge has |pending_keys_|. // Note: with complete support of TRUSTED_VAULT mode, commit might be // issued in this case as well. - *specifics.mutable_encryption_keybag() = *pending_keys_; + *specifics.mutable_encryption_keybag() = *state_.pending_keys; } specifics.set_keybag_is_frozen(true); - specifics.set_encrypt_everything(encrypt_everything_); - if (encrypt_everything_) { + specifics.set_encrypt_everything(state_.encrypt_everything); + if (state_.encrypt_everything) { UpdateNigoriSpecificsFromEncryptedTypes(EncryptableUserTypes(), &specifics); } - specifics.set_passphrase_type(passphrase_type_); - if (passphrase_type_ == NigoriSpecifics::CUSTOM_PASSPHRASE) { - DCHECK(custom_passphrase_key_derivation_params_); + specifics.set_passphrase_type(state_.passphrase_type); + if (state_.passphrase_type == NigoriSpecifics::CUSTOM_PASSPHRASE) { + DCHECK(state_.custom_passphrase_key_derivation_params); UpdateSpecificsFromKeyDerivationParams( - *custom_passphrase_key_derivation_params_, &specifics); + *state_.custom_passphrase_key_derivation_params, &specifics); } - if (passphrase_type_ == NigoriSpecifics::KEYSTORE_PASSPHRASE) { - EncryptKeystoreDecryptorToken(*cryptographer_, + if (state_.passphrase_type == NigoriSpecifics::KEYSTORE_PASSPHRASE) { + EncryptKeystoreDecryptorToken(*state_.cryptographer, specifics.mutable_keystore_decryptor_token()); } - if (!keystore_migration_time_.is_null()) { + if (!state_.keystore_migration_time.is_null()) { specifics.set_keystore_migration_time( - TimeToProtoTime(keystore_migration_time_)); + TimeToProtoTime(state_.keystore_migration_time)); } - if (!custom_passphrase_time_.is_null()) { + if (!state_.custom_passphrase_time.is_null()) { specifics.set_custom_passphrase_time( - TimeToProtoTime(custom_passphrase_time_)); + TimeToProtoTime(state_.custom_passphrase_time)); } // TODO(crbug.com/922900): add other fields support. NOTIMPLEMENTED(); @@ -1124,16 +1054,16 @@ // |explicit_passphrase_key_| will become not working, once we clean up // storing explicit passphrase key in prefs, we need to find better solution. storage_->ClearData(); - keystore_keys_.clear(); - cryptographer_ = CryptographerImpl::CreateEmpty(); - pending_keys_.reset(); - passphrase_type_ = NigoriSpecifics::UNKNOWN; - encrypt_everything_ = false; - custom_passphrase_time_ = base::Time(); - keystore_migration_time_ = base::Time(); - custom_passphrase_key_derivation_params_ = base::nullopt; + state_.keystore_keys.clear(); + state_.cryptographer = CryptographerImpl::CreateEmpty(); + state_.pending_keys.reset(); + state_.passphrase_type = NigoriSpecifics::UNKNOWN; + state_.encrypt_everything = false; + state_.custom_passphrase_time = base::Time(); + state_.keystore_migration_time = base::Time(); + state_.custom_passphrase_key_derivation_params = base::nullopt; for (auto& observer : observers_) { - observer.OnCryptographerStateChanged(cryptographer_.get(), + observer.OnCryptographerStateChanged(state_.cryptographer.get(), /*has_pending_keys=*/false); } for (auto& observer : observers_) { @@ -1142,20 +1072,20 @@ } const Cryptographer& NigoriSyncBridgeImpl::GetCryptographerForTesting() const { - return *cryptographer_; + return *state_.cryptographer; } sync_pb::NigoriSpecifics::PassphraseType NigoriSyncBridgeImpl::GetPassphraseTypeForTesting() const { - return passphrase_type_; + return state_.passphrase_type; } ModelTypeSet NigoriSyncBridgeImpl::GetEncryptedTypesForTesting() const { - return GetEncryptedTypes(encrypt_everything_); + return GetEncryptedTypes(state_.encrypt_everything); } bool NigoriSyncBridgeImpl::HasPendingKeysForTesting() const { - return pending_keys_.has_value(); + return state_.pending_keys.has_value(); } std::string NigoriSyncBridgeImpl::PackExplicitPassphraseKeyForTesting( @@ -1165,7 +1095,7 @@ } base::Time NigoriSyncBridgeImpl::GetExplicitPassphraseTime() const { - switch (passphrase_type_) { + switch (state_.passphrase_type) { case NigoriSpecifics::IMPLICIT_PASSPHRASE: // IMPLICIT_PASSPHRASE type isn't supported and should be never set as // |passphrase_type_|; @@ -1176,17 +1106,17 @@ case NigoriSpecifics::TRUSTED_VAULT_PASSPHRASE: return base::Time(); case NigoriSpecifics::FROZEN_IMPLICIT_PASSPHRASE: - return keystore_migration_time_; + return state_.keystore_migration_time; case NigoriSpecifics::CUSTOM_PASSPHRASE: - return custom_passphrase_time_; + return state_.custom_passphrase_time; } NOTREACHED(); - return custom_passphrase_time_; + return state_.custom_passphrase_time; } KeyDerivationParams NigoriSyncBridgeImpl::GetKeyDerivationParamsForPendingKeys() const { - switch (passphrase_type_) { + switch (state_.passphrase_type) { case NigoriSpecifics::UNKNOWN: case NigoriSpecifics::IMPLICIT_PASSPHRASE: case NigoriSpecifics::KEYSTORE_PASSPHRASE: @@ -1196,13 +1126,13 @@ case NigoriSpecifics::TRUSTED_VAULT_PASSPHRASE: return KeyDerivationParams::CreateForPbkdf2(); case NigoriSpecifics::CUSTOM_PASSPHRASE: - DCHECK(custom_passphrase_key_derivation_params_); - return *custom_passphrase_key_derivation_params_; + DCHECK(state_.custom_passphrase_key_derivation_params); + return *state_.custom_passphrase_key_derivation_params; } } void NigoriSyncBridgeImpl::MaybeNotifyBootstrapTokenUpdated() const { - switch (passphrase_type_) { + switch (state_.passphrase_type) { case NigoriSpecifics::UNKNOWN: case NigoriSpecifics::IMPLICIT_PASSPHRASE: NOTREACHED(); @@ -1222,7 +1152,7 @@ // |packed_custom_passphrase_key| will be empty in case serialization or // encryption error occurs. std::string packed_custom_passphrase_key = - PackExplicitPassphraseKey(*encryptor_, *cryptographer_); + PackExplicitPassphraseKey(*encryptor_, *state_.cryptographer); if (!packed_custom_passphrase_key.empty()) { for (auto& observer : observers_) { observer.OnBootstrapTokenUpdated(packed_custom_passphrase_key, @@ -1244,41 +1174,7 @@ } // Serialize the data. - sync_pb::NigoriModel* nigori_model = output.mutable_nigori_model(); - *nigori_model->mutable_cryptographer_data() = cryptographer_->ToProto(); - if (pending_keys_) { - *nigori_model->mutable_pending_keys() = *pending_keys_; - } - if (!keystore_keys_.empty()) { - nigori_model->set_current_keystore_key_name( - ComputePbkdf2KeyName(keystore_keys_.back())); - } - nigori_model->set_passphrase_type(passphrase_type_); - if (!keystore_migration_time_.is_null()) { - nigori_model->set_keystore_migration_time( - TimeToProtoTime(keystore_migration_time_)); - } - if (!custom_passphrase_time_.is_null()) { - nigori_model->set_custom_passphrase_time( - TimeToProtoTime(custom_passphrase_time_)); - } - if (custom_passphrase_key_derivation_params_) { - *nigori_model->mutable_custom_passphrase_key_derivation_params() = - CustomPassphraseKeyDerivationParamsToProto( - *custom_passphrase_key_derivation_params_); - } - nigori_model->set_encrypt_everything(encrypt_everything_); - for (ModelType model_type : GetEncryptedTypes(encrypt_everything_)) { - nigori_model->add_encrypted_types_specifics_field_number( - GetSpecificsFieldNumberFromModelType(model_type)); - } - // TODO(crbug.com/970213): we currently store keystore keys in proto only to - // allow rollback of USS Nigori. Having keybag with all keystore keys and - // |current_keystore_key_name| is enough to support all bridge logic. We - // should remove them few milestones after USS migration completed. - for (const std::string& keystore_key : keystore_keys_) { - nigori_model->add_keystore_key(keystore_key); - } + *output.mutable_nigori_model() = state_.ToProto(); return output; }
diff --git a/components/sync/nigori/nigori_sync_bridge_impl.h b/components/sync/nigori/nigori_sync_bridge_impl.h index 6f5e769..fbf29e0b 100644 --- a/components/sync/nigori/nigori_sync_bridge_impl.h +++ b/components/sync/nigori/nigori_sync_bridge_impl.h
@@ -21,6 +21,7 @@ #include "components/sync/nigori/cryptographer_impl.h" #include "components/sync/nigori/keystore_keys_handler.h" #include "components/sync/nigori/nigori_local_change_processor.h" +#include "components/sync/nigori/nigori_state.h" #include "components/sync/nigori/nigori_sync_bridge.h" namespace sync_pb { @@ -130,32 +131,7 @@ // decryption/decoding errors. const sync_pb::NigoriKey explicit_passphrase_key_; - // Base64 encoded keystore keys. The last element is the current keystore - // key. These keys are not a part of Nigori node and are persisted - // separately. Should be encrypted with OSCrypt before persisting. - std::vector<std::string> keystore_keys_; - - std::unique_ptr<CryptographerImpl> cryptographer_; - - // Pending keys represent a remote update that contained a keybag that cannot - // be decrypted (e.g. user needs to enter a custom passphrase). If pending - // keys are present, |*cryptographer_| does not have a default encryption key - // set and instead the should-be default encryption key is determined by the - // key in |pending_keys_|. - base::Optional<sync_pb::EncryptedData> pending_keys_; - - // TODO(mmoskvitin): Consider adopting the C++ enum PassphraseType here and - // if so remove function ProtoPassphraseInt32ToProtoEnum() from - // passphrase_enums.h. - sync_pb::NigoriSpecifics::PassphraseType passphrase_type_; - bool encrypt_everything_; - base::Time custom_passphrase_time_; - base::Time keystore_migration_time_; - - // The key derivation params we are using for the custom passphrase. Set iff - // |passphrase_type_| is CUSTOM_PASSPHRASE, otherwise key derivation method - // is always PBKDF2. - base::Optional<KeyDerivationParams> custom_passphrase_key_derivation_params_; + syncer::NigoriState state_; // TODO(crbug/922900): consider using checked ObserverList once // SyncEncryptionHandlerImpl is no longer needed or consider refactoring old
diff --git a/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc b/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc index ec98dc9..6fc8832 100644 --- a/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc +++ b/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc
@@ -193,6 +193,7 @@ specifics.mutable_keystore_decryptor_token())); specifics.set_passphrase_type(sync_pb::NigoriSpecifics::KEYSTORE_PASSPHRASE); + specifics.set_keystore_migration_time(TimeToProtoTime(base::Time::Now())); return specifics; } @@ -394,6 +395,7 @@ NotNull(), /*has_pending_keys=*/false)); EXPECT_THAT(bridge()->MergeSyncData(std::move(entity_data)), Eq(base::nullopt)); + EXPECT_THAT(bridge()->GetKeystoreMigrationTime(), Not(NullTime())); const Cryptographer& cryptographer = bridge()->GetCryptographerForTesting(); EXPECT_THAT(cryptographer, CanDecryptWith(kKeystoreKeyParams)); @@ -497,12 +499,13 @@ EXPECT_THAT(bridge()->MergeSyncData(std::move(default_entity_data)), Eq(base::nullopt)); EXPECT_THAT(bridge()->GetData(), HasKeystoreNigori()); + EXPECT_THAT(bridge()->GetKeystoreMigrationTime(), Not(NullTime())); + EXPECT_EQ(bridge()->GetPassphraseTypeForTesting(), + sync_pb::NigoriSpecifics::KEYSTORE_PASSPHRASE); const Cryptographer& cryptographer = bridge()->GetCryptographerForTesting(); EXPECT_THAT(cryptographer, CanDecryptWith(kKeystoreKeyParams)); EXPECT_THAT(cryptographer, HasDefaultKeyDerivedFrom(kKeystoreKeyParams)); - // TODO(crbug.com/922900): verify that passphrase type is equal to - // KeystorePassphrase once passphrase type support is implemented. } // Tests that we can perform initial sync with custom passphrase Nigori.
diff --git a/components/sync_device_info/device_info.cc b/components/sync_device_info/device_info.cc index 276db02..2d4b3c7 100644 --- a/components/sync_device_info/device_info.cc +++ b/components/sync_device_info/device_info.cc
@@ -8,6 +8,31 @@ namespace syncer { +DeviceInfo::SharingInfo::SharingInfo( + std::string fcm_token, + std::string p256dh, + std::string auth_secret, + std::set<sync_pb::SharingSpecificFields::EnabledFeatures> enabled_features) + : fcm_token(std::move(fcm_token)), + p256dh(std::move(p256dh)), + auth_secret(std::move(auth_secret)), + enabled_features(std::move(enabled_features)) {} + +DeviceInfo::SharingInfo::SharingInfo(const SharingInfo& other) = default; + +DeviceInfo::SharingInfo::SharingInfo(SharingInfo&& other) = default; + +DeviceInfo::SharingInfo& DeviceInfo::SharingInfo::operator=( + const SharingInfo& other) = default; + +DeviceInfo::SharingInfo::~SharingInfo() = default; + +bool DeviceInfo::SharingInfo::operator==(const SharingInfo& other) const { + return fcm_token == other.fcm_token && p256dh == other.p256dh && + auth_secret == other.auth_secret && + enabled_features == other.enabled_features; +} + DeviceInfo::DeviceInfo(const std::string& guid, const std::string& client_name, const std::string& chrome_version, @@ -15,7 +40,8 @@ const sync_pb::SyncEnums::DeviceType device_type, const std::string& signin_scoped_device_id, base::Time last_updated_timestamp, - bool send_tab_to_self_receiving_enabled) + bool send_tab_to_self_receiving_enabled, + const base::Optional<SharingInfo>& sharing_info) : guid_(guid), client_name_(client_name), chrome_version_(chrome_version), @@ -23,7 +49,8 @@ device_type_(device_type), signin_scoped_device_id_(signin_scoped_device_id), last_updated_timestamp_(last_updated_timestamp), - send_tab_to_self_receiving_enabled_(send_tab_to_self_receiving_enabled) {} + send_tab_to_self_receiving_enabled_(send_tab_to_self_receiving_enabled), + sharing_info_(sharing_info) {} DeviceInfo::~DeviceInfo() {} @@ -63,6 +90,11 @@ return send_tab_to_self_receiving_enabled_; } +const base::Optional<DeviceInfo::SharingInfo>& DeviceInfo::sharing_info() + const { + return sharing_info_; +} + std::string DeviceInfo::GetOSString() const { switch (device_type_) { case sync_pb::SyncEnums_DeviceType_TYPE_WIN: @@ -107,7 +139,8 @@ this->device_type() == other.device_type() && this->signin_scoped_device_id() == other.signin_scoped_device_id() && this->send_tab_to_self_receiving_enabled() == - other.send_tab_to_self_receiving_enabled(); + other.send_tab_to_self_receiving_enabled() && + this->sharing_info() == other.sharing_info(); } std::unique_ptr<base::DictionaryValue> DeviceInfo::ToValue() { @@ -120,6 +153,7 @@ value->SetInteger("lastUpdatedTimestamp", last_updated_timestamp().ToTimeT()); value->SetBoolean("sendTabToSelfReceivingEnabled", send_tab_to_self_receiving_enabled()); + value->SetBoolean("hasSharingInfo", sharing_info().has_value()); return value; } @@ -131,4 +165,9 @@ send_tab_to_self_receiving_enabled_ = new_value; } +void DeviceInfo::set_sharing_info( + const base::Optional<SharingInfo>& sharing_info) { + sharing_info_ = sharing_info; +} + } // namespace syncer
diff --git a/components/sync_device_info/device_info.h b/components/sync_device_info/device_info.h index e4a2c9a..3e17461 100644 --- a/components/sync_device_info/device_info.h +++ b/components/sync_device_info/device_info.h
@@ -6,10 +6,12 @@ #define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_H_ #include <memory> +#include <set> #include <string> #include "base/callback.h" #include "base/macros.h" +#include "base/optional.h" #include "base/time/time.h" #include "components/sync/protocol/sync.pb.h" @@ -22,6 +24,32 @@ // A class that holds information regarding the properties of a device. class DeviceInfo { public: + struct SharingInfo { + SharingInfo(std::string fcm_token, + std::string p256dh, + std::string auth_secret, + std::set<sync_pb::SharingSpecificFields::EnabledFeatures> + enabled_features); + SharingInfo(const SharingInfo& other); + SharingInfo(SharingInfo&& other); + SharingInfo& operator=(const SharingInfo& other); + ~SharingInfo(); + + // FCM registration token of device for sending Sharing messages. + std::string fcm_token; + + // Subscription public key required for Sharing message encryption[RFC8291]. + std::string p256dh; + + // Auth secret key required for Sharing message encryption[RFC8291]. + std::string auth_secret; + + // Set of Sharing features enabled on the device. + std::set<sync_pb::SharingSpecificFields::EnabledFeatures> enabled_features; + + bool operator==(const SharingInfo& other) const; + }; + DeviceInfo(const std::string& guid, const std::string& client_name, const std::string& chrome_version, @@ -29,7 +57,8 @@ const sync_pb::SyncEnums::DeviceType device_type, const std::string& signin_scoped_device_id, base::Time last_updated_timestamp, - bool send_tab_to_self_receiving_enabled); + bool send_tab_to_self_receiving_enabled, + const base::Optional<SharingInfo>& sharing_info); ~DeviceInfo(); // Sync specific unique identifier for the device. Note if a device @@ -65,6 +94,9 @@ // Whether the receiving side of the SendTabToSelf feature is enabled. bool send_tab_to_self_receiving_enabled() const; + // Returns Sharing related info of the device. + const base::Optional<SharingInfo>& sharing_info() const; + // Gets the OS in string form. std::string GetOSString() const; @@ -82,6 +114,8 @@ void set_send_tab_to_self_receiving_enabled(bool new_value); + void set_sharing_info(const base::Optional<SharingInfo>& sharing_info); + // Converts the |DeviceInfo| values to a JS friendly DictionaryValue, // which extension APIs can expose to third party apps. std::unique_ptr<base::DictionaryValue> ToValue(); @@ -109,6 +143,8 @@ bool send_tab_to_self_receiving_enabled_; + base::Optional<SharingInfo> sharing_info_; + DISALLOW_COPY_AND_ASSIGN(DeviceInfo); };
diff --git a/components/sync_device_info/device_info_sync_bridge.cc b/components/sync_device_info/device_info_sync_bridge.cc index e8b16a9..16676fdc 100644 --- a/components/sync_device_info/device_info_sync_bridge.cc +++ b/components/sync_device_info/device_info_sync_bridge.cc
@@ -34,6 +34,7 @@ using sync_pb::EntitySpecifics; using sync_pb::FeatureSpecificFields; using sync_pb::ModelTypeState; +using sync_pb::SharingSpecificFields; using Record = ModelTypeStore::Record; using RecordList = ModelTypeStore::RecordList; @@ -54,6 +55,22 @@ } } +base::Optional<DeviceInfo::SharingInfo> SpecificsToSharingInfo( + const DeviceInfoSpecifics& specifics) { + if (!specifics.has_sharing_fields()) { + return base::nullopt; + } + + std::set<SharingSpecificFields::EnabledFeatures> enabled_features; + for (int i = 0; i < specifics.sharing_fields().enabled_features_size(); ++i) { + enabled_features.insert(specifics.sharing_fields().enabled_features(i)); + } + return DeviceInfo::SharingInfo(specifics.sharing_fields().fcm_token(), + specifics.sharing_fields().p256dh(), + specifics.sharing_fields().auth_secret(), + std::move(enabled_features)); +} + // Converts DeviceInfoSpecifics into a freshly allocated DeviceInfo. std::unique_ptr<DeviceInfo> SpecificsToModel( const DeviceInfoSpecifics& specifics) { @@ -62,7 +79,8 @@ specifics.chrome_version(), specifics.sync_user_agent(), specifics.device_type(), specifics.signin_scoped_device_id(), ProtoTimeToTime(specifics.last_updated_timestamp()), - specifics.feature_fields().send_tab_to_self_receiving_enabled()); + specifics.feature_fields().send_tab_to_self_receiving_enabled(), + SpecificsToSharingInfo(specifics)); } // Allocate a EntityData and copies |specifics| into it. @@ -93,6 +111,19 @@ feature_fields->set_send_tab_to_self_receiving_enabled( info.send_tab_to_self_receiving_enabled()); + const base::Optional<DeviceInfo::SharingInfo>& sharing_info = + info.sharing_info(); + if (sharing_info) { + SharingSpecificFields* sharing_fields = specifics->mutable_sharing_fields(); + sharing_fields->set_fcm_token(sharing_info->fcm_token); + sharing_fields->set_p256dh(sharing_info->p256dh); + sharing_fields->set_auth_secret(sharing_info->auth_secret); + for (sync_pb::SharingSpecificFields::EnabledFeatures feature : + sharing_info->enabled_features) { + sharing_fields->add_enabled_features(feature); + } + } + return specifics; }
diff --git a/components/sync_device_info/device_info_sync_bridge_unittest.cc b/components/sync_device_info/device_info_sync_bridge_unittest.cc index 25242578..74dad4d 100644 --- a/components/sync_device_info/device_info_sync_bridge_unittest.cc +++ b/components/sync_device_info/device_info_sync_bridge_unittest.cc
@@ -59,6 +59,26 @@ } MATCHER_P(ModelEqualsSpecifics, expected_specifics, "") { + if (expected_specifics.has_sharing_fields() != arg.sharing_info().has_value()) + return false; + + if (expected_specifics.has_sharing_fields()) { + auto& expected_fields = expected_specifics.sharing_fields(); + auto& arg_info = *arg.sharing_info(); + if (expected_fields.fcm_token() != arg_info.fcm_token || + expected_fields.p256dh() != arg_info.p256dh || + expected_fields.auth_secret() != arg_info.auth_secret || + static_cast<size_t>(expected_fields.enabled_features_size()) != + arg_info.enabled_features.size()) { + return false; + } + + for (int i = 0; i < expected_fields.enabled_features_size(); ++i) { + if (!arg_info.enabled_features.count(expected_fields.enabled_features(i))) + return false; + } + } + // Note that we ignore the device name here to avoid having to inject the // local device's. return expected_specifics.cache_guid() == arg.guid() && @@ -115,6 +135,24 @@ return base::StringPrintf("signin scoped device id %d", suffix); } +std::string SharingFcmTokenForSuffix(int suffix) { + return base::StringPrintf("sharing fcm token %d", suffix); +} + +std::string SharingP256dhForSuffix(int suffix) { + return base::StringPrintf("sharing p256dh %d", suffix); +} + +std::string SharingAuthSecretForSuffix(int suffix) { + return base::StringPrintf("sharing auth secret %d", suffix); +} + +sync_pb::SharingSpecificFields::EnabledFeatures SharingEnabledFeaturesForSuffix( + int suffix) { + return suffix % 2 ? sync_pb::SharingSpecificFields::CLICK_TO_CALL + : sync_pb::SharingSpecificFields::SHARED_CLIPBOARD; +} + DataTypeActivationRequest TestDataTypeActivationRequest() { DataTypeActivationRequest request; request.cache_guid = CacheGuidForSuffix(kLocalSuffix); @@ -134,6 +172,14 @@ specifics.set_last_updated_timestamp(TimeToProtoTime(last_updated)); specifics.mutable_feature_fields()->set_send_tab_to_self_receiving_enabled( true); + specifics.mutable_sharing_fields()->set_fcm_token( + SharingFcmTokenForSuffix(suffix)); + specifics.mutable_sharing_fields()->set_p256dh( + SharingP256dhForSuffix(suffix)); + specifics.mutable_sharing_fields()->set_auth_secret( + SharingAuthSecretForSuffix(suffix)); + specifics.mutable_sharing_fields()->add_enabled_features( + SharingEnabledFeaturesForSuffix(suffix)); return specifics; } @@ -188,11 +234,18 @@ // MutableLocalDeviceInfoProvider implementation. void Initialize(const std::string& cache_guid, const std::string& session_name) override { + std::set<sync_pb::SharingSpecificFields::EnabledFeatures> + sharing_enabled_features{SharingEnabledFeaturesForSuffix(kLocalSuffix)}; local_device_info_ = std::make_unique<DeviceInfo>( cache_guid, session_name, ChromeVersionForSuffix(kLocalSuffix), SyncUserAgentForSuffix(kLocalSuffix), sync_pb::SyncEnums_DeviceType_TYPE_LINUX, - SigninScopedDeviceIdForSuffix(kLocalSuffix), base::Time(), true); + SigninScopedDeviceIdForSuffix(kLocalSuffix), base::Time(), + /*send_tab_to_self_receiving_enabled=*/true, + DeviceInfo::SharingInfo(SharingFcmTokenForSuffix(kLocalSuffix), + SharingP256dhForSuffix(kLocalSuffix), + SharingAuthSecretForSuffix(kLocalSuffix), + sharing_enabled_features)); } void Clear() override { local_device_info_.reset(); }
diff --git a/components/sync_device_info/device_info_sync_client.h b/components/sync_device_info/device_info_sync_client.h index 386038d..e6f0d02f 100644 --- a/components/sync_device_info/device_info_sync_client.h +++ b/components/sync_device_info/device_info_sync_client.h
@@ -6,8 +6,9 @@ #define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_SYNC_CLIENT_H_ #include <string> - #include "base/macros.h" +#include "base/optional.h" +#include "components/sync_device_info/device_info.h" namespace syncer { @@ -19,6 +20,8 @@ virtual std::string GetSigninScopedDeviceId() const = 0; virtual bool GetSendTabToSelfReceivingEnabled() const = 0; + virtual base::Optional<DeviceInfo::SharingInfo> GetLocalSharingInfo() + const = 0; private: DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncClient);
diff --git a/components/sync_device_info/fake_device_info_tracker.cc b/components/sync_device_info/fake_device_info_tracker.cc index 51b8032d..8360aae5 100644 --- a/components/sync_device_info/fake_device_info_tracker.cc +++ b/components/sync_device_info/fake_device_info_tracker.cc
@@ -17,7 +17,8 @@ device_info.chrome_version(), device_info.sync_user_agent(), device_info.device_type(), device_info.signin_scoped_device_id(), device_info.last_updated_timestamp(), - device_info.send_tab_to_self_receiving_enabled()); + device_info.send_tab_to_self_receiving_enabled(), + device_info.sharing_info()); } } // namespace
diff --git a/components/sync_device_info/local_device_info_provider_impl.cc b/components/sync_device_info/local_device_info_provider_impl.cc index aae8589..5574be15 100644 --- a/components/sync_device_info/local_device_info_provider_impl.cc +++ b/components/sync_device_info/local_device_info_provider_impl.cc
@@ -38,6 +38,7 @@ local_device_info_->set_send_tab_to_self_receiving_enabled( sync_client_->GetSendTabToSelfReceivingEnabled()); + local_device_info_->set_sharing_info(sync_client_->GetLocalSharingInfo()); return local_device_info_.get(); } @@ -60,7 +61,8 @@ cache_guid, session_name, version_, MakeUserAgentForSync(channel_), GetLocalDeviceType(), sync_client_->GetSigninScopedDeviceId(), /*last_updated_timestamp=*/base::Time(), - sync_client_->GetSendTabToSelfReceivingEnabled()); + sync_client_->GetSendTabToSelfReceivingEnabled(), + sync_client_->GetLocalSharingInfo()); // Notify observers. callback_list_.Notify();
diff --git a/components/sync_device_info/local_device_info_provider_impl_unittest.cc b/components/sync_device_info/local_device_info_provider_impl_unittest.cc index aabd8f0..dc2b545 100644 --- a/components/sync_device_info/local_device_info_provider_impl_unittest.cc +++ b/components/sync_device_info/local_device_info_provider_impl_unittest.cc
@@ -17,6 +17,12 @@ const char kLocalDeviceGuid[] = "foo"; const char kLocalDeviceSessionName[] = "bar"; +const char kSharingFCMToken[] = "test_fcm_token"; +const char kSharingP256dh[] = "test_p256_dh"; +const char kSharingAuthSecret[] = "test_auth_secret"; +const sync_pb::SharingSpecificFields::EnabledFeatures + kSharingEnabledFeatures[] = {sync_pb::SharingSpecificFields::CLICK_TO_CALL}; + using testing::NotNull; using testing::Return; @@ -27,6 +33,8 @@ MOCK_CONST_METHOD0(GetSigninScopedDeviceId, std::string()); MOCK_CONST_METHOD0(GetSendTabToSelfReceivingEnabled, bool()); + MOCK_CONST_METHOD0(GetLocalSharingInfo, + base::Optional<DeviceInfo::SharingInfo>()); private: DISALLOW_COPY_AND_ASSIGN(MockDeviceInfoSyncClient); @@ -104,5 +112,33 @@ provider_->GetLocalDeviceInfo()->send_tab_to_self_receiving_enabled()); } +TEST_F(LocalDeviceInfoProviderImplTest, SharingInfo) { + ON_CALL(device_info_sync_client_, GetLocalSharingInfo()) + .WillByDefault(Return(base::nullopt)); + + InitializeProvider(); + + ASSERT_THAT(provider_->GetLocalDeviceInfo(), NotNull()); + EXPECT_FALSE(provider_->GetLocalDeviceInfo()->sharing_info()); + + std::set<sync_pb::SharingSpecificFields::EnabledFeatures> enabled_features( + std::begin(kSharingEnabledFeatures), std::end(kSharingEnabledFeatures)); + base::Optional<DeviceInfo::SharingInfo> sharing_info = + base::make_optional<DeviceInfo::SharingInfo>( + kSharingFCMToken, kSharingP256dh, kSharingAuthSecret, + enabled_features); + ON_CALL(device_info_sync_client_, GetLocalSharingInfo()) + .WillByDefault(Return(sharing_info)); + + ASSERT_THAT(provider_->GetLocalDeviceInfo(), NotNull()); + const base::Optional<DeviceInfo::SharingInfo>& local_sharing_info = + provider_->GetLocalDeviceInfo()->sharing_info(); + EXPECT_TRUE(local_sharing_info); + EXPECT_EQ(kSharingFCMToken, local_sharing_info->fcm_token); + EXPECT_EQ(kSharingP256dh, local_sharing_info->p256dh); + EXPECT_EQ(kSharingAuthSecret, local_sharing_info->auth_secret); + EXPECT_EQ(enabled_features, local_sharing_info->enabled_features); +} + } // namespace } // namespace syncer
diff --git a/components/tracing/common/tracing_switches.cc b/components/tracing/common/tracing_switches.cc index 0428622f..a29715d 100644 --- a/components/tracing/common/tracing_switches.cc +++ b/components/tracing/common/tracing_switches.cc
@@ -37,7 +37,7 @@ // all events since startup. const char kTraceStartupFile[] = "trace-startup-file"; -// If supplied, sets the tracing record mode; otherwise, the default +// If supplied, sets the tracing record mode and options; otherwise, the default // "record-until-full" mode will be used. const char kTraceStartupRecordMode[] = "trace-startup-record-mode"; @@ -58,6 +58,11 @@ // through the normal methods for stopping system traces. const char kTraceStartupOwner[] = "trace-startup-owner"; +// If the perfetto tracing backend is used, this enables privacy filtering in +// the TraceEvent data sources for the startup tracing session. +const char kTraceStartupEnablePrivacyFiltering[] = + "trace-startup-enable-privacy-filtering"; + // Repeat internable data for each TraceEvent in the perfetto proto format. const char kPerfettoDisableInterning[] = "perfetto-disable-interning";
diff --git a/components/tracing/common/tracing_switches.h b/components/tracing/common/tracing_switches.h index 09b7a20..0ef5dd0 100644 --- a/components/tracing/common/tracing_switches.h +++ b/components/tracing/common/tracing_switches.h
@@ -16,6 +16,7 @@ TRACING_EXPORT extern const char kTraceStartupFile[]; TRACING_EXPORT extern const char kTraceStartupRecordMode[]; TRACING_EXPORT extern const char kTraceStartupOwner[]; +TRACING_EXPORT extern const char kTraceStartupEnablePrivacyFiltering[]; TRACING_EXPORT extern const char kPerfettoDisableInterning[]; TRACING_EXPORT extern const char kPerfettoOutputFile[]; TRACING_EXPORT extern const char kTraceToConsole[];
diff --git a/components/variations/android/junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java b/components/variations/android/junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java index ab94cd41..54c0db4 100644 --- a/components/variations/android/junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java +++ b/components/variations/android/junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java
@@ -143,7 +143,7 @@ * Test method for {@link VariationsSeedFetcher#getConnectionString()} has URl params. */ @Test - public void testGetConnectionString_HasParams() throws IOException { + public void testGetConnectionString_HasParams() { String urlString = mFetcher.getConnectionString( VariationsSeedFetcher.VariationsPlatform.ANDROID, sRestrict, sMilestone, sChannel);
diff --git a/components/visitedlink/test/visitedlink_perftest.cc b/components/visitedlink/test/visitedlink_perftest.cc index edb3f453..a6ca5d7 100644 --- a/components/visitedlink/test/visitedlink_perftest.cc +++ b/components/visitedlink/test/visitedlink_perftest.cc
@@ -15,7 +15,7 @@ #include "content/public/test/browser_task_environment.h" #include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" -#include "testing/perf/perf_test.h" +#include "testing/perf/perf_result_reporter.h" #include "url/gurl.h" using base::TimeDelta; @@ -24,24 +24,42 @@ namespace { +static constexpr char kMetricAddAndQueryMs[] = "add_and_query"; +static constexpr char kMetricTableInitMs[] = "table_initialization"; +static constexpr char kMetricLinkInitMs[] = "link_init"; +static constexpr char kMetricDatabaseFlushMs[] = "database_flush"; +static constexpr char kMetricColdLoadTimeMs[] = "cold_load_time"; +static constexpr char kMetricHotLoadTimeMs[] = "hot_load_time"; + +perf_test::PerfResultReporter SetUpReporter(const std::string& metric_suffix) { + perf_test::PerfResultReporter reporter("VisitedLink.", metric_suffix); + reporter.RegisterImportantMetric(kMetricAddAndQueryMs, "ms"); + reporter.RegisterImportantMetric(kMetricTableInitMs, "ms"); + reporter.RegisterImportantMetric(kMetricLinkInitMs, "ms"); + reporter.RegisterImportantMetric(kMetricDatabaseFlushMs, "ms"); + reporter.RegisterImportantMetric(kMetricColdLoadTimeMs, "ms"); + reporter.RegisterImportantMetric(kMetricHotLoadTimeMs, "ms"); + return reporter; +} + // Designed like base/test/perf_time_logger but uses testing/perf instead of // base/test/perf* to report timings. class TimeLogger { public: - explicit TimeLogger(std::string test_name); + explicit TimeLogger(std::string metric_suffix); ~TimeLogger(); void Done(); private: bool logged_; - std::string test_name_; + std::string metric_suffix_; base::ElapsedTimer timer_; DISALLOW_COPY_AND_ASSIGN(TimeLogger); }; -TimeLogger::TimeLogger(std::string test_name) - : logged_(false), test_name_(std::move(test_name)) {} +TimeLogger::TimeLogger(std::string metric_suffix) + : logged_(false), metric_suffix_(std::move(metric_suffix)) {} TimeLogger::~TimeLogger() { if (!logged_) @@ -52,8 +70,8 @@ // We use a floating-point millisecond value because it is more // intuitive than microseconds and we want more precision than // integer milliseconds. - perf_test::PrintResult(test_name_, std::string(), std::string(), - timer_.Elapsed().InMillisecondsF(), "ms", true); + perf_test::PerfResultReporter reporter = SetUpReporter("baseline_story"); + reporter.AddResult(metric_suffix_, timer_.Elapsed().InMillisecondsF()); logged_ = true; } @@ -118,7 +136,7 @@ ASSERT_TRUE(master.Init()); content::RunAllTasksUntilIdle(); - TimeLogger timer("Visited_link_add_and_query"); + TimeLogger timer(kMetricAddAndQueryMs); // first check without anything in the table CheckVisited(master, added_prefix, 0, add_count); @@ -144,13 +162,13 @@ TEST_F(VisitedLink, DISABLED_TestLoad) { // create a big DB { - TimeLogger table_initialization_timer("Table_initialization"); + TimeLogger table_initialization_timer(kMetricTableInitMs); VisitedLinkMaster master(new DummyVisitedLinkEventListener(), nullptr, true, true, db_path_, 0); // time init with empty table - TimeLogger initTimer("Empty_visited_link_init"); + TimeLogger initTimer(kMetricLinkInitMs); bool success = master.Init(); content::RunAllTasksUntilIdle(); initTimer.Done(); @@ -163,7 +181,7 @@ FillTable(master, added_prefix, 0, load_test_add_count); // time writing the file out out - TimeLogger flushTimer("Visited_link_database_flush"); + TimeLogger flushTimer(kMetricDatabaseFlushMs); master.RewriteFile(); // TODO(maruel): Without calling FlushFileBuffers(master.file_); you don't // know really how much time it took to write the file. @@ -222,12 +240,9 @@ hot_sum += hot_load_times[i]; } - perf_test::PrintResult("Visited_link_cold_load_time", std::string(), - std::string(), cold_sum / cold_load_times.size(), "ms", - true); - perf_test::PrintResult("Visited_link_hot_load_time", std::string(), - std::string(), hot_sum / hot_load_times.size(), "ms", - true); + perf_test::PerfResultReporter reporter = SetUpReporter("baseline_story"); + reporter.AddResult(kMetricColdLoadTimeMs, cold_sum / cold_load_times.size()); + reporter.AddResult(kMetricHotLoadTimeMs, hot_sum / hot_load_times.size()); } } // namespace visitedlink
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index e8d43be..62027d0 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -2425,6 +2425,7 @@ "//ui/android", "//ui/compositor", "//ui/compositor/host", + "//url:origin_android", ] if (enable_vulkan) { deps += [ "//gpu/vulkan/init" ]
diff --git a/content/browser/accessibility/browser_accessibility_position.cc b/content/browser/accessibility/browser_accessibility_position.cc index 5fa5466..7624d61 100644 --- a/content/browser/accessibility/browser_accessibility_position.cc +++ b/content/browser/accessibility/browser_accessibility_position.cc
@@ -29,15 +29,16 @@ return GetAnchor()->GetText(); } -void BrowserAccessibilityPosition::AnchorChild(int child_index, - AXTreeID* tree_id, - int32_t* child_id) const { +void BrowserAccessibilityPosition::AnchorChild( + int child_index, + AXTreeID* tree_id, + ui::AXNode::AXID* child_id) const { DCHECK(tree_id); DCHECK(child_id); if (!GetAnchor() || child_index < 0 || child_index >= AnchorChildCount()) { *tree_id = ui::AXTreeIDUnknown(); - *child_id = INVALID_ANCHOR_ID; + *child_id = ui::AXNode::kInvalidAXID; return; } @@ -79,14 +80,15 @@ return anchors; } -void BrowserAccessibilityPosition::AnchorParent(AXTreeID* tree_id, - int32_t* parent_id) const { +void BrowserAccessibilityPosition::AnchorParent( + AXTreeID* tree_id, + ui::AXNode::AXID* parent_id) const { DCHECK(tree_id); DCHECK(parent_id); if (!GetAnchor() || !GetAnchor()->PlatformGetParent()) { *tree_id = ui::AXTreeIDUnknown(); - *parent_id = AXPosition::INVALID_ANCHOR_ID; + *parent_id = ui::AXNode::kInvalidAXID; return; } @@ -97,9 +99,8 @@ BrowserAccessibility* BrowserAccessibilityPosition::GetNodeInTree( AXTreeID tree_id, - int32_t node_id) const { - if (tree_id == ui::AXTreeIDUnknown() || - node_id == AXPosition::INVALID_ANCHOR_ID) { + ui::AXNode::AXID node_id) const { + if (tree_id == ui::AXTreeIDUnknown() || node_id == ui::AXNode::kInvalidAXID) { return nullptr; } @@ -189,30 +190,31 @@ ax::mojom::IntListAttribute::kWordEnds); } -int32_t BrowserAccessibilityPosition::GetNextOnLineID(int32_t node_id) const { +ui::AXNode::AXID BrowserAccessibilityPosition::GetNextOnLineID( + ui::AXNode::AXID node_id) const { if (IsNullPosition()) - return INVALID_ANCHOR_ID; + return ui::AXNode::kInvalidAXID; BrowserAccessibility* node = GetNodeInTree(tree_id(), node_id); int next_on_line_id; if (!node || !node->GetIntAttribute(ax::mojom::IntAttribute::kNextOnLineId, &next_on_line_id)) { - return INVALID_ANCHOR_ID; + return ui::AXNode::kInvalidAXID; } - return static_cast<int32_t>(next_on_line_id); + return static_cast<ui::AXNode::AXID>(next_on_line_id); } -int32_t BrowserAccessibilityPosition::GetPreviousOnLineID( - int32_t node_id) const { +ui::AXNode::AXID BrowserAccessibilityPosition::GetPreviousOnLineID( + ui::AXNode::AXID node_id) const { if (IsNullPosition()) - return INVALID_ANCHOR_ID; + return ui::AXNode::kInvalidAXID; BrowserAccessibility* node = GetNodeInTree(tree_id(), node_id); int previous_on_line_id; if (!node || !node->GetIntAttribute(ax::mojom::IntAttribute::kPreviousOnLineId, &previous_on_line_id)) { - return INVALID_ANCHOR_ID; + return ui::AXNode::kInvalidAXID; } - return static_cast<int32_t>(previous_on_line_id); + return static_cast<ui::AXNode::AXID>(previous_on_line_id); } } // namespace content
diff --git a/content/browser/accessibility/browser_accessibility_position.h b/content/browser/accessibility/browser_accessibility_position.h index 081e587..a221f847 100644 --- a/content/browser/accessibility/browser_accessibility_position.h +++ b/content/browser/accessibility/browser_accessibility_position.h
@@ -39,13 +39,14 @@ default; void AnchorChild(int child_index, AXTreeID* tree_id, - int32_t* child_id) const override; + ui::AXNode::AXID* child_id) const override; int AnchorChildCount() const override; int AnchorIndexInParent() const override; base::stack<BrowserAccessibility*> GetAncestorAnchors() const override; - void AnchorParent(AXTreeID* tree_id, int32_t* parent_id) const override; + void AnchorParent(AXTreeID* tree_id, + ui::AXNode::AXID* parent_id) const override; BrowserAccessibility* GetNodeInTree(AXTreeID tree_id, - int32_t node_id) const override; + ui::AXNode::AXID node_id) const override; bool IsEmbeddedObjectInParent() const override; bool IsInLineBreakingObject() const override; @@ -53,8 +54,8 @@ ui::AXNodeTextStyles GetTextStyles() const override; std::vector<int32_t> GetWordStartOffsets() const override; std::vector<int32_t> GetWordEndOffsets() const override; - int32_t GetNextOnLineID(int32_t node_id) const override; - int32_t GetPreviousOnLineID(int32_t node_id) const override; + ui::AXNode::AXID GetNextOnLineID(ui::AXNode::AXID node_id) const override; + ui::AXNode::AXID GetPreviousOnLineID(ui::AXNode::AXID node_id) const override; }; } // namespace content
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index b106731..7c1bd39 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc
@@ -59,6 +59,7 @@ #include "net/websockets/websocket_channel.h" #include "services/service_manager/embedder/switches.h" #include "services/service_manager/public/cpp/constants.h" +#include "services/tracing/public/cpp/trace_startup.h" #if defined(OS_MACOSX) #include "content/browser/child_process_task_port_provider_mac.h" @@ -247,24 +248,7 @@ // static void BrowserChildProcessHostImpl::CopyTraceStartupFlags( base::CommandLine* cmd_line) { - if (tracing::TraceStartupConfig::GetInstance()->IsEnabled()) { - const auto trace_config = - tracing::TraceStartupConfig::GetInstance()->GetTraceConfig(); - if (!trace_config.IsArgumentFilterEnabled()) { - // The only trace option that we can pass through switches is the record - // mode. Other trace options should have the default value. - // - // TODO(chiniforooshan): Add other trace options to switches if, for - // example, they are used in a telemetry test that needs startup trace - // events from renderer processes. - cmd_line->AppendSwitchASCII(switches::kTraceStartup, - trace_config.ToCategoryFilterString()); - cmd_line->AppendSwitchASCII( - switches::kTraceStartupRecordMode, - base::trace_event::TraceConfig::TraceRecordModeToStr( - trace_config.GetTraceRecordMode())); - } - } + tracing::PropagateTracingFlagsToChildProcessCmdLine(cmd_line); } void BrowserChildProcessHostImpl::Launch(
diff --git a/content/browser/dom_storage/session_storage_context_mojo_unittest.cc b/content/browser/dom_storage/session_storage_context_mojo_unittest.cc index 3a51f11..4c3ac4a 100644 --- a/content/browser/dom_storage/session_storage_context_mojo_unittest.cc +++ b/content/browser/dom_storage/session_storage_context_mojo_unittest.cc
@@ -243,7 +243,7 @@ key_as_vector, String16ToUint8Vector(value)))); } -TEST_F(SessionStorageContextMojoTest, StartupShutdownSave) { +TEST_F(SessionStorageContextMojoTest, DISABLED_StartupShutdownSave) { std::string namespace_id1 = base::GenerateGUID(); url::Origin origin1 = url::Origin::Create(GURL("http://foobar.com")); context()->CreateSessionNamespace(namespace_id1); @@ -480,7 +480,7 @@ EXPECT_TRUE(bad_message_called_); } -TEST_F(SessionStorageContextMojoTest, Scavenging) { +TEST_F(SessionStorageContextMojoTest, DISABLED_Scavenging) { // Create our namespace, destroy our context and leave that namespace on disk, // and verify that it is scavenged if we re-create the context without calling // CreateSessionNamespace.
diff --git a/content/browser/frame_host/render_frame_host_android.cc b/content/browser/frame_host/render_frame_host_android.cc index 7474639..735e854 100644 --- a/content/browser/frame_host/render_frame_host_android.cc +++ b/content/browser/frame_host/render_frame_host_android.cc
@@ -16,6 +16,7 @@ #include "content/public/android/content_jni_headers/RenderFrameHostImpl_jni.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/site_instance.h" +#include "url/origin.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF8ToJavaString; @@ -78,6 +79,12 @@ env, render_frame_host_->GetLastCommittedURL().spec()); } +ScopedJavaLocalRef<jobject> RenderFrameHostAndroid::GetLastCommittedOrigin( + JNIEnv* env, + const JavaParamRef<jobject>& obj) { + return render_frame_host_->GetLastCommittedOrigin().CreateJavaObject(); +} + void RenderFrameHostAndroid::GetCanonicalUrlForSharing( JNIEnv* env, const base::android::JavaParamRef<jobject>&,
diff --git a/content/browser/frame_host/render_frame_host_android.h b/content/browser/frame_host/render_frame_host_android.h index efa9a2c..35315276 100644 --- a/content/browser/frame_host/render_frame_host_android.h +++ b/content/browser/frame_host/render_frame_host_android.h
@@ -39,6 +39,10 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>&) const; + base::android::ScopedJavaLocalRef<jobject> GetLastCommittedOrigin( + JNIEnv* env, + const base::android::JavaParamRef<jobject>&); + void GetCanonicalUrlForSharing( JNIEnv* env, const base::android::JavaParamRef<jobject>&,
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 5d7c757..a9f70ed 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2191,7 +2191,10 @@ } #endif - const GURL& top_document_url = frame_tree_->root()->current_url(); + const GURL& top_document_url = frame_tree_->root() + ->current_frame_host() + ->GetLastCommittedOrigin() + .GetURL(); if (GetContentClient() ->browser()
diff --git a/content/browser/frame_host/render_frame_host_impl_browsertest.cc b/content/browser/frame_host/render_frame_host_impl_browsertest.cc index 2142ad5..959842c 100644 --- a/content/browser/frame_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/frame_host/render_frame_host_impl_browsertest.cc
@@ -2778,52 +2778,79 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, ComputeSiteForCookiesForNavigationSandbox) { - GURL url = embedded_test_server()->GetURL( - "a.com", - "/cross_site_iframe_factory.html?a(a{sandbox-allow-scripts}(a)," - "a{sandbox-allow-scripts,sandbox-allow-same-origin}(a))"); + // Test sandboxed subframe. + { + GURL url = embedded_test_server()->GetURL( + "a.com", + "/cross_site_iframe_factory.html?a(a{sandbox-allow-scripts}(a)," + "a{sandbox-allow-scripts,sandbox-allow-same-origin}(a))"); - EXPECT_TRUE(NavigateToURL(shell(), url)); + EXPECT_TRUE(NavigateToURL(shell(), url)); - WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); - RenderFrameHostImpl* main_frame = - static_cast<RenderFrameHostImpl*>(wc->GetMainFrame()); + WebContentsImpl* wc = + static_cast<WebContentsImpl*>(shell()->web_contents()); + RenderFrameHostImpl* main_frame = wc->GetMainFrame(); - EXPECT_EQ("a.com", main_frame->GetLastCommittedURL().host()); + EXPECT_EQ("a.com", main_frame->GetLastCommittedURL().host()); - ASSERT_EQ(2u, main_frame->child_count()); - FrameTreeNode* child_a = main_frame->child_at(0); - EXPECT_EQ("a.com", child_a->current_url().host()); - EXPECT_TRUE(child_a->current_frame_host()->GetLastCommittedOrigin().opaque()); + ASSERT_EQ(2u, main_frame->child_count()); + FrameTreeNode* child_a = main_frame->child_at(0); + EXPECT_EQ("a.com", child_a->current_url().host()); + EXPECT_TRUE( + child_a->current_frame_host()->GetLastCommittedOrigin().opaque()); - ASSERT_EQ(1u, child_a->child_count()); - FrameTreeNode* child_aa = child_a->child_at(0); - EXPECT_EQ("a.com", child_aa->current_url().host()); - EXPECT_TRUE( - child_aa->current_frame_host()->GetLastCommittedOrigin().opaque()); + ASSERT_EQ(1u, child_a->child_count()); + FrameTreeNode* child_aa = child_a->child_at(0); + EXPECT_EQ("a.com", child_aa->current_url().host()); + EXPECT_TRUE( + child_aa->current_frame_host()->GetLastCommittedOrigin().opaque()); - FrameTreeNode* child_a2 = main_frame->child_at(1); - EXPECT_EQ("a.com", child_a2->current_url().host()); - EXPECT_FALSE( - child_a2->current_frame_host()->GetLastCommittedOrigin().opaque()); + FrameTreeNode* child_a2 = main_frame->child_at(1); + EXPECT_EQ("a.com", child_a2->current_url().host()); + EXPECT_FALSE( + child_a2->current_frame_host()->GetLastCommittedOrigin().opaque()); - ASSERT_EQ(1u, child_a2->child_count()); - FrameTreeNode* child_a2a = child_a2->child_at(0); - EXPECT_EQ("a.com", child_a2a->current_url().host()); - EXPECT_FALSE( - child_a2a->current_frame_host()->GetLastCommittedOrigin().opaque()); + ASSERT_EQ(1u, child_a2->child_count()); + FrameTreeNode* child_a2a = child_a2->child_at(0); + EXPECT_EQ("a.com", child_a2a->current_url().host()); + EXPECT_FALSE( + child_a2a->current_frame_host()->GetLastCommittedOrigin().opaque()); - // |child_aa| frame navigation should be cross-site since its parent is - // sandboxed without allow-same-origin - EXPECT_TRUE(child_aa->current_frame_host() - ->ComputeSiteForCookiesForNavigation(url) - .is_empty()); + // |child_aa| frame navigation should be cross-site since its parent is + // sandboxed without allow-same-origin + EXPECT_TRUE(child_aa->current_frame_host() + ->ComputeSiteForCookiesForNavigation(url) + .is_empty()); - // |child_a2a| frame navigation should be same-site since its sandboxed parent - // is sandbox-same-origin. - EXPECT_EQ("a.com", child_a2a->current_frame_host() - ->ComputeSiteForCookiesForNavigation(url) - .host()); + // |child_a2a| frame navigation should be same-site since its sandboxed + // parent is sandbox-same-origin. + EXPECT_EQ("a.com", child_a2a->current_frame_host() + ->ComputeSiteForCookiesForNavigation(url) + .host()); + } + + // Test sandboxed main frame. + { + GURL url = + embedded_test_server()->GetURL("a.com", "/csp_sandboxed_frame.html"); + EXPECT_TRUE(NavigateToURL(shell(), url)); + + WebContentsImpl* wc = + static_cast<WebContentsImpl*>(shell()->web_contents()); + RenderFrameHostImpl* main_frame = wc->GetMainFrame(); + EXPECT_EQ(url, main_frame->GetLastCommittedURL()); + EXPECT_TRUE(main_frame->GetLastCommittedOrigin().opaque()); + + ASSERT_EQ(2u, main_frame->child_count()); + FrameTreeNode* child_a = main_frame->child_at(0); + EXPECT_EQ("a.com", child_a->current_url().host()); + EXPECT_TRUE( + child_a->current_frame_host()->GetLastCommittedOrigin().opaque()); + + EXPECT_TRUE(child_a->current_frame_host() + ->ComputeSiteForCookiesForNavigation(url) + .is_empty()); + } } IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 67889eda..e42a2f7 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -219,6 +219,8 @@ switches::kDisableWebRtcHWEncoding, switches::kEnableGpuRasterization, switches::kEnableLogging, + switches::kEnableDeJelly, + switches::kDeJellyScreenWidth, switches::kEnableVizDevTools, switches::kHeadless, switches::kLoggingLevel,
diff --git a/content/browser/loader/loader_browsertest.cc b/content/browser/loader/loader_browsertest.cc index 76ac177..2b334fe2 100644 --- a/content/browser/loader/loader_browsertest.cc +++ b/content/browser/loader/loader_browsertest.cc
@@ -787,7 +787,7 @@ EXPECT_FALSE(first_request->initiator.has_value()); for (size_t i = 1; i < requests.size(); i++) { const RequestData* request = &requests[i]; - EXPECT_EQ(top_url, request->first_party); + EXPECT_EQ(top_origin, url::Origin::Create(request->first_party)); ASSERT_TRUE(request->initiator.has_value()); EXPECT_EQ(top_origin, request->initiator); } @@ -849,15 +849,15 @@ EXPECT_EQ(9u, requests.size()); // The first items loaded are the top-level and nested documents. These should - // both have a |first_party| that match the URL of the top-level document. + // both have a |first_party| that match the origin of the top-level document. // The top-level document has no initiator and the nested frame is initiated // by the top-level document. EXPECT_EQ(top_url, requests[0].url); - EXPECT_EQ(top_url, requests[0].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[0].first_party)); EXPECT_FALSE(requests[0].initiator.has_value()); EXPECT_EQ(nested_url, requests[1].url); - EXPECT_EQ(top_url, requests[1].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[1].first_party)); EXPECT_EQ(top_origin, requests[1].initiator); // The remaining items are loaded as subresources in the nested document, and @@ -885,19 +885,19 @@ // URL to which they navigate. The navigation was initiated outside of a // document, so there is no |initiator|. EXPECT_EQ(top_url, requests[0].url); - EXPECT_EQ(top_url, requests[0].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[0].first_party)); EXPECT_FALSE(requests[0].initiator.has_value()); // Subresource requests have a first-party and initiator that matches the // document in which they're embedded. EXPECT_EQ(image_url, requests[1].url); - EXPECT_EQ(top_url, requests[1].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[1].first_party)); EXPECT_EQ(top_origin, requests[1].initiator); // Same-origin nested frames have a first-party and initiator that matches // the document in which they're embedded. EXPECT_EQ(nested_url, requests[2].url); - EXPECT_EQ(top_url, requests[2].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[2].first_party)); EXPECT_EQ(top_origin, requests[2].initiator); } @@ -925,13 +925,14 @@ // URL to which they navigate, even if they fail to load. The navigation was // initiated outside of a document, so there is no |initiator|. EXPECT_EQ(top_url, requests[0].url); - EXPECT_EQ(top_url, requests[0].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[0].first_party)); EXPECT_FALSE(requests[0].initiator.has_value()); // Auxiliary navigations have a first-party that matches the URL to which they // navigate, and an initiator that matches the document that triggered them. EXPECT_EQ(auxiliary_url, requests[1].url); - EXPECT_EQ(auxiliary_url, requests[1].first_party); + EXPECT_EQ(url::Origin::Create(auxiliary_url), + url::Origin::Create(requests[1].first_party)); EXPECT_EQ(top_origin, requests[1].initiator); } @@ -967,13 +968,14 @@ // URL to which they navigate, even if they fail to load. The navigation was // initiated outside of a document, so there is no initiator. EXPECT_EQ(top_url, requests[0].url); - EXPECT_EQ(top_url, requests[0].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[0].first_party)); EXPECT_FALSE(requests[0].initiator.has_value()); // Auxiliary navigations have a first-party that matches the URL to which they // navigate, and an initiator that matches the document that triggered them. EXPECT_EQ(auxiliary_url, requests[1].url); - EXPECT_EQ(auxiliary_url, requests[1].first_party); + EXPECT_EQ(url::Origin::Create(auxiliary_url), + url::Origin::Create(requests[1].first_party)); EXPECT_EQ(top_origin, requests[1].initiator); } @@ -992,7 +994,7 @@ // URL to which they navigate, even if they fail to load. The navigation was // initiated outside of a document, so there is no initiator. EXPECT_EQ(top_url, requests[0].url); - EXPECT_EQ(top_url, requests[0].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[0].first_party)); EXPECT_FALSE(requests[0].initiator.has_value()); } @@ -1016,17 +1018,17 @@ // User-initiated top-level navigations have a |first-party|. The navigation // was initiated outside of a document, so there are no initiator. EXPECT_EQ(top_url, requests[0].url); - EXPECT_EQ(top_url, requests[0].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[0].first_party)); EXPECT_FALSE(requests[0].initiator.has_value()); EXPECT_EQ(top_js_url, requests[1].url); - EXPECT_EQ(top_url, requests[1].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[1].first_party)); EXPECT_EQ(top_origin, requests[1].initiator); // Cross-origin frames have a first-party and initiator that matches the URL // in which they're embedded. EXPECT_EQ(nested_url, requests[2].url); - EXPECT_EQ(top_url, requests[2].first_party); + EXPECT_EQ(top_origin, url::Origin::Create(requests[2].first_party)); EXPECT_EQ(top_origin, requests[2].initiator); // Cross-origin subresource requests have a unique first-party, and an
diff --git a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc index aaaf3ce26..0f0914a 100644 --- a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc +++ b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc
@@ -385,6 +385,9 @@ FROM_HERE, base::BlockingType::MAY_BLOCK); outstanding_family_results_ = collection_->GetFontFamilyCount(); + UMA_HISTOGRAM_CUSTOM_COUNTS( + "DirectWrite.Fonts.Proxy.FamilyCountIndexingStart", + outstanding_family_results_, 1, 5000, 50); } for (UINT32 family_index = 0; family_index < outstanding_family_results_; ++family_index) {
diff --git a/content/browser/renderer_interface_binders.cc b/content/browser/renderer_interface_binders.cc index a399ac0..14216c8 100644 --- a/content/browser/renderer_interface_binders.cc +++ b/content/browser/renderer_interface_binders.cc
@@ -114,23 +114,26 @@ } void BindBarcodeDetectionProvider( - shape_detection::mojom::BarcodeDetectionProviderRequest request, + mojo::PendingReceiver<shape_detection::mojom::BarcodeDetectionProvider> + receiver, RenderProcessHost* host, const url::Origin& origin) { - GetShapeDetectionService()->BindBarcodeDetectionProvider(std::move(request)); + GetShapeDetectionService()->BindBarcodeDetectionProvider(std::move(receiver)); } void BindFaceDetectionProvider( - shape_detection::mojom::FaceDetectionProviderRequest request, + mojo::PendingReceiver<shape_detection::mojom::FaceDetectionProvider> + receiver, RenderProcessHost* host, const url::Origin& origin) { - GetShapeDetectionService()->BindFaceDetectionProvider(std::move(request)); + GetShapeDetectionService()->BindFaceDetectionProvider(std::move(receiver)); } -void BindTextDetection(shape_detection::mojom::TextDetectionRequest request, - RenderProcessHost* host, - const url::Origin& origin) { - GetShapeDetectionService()->BindTextDetection(std::move(request)); +void BindTextDetection( + mojo::PendingReceiver<shape_detection::mojom::TextDetection> receiver, + RenderProcessHost* host, + const url::Origin& origin) { + GetShapeDetectionService()->BindTextDetection(std::move(receiver)); } // Register renderer-exposed interfaces. Each registered interface binder is
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc index e87204fc..f0897fd 100644 --- a/content/browser/service_worker/service_worker_context_core.cc +++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -52,7 +52,7 @@ namespace content { namespace { - + void CheckFetchHandlerOfInstalledServiceWorker( ServiceWorkerContext::CheckHasServiceWorkerCallback callback, scoped_refptr<ServiceWorkerRegistration> registration) { @@ -258,6 +258,12 @@ : wrapper_(wrapper), providers_(std::make_unique<ProviderByIdMap>()), provider_by_uuid_(std::make_unique<ProviderByClientUUIDMap>()), + storage_(ServiceWorkerStorage::Create(user_data_directory, + this, + std::move(database_task_runner), + quota_manager_proxy, + special_storage_policy)), + job_coordinator_(std::make_unique<ServiceWorkerJobCoordinator>(this)), loader_factory_getter_(url_loader_factory_getter), force_update_on_page_load_(false), was_service_worker_registered_(false), @@ -268,12 +274,6 @@ base::MakeRefCounted<blink::URLLoaderFactoryBundle>( std::move(non_network_loader_factory_bundle_info_for_update_check)); } - // These get a WeakPtr from |weak_factory_|, so must be set after - // |weak_factory_| is initialized. - storage_ = ServiceWorkerStorage::Create( - user_data_directory, AsWeakPtr(), std::move(database_task_runner), - quota_manager_proxy, special_storage_policy); - job_coordinator_ = std::make_unique<ServiceWorkerJobCoordinator>(AsWeakPtr()); } ServiceWorkerContextCore::ServiceWorkerContextCore( @@ -282,26 +282,22 @@ : wrapper_(wrapper), providers_(old_context->providers_.release()), provider_by_uuid_(old_context->provider_by_uuid_.release()), + storage_(ServiceWorkerStorage::Create(this, old_context->storage())), + job_coordinator_(std::make_unique<ServiceWorkerJobCoordinator>(this)), loader_factory_getter_(old_context->loader_factory_getter()), loader_factory_bundle_for_update_check_( std::move(old_context->loader_factory_bundle_for_update_check_)), was_service_worker_registered_( old_context->was_service_worker_registered_), observer_list_(old_context->observer_list_), - next_embedded_worker_id_(old_context->next_embedded_worker_id_) { - DCHECK(observer_list_); - - // These get a WeakPtr from |weak_factory_|, so must be set after - // |weak_factory_| is initialized. - storage_ = ServiceWorkerStorage::Create(AsWeakPtr(), old_context->storage()); - job_coordinator_ = std::make_unique<ServiceWorkerJobCoordinator>(AsWeakPtr()); -} + next_embedded_worker_id_(old_context->next_embedded_worker_id_) {} ServiceWorkerContextCore::~ServiceWorkerContextCore() { DCHECK(storage_); for (const auto& it : live_versions_) it.second->RemoveObserver(this); - weak_factory_.InvalidateWeakPtrs(); + + job_coordinator_->ClearForShutdown(); } void ServiceWorkerContextCore::AddProviderHost(
diff --git a/content/browser/service_worker/service_worker_job_coordinator.cc b/content/browser/service_worker/service_worker_job_coordinator.cc index 8270b5a..09bfb6ce 100644 --- a/content/browser/service_worker/service_worker_job_coordinator.cc +++ b/content/browser/service_worker/service_worker_job_coordinator.cc
@@ -59,20 +59,18 @@ } void ServiceWorkerJobCoordinator::JobQueue::ClearForShutdown() { + for (const auto& job : jobs_) + job->WillShutDown(); jobs_.clear(); } ServiceWorkerJobCoordinator::ServiceWorkerJobCoordinator( - base::WeakPtr<ServiceWorkerContextCore> context) + ServiceWorkerContextCore* context) : context_(context) { + DCHECK(context_); } ServiceWorkerJobCoordinator::~ServiceWorkerJobCoordinator() { - if (!context_) { - for (auto& job_pair : job_queues_) - job_pair.second.ClearForShutdown(); - job_queues_.clear(); - } DCHECK(job_queues_.empty()) << "Destroying ServiceWorkerJobCoordinator with " << job_queues_.size() << " job queues"; } @@ -139,6 +137,12 @@ job_queues_.clear(); } +void ServiceWorkerJobCoordinator::ClearForShutdown() { + for (auto& job_pair : job_queues_) + job_pair.second.ClearForShutdown(); + job_queues_.clear(); +} + void ServiceWorkerJobCoordinator::FinishJob(const GURL& scope, ServiceWorkerRegisterJobBase* job) { auto pending_jobs = job_queues_.find(scope);
diff --git a/content/browser/service_worker/service_worker_job_coordinator.h b/content/browser/service_worker/service_worker_job_coordinator.h index 667c82b..adde9af0 100644 --- a/content/browser/service_worker/service_worker_job_coordinator.h +++ b/content/browser/service_worker/service_worker_job_coordinator.h
@@ -23,8 +23,7 @@ // This class manages all in-flight registration or unregistration jobs. class CONTENT_EXPORT ServiceWorkerJobCoordinator { public: - explicit ServiceWorkerJobCoordinator( - base::WeakPtr<ServiceWorkerContextCore> context); + explicit ServiceWorkerJobCoordinator(ServiceWorkerContextCore* context); ~ServiceWorkerJobCoordinator(); void Register(const GURL& script_url, @@ -46,6 +45,10 @@ void Abort(const GURL& scope); void AbortAll(); + // Marks that the ServiceWorkerContextCore is shutting down, so jobs may be + // destroyed before finishing. + void ClearForShutdown(); + // Removes the job. A job that was not aborted must call FinishJob when it is // done. void FinishJob(const GURL& scope, ServiceWorkerRegisterJobBase* job); @@ -84,9 +87,8 @@ DISALLOW_COPY_AND_ASSIGN(JobQueue); }; - // The ServiceWorkerContextCore object should always outlive the - // job coordinator, the core owns the coordinator. - base::WeakPtr<ServiceWorkerContextCore> context_; + // The ServiceWorkerContextCore object must outlive this. + ServiceWorkerContextCore* const context_; std::map<GURL, JobQueue> job_queues_; DISALLOW_COPY_AND_ASSIGN(ServiceWorkerJobCoordinator);
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc index 7e7b87b..1f7dd4c 100644 --- a/content/browser/service_worker/service_worker_register_job.cc +++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -6,6 +6,8 @@ #include <stdint.h> +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" @@ -38,7 +40,7 @@ typedef ServiceWorkerRegisterJobBase::RegistrationJobType RegistrationJobType; ServiceWorkerRegisterJob::ServiceWorkerRegisterJob( - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, const GURL& script_url, const blink::mojom::ServiceWorkerRegistrationOptions& options) : context_(context), @@ -48,14 +50,17 @@ worker_script_type_(options.type), update_via_cache_(options.update_via_cache), phase_(INITIAL), + is_shutting_down_(false), is_promise_resolved_(false), should_uninstall_on_failure_(false), force_bypass_cache_(false), skip_script_comparison_(false), - promise_resolved_status_(blink::ServiceWorkerStatusCode::kOk) {} + promise_resolved_status_(blink::ServiceWorkerStatusCode::kOk) { + DCHECK(context_); +} ServiceWorkerRegisterJob::ServiceWorkerRegisterJob( - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, ServiceWorkerRegistration* registration, bool force_bypass_cache, bool skip_script_comparison) @@ -64,17 +69,19 @@ scope_(registration->scope()), update_via_cache_(registration->update_via_cache()), phase_(INITIAL), + is_shutting_down_(false), is_promise_resolved_(false), should_uninstall_on_failure_(false), force_bypass_cache_(force_bypass_cache), skip_script_comparison_(skip_script_comparison), promise_resolved_status_(blink::ServiceWorkerStatusCode::kOk) { + DCHECK(context_); internal_.registration = registration; } ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob() { - DCHECK(!context_ || - phase_ == INITIAL || phase_ == COMPLETE || phase_ == ABORT) + DCHECK(is_shutting_down_ || phase_ == INITIAL || phase_ == COMPLETE || + phase_ == ABORT) << "Jobs should only be interrupted during shutdown."; } @@ -135,6 +142,10 @@ // the jobs from the queue. } +void ServiceWorkerRegisterJob::WillShutDown() { + is_shutting_down_ = true; +} + bool ServiceWorkerRegisterJob::Equals(ServiceWorkerRegisterJobBase* job) const { if (job->GetType() != job_type_) return false; @@ -340,8 +351,7 @@ update_checker_ = std::make_unique<ServiceWorkerUpdateChecker>( std::move(resources), script_url_, script_resource_id, version_to_update, std::move(loader_factory), force_bypass_cache_, - registration()->update_via_cache(), time_since_last_check, - context_.get()); + registration()->update_via_cache(), time_since_last_check, context_); update_checker_->Start( base::BindOnce(&ServiceWorkerRegisterJob::OnUpdateCheckFinished, weak_factory_.GetWeakPtr())); @@ -404,8 +414,8 @@ blink::mojom::ServiceWorkerRegistrationOptions options( scope_, worker_script_type_, update_via_cache_); - set_registration( - new ServiceWorkerRegistration(options, registration_id, context_)); + set_registration(new ServiceWorkerRegistration(options, registration_id, + context_->AsWeakPtr())); AddRegistrationToMatchingProviderHosts(registration()); UpdateAndContinue(); } @@ -473,8 +483,9 @@ } // "Let worker be a new ServiceWorker object..." and start the worker. - set_new_version(new ServiceWorkerVersion( - registration(), script_url_, worker_script_type_, version_id, context_)); + set_new_version(new ServiceWorkerVersion(registration(), script_url_, + worker_script_type_, version_id, + context_->AsWeakPtr())); new_version()->set_force_bypass_cache_for_scripts(force_bypass_cache_); if (need_to_pause_after_download) {
diff --git a/content/browser/service_worker/service_worker_register_job.h b/content/browser/service_worker/service_worker_register_job.h index e7c84f8..c7ae1d6 100644 --- a/content/browser/service_worker/service_worker_register_job.h +++ b/content/browser/service_worker/service_worker_register_job.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ +#include <map> +#include <memory> #include <string> #include <vector> @@ -49,13 +51,13 @@ // For registration jobs. CONTENT_EXPORT ServiceWorkerRegisterJob( - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, const GURL& script_url, const blink::mojom::ServiceWorkerRegistrationOptions& options); // For update jobs. CONTENT_EXPORT ServiceWorkerRegisterJob( - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, ServiceWorkerRegistration* registration, bool force_bypass_cache, bool skip_script_comparison); @@ -68,6 +70,7 @@ // ServiceWorkerRegisterJobBase implementation: void Start() override; void Abort() override; + void WillShutDown() override; bool Equals(ServiceWorkerRegisterJobBase* job) const override; RegistrationJobType GetType() const override; @@ -171,8 +174,8 @@ void BumpLastUpdateCheckTimeIfNeeded(); - // The ServiceWorkerContextCore object should always outlive this. - base::WeakPtr<ServiceWorkerContextCore> context_; + // The ServiceWorkerContextCore object must outlive this. + ServiceWorkerContextCore* const context_; std::unique_ptr<ServiceWorkerUpdateChecker> update_checker_; std::map<GURL, ServiceWorkerUpdateChecker::ComparedScriptInfo> @@ -188,6 +191,7 @@ const blink::mojom::ServiceWorkerUpdateViaCache update_via_cache_; std::vector<RegistrationCallback> callbacks_; Phase phase_; + bool is_shutting_down_; Internal internal_; bool is_promise_resolved_; bool should_uninstall_on_failure_;
diff --git a/content/browser/service_worker/service_worker_register_job_base.h b/content/browser/service_worker/service_worker_register_job_base.h index 8c3f59a..4d5766a 100644 --- a/content/browser/service_worker/service_worker_register_job_base.h +++ b/content/browser/service_worker/service_worker_register_job_base.h
@@ -24,6 +24,9 @@ // It can be called regardless of whether Start() was called. virtual void Abort() = 0; + // Notifies the job that the context is shutting down. + virtual void WillShutDown() = 0; + // Returns true if this job is identical to |job| for the purpose of // collapsing them together in a ServiceWorkerJobCoordinator queue. // Registration jobs are equal if they are for the same scope and script
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc index e8926a4..31a16be 100644 --- a/content/browser/service_worker/service_worker_storage.cc +++ b/content/browser/service_worker/service_worker_storage.cc
@@ -119,7 +119,7 @@ // static std::unique_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( const base::FilePath& user_data_directory, - const base::WeakPtr<ServiceWorkerContextCore>& context, + ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy) { @@ -130,7 +130,7 @@ // static std::unique_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( - const base::WeakPtr<ServiceWorkerContextCore>& context, + ServiceWorkerContextCore* context, ServiceWorkerStorage* old_storage) { return base::WrapUnique( new ServiceWorkerStorage(old_storage->user_data_directory_, context, @@ -1148,7 +1148,7 @@ ServiceWorkerStorage::ServiceWorkerStorage( const base::FilePath& user_data_directory, - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy) @@ -1636,8 +1636,8 @@ blink::mojom::ServiceWorkerRegistrationOptions options( data.scope, data.script_type, data.update_via_cache); - registration = - new ServiceWorkerRegistration(options, data.registration_id, context_); + registration = new ServiceWorkerRegistration(options, data.registration_id, + context_->AsWeakPtr()); registration->set_resources_total_size_bytes(data.resources_total_size_bytes); registration->set_last_update_check(data.last_update_check); DCHECK(uninstalling_registrations_.find(data.registration_id) == @@ -1648,7 +1648,7 @@ if (!version) { version = base::MakeRefCounted<ServiceWorkerVersion>( registration.get(), data.script, data.script_type, data.version_id, - context_); + context_->AsWeakPtr()); version->set_fetch_handler_existence( data.has_fetch_handler ? ServiceWorkerVersion::FetchHandlerExistence::EXISTS
diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h index 2712a4d..9d3006f 100644 --- a/content/browser/service_worker/service_worker_storage.h +++ b/content/browser/service_worker/service_worker_storage.h
@@ -94,14 +94,14 @@ static std::unique_ptr<ServiceWorkerStorage> Create( const base::FilePath& user_data_directory, - const base::WeakPtr<ServiceWorkerContextCore>& context, + ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy); // Used for DeleteAndStartOver. Creates new storage based on |old_storage|. static std::unique_ptr<ServiceWorkerStorage> Create( - const base::WeakPtr<ServiceWorkerContextCore>& context, + ServiceWorkerContextCore* context, ServiceWorkerStorage* old_storage); // Finds registration for |document_url| or |scope| or |registration_id|. @@ -373,7 +373,7 @@ ServiceWorkerStorage( const base::FilePath& user_data_directory, - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy); @@ -602,8 +602,8 @@ base::FilePath user_data_directory_; - // The context should be valid while the storage is alive. - base::WeakPtr<ServiceWorkerContextCore> context_; + // The ServiceWorkerContextCore object must outlive this. + ServiceWorkerContextCore* const context_; // |database_| is only accessed using |database_task_runner_|. std::unique_ptr<ServiceWorkerDatabase> database_;
diff --git a/content/browser/service_worker/service_worker_unregister_job.cc b/content/browser/service_worker/service_worker_unregister_job.cc index 3b1894d..2abb284e 100644 --- a/content/browser/service_worker/service_worker_unregister_job.cc +++ b/content/browser/service_worker/service_worker_unregister_job.cc
@@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_unregister_job.h" +#include <utility> + #include "base/bind.h" #include "base/memory/weak_ptr.h" #include "content/browser/service_worker/service_worker_context_core.h" @@ -19,9 +21,11 @@ typedef ServiceWorkerRegisterJobBase::RegistrationJobType RegistrationJobType; ServiceWorkerUnregisterJob::ServiceWorkerUnregisterJob( - base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerContextCore* context, const GURL& scope) - : context_(context), scope_(scope), is_promise_resolved_(false) {} + : context_(context), scope_(scope), is_promise_resolved_(false) { + DCHECK(context_); +} ServiceWorkerUnregisterJob::~ServiceWorkerUnregisterJob() {} @@ -40,6 +44,8 @@ blink::ServiceWorkerStatusCode::kErrorAbort); } +void ServiceWorkerUnregisterJob::WillShutDown() {} + bool ServiceWorkerUnregisterJob::Equals( ServiceWorkerRegisterJobBase* job) const { if (job->GetType() != GetType())
diff --git a/content/browser/service_worker/service_worker_unregister_job.h b/content/browser/service_worker/service_worker_unregister_job.h index 96702691..b32db83 100644 --- a/content/browser/service_worker/service_worker_unregister_job.h +++ b/content/browser/service_worker/service_worker_unregister_job.h
@@ -32,7 +32,7 @@ blink::ServiceWorkerStatusCode status)> UnregistrationCallback; - ServiceWorkerUnregisterJob(base::WeakPtr<ServiceWorkerContextCore> context, + ServiceWorkerUnregisterJob(ServiceWorkerContextCore* context, const GURL& scope); ~ServiceWorkerUnregisterJob() override; @@ -43,6 +43,7 @@ // ServiceWorkerRegisterJobBase implementation: void Start() override; void Abort() override; + void WillShutDown() override; bool Equals(ServiceWorkerRegisterJobBase* job) const override; RegistrationJobType GetType() const override; @@ -56,7 +57,8 @@ void ResolvePromise(int64_t registration_id, blink::ServiceWorkerStatusCode status); - base::WeakPtr<ServiceWorkerContextCore> context_; + // The ServiceWorkerContextCore object must outlive this. + ServiceWorkerContextCore* const context_; const GURL scope_; std::vector<UnregistrationCallback> callbacks_; bool is_promise_resolved_;
diff --git a/content/browser/service_worker/service_worker_update_checker.cc b/content/browser/service_worker/service_worker_update_checker.cc index 752297b0..56253ad 100644 --- a/content/browser/service_worker/service_worker_update_checker.cc +++ b/content/browser/service_worker/service_worker_update_checker.cc
@@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_update_checker.h" +#include <utility> + #include "base/bind.h" #include "base/task/post_task.h" #include "base/trace_event/trace_event.h" @@ -94,7 +96,9 @@ force_bypass_cache_(force_bypass_cache), update_via_cache_(update_via_cache), time_since_last_check_(time_since_last_check), - context_(context) {} + context_(context) { + DCHECK(context_); +} ServiceWorkerUpdateChecker::~ServiceWorkerUpdateChecker() = default;
diff --git a/content/browser/service_worker/service_worker_update_checker.h b/content/browser/service_worker/service_worker_update_checker.h index 0a38ba93..a5de842 100644 --- a/content/browser/service_worker/service_worker_update_checker.h +++ b/content/browser/service_worker/service_worker_update_checker.h
@@ -5,6 +5,10 @@ #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UPDATE_CHECKER_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UPDATE_CHECKER_H_ +#include <map> +#include <memory> +#include <vector> + #include "base/callback.h" #include "content/browser/service_worker/service_worker_database.h" #include "content/browser/service_worker/service_worker_single_script_update_checker.h"
diff --git a/content/browser/tracing/background_tracing_active_scenario.cc b/content/browser/tracing/background_tracing_active_scenario.cc index 5014f622..bb6cc52 100644 --- a/content/browser/tracing/background_tracing_active_scenario.cc +++ b/content/browser/tracing/background_tracing_active_scenario.cc
@@ -354,7 +354,20 @@ uint8_t modes = base::trace_event::TraceLog::RECORDING_MODE; if (!chrome_config.event_filters().empty()) modes |= base::trace_event::TraceLog::FILTERING_MODE; - base::trace_event::TraceLog::GetInstance()->SetEnabled(chrome_config, modes); + +// TODO(crbug.com/941318): Re-enable startup tracing for Perfetto backend on +// Android once all Perfetto-related deadlocks are resolved. +#if !defined(OS_ANDROID) + TraceConfig chrome_config_for_trace_log(chrome_config); + // Perfetto backend configures buffer sizes when tracing is started in the + // service (see perfetto_config.cc). Zero them out here for TraceLog to avoid + // DCHECKs in TraceConfig::Merge. + chrome_config_for_trace_log.SetTraceBufferSizeInKb(0); + chrome_config_for_trace_log.SetTraceBufferSizeInEvents(0); + + base::trace_event::TraceLog::GetInstance()->SetEnabled( + chrome_config_for_trace_log, modes); +#endif // !defined(OS_ANDROID) DCHECK(!tracing_session_); if (base::FeatureList::IsEnabled(features::kBackgroundTracingProtoOutput)) {
diff --git a/content/browser/tracing/startup_tracing_browsertest.cc b/content/browser/tracing/startup_tracing_browsertest.cc index f03ea41..e809fa64 100644 --- a/content/browser/tracing/startup_tracing_browsertest.cc +++ b/content/browser/tracing/startup_tracing_browsertest.cc
@@ -127,6 +127,8 @@ auto config = tracing::TraceStartupConfig::GetInstance() ->GetDefaultBrowserStartupConfig(); + config.SetTraceBufferSizeInEvents(0); + config.SetTraceBufferSizeInKb(0); uint8_t modes = base::trace_event::TraceLog::RECORDING_MODE; base::trace_event::TraceLog::GetInstance()->SetEnabled(config, modes);
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index a3fac4b..36d1244 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -1412,7 +1412,7 @@ } // TODO(http://crbug.com/997808): Flaky on Linux ASAN. -#if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) +#if defined(OS_LINUX) && (defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER)) #define MAYBE_SplitCacheDedicatedWorkers DISABLED_SplitCacheDedicatedWorkers #else #define MAYBE_SplitCacheDedicatedWorkers SplitCacheDedicatedWorkers
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index ac096c7..d20136b 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -412,6 +412,7 @@ public: AsyncDropNavigationObserver(WebContents* watched_contents, std::unique_ptr<DropData> drop_data, + base::ScopedClosureRunner end_drag_runner, RenderWidgetHostImpl* target_rwh, const gfx::PointF& client_pt, const gfx::PointF& screen_pt, @@ -436,6 +437,7 @@ // Data cached at the start of the drop operation and needed to complete the // drop. std::unique_ptr<DropData> drop_data_; + base::ScopedClosureRunner end_drag_runner_; base::WeakPtr<RenderWidgetHostImpl> target_rwh_; const gfx::PointF client_pt_; const gfx::PointF screen_pt_; @@ -447,6 +449,7 @@ WebContentsViewAura::AsyncDropNavigationObserver::AsyncDropNavigationObserver( WebContents* watched_contents, std::unique_ptr<DropData> drop_data, + base::ScopedClosureRunner end_drag_runner, RenderWidgetHostImpl* target_rwh, const gfx::PointF& client_pt, const gfx::PointF& screen_pt, @@ -454,6 +457,7 @@ : WebContentsObserver(watched_contents), drop_allowed_(true), drop_data_(std::move(drop_data)), + end_drag_runner_(std::move(end_drag_runner)), target_rwh_(target_rwh->GetWeakPtr()), client_pt_(client_pt), screen_pt_(screen_pt), @@ -1093,7 +1097,15 @@ return; } - EndDrag(source_rwh_weak_ptr.get(), ConvertToWeb(result_op)); + // If drag is still in progress that means we haven't received drop targeting + // callback yet. So we have to make sure to delay calling EndDrag until drop + // is done. + if (!drag_in_progress_) + EndDrag(source_rwh_weak_ptr.get(), ConvertToWeb(result_op)); + else + end_drag_runner_ = base::ScopedClosureRunner(base::BindOnce( + &WebContentsViewAura::EndDrag, weak_ptr_factory_.GetWeakPtr(), + source_rwh_weak_ptr.get(), ConvertToWeb(result_op))); } void WebContentsViewAura::UpdateDragCursor(blink::WebDragOperation operation) { @@ -1387,6 +1399,8 @@ base::WeakPtr<RenderWidgetHostViewBase> target, base::Optional<gfx::PointF> transformed_pt) { drag_in_progress_ = false; + base::ScopedClosureRunner end_drag_runner(std::move(end_drag_runner_)); + if (!target) return; RenderWidgetHostImpl* target_rwh = @@ -1407,9 +1421,8 @@ DragEnteredCallback(event, std::move(drop_data), target, transformed_pt); } - if (!current_drop_data_) { + if (!current_drop_data_) return; - } const int key_modifiers = ui::EventFlagsToWebEventModifiers(event.flags()); #if defined(OS_WIN) @@ -1434,8 +1447,9 @@ // operation completes. async_drop_navigation_observer_ = std::make_unique<AsyncDropNavigationObserver>( - web_contents_, std::move(current_drop_data_), target_rwh, - transformed_pt.value(), screen_pt, key_modifiers); + web_contents_, std::move(current_drop_data_), + std::move(end_drag_runner), target_rwh, transformed_pt.value(), + screen_pt, key_modifiers); return; } }
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h index 149aeb2b..b133ebd7 100644 --- a/content/browser/web_contents/web_contents_view_aura.h +++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "base/callback_helpers.h" #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -244,6 +245,10 @@ #endif DropCallbackForTesting drop_callback_for_testing_; + // If this callback is initialized it must be run after the drop operation is + // done to send dragend event in EndDrag function. + base::ScopedClosureRunner end_drag_runner_; + std::unique_ptr<aura::Window> window_; std::unique_ptr<WindowObserver> window_observer_;
diff --git a/content/child/child_process_sandbox_support_impl_linux.cc b/content/child/child_process_sandbox_support_impl_linux.cc index 0a57543..712e428 100644 --- a/content/child/child_process_sandbox_support_impl_linux.cc +++ b/content/child/child_process_sandbox_support_impl_linux.cc
@@ -47,10 +47,8 @@ std::string family_name; if (!font_loader_->FallbackFontForCharacter(character, preferred_locale, &font_identity, &family_name, - &is_bold, &is_italic)) { - LOG(ERROR) << "FontService fallback request does not receive a response."; + &is_bold, &is_italic)) return; - } // TODO(drott): Perhaps take OutOfProcessFont out of the picture here and pass // mojo FontIdentityPtr directly?
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index a40e8af..11e3b39e 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -42,75 +42,19 @@ namespace { -void SetRuntimeFeatureDefaultsForPlatform() { +// Sets blink runtime features for specific platforms. +// This should be a last resort vs runtime_enabled_features.json5. +void SetRuntimeFeatureDefaultsForPlatform( + const base::CommandLine& command_line) { // Please consider setting up feature defaults for different platforms // in runtime_enabled_features.json5 instead of here - #if defined(USE_AURA) WebRuntimeFeatures::EnableCompositedSelectionUpdate(true); #endif - #if defined(OS_WIN) if (base::win::GetVersion() >= base::win::Version::WIN10) WebRuntimeFeatures::EnableWebBluetooth(true); #endif -} - -void SetIndividualRuntimeFeatures( - const base::CommandLine& command_line, - bool enable_experimental_web_platform_features) { - - if (!base::FeatureList::IsEnabled(features::kWebUsb)) - WebRuntimeFeatures::EnableWebUsb(false); - - if (base::FeatureList::IsEnabled( - blink::features::kBlockingFocusWithoutUserActivation)) { - WebRuntimeFeatures::EnableBlockingFocusWithoutUserActivation(true); - } - - if (command_line.HasSwitch(switches::kDisableDatabases)) - WebRuntimeFeatures::EnableDatabase(false); - - if (command_line.HasSwitch(switches::kDisableNotifications)) { - WebRuntimeFeatures::EnableNotifications(false); - - // Chrome's Push Messaging implementation relies on Web Notifications. - WebRuntimeFeatures::EnablePushMessaging(false); - } - - if (!base::FeatureList::IsEnabled(features::kNotificationContentImage)) - WebRuntimeFeatures::EnableNotificationContentImage(false); - - WebRuntimeFeatures::EnableSharedArrayBuffer( - base::FeatureList::IsEnabled(features::kSharedArrayBuffer) || - base::FeatureList::IsEnabled(features::kWebAssemblyThreads)); - - if (command_line.HasSwitch(switches::kDisableSharedWorkers)) - WebRuntimeFeatures::EnableSharedWorker(false); - - if (command_line.HasSwitch(switches::kDisableSpeechAPI)) { - WebRuntimeFeatures::EnableScriptedSpeechRecognition(false); - WebRuntimeFeatures::EnableScriptedSpeechSynthesis(false); - } - - if (command_line.HasSwitch(switches::kDisableSpeechSynthesisAPI)) { - WebRuntimeFeatures::EnableScriptedSpeechSynthesis(false); - } - - if (command_line.HasSwitch(switches::kDisableFileSystem)) - WebRuntimeFeatures::EnableFileSystem(false); - - if (!command_line.HasSwitch(switches::kDisableYUVImageDecoding) && - base::FeatureList::IsEnabled( - blink::features::kDecodeJpeg420ImagesToYUV)) { - WebRuntimeFeatures::EnableDecodeJpeg420ImagesToYUV(true); - } - - if (!command_line.HasSwitch(switches::kDisableYUVImageDecoding) && - base::FeatureList::IsEnabled( - blink::features::kDecodeLossyWebPImagesToYUV)) { - WebRuntimeFeatures::EnableDecodeLossyWebPImagesToYUV(true); - } #if defined(SUPPORT_WEBGL2_COMPUTE_CONTEXT) if (command_line.HasSwitch(switches::kEnableWebGL2ComputeContext)) { @@ -118,16 +62,6 @@ } #endif - if (command_line.HasSwitch(switches::kEnableWebGLDraftExtensions)) - WebRuntimeFeatures::EnableWebGLDraftExtensions(true); - - if (command_line.HasSwitch(switches::kEnableAutomation) || - command_line.HasSwitch(switches::kHeadless) || - command_line.HasSwitch(switches::kRemoteDebuggingPipe) || - command_line.HasSwitch(switches::kRemoteDebuggingPort)) { - WebRuntimeFeatures::EnableAutomationControlled(true); - } - #if defined(OS_MACOSX) const bool enable_canvas_2d_image_chromium = command_line.HasSwitch( @@ -154,24 +88,64 @@ #endif WebRuntimeFeatures::EnableWebGLImageChromium(enable_web_gl_image_chromium); - if (command_line.HasSwitch(switches::kForceOverlayFullscreenVideo)) - WebRuntimeFeatures::ForceOverlayFullscreenVideo(true); +#if defined(OS_ANDROID) + if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) + WebRuntimeFeatures::EnableMediaSession(false); +#endif - if (ui::IsOverlayScrollbarEnabled()) - WebRuntimeFeatures::EnableOverlayScrollbars(true); +#if defined(OS_ANDROID) + WebRuntimeFeatures::EnableWebNfc( + base::FeatureList::IsEnabled(features::kWebNfc)); +#endif - if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) - WebRuntimeFeatures::EnablePreciseMemoryInfo(true); +#if defined(OS_ANDROID) + // APIs for Web Authentication are not available prior to N. + WebRuntimeFeatures::EnableWebAuth( + base::FeatureList::IsEnabled(features::kWebAuth) && + base::android::BuildInfo::GetInstance()->sdk_int() >= + base::android::SDK_VERSION_NOUGAT); +#else + WebRuntimeFeatures::EnableWebAuth( + base::FeatureList::IsEnabled(features::kWebAuth)); +#endif - if (command_line.HasSwitch(switches::kEnablePrintBrowser)) - WebRuntimeFeatures::EnablePrintBrowser(true); +#if defined(OS_ANDROID) + WebRuntimeFeatures::EnablePictureInPictureAPI( + base::FeatureList::IsEnabled(media::kPictureInPictureAPI)); +#endif - // TODO(yashard): Remove |enable_experimental_web_platform_features| flag - // since the feature should have been enabled when it is set to experimental - if (command_line.HasSwitch(switches::kEnableNetworkInformationDownlinkMax) || - enable_experimental_web_platform_features) { - WebRuntimeFeatures::EnableNetInfoDownlinkMax(true); +#if defined(OS_ANDROID) + if (base::android::BuildInfo::GetInstance()->sdk_int() >= + base::android::SDK_VERSION_P) { + // Display Cutout is limited to Android P+. + WebRuntimeFeatures::EnableDisplayCutoutAPI(true); } +#endif + +#if defined(OS_ANDROID) + WebRuntimeFeatures::EnableMediaControlsExpandGesture( + base::FeatureList::IsEnabled(media::kMediaControlsExpandGesture)); +#endif +} + +// Sets blink runtime features that are either directly +// controlled by Chromium base::Feature or are overridden +// by base::Feature states. +void SetRuntimeFeaturesFromChromiumFeatures() { + if (!base::FeatureList::IsEnabled(features::kWebUsb)) + WebRuntimeFeatures::EnableWebUsb(false); + + if (base::FeatureList::IsEnabled( + blink::features::kBlockingFocusWithoutUserActivation)) { + WebRuntimeFeatures::EnableBlockingFocusWithoutUserActivation(true); + } + + if (!base::FeatureList::IsEnabled(features::kNotificationContentImage)) + WebRuntimeFeatures::EnableNotificationContentImage(false); + + WebRuntimeFeatures::EnableSharedArrayBuffer( + base::FeatureList::IsEnabled(features::kSharedArrayBuffer) || + base::FeatureList::IsEnabled(features::kWebAssemblyThreads)); WebRuntimeFeatures::EnableReducedReferrerGranularity( base::FeatureList::IsEnabled(features::kReducedReferrerGranularity)); @@ -179,20 +153,6 @@ if (base::FeatureList::IsEnabled(features::kPeriodicBackgroundSync)) WebRuntimeFeatures::EnablePeriodicBackgroundSync(true); - if (command_line.HasSwitch(switches::kDisablePermissionsAPI)) - WebRuntimeFeatures::EnablePermissionsAPI(false); - - if (command_line.HasSwitch(switches::kDisableV8IdleTasks)) - WebRuntimeFeatures::EnableV8IdleTasks(false); - else - WebRuntimeFeatures::EnableV8IdleTasks(true); - - if (command_line.HasSwitch(switches::kEnableUnsafeWebGPU)) - WebRuntimeFeatures::EnableWebGPU(true); - - if (command_line.HasSwitch(switches::kEnableWebVR)) - WebRuntimeFeatures::EnableWebVR(true); - if (base::FeatureList::IsEnabled(features::kWebXr)) WebRuntimeFeatures::EnableWebXR(true); @@ -208,21 +168,11 @@ if (base::FeatureList::IsEnabled(features::kWebXrPlaneDetection)) WebRuntimeFeatures::EnableWebXRPlaneDetection(true); - if (command_line.HasSwitch(switches::kDisablePresentationAPI)) - WebRuntimeFeatures::EnablePresentationAPI(false); - - if (command_line.HasSwitch(switches::kDisableRemotePlaybackAPI)) - WebRuntimeFeatures::EnableRemotePlaybackAPI(false); - - // TODO(yashard): Remove |enable_experimental_web_platform_features| flag - // since the feature should have been enabled when it is set to experimental WebRuntimeFeatures::EnableFetchMetadata( - base::FeatureList::IsEnabled(network::features::kFetchMetadata) || - enable_experimental_web_platform_features); + base::FeatureList::IsEnabled(network::features::kFetchMetadata)); WebRuntimeFeatures::EnableFetchMetadataDestination( base::FeatureList::IsEnabled( - network::features::kFetchMetadataDestination) || - enable_experimental_web_platform_features); + network::features::kFetchMetadataDestination)); WebRuntimeFeatures::EnableUserActivationPostMessageTransfer( base::FeatureList::IsEnabled( @@ -240,13 +190,11 @@ WebRuntimeFeatures::EnableFeatureFromString( "CSSBackdropFilter", - base::FeatureList::IsEnabled(blink::features::kCSSBackdropFilter) || - enable_experimental_web_platform_features); + base::FeatureList::IsEnabled(blink::features::kCSSBackdropFilter)); WebRuntimeFeatures::EnableFeatureFromString( "FastBorderRadius", - base::FeatureList::IsEnabled(blink::features::kFastBorderRadius) || - enable_experimental_web_platform_features); + base::FeatureList::IsEnabled(blink::features::kFastBorderRadius)); WebRuntimeFeatures::EnablePassiveDocumentEventListeners( base::FeatureList::IsEnabled(features::kPassiveDocumentEventListeners)); @@ -263,9 +211,6 @@ "LegacyWindowsDWriteFontFallback", base::FeatureList::IsEnabled(features::kLegacyWindowsDWriteFontFallback)); - if (command_line.HasSwitch(switches::kDisableBackgroundTimerThrottling)) - WebRuntimeFeatures::EnableTimerThrottlingForBackgroundTabs(false); - WebRuntimeFeatures::EnableExpensiveBackgroundTimerThrottling( base::FeatureList::IsEnabled( features::kExpensiveBackgroundTimerThrottling)); @@ -277,11 +222,6 @@ features::kSendBeaconThrowForBlobWithNonSimpleType)) WebRuntimeFeatures::EnableSendBeaconThrowForBlobWithNonSimpleType(true); -#if defined(OS_ANDROID) - if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) - WebRuntimeFeatures::EnableMediaSession(false); -#endif - WebRuntimeFeatures::EnablePaymentRequest( base::FeatureList::IsEnabled(features::kWebPayments)); @@ -294,9 +234,6 @@ if (base::FeatureList::IsEnabled(features::kGenericSensorExtraClasses)) WebRuntimeFeatures::EnableGenericSensorExtraClasses(true); - if (network::features::ShouldEnableOutOfBlinkCors()) - WebRuntimeFeatures::EnableOutOfBlinkCors(true); - if (base::FeatureList::IsEnabled( network::features::kBlockNonSecureExternalRequests)) { WebRuntimeFeatures::EnableFeatureFromString("AddressSpace", true); @@ -318,22 +255,6 @@ base::FeatureList::IsEnabled( features::kAllowContentInitiatedDataUrlNavigations)); -#if defined(OS_ANDROID) - WebRuntimeFeatures::EnableWebNfc( - base::FeatureList::IsEnabled(features::kWebNfc)); -#endif - -#if defined(OS_ANDROID) - // APIs for Web Authentication are not available prior to N. - WebRuntimeFeatures::EnableWebAuth( - base::FeatureList::IsEnabled(features::kWebAuth) && - base::android::BuildInfo::GetInstance()->sdk_int() >= - base::android::SDK_VERSION_NOUGAT); -#else - WebRuntimeFeatures::EnableWebAuth( - base::FeatureList::IsEnabled(features::kWebAuth)); -#endif - WebRuntimeFeatures::EnableResourceLoadScheduler( base::FeatureList::IsEnabled(features::kResourceLoadScheduler)); @@ -377,39 +298,9 @@ WebRuntimeFeatures::EnableLazyImageVisibleLoadTimeMetrics( base::FeatureList::IsEnabled(features::kLazyImageVisibleLoadTimeMetrics)); - WebRuntimeFeatures::EnableAutomaticLazyFrameLoading( - base::GetFieldTrialParamByFeatureAsBool( - features::kLazyFrameLoading, "automatic-lazy-load-frames-enabled", - false)); - WebRuntimeFeatures::EnableRestrictAutomaticLazyFrameLoadingToDataSaver( - base::GetFieldTrialParamByFeatureAsBool( - features::kLazyFrameLoading, - "restrict-lazy-load-frames-to-data-saver-only", true)); - WebRuntimeFeatures::EnableAutoLazyLoadOnReloads( - base::GetFieldTrialParamByFeatureAsBool( - features::kLazyFrameLoading, "enable-lazy-load-on-reload", false)); - - WebRuntimeFeatures::EnableAutomaticLazyImageLoading( - base::GetFieldTrialParamByFeatureAsBool( - features::kLazyImageLoading, "automatic-lazy-load-images-enabled", - false)); - WebRuntimeFeatures::EnableRestrictAutomaticLazyImageLoadingToDataSaver( - base::GetFieldTrialParamByFeatureAsBool( - features::kLazyImageLoading, - "restrict-lazy-load-images-to-data-saver-only", true)); - WebRuntimeFeatures::EnableLazyImageLoadingMetadataFetch( - base::GetFieldTrialParamByFeatureAsBool( - features::kLazyImageLoading, "enable-lazy-load-images-metadata-fetch", - false)); - WebRuntimeFeatures::EnablePictureInPicture( base::FeatureList::IsEnabled(media::kPictureInPicture)); -#if defined(OS_ANDROID) - WebRuntimeFeatures::EnablePictureInPictureAPI( - base::FeatureList::IsEnabled(media::kPictureInPictureAPI)); -#endif - WebRuntimeFeatures::EnableCacheInlineScriptCode( base::FeatureList::IsEnabled(features::kCacheInlineScriptCode)); @@ -424,45 +315,18 @@ if (base::FeatureList::IsEnabled(features::kFeaturePolicyForSandbox)) WebRuntimeFeatures::EnableFeaturePolicyForSandbox(true); -#if defined(OS_ANDROID) - if (base::android::BuildInfo::GetInstance()->sdk_int() >= - base::android::SDK_VERSION_P) { - // Display Cutout is limited to Android P+. - WebRuntimeFeatures::EnableDisplayCutoutAPI(true); - } -#endif - WebRuntimeFeatures::EnableAccessibilityExposeDisplayNone( base::FeatureList::IsEnabled( features::kEnableAccessibilityExposeDisplayNone)); - if (command_line.HasSwitch(switches::kEnableAccessibilityObjectModel)) - WebRuntimeFeatures::EnableAccessibilityObjectModel(true); - - if (base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine( - blink::features::kNativeFileSystemAPI.name, - base::FeatureList::OVERRIDE_ENABLE_FEATURE)) { - WebRuntimeFeatures::EnableFeatureFromString("NativeFileSystem", true); - } - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI) && - base::FeatureList::IsEnabled(blink::features::kFileHandlingAPI)) { - WebRuntimeFeatures::EnableFeatureFromString("FileHandling", true); - } - if (base::FeatureList::IsEnabled( - blink::features::kAllowSyncXHRInPageDismissal) || - command_line.HasSwitch(switches::kAllowSyncXHRInPageDismissal)) { + blink::features::kAllowSyncXHRInPageDismissal)) { WebRuntimeFeatures::EnableAllowSyncXHRInPageDismissal(true); } WebRuntimeFeatures::EnableAutoplayIgnoresWebAudio( base::FeatureList::IsEnabled(media::kAutoplayIgnoreWebAudio)); -#if defined(OS_ANDROID) - WebRuntimeFeatures::EnableMediaControlsExpandGesture( - base::FeatureList::IsEnabled(media::kMediaControlsExpandGesture)); -#endif - WebRuntimeFeatures::EnablePortals( base::FeatureList::IsEnabled(blink::features::kPortals)); @@ -515,11 +379,7 @@ WebRuntimeFeatures::EnableSmsReceiver(false); WebRuntimeFeatures::EnableDisplayLocking( - base::FeatureList::IsEnabled(blink::features::kDisplayLocking) || - enable_experimental_web_platform_features); - - WebRuntimeFeatures::EnableFormControlsRefresh( - features::IsFormControlsRefreshEnabled()); + base::FeatureList::IsEnabled(blink::features::kDisplayLocking)); if (base::FeatureList::IsEnabled( blink::features::kAudioWorkletRealtimeThread)) { @@ -578,30 +438,195 @@ base::FeatureList::IsEnabled(features::kDocumentPolicy)); } +// Sets blink runtime features controlled by command line switches. +void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) { + if (command_line.HasSwitch(switches::kDisableDatabases)) + WebRuntimeFeatures::EnableDatabase(false); + + if (command_line.HasSwitch(switches::kDisableNotifications)) { + WebRuntimeFeatures::EnableNotifications(false); + + // Chrome's Push Messaging implementation relies on Web Notifications. + WebRuntimeFeatures::EnablePushMessaging(false); + } + + if (command_line.HasSwitch(switches::kDisableSharedWorkers)) + WebRuntimeFeatures::EnableSharedWorker(false); + + if (command_line.HasSwitch(switches::kDisableSpeechAPI)) { + WebRuntimeFeatures::EnableScriptedSpeechRecognition(false); + WebRuntimeFeatures::EnableScriptedSpeechSynthesis(false); + } + + if (command_line.HasSwitch(switches::kDisableSpeechSynthesisAPI)) { + WebRuntimeFeatures::EnableScriptedSpeechSynthesis(false); + } + + if (command_line.HasSwitch(switches::kDisableFileSystem)) + WebRuntimeFeatures::EnableFileSystem(false); + + if (command_line.HasSwitch(switches::kEnableWebGLDraftExtensions)) + WebRuntimeFeatures::EnableWebGLDraftExtensions(true); + + if (command_line.HasSwitch(switches::kEnableAutomation) || + command_line.HasSwitch(switches::kHeadless) || + command_line.HasSwitch(switches::kRemoteDebuggingPipe) || + command_line.HasSwitch(switches::kRemoteDebuggingPort)) { + WebRuntimeFeatures::EnableAutomationControlled(true); + } + + if (command_line.HasSwitch(switches::kForceOverlayFullscreenVideo)) + WebRuntimeFeatures::ForceOverlayFullscreenVideo(true); + + if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) + WebRuntimeFeatures::EnablePreciseMemoryInfo(true); + + if (command_line.HasSwitch(switches::kEnablePrintBrowser)) + WebRuntimeFeatures::EnablePrintBrowser(true); + + if (command_line.HasSwitch(switches::kEnableNetworkInformationDownlinkMax)) + WebRuntimeFeatures::EnableNetInfoDownlinkMax(true); + + if (command_line.HasSwitch(switches::kDisablePermissionsAPI)) + WebRuntimeFeatures::EnablePermissionsAPI(false); + + if (command_line.HasSwitch(switches::kDisableV8IdleTasks)) + WebRuntimeFeatures::EnableV8IdleTasks(false); + else + WebRuntimeFeatures::EnableV8IdleTasks(true); + + if (command_line.HasSwitch(switches::kEnableUnsafeWebGPU)) + WebRuntimeFeatures::EnableWebGPU(true); + + if (command_line.HasSwitch(switches::kEnableWebVR)) + WebRuntimeFeatures::EnableWebVR(true); + + if (command_line.HasSwitch(switches::kDisablePresentationAPI)) + WebRuntimeFeatures::EnablePresentationAPI(false); + + if (command_line.HasSwitch(switches::kDisableRemotePlaybackAPI)) + WebRuntimeFeatures::EnableRemotePlaybackAPI(false); + + if (command_line.HasSwitch(switches::kDisableBackgroundTimerThrottling)) + WebRuntimeFeatures::EnableTimerThrottlingForBackgroundTabs(false); + + if (command_line.HasSwitch(switches::kEnableAccessibilityObjectModel)) + WebRuntimeFeatures::EnableAccessibilityObjectModel(true); + + if (command_line.HasSwitch(switches::kAllowSyncXHRInPageDismissal)) + WebRuntimeFeatures::EnableAllowSyncXHRInPageDismissal(true); +} + +// Sets blink runtime features controlled by FieldTrial parameter values. +void SetRuntimeFeaturesFromFieldTrialParams() { + WebRuntimeFeatures::EnableAutomaticLazyFrameLoading( + base::GetFieldTrialParamByFeatureAsBool( + features::kLazyFrameLoading, "automatic-lazy-load-frames-enabled", + false)); + WebRuntimeFeatures::EnableRestrictAutomaticLazyFrameLoadingToDataSaver( + base::GetFieldTrialParamByFeatureAsBool( + features::kLazyFrameLoading, + "restrict-lazy-load-frames-to-data-saver-only", true)); + WebRuntimeFeatures::EnableAutoLazyLoadOnReloads( + base::GetFieldTrialParamByFeatureAsBool( + features::kLazyFrameLoading, "enable-lazy-load-on-reload", false)); + + WebRuntimeFeatures::EnableAutomaticLazyImageLoading( + base::GetFieldTrialParamByFeatureAsBool( + features::kLazyImageLoading, "automatic-lazy-load-images-enabled", + false)); + WebRuntimeFeatures::EnableRestrictAutomaticLazyImageLoadingToDataSaver( + base::GetFieldTrialParamByFeatureAsBool( + features::kLazyImageLoading, + "restrict-lazy-load-images-to-data-saver-only", true)); + WebRuntimeFeatures::EnableLazyImageLoadingMetadataFetch( + base::GetFieldTrialParamByFeatureAsBool( + features::kLazyImageLoading, "enable-lazy-load-images-metadata-fetch", + false)); +} + +// Sets blink runtime features that depend on a combination +// of args rather than a single check of base::Feature or switch. +// This can be a combination of both or custom checking logic +// not covered by other functions. In short, this should be used +// as a last resort. +void SetCustomizedRuntimeFeaturesFromCombinedArgs( + const base::CommandLine& command_line, + bool enable_experimental_web_platform_features) { + // CAUTION: Only add custom enabling logic here if it cannot + // be covered by the other functions. + + if (!command_line.HasSwitch(switches::kDisableYUVImageDecoding) && + base::FeatureList::IsEnabled( + blink::features::kDecodeJpeg420ImagesToYUV)) { + WebRuntimeFeatures::EnableDecodeJpeg420ImagesToYUV(true); + } + if (!command_line.HasSwitch(switches::kDisableYUVImageDecoding) && + base::FeatureList::IsEnabled( + blink::features::kDecodeLossyWebPImagesToYUV)) { + WebRuntimeFeatures::EnableDecodeLossyWebPImagesToYUV(true); + } + + if (ui::IsOverlayScrollbarEnabled()) + WebRuntimeFeatures::EnableOverlayScrollbars(true); + if (network::features::ShouldEnableOutOfBlinkCors()) + WebRuntimeFeatures::EnableOutOfBlinkCors(true); + WebRuntimeFeatures::EnableFormControlsRefresh( + features::IsFormControlsRefreshEnabled()); + + if (base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine( + blink::features::kNativeFileSystemAPI.name, + base::FeatureList::OVERRIDE_ENABLE_FEATURE)) { + WebRuntimeFeatures::EnableFeatureFromString("NativeFileSystem", true); + } + if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI) && + base::FeatureList::IsEnabled(blink::features::kFileHandlingAPI)) { + WebRuntimeFeatures::EnableFeatureFromString("FileHandling", true); + } + + // This is a hack to get the tests passing as they require + // these blink features to be enabled while they are disabled + // by base::Feature controls earlier in code. + // TODO(rodneyding): Investigate more on proper treatments of + // these features. + if (enable_experimental_web_platform_features) { + WebRuntimeFeatures::EnableNetInfoDownlinkMax(true); + WebRuntimeFeatures::EnableFetchMetadata(true); + WebRuntimeFeatures::EnableFetchMetadataDestination(true); + WebRuntimeFeatures::EnableFeatureFromString("CSSBackdropFilter", true); + WebRuntimeFeatures::EnableFeatureFromString("FastBorderRadius", true); + WebRuntimeFeatures::EnableDisplayLocking(true); + } +} + } // namespace namespace content { void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( const base::CommandLine& command_line) { - // Set experimental features + // Sets experimental features. bool enable_experimental_web_platform_features = command_line.HasSwitch(switches::kEnableExperimentalWebPlatformFeatures); if (enable_experimental_web_platform_features) WebRuntimeFeatures::EnableExperimentalFeatures(true); - SetRuntimeFeatureDefaultsForPlatform(); + SetRuntimeFeatureDefaultsForPlatform(command_line); - // Set origin trial features + // Sets origin trial features. if (command_line.HasSwitch( switches::kDisableOriginTrialControlledBlinkFeatures)) { WebRuntimeFeatures::EnableOriginTrialControlledFeatures(false); } - // TODO(yashard): Remove |enable_experimental_web_platform_features| - // flag since no individual feature should need it - SetIndividualRuntimeFeatures(command_line, - enable_experimental_web_platform_features); + SetRuntimeFeaturesFromChromiumFeatures(); + + SetRuntimeFeaturesFromCommandLine(command_line); + + SetRuntimeFeaturesFromFieldTrialParams(); + + SetCustomizedRuntimeFeaturesFromCombinedArgs( + command_line, enable_experimental_web_platform_features); // Enable explicitly enabled features, and then disable explicitly disabled // ones.
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn index 2c949bb..197094e2 100644 --- a/content/public/android/BUILD.gn +++ b/content/public/android/BUILD.gn
@@ -90,6 +90,7 @@ "//third_party/jsr-305:jsr_305_javalib", "//ui/android:ui_java", "//ui/gfx/geometry/mojom:mojom_java", + "//url:origin_java", ] srcjar_deps = [
diff --git a/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java b/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java index 269faba5..34a911b 100644 --- a/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java
@@ -12,6 +12,7 @@ import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.mojo.system.impl.CoreImpl; import org.chromium.services.service_manager.InterfaceProvider; +import org.chromium.url.Origin; /** * The RenderFrameHostImpl Java wrapper to allow communicating with the native RenderFrameHost @@ -73,6 +74,13 @@ } @Override + public Origin getLastCommittedOrigin() { + if (mNativeRenderFrameHostAndroid == 0) return null; + return RenderFrameHostImplJni.get().getLastCommittedOrigin( + mNativeRenderFrameHostAndroid, RenderFrameHostImpl.this); + } + + @Override public void getCanonicalUrlForSharing(Callback<String> callback) { if (mNativeRenderFrameHostAndroid == 0) { callback.onResult(null); @@ -121,6 +129,8 @@ @NativeMethods interface Natives { String getLastCommittedURL(long nativeRenderFrameHostAndroid, RenderFrameHostImpl caller); + Origin getLastCommittedOrigin( + long nativeRenderFrameHostAndroid, RenderFrameHostImpl caller); void getCanonicalUrlForSharing(long nativeRenderFrameHostAndroid, RenderFrameHostImpl caller, Callback<String> callback); UnguessableToken getAndroidOverlayRoutingToken(
diff --git a/content/public/android/java/src/org/chromium/content_public/browser/RenderFrameHost.java b/content/public/android/java/src/org/chromium/content_public/browser/RenderFrameHost.java index 0a4efba..9d1d36a3 100644 --- a/content/public/android/java/src/org/chromium/content_public/browser/RenderFrameHost.java +++ b/content/public/android/java/src/org/chromium/content_public/browser/RenderFrameHost.java
@@ -6,6 +6,7 @@ import org.chromium.base.Callback; import org.chromium.services.service_manager.InterfaceProvider; +import org.chromium.url.Origin; /** * The RenderFrameHost Java wrapper to allow communicating with the native RenderFrameHost object. @@ -19,6 +20,15 @@ String getLastCommittedURL(); /** + * Get the last committed Origin of the frame. This is not always the same as scheme/host/port + * of getLastCommittedURL(), since it can be an "opaque" origin in such cases as, for example, + * sandboxed frame. + * + * @return The last committed Origin of the frame. + */ + Origin getLastCommittedOrigin(); + + /** * Fetch the canonical URL associated with the fame. * * @param callback The callback to be notified once the canonical URL has been fetched.
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/BrowserStartupControllerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/BrowserStartupControllerTest.java index 143f54c..71d43d66 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/BrowserStartupControllerTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/BrowserStartupControllerTest.java
@@ -117,7 +117,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mController = new TestBrowserStartupController(); RecordHistogram.setDisabledForTests(true); // Setting the static singleton instance field enables more correct testing, since it is
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java index b733563..d2ba1eb 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherHelperTest.java
@@ -58,7 +58,7 @@ private static final int BLOCK_UNTIL_SETUP = 2; @Before - public void setUp() throws Exception { + public void setUp() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_CHILD); } @@ -267,7 +267,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testWarmUpProcessCrashBeforeUse() throws RemoteException { + public void testWarmUpProcessCrashBeforeUse() { Assert.assertEquals(0, getConnectedSandboxedServicesCount()); Context context = InstrumentationRegistry.getTargetContext(); @@ -294,7 +294,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testWarmUpProcessCrashAfterUse() throws RemoteException { + public void testWarmUpProcessCrashAfterUse() { Context context = InstrumentationRegistry.getTargetContext(); warmUpOnUiThreadBlocking(context, true /* sandboxed */); @@ -319,7 +319,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testWarmUpPrivilegedProcess() throws RemoteException { + public void testWarmUpPrivilegedProcess() { Assert.assertEquals(0, getConnectedServicesCount()); Context context = InstrumentationRegistry.getTargetContext(); @@ -340,7 +340,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testLauncherCleanup() throws RemoteException { + public void testLauncherCleanup() { ChildProcessLauncherHelperImpl launcher = startSandboxedChildProcess(BLOCK_UNTIL_SETUP, true /* doSetupConnection */); int pid = getPid(launcher);
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java index 42246d66..a24950a 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
@@ -6,7 +6,6 @@ import android.content.Context; import android.os.Bundle; -import android.os.RemoteException; import android.support.test.InstrumentationRegistry; import android.support.test.filters.LargeTest; import android.support.test.filters.MediumTest; @@ -100,7 +99,7 @@ private ChildConnectionAllocator mConnectionAllocator; @Before - public void setUp() throws Exception { + public void setUp() { mConnectionAllocator = ChildProcessLauncherTestUtils.runOnLauncherAndGetResult( new Callable<ChildConnectionAllocator>() { @Override @@ -162,19 +161,19 @@ mOnRunMainHelper.notifyCalled(); } - public void waitForOnConnectionSetupCalled() throws InterruptedException, TimeoutException { + public void waitForOnConnectionSetupCalled() throws TimeoutException { mOnConnectionSetupHelper.waitForCallback(0 /* currentCallCount */); } - public void waitForOnNativeLibraryCalled() throws InterruptedException, TimeoutException { + public void waitForOnNativeLibraryCalled() throws TimeoutException { mOnLoadNativeHelper.waitForCallback(0 /* currentCallCount */); } - public void waitOnBeforeMainCalled() throws InterruptedException, TimeoutException { + public void waitOnBeforeMainCalled() throws TimeoutException { mOnBeforeMainHelper.waitForCallback(0 /* currentCallCount */); } - public void waitOnRunMainCalled() throws InterruptedException, TimeoutException { + public void waitOnRunMainCalled() throws TimeoutException { mOnRunMainHelper.waitForCallback(0 /* currentCallCount */); } }; @@ -186,7 +185,7 @@ * validate them. */ private void testProcessLauncher(final AlreadyBoundConnection boundConnectionToUse) - throws InterruptedException, TimeoutException { + throws TimeoutException { // ConditionVariables used to check the ChildProcessLauncher.Delegate methods get called. final CallbackHelper onBeforeConnectionAllocatedHelper = new CallbackHelper(); final CallbackHelper onBeforeConnectionSetupHelper = new CallbackHelper(); @@ -379,7 +378,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testServiceCrashedBeforeSetup() throws RemoteException { + public void testServiceCrashedBeforeSetup() { Assert.assertFalse(mConnectionAllocator.anyConnectionAllocated()); // Start and connect to a new service. @@ -403,7 +402,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testServiceCrashedAfterSetup() throws RemoteException { + public void testServiceCrashedAfterSetup() { Assert.assertFalse(mConnectionAllocator.anyConnectionAllocated()); // Start and connect to a new service. @@ -430,7 +429,7 @@ @Test @MediumTest @Feature({"ProcessManagement"}) - public void testPendingSpawnQueue() throws RemoteException { + public void testPendingSpawnQueue() { Assert.assertFalse(mConnectionAllocator.anyConnectionAllocated()); // Launch 4 processes. Since we have only 2 services, the 3rd and 4th should get queued.
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ClipboardTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ClipboardTest.java index 81392f7..98c2220 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ClipboardTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ClipboardTest.java
@@ -47,7 +47,7 @@ private static final String EXPECTED_HTML_NEEDLE = "http://www.example.com/"; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.launchContentShellWithUrl(TEST_PAGE_DATA_URL); mActivityTestRule.waitForActiveShellToBeDoneLoading(); } @@ -62,7 +62,7 @@ @Feature({"Clipboard", "TextInput"}) @RerunWithUpdatedContainerView @DisabledTest(message = "https://crbug.com/791021") - public void testCopyDocumentFragment() throws Throwable { + public void testCopyDocumentFragment() { ClipboardManager clipboardManager = TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<ClipboardManager>() { @Override
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java index c484cf0..466c6acf 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java
@@ -44,7 +44,7 @@ static final String CL_ADDED_VALUE_2 = "bozo"; @Before - public void setUp() throws Exception { + public void setUp() { CommandLine.reset(); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentTextSelectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentTextSelectionTest.java index b4b58db..0b7b166b 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentTextSelectionTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentTextSelectionTest.java
@@ -105,7 +105,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.launchContentShellWithUrl(DATA_URL); mActivityTestRule.waitForActiveShellToBeDoneLoading(); @@ -664,7 +664,7 @@ return ImeTestUtils.runBlockingOnHandlerNoException( connection.getHandler(), new Callable<CharSequence>() { @Override - public CharSequence call() throws Exception { + public CharSequence call() { return connection.getTextBeforeCursor(length, flags); } });
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java index 69eaeaa5..62ff2097 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java
@@ -86,7 +86,7 @@ mJavascriptHelper.waitUntilHasValue(); } - private void ensureGeolocationRunning(final boolean running) throws Exception { + private void ensureGeolocationRunning(final boolean running) { CriteriaHelper.pollInstrumentationThread(Criteria.equals(running, new Callable<Boolean>() { @Override public Boolean call() { @@ -96,7 +96,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mMockLocationProvider = new MockLocationProvider(); LocationProviderOverrider.setLocationProviderImpl(mMockLocationProvider); @@ -115,7 +115,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mMockLocationProvider.stopUpdates(); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPointerTypeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPointerTypeTest.java index ab5400c..a774d251 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPointerTypeTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPointerTypeTest.java
@@ -58,7 +58,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrlSync(CURSOR_PAGE); if (activity != null) {
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java index 3d70dd2..2d6f36e 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java
@@ -128,7 +128,7 @@ }); } - private void fling(final int vx, final int vy) throws Throwable { + private void fling(final int vx, final int vy) { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -138,7 +138,7 @@ }); } - private void scrollTo(final int x, final int y) throws Throwable { + private void scrollTo(final int x, final int y) { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -147,7 +147,7 @@ }); } - private void scrollBy(final int dx, final int dy) throws Throwable { + private void scrollBy(final int dx, final int dy) { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -156,8 +156,7 @@ }); } - private void scrollWithJoystick(final float deltaAxisX, final float deltaAxisY) - throws Throwable { + private void scrollWithJoystick(final float deltaAxisX, final float deltaAxisY) { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -173,7 +172,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.launchContentShellWithUrl(LARGE_PAGE); mActivityTestRule.waitForActiveShellToBeDoneLoading(); mCoordinates = mActivityTestRule.getRenderCoordinates(); @@ -188,7 +187,7 @@ @SmallTest @Feature({"Main"}) @RetryOnFailure - public void testFling() throws Throwable { + public void testFling() { // Scaling the initial velocity by the device scale factor ensures that // it's of sufficient magnitude for all displays densities. float deviceScaleFactor = InstrumentationRegistry.getInstrumentation() @@ -223,7 +222,7 @@ @SmallTest @Feature({"Main"}) @RetryOnFailure - public void testFlingDistance() throws Throwable { + public void testFlingDistance() { // Scaling the initial velocity by the device scale factor ensures that // it's of sufficient magnitude for all displays densities. float deviceScaleFactor = InstrumentationRegistry.getInstrumentation() @@ -258,7 +257,7 @@ @RerunWithUpdatedContainerView @Feature({"Main"}) @RetryOnFailure - public void testScrollTo() throws Throwable { + public void testScrollTo() { // Vertical scroll to lower-left. scrollTo(0, 2500); waitForScroll(true, false); @@ -285,7 +284,7 @@ @RerunWithUpdatedContainerView @Feature({"Main"}) @RetryOnFailure - public void testScrollBy() throws Throwable { + public void testScrollBy() { scrollTo(0, 0); waitForScroll(true, true); @@ -317,7 +316,7 @@ @Test @SmallTest @Feature({"Main"}) - public void testJoystickScroll() throws Throwable { + public void testJoystickScroll() { scrollTo(0, 0); waitForScroll(true, true); @@ -352,7 +351,7 @@ @RerunWithUpdatedContainerView @Feature({"Main"}) @RetryOnFailure - public void testOverScroll() throws Throwable { + public void testOverScroll() { // Overscroll lower-left. scrollTo(-10000, 10000); waitForScroll(true, false); @@ -383,7 +382,7 @@ @RerunWithUpdatedContainerView @Feature({"Main"}) @RetryOnFailure - public void testOnScrollChanged() throws Throwable { + public void testOnScrollChanged() { final int scrollToX = mCoordinates.getScrollXPixInt() + 2500; final int scrollToY = mCoordinates.getScrollYPixInt() + 2500; final TestInternalAccessDelegate accessDelegate = new TestInternalAccessDelegate();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java b/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java index 8a8a894..bdaced0 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java
@@ -75,7 +75,7 @@ } private void verifyClicksAreRegistered(String disambiguation, WebContents webContents) - throws InterruptedException, Exception, Throwable { + throws Exception, Throwable { // Initially the text on the page should say "not clicked". CriteriaHelper.pollInstrumentationThread( new NodeContentsIsEqualToCriteria("The page contents is invalid " + disambiguation,
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java index 2992987e..6fa29d3 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java
@@ -85,7 +85,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.loadNativeLibraryNoBrowserProcess(); } }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java index e99c917..63b562e 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java
@@ -51,7 +51,7 @@ return TestThreadUtils .runOnUiThreadBlocking(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return mInterstitialShowing; } }) @@ -70,7 +70,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(URL); Assert.assertNotNull(activity); mActivityTestRule.waitForActiveShellToBeDoneLoading(); @@ -119,7 +119,7 @@ TestWebContentsObserver observer = TestThreadUtils.runOnUiThreadBlocking(new Callable<TestWebContentsObserver>() { @Override - public TestWebContentsObserver call() throws Exception { + public TestWebContentsObserver call() { delegate.showInterstitialPage(URL, mActivityTestRule.getWebContents()); return new TestWebContentsObserver(mActivityTestRule.getWebContents()); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java index f2778332c..850efea0 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java
@@ -96,18 +96,18 @@ }); } - public void injectObjectAndReload(Object object, String name) throws Exception { + public void injectObjectAndReload(Object object, String name) { injectObjectAndReload(object, name, null); } - public void injectObjectAndReload(Object object, String name, - Class<? extends Annotation> requiredAnnotation) throws Exception { + public void injectObjectAndReload( + Object object, String name, Class<? extends Annotation> requiredAnnotation) { injectObjectsAndReload(object, name, null, null, requiredAnnotation); } public void injectObjectsAndReload(final Object object1, final String name1, final Object object2, final String name2, - final Class<? extends Annotation> requiredAnnotation) throws Exception { + final Class<? extends Annotation> requiredAnnotation) { TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = mTestCallbackHelperContainer.getOnPageFinishedHelper(); int currentCallCount = onPageFinishedHelper.getCallCount();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayCoercionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayCoercionTest.java index 46f147b..d21ebd8 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayCoercionTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayCoercionTest.java
@@ -161,7 +161,7 @@ private TestObject mTestObject; @Before - public void setUp() throws Exception { + public void setUp() { mTestObject = new TestObject(); mActivityTestRule.injectObjectAndReload(mTestObject, "testObject"); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayTest.java index 72f29171..9dcdc1b5 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeArrayTest.java
@@ -99,7 +99,7 @@ private TestObject mTestObject; @Before - public void setUp() throws Exception { + public void setUp() { mTestObject = new TestObject(); mActivityTestRule.injectObjectAndReload(mTestObject, "testObject"); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBareboneTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBareboneTest.java index 50773b3dd..8ae44e3 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBareboneTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBareboneTest.java
@@ -31,7 +31,7 @@ private TestCallbackHelperContainer mTestCallbackHelperContainer; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.launchContentShellWithUrl( UrlUtils.encodeHtmlDataUri("<html><head></head><body>test</body></html>")); mActivityTestRule.waitForActiveShellToBeDoneLoading();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java index 1e5f31a..85ab4390 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java
@@ -102,7 +102,7 @@ TestController mTestController; @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.setUpContentView(); mTestController = new TestController(); mActivityTestRule.injectObjectAndReload(mTestController, "testController"); @@ -550,7 +550,7 @@ @Test @SmallTest @Feature({"AndroidWebView", "Android-JavaBridge"}) - public void testBlockingUiThreadDoesNotBlockCallsFromJs() throws Throwable { + public void testBlockingUiThreadDoesNotBlockCallsFromJs() { class TestObject { private CountDownLatch mLatch; public TestObject() { @@ -560,7 +560,7 @@ return mLatch.await(scaleTimeout(10000), java.util.concurrent.TimeUnit.MILLISECONDS); } - public void unlockTheLatch() throws Exception { + public void unlockTheLatch() { mTestController.setStringValue("unlocked"); mLatch.countDown(); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java index 2ad2cb6d..220abd8 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
@@ -59,7 +59,7 @@ TestController mTestController; @Before - public void setUp() throws Exception { + public void setUp() { mTestController = new TestController(); mActivityTestRule.injectObjectAndReload(mTestController, "testController"); } @@ -274,8 +274,8 @@ Assert.assertNull(testObject.mWeakRefForInner.get()); } - private String executeJavaScriptAndGetResult(final WebContents webContents, - final String script) throws Throwable { + private String executeJavaScriptAndGetResult( + final WebContents webContents, final String script) { final String[] result = new String[1]; class ResultCallback extends Controller implements JavaScriptCallback { @Override
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeCoercionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeCoercionTest.java index 470ef1d..f33997b 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeCoercionTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeCoercionTest.java
@@ -199,7 +199,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mTestObject = new TestObject(); mTestController = new TestController(); mActivityTestRule.injectObjectsAndReload(
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeFieldsTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeFieldsTest.java index cb88225..91631a0 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeFieldsTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeFieldsTest.java
@@ -59,7 +59,7 @@ TestObject mTestObject; @Before - public void setUp() throws Exception { + public void setUp() { mTestObject = new TestObject(); mActivityTestRule.injectObjectAndReload(mTestObject, "testObject"); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeReturnValuesTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeReturnValuesTest.java index 19b1247..393022e 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeReturnValuesTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeReturnValuesTest.java
@@ -116,7 +116,7 @@ TestObject mTestObject; @Before - public void setUp() throws Exception { + public void setUp() { mTestObject = new TestObject(); mActivityTestRule.injectObjectAndReload(mTestObject, "testObject"); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java index e06cd3e..279e005c 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java
@@ -76,7 +76,7 @@ return mAudioFocusState; } - public void requestAudioFocus(int focusType) throws Exception { + public void requestAudioFocus(int focusType) { int result = getAudioManager().requestAudioFocus( this, AudioManager.STREAM_MUSIC, focusType); if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { @@ -138,7 +138,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { try { mActivityTestRule.launchContentShellWithUrlSync(MEDIA_SESSION_TEST_URL); } catch (Throwable t) { @@ -158,9 +158,8 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mAudioFocusChangeListener.abandonAudioFocus(); - } @Test
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ScreenOrientationListenerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ScreenOrientationListenerTest.java index dd7627b..c6d84de 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ScreenOrientationListenerTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ScreenOrientationListenerTest.java
@@ -81,7 +81,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> { mDisplayAndroid.removeObserver(mCallbackHelper); mDisplayAndroid = null;
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java b/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java index 63788ac..04531828 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java
@@ -42,8 +42,7 @@ @Test @LargeTest @Feature({"Browser"}) - public void testJavaScriptEvalIsCorrectlyOrdered() - throws InterruptedException, Exception, Throwable { + public void testJavaScriptEvalIsCorrectlyOrdered() throws Exception, Throwable { mActivityTestRule.launchContentShellWithUrl(JSTEST_URL); mActivityTestRule.waitForActiveShellToBeDoneLoading();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/TracingControllerAndroidImplTest.java b/content/public/android/javatests/src/org/chromium/content/browser/TracingControllerAndroidImplTest.java index f2358a1..6040b6e 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/TracingControllerAndroidImplTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/TracingControllerAndroidImplTest.java
@@ -42,7 +42,7 @@ @MediumTest @Feature({"GPU"}) @DisableIf.Build(sdk_is_less_than = 21, message = "crbug.com/899894") - public void testTraceFileCreation() throws Exception { + public void testTraceFileCreation() { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl("about:blank"); mActivityTestRule.waitForActiveShellToBeDoneLoading();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/VSyncPausedTest.java b/content/public/android/javatests/src/org/chromium/content/browser/VSyncPausedTest.java index c721da5..8659068 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/VSyncPausedTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/VSyncPausedTest.java
@@ -61,7 +61,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { mObserver.destroy(); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/VideoFullscreenOrientationLockTest.java b/content/public/android/javatests/src/org/chromium/content/browser/VideoFullscreenOrientationLockTest.java index a3c60a7..ff0a95f 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/VideoFullscreenOrientationLockTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/VideoFullscreenOrientationLockTest.java
@@ -49,11 +49,10 @@ CriteriaHelper.pollInstrumentationThread( Criteria.equals(fullscreenValue, new Callable<Boolean>() { @Override - public Boolean call() throws InterruptedException, TimeoutException { + public Boolean call() throws TimeoutException { return DOMUtils.isFullscreen(mActivityTestRule.getWebContents()); } - }) - ); + })); } private boolean isScreenOrientationLocked() { @@ -61,7 +60,7 @@ != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; } - private boolean isScreenOrientationLandscape() throws InterruptedException, TimeoutException { + private boolean isScreenOrientationLandscape() throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" return screen.orientation.type.startsWith('landscape');"); @@ -73,14 +72,12 @@ .equals("true"); } - private void waitUntilLockedToLandscape() throws InterruptedException { + private void waitUntilLockedToLandscape() { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() { try { return isScreenOrientationLocked() && isScreenOrientationLandscape(); - } catch (InterruptedException e) { - return false; } catch (TimeoutException e) { return false; } @@ -88,7 +85,7 @@ }); } - private void waitUntilUnlocked() throws InterruptedException { + private void waitUntilUnlocked() { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override public boolean isSatisfied() { @@ -121,14 +118,14 @@ return new Rect(left, panel.top, right, panel.bottom); } - private boolean clickFullscreenButton() throws InterruptedException, TimeoutException { + private boolean clickFullscreenButton() throws TimeoutException { return DOMUtils.clickRect(mActivityTestRule.getWebContents(), fullscreenButtonBounds( DOMUtils.getNodeBounds(mActivityTestRule.getWebContents(), VIDEO_ID))); } @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.launchContentShellWithUrlSync(TEST_URL); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/VideoRotateToFullscreenTest.java b/content/public/android/javatests/src/org/chromium/content/browser/VideoRotateToFullscreenTest.java index 565c93e7..d9c5866 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/VideoRotateToFullscreenTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/VideoRotateToFullscreenTest.java
@@ -49,7 +49,7 @@ CriteriaHelper.pollInstrumentationThread( Criteria.equals(fullscreenValue, new Callable<Boolean>() { @Override - public Boolean call() throws InterruptedException, TimeoutException { + public Boolean call() throws TimeoutException { return DOMUtils.isFullscreen(mRule.getWebContents()); } })); @@ -59,13 +59,13 @@ CriteriaHelper.pollInstrumentationThread( Criteria.equals(orientationValue, new Callable<String>() { @Override - public String call() throws InterruptedException, TimeoutException { + public String call() throws TimeoutException { return screenOrientation(); } })); } - private String screenOrientation() throws InterruptedException, TimeoutException { + private String screenOrientation() throws TimeoutException { // Returns "\"portrait\"" or "\"landscape\"" (strips the "-primary" or "-secondary" suffix). return JavaScriptUtils.executeJavaScriptAndWaitForResult( mRule.getWebContents(), "screen.orientation.type.split('-')[0]"); @@ -80,7 +80,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { TestThreadUtils.runOnUiThreadBlocking(() -> { mRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/WakeLockTest.java b/content/public/android/javatests/src/org/chromium/content/browser/WakeLockTest.java index ebdc2e4..36eb758 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/WakeLockTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/WakeLockTest.java
@@ -35,7 +35,7 @@ private static final String TEST_PATH = "content/test/data/android/title1.html"; @Before - public void setUp() throws Exception { + public void setUp() { try { mActivityTestRule.launchContentShellWithUrlSync(TEST_PATH); } catch (Throwable t) { @@ -43,13 +43,13 @@ } } - private void getWakeLock(String type) throws InterruptedException, TimeoutException { + private void getWakeLock(String type) throws TimeoutException { final String code = "WakeLock.request('" + type + "');"; JavaScriptUtils.executeJavaScriptAndWaitForResult(mActivityTestRule.getWebContents(), code); } @After - public void tearDown() throws Exception {} + public void tearDown() {} @Test @SmallTest
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java b/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java index 31e96e0..bcc878a5 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
@@ -54,7 +54,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(null); Assert.assertNotNull(activity); mActivityTestRule.waitForActiveShellToBeDoneLoading(); @@ -70,7 +70,7 @@ TestWebContentsObserver observer = TestThreadUtils.runOnUiThreadBlocking(new Callable<TestWebContentsObserver>() { @Override - public TestWebContentsObserver call() throws Exception { + public TestWebContentsObserver call() { return new TestWebContentsObserver(mActivityTestRule.getWebContents()); } });
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityTest.java b/content/public/android/javatests/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityTest.java index 6234ad74..8b46063 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityTest.java
@@ -88,7 +88,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O) - public void testAddExtraDataToAccessibilityNodeInfo() throws Throwable { + public void testAddExtraDataToAccessibilityNodeInfo() { // Load a really simple webpage. final String data = "<h1>Simple test page</h1>" + "<section><p>Text</p></section>"; @@ -370,7 +370,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testTextFieldExposesActionSetText() throws Throwable { + public void testTextFieldExposesActionSetText() { // Load a web page with a text field. final String data = "<h1>Simple test page</h1>" + "<section><input type=text placeholder=Text></section>"; @@ -394,7 +394,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testContentEditableClassName() throws Throwable { + public void testContentEditableClassName() { final String data = "<div contenteditable>Edit This</div>"; mActivityTestRule.launchContentShellWithUrl(UrlUtils.encodeHtmlDataUri(data)); @@ -416,7 +416,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testEditTextFieldAriaInvalidTrueErrorMessage() throws Throwable { + public void testEditTextFieldAriaInvalidTrueErrorMessage() { final String data = "<form>\n" + " First name:<br>\n" + " <input id='fn' type='text' aria-invalid='true'><br>\n" @@ -441,7 +441,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testEditTextFieldAriaInvalidSpellingErrorMessage() throws Throwable { + public void testEditTextFieldAriaInvalidSpellingErrorMessage() { final String data = "<input type='text' aria-invalid='spelling'><br>\n"; mActivityTestRule.launchContentShellWithUrl(UrlUtils.encodeHtmlDataUri(data)); @@ -463,7 +463,7 @@ @MediumTest @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testEditTextFieldAriaInvalidGrammarErrorMessage() throws Throwable { + public void testEditTextFieldAriaInvalidGrammarErrorMessage() { final String data = "<input type='text' aria-invalid='grammar'><br>\n"; mActivityTestRule.launchContentShellWithUrl(UrlUtils.encodeHtmlDataUri(data)); @@ -485,7 +485,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void testEditTextFieldValidNoErrorMessage() throws Throwable { + public void testEditTextFieldValidNoErrorMessage() { final String data = "<input type='text'><br>\n"; mActivityTestRule.launchContentShellWithUrl(UrlUtils.encodeHtmlDataUri(data)); mActivityTestRule.waitForActiveShellToBeDoneLoading();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplPixelTest.java b/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplPixelTest.java index 9d87e8ea..661fd87 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplPixelTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplPixelTest.java
@@ -98,7 +98,7 @@ RenderCoordinatesImpl mCoordinates; @Before - public void setUp() throws Exception { + public void setUp() { takeScreenshotOfBackground(); mCoordinates = mActivityTestRule.getRenderCoordinates(); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTestRule.java b/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTestRule.java index 1aea210..495d099 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTestRule.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTestRule.java
@@ -187,7 +187,7 @@ public Statement apply(final Statement base, Description desc) { return super.apply(new Statement() { @Override - public void evaluate() throws Throwable { + public void evaluate() { launchContentShellWithUrl(getInitialUrl()); waitForActiveShellToBeDoneLoading(); // Do we need this?
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeActivityTestRule.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeActivityTestRule.java index e7a6bee..5bdc6fe 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeActivityTestRule.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeActivityTestRule.java
@@ -143,7 +143,7 @@ return mConnectionFactory; } - void fullyLoadUrl(final String url) throws Throwable { + void fullyLoadUrl(final String url) { TestThreadUtils.runOnUiThreadBlocking( () -> { getActivity().getActiveShell().loadUrl(url); }); waitForActiveShellToBeDoneLoading(); @@ -238,8 +238,9 @@ Integer[] textInputModeHistory = null; Integer[] textInputActionHistory = null; if (includeInputMode) textInputModeHistory = mConnectionFactory.getTextInputModeHistory(); - if (includeInputAction) + if (includeInputAction) { textInputActionHistory = mConnectionFactory.getTextInputActionHistory(); + } return stringifyKeyboardStates(showCount, hideCount, restartCount, textInputTypeHistory, textInputModeHistory, textInputActionHistory); } @@ -272,7 +273,7 @@ final InputConnection inputConnection = mConnection; final Callable<Void> callable = new Callable<Void>() { @Override - public Void call() throws Exception { + public Void call() { inputConnection.performEditorAction(EditorInfo.IME_ACTION_GO); return null; } @@ -582,20 +583,18 @@ * Focus element, wait for a single state update, reset state update list. * @param id ID of the element to focus. */ - void focusElementAndWaitForStateUpdate(String id) - throws InterruptedException, TimeoutException { + void focusElementAndWaitForStateUpdate(String id) throws TimeoutException { resetAllStates(); focusElement(id); waitAndVerifyUpdateSelection(0, 0, 0, -1, -1); resetAllStates(); } - void focusElement(final String id) throws InterruptedException, TimeoutException { + void focusElement(final String id) throws TimeoutException { focusElement(id, true); } - void focusElement(final String id, boolean shouldShowKeyboard) - throws InterruptedException, TimeoutException { + void focusElement(final String id, boolean shouldShowKeyboard) throws TimeoutException { DOMUtils.focusNode(getWebContents(), id); assertWaitForKeyboardStatus(shouldShowKeyboard); waitForFocusedElement(id);
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java index 6f1ef18..cb54181 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -678,7 +678,7 @@ })); } - private void reloadPage() throws Throwable { + private void reloadPage() { // Reload the page, then focus will be lost and keyboard should be hidden. mRule.fullyLoadUrl(mRule.getWebContents().getLastCommittedUrl()); } @@ -1608,7 +1608,7 @@ }); Assert.assertEquals("abc", mRule.runBlockingOnImeThread(new Callable<CharSequence>() { @Override - public CharSequence call() throws Exception { + public CharSequence call() { return connection.getTextBeforeCursor(5, 0); } })); @@ -1639,7 +1639,7 @@ public boolean isSatisfied() { try { return DOMUtils.getNodeContents(webContents, "div").equals("hello world"); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/InputDialogContainerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/InputDialogContainerTest.java index 37afba4..592c302 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/InputDialogContainerTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/InputDialogContainerTest.java
@@ -41,7 +41,7 @@ InputDialogContainerForTests mInputDialogContainer; @Before - public void setUp() throws Exception { + public void setUp() { mInputActionDelegate = new InputActionDelegateForTests(); mInputDialogContainer = new InputDialogContainerForTests( InstrumentationRegistry.getContext(), mInputActionDelegate);
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java index c0cd791..d0bf9a47 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java
@@ -74,7 +74,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { mActivityTestRule.launchContentShellWithUrl(SELECT_URL); mActivityTestRule.waitForActiveShellToBeDoneLoading(); } @@ -88,7 +88,7 @@ @Feature({"Browser"}) @RerunWithUpdatedContainerView @RetryOnFailure - public void testReloadWhilePopupShowing() throws InterruptedException, Exception, Throwable { + public void testReloadWhilePopupShowing() throws Exception, Throwable { // The popup should be hidden before the click. CriteriaHelper.pollUiThread(new PopupHiddenCriteria());
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/TextSuggestionMenuTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/TextSuggestionMenuTest.java index cee325ba..d34d6f6 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/TextSuggestionMenuTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/TextSuggestionMenuTest.java
@@ -73,7 +73,7 @@ public boolean isSatisfied() { try { return DOMUtils.getNodeContents(webContents, "div").equals(""); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } } @@ -102,7 +102,7 @@ public boolean isSatisfied() { try { return DOMUtils.getNodeContents(webContents, "div").equals("hello"); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } } @@ -127,7 +127,7 @@ public boolean isSatisfied() { try { return DOMUtils.getNodeContents(mRule.getWebContents(), "div").equals(""); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } } @@ -176,7 +176,7 @@ public boolean isSatisfied() { try { return DOMUtils.getNodeContents(webContents, "div").equals("hello world"); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } } @@ -205,7 +205,7 @@ try { return DOMUtils.getNodeContents(mRule.getWebContents(), "div") .equals("suggestion3"); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } } @@ -248,7 +248,7 @@ try { return DOMUtils.getNodeContents(mRule.getWebContents(), "div") .equals("replacement"); - } catch (InterruptedException | TimeoutException e) { + } catch (TimeoutException e) { return false; } }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/scheduler/NativePostTaskTest.java b/content/public/android/javatests/src/org/chromium/content/browser/scheduler/NativePostTaskTest.java index 733cecf..2cec23f8 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/scheduler/NativePostTaskTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/scheduler/NativePostTaskTest.java
@@ -97,7 +97,7 @@ @Test @MediumTest - public void testCreateTaskRunner() throws Exception { + public void testCreateTaskRunner() { startNativeScheduler(); TaskRunner taskQueue = PostTask.createTaskRunner(TaskTraits.USER_BLOCKING); // This should not time out. @@ -129,7 +129,7 @@ @Test @MediumTest - public void testCreateSequencedTaskRunner() throws Exception { + public void testCreateSequencedTaskRunner() { startNativeScheduler(); TaskRunner taskQueue = PostTask.createSequencedTaskRunner(TaskTraits.USER_BLOCKING); testRunningTasksInSequence(taskQueue); @@ -137,7 +137,7 @@ @Test @MediumTest - public void testCreateSingleThreadSequencedTaskRunner() throws Exception { + public void testCreateSingleThreadSequencedTaskRunner() { startNativeScheduler(); TaskRunner taskQueue = PostTask.createSingleThreadTaskRunner(TaskTraits.USER_BLOCKING); testRunningTasksInSequence(taskQueue); @@ -254,7 +254,7 @@ } } - private void startNativeScheduler() throws Exception { + private void startNativeScheduler() { mNativeLibraryTestRule.loadNativeLibraryNoBrowserProcess(); ContentMain.start(/* startServiceManagerOnly */ false); ThreadPoolTestHelpers.enableThreadPoolExecutionForTesting();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/scheduler/UiThreadSchedulerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/scheduler/UiThreadSchedulerTest.java index f3cad30..1e9a9f9 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/scheduler/UiThreadSchedulerTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/scheduler/UiThreadSchedulerTest.java
@@ -68,7 +68,7 @@ @Test @MediumTest - public void testSimpleUiThreadPostingBeforeNativeLoaded() throws Exception { + public void testSimpleUiThreadPostingBeforeNativeLoaded() { TaskRunner uiThreadTaskRunner = PostTask.createSingleThreadTaskRunner(UiThreadTaskTraits.DEFAULT); try { @@ -117,7 +117,7 @@ @Test @MediumTest - public void testUiThreadTaskRunnerMigrationToNative() throws Exception { + public void testUiThreadTaskRunnerMigrationToNative() { TaskRunner uiThreadTaskRunner = PostTask.createSingleThreadTaskRunner(UiThreadTaskTraits.DEFAULT); try { @@ -139,7 +139,7 @@ @Test @MediumTest - public void testSimpleUiThreadPostingAfterNativeLoaded() throws Exception { + public void testSimpleUiThreadPostingAfterNativeLoaded() { TaskRunner uiThreadTaskRunner = PostTask.createSingleThreadTaskRunner(UiThreadTaskTraits.DEFAULT); try { @@ -159,7 +159,7 @@ @Test @MediumTest - public void testTaskNotRunOnUiThreadWithoutUiThreadTaskTraits() throws Exception { + public void testTaskNotRunOnUiThreadWithoutUiThreadTaskTraits() { TaskRunner uiThreadTaskRunner = PostTask.createSingleThreadTaskRunner(TaskTraits.USER_BLOCKING); try { @@ -211,7 +211,7 @@ @Test @MediumTest - public void testRunSynchronously() throws InterruptedException { + public void testRunSynchronously() { final Object lock = new Object(); final AtomicBoolean taskExecuted = new AtomicBoolean(); @@ -257,7 +257,7 @@ } private void postRepeatingTaskAndStartNativeSchedulerThenWaitForTaskToRun( - TaskRunner taskQueue, Runnable taskToRunAfterNativeSchedulerLoaded) throws Exception { + TaskRunner taskQueue, Runnable taskToRunAfterNativeSchedulerLoaded) { final Object lock = new Object(); final AtomicBoolean taskRun = new AtomicBoolean(); final AtomicBoolean nativeSchedulerStarted = new AtomicBoolean();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java b/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java index 26858870..0320558 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
@@ -53,12 +53,11 @@ * TODO(dtrainor): Test this using {@link WebContents#destroy()} instead once it is possible to * build a {@link WebContents} directly in the content/ layer. * - * @throws InterruptedException * @throws ExecutionException */ @Test @SmallTest - public void testWebContentsIsDestroyedMethod() throws InterruptedException, ExecutionException { + public void testWebContentsIsDestroyedMethod() throws ExecutionException { final ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); @@ -79,11 +78,10 @@ /** * Check that it is possible to serialize and deserialize a WebContents object through Parcels. * - * @throws InterruptedException */ @Test @SmallTest - public void testWebContentsSerializeDeserializeInParcel() throws InterruptedException { + public void testWebContentsSerializeDeserializeInParcel() { mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = mActivityTestRule.getWebContents(); @@ -109,13 +107,12 @@ /** * Check that it is possible to serialize and deserialize a WebContents object through Bundles. - * @throws InterruptedException */ @Test @SmallTest // TODO(crbug.com/635567): Fix this properly. @SuppressLint("ParcelClassLoader") - public void testWebContentsSerializeDeserializeInBundle() throws InterruptedException { + public void testWebContentsSerializeDeserializeInBundle() { mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = mActivityTestRule.getWebContents(); @@ -151,13 +148,12 @@ /** * Check that it is possible to serialize and deserialize a WebContents object through Intents. - * @throws InterruptedException */ @Test @SmallTest // TODO(crbug.com/635567): Fix this properly. @SuppressLint("ParcelClassLoader") - public void testWebContentsSerializeDeserializeInIntent() throws InterruptedException { + public void testWebContentsSerializeDeserializeInIntent() { mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = mActivityTestRule.getWebContents(); @@ -194,12 +190,10 @@ /** * Check that attempting to deserialize a WebContents object from a Parcel from another process * instance fails. - * @throws InterruptedException */ @Test @SmallTest - public void testWebContentsFailDeserializationAcrossProcessBoundary() - throws InterruptedException { + public void testWebContentsFailDeserializationAcrossProcessBoundary() { mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = mActivityTestRule.getWebContents(); @@ -228,13 +222,11 @@ /** * Check that serializing a destroyed WebContents always results in a null deserialized * WebContents. - * @throws InterruptedException * @throws ExecutionException */ @Test @SmallTest - public void testSerializingADestroyedWebContentsDoesNotDeserialize() - throws InterruptedException, ExecutionException { + public void testSerializingADestroyedWebContentsDoesNotDeserialize() throws ExecutionException { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = activity.getActiveWebContents(); @@ -264,13 +256,12 @@ /** * Check that destroying a WebContents after serializing it always results in a null * deserialized WebContents. - * @throws InterruptedException * @throws ExecutionException */ @Test @SmallTest public void testDestroyingAWebContentsAfterSerializingDoesNotDeserialize() - throws InterruptedException, ExecutionException { + throws ExecutionException { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = activity.getActiveWebContents(); @@ -301,11 +292,10 @@ /** * Check that failing a WebContents deserialization doesn't corrupt subsequent data in the * Parcel. - * @throws InterruptedException */ @Test @SmallTest - public void testFailedDeserializationDoesntCorruptParcel() throws InterruptedException { + public void testFailedDeserializationDoesntCorruptParcel() { mActivityTestRule.launchContentShellWithUrl(TEST_URL_1); mActivityTestRule.waitForActiveShellToBeDoneLoading(); WebContents webContents = mActivityTestRule.getWebContents(); @@ -342,11 +332,10 @@ * Check that the main frame associated with the WebContents is not null * and corresponds with the test URL. * - * @throws InterruptedException */ @Test @SmallTest - public void testWebContentsMainFrame() throws InterruptedException { + public void testWebContentsMainFrame() { final ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(TEST_URL_2); mActivityTestRule.waitForActiveShellToBeDoneLoading(); @@ -429,7 +418,7 @@ private boolean isWebContentsDestroyed(final WebContents webContents) { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return webContents.isDestroyed(); } });
diff --git a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java index 9ff5320..26a399e 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java
@@ -117,7 +117,7 @@ private boolean mHasWindowFocus; @Before - public void setUp() throws Exception { + public void setUp() { // ThreadedInputConnectionFactory#initializeAndGet() logic is activated under N, so pretend // that we're in L. Note that this is to workaround crbug.com/944476 that // @Config(..., sdk = Build.VERSION_CODES.LOLLIPOP) doesn't work. @@ -152,7 +152,7 @@ when(mProxyView.getHandler()).thenReturn(mImeHandler); final Callable<InputConnection> callable = new Callable<InputConnection>() { @Override - public InputConnection call() throws Exception { + public InputConnection call() { return mFactory.initializeAndGet( mContainerView, mImeAdapter, 1, 0, 0, 0, 0, 0, mEditorInfo); } @@ -170,7 +170,7 @@ private int mCount; @Override - public Boolean answer(InvocationOnMock invocation) throws Throwable { + public Boolean answer(InvocationOnMock invocation) { mCount++; // To simplify IMM's behavior, let's say that it succeeds input method activation // only when the view has a window focus. @@ -184,7 +184,7 @@ }); when(mInputMethodManager.isActive(mProxyView)).thenAnswer(new Answer<Boolean>() { @Override - public Boolean answer(InvocationOnMock invocation) throws Throwable { + public Boolean answer(InvocationOnMock invocation) { return mInputConnection != null; } });
diff --git a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java index 27437bd..5c3ea586 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java
@@ -59,7 +59,7 @@ boolean mRunningOnUiThread; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); mImeAdapter = Mockito.mock(ImeAdapterImpl.class); @@ -234,7 +234,7 @@ @Test @Feature("TextInput") - public void testUpdateSelectionBehaviorWhenUpdatesRequested() throws InterruptedException { + public void testUpdateSelectionBehaviorWhenUpdatesRequested() { // Arrange. final ExtractedTextRequest request = new ExtractedTextRequest(); @@ -267,7 +267,7 @@ @Test @Feature("TextInput") - public void testUpdateSelectionBehaviorWhenUpdatesNotRequested() throws InterruptedException { + public void testUpdateSelectionBehaviorWhenUpdatesNotRequested() { // Arrange. final ExtractedTextRequest request = new ExtractedTextRequest(); @@ -316,7 +316,7 @@ @Test @Feature("TextInput") - public void testExtractedTextNotSentAfterInputConnectionReset() throws InterruptedException { + public void testExtractedTextNotSentAfterInputConnectionReset() { // Arrange. final ExtractedTextRequest request = new ExtractedTextRequest();
diff --git a/content/public/android/junit/src/org/chromium/content/browser/remoteobjects/RemoteObjectImplTest.java b/content/public/android/junit/src/org/chromium/content/browser/remoteobjects/RemoteObjectImplTest.java index 1fbec4d..6b6906b 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/remoteobjects/RemoteObjectImplTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/remoteobjects/RemoteObjectImplTest.java
@@ -67,7 +67,7 @@ private RemoteObjectImpl.ObjectIdAllocator mIdAllocator; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); }
diff --git a/content/public/android/junit/src/org/chromium/content/browser/selection/MagnifierAnimatorTest.java b/content/public/android/junit/src/org/chromium/content/browser/selection/MagnifierAnimatorTest.java index d69b693..3a59a40d 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/selection/MagnifierAnimatorTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/selection/MagnifierAnimatorTest.java
@@ -33,7 +33,7 @@ private MagnifierAnimator mAnimator; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); ShadowLog.stream = System.out;
diff --git a/content/public/android/junit/src/org/chromium/content/browser/selection/SelectionPopupControllerTest.java b/content/public/android/junit/src/org/chromium/content/browser/selection/SelectionPopupControllerTest.java index eb30357..7df3b6f 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/selection/SelectionPopupControllerTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/selection/SelectionPopupControllerTest.java
@@ -132,7 +132,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); ShadowLog.stream = System.out; @@ -177,7 +177,7 @@ } @After - public void tearDown() throws Exception { + public void tearDown() { ContentClassFactory.set(mOriginalContentClassFactory); }
diff --git a/content/public/android/junit/src/org/chromium/content/browser/selection/SmartSelectionMetricsLoggerTest.java b/content/public/android/junit/src/org/chromium/content/browser/selection/SmartSelectionMetricsLoggerTest.java index 6010834..9dc3930 100644 --- a/content/public/android/junit/src/org/chromium/content/browser/selection/SmartSelectionMetricsLoggerTest.java +++ b/content/public/android/junit/src/org/chromium/content/browser/selection/SmartSelectionMetricsLoggerTest.java
@@ -64,7 +64,7 @@ } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); ShadowLog.stream = System.out; }
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/mock/MockRenderFrameHost.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/mock/MockRenderFrameHost.java index 47888f3..a26cc27 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/mock/MockRenderFrameHost.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/mock/MockRenderFrameHost.java
@@ -7,6 +7,7 @@ import org.chromium.base.Callback; import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.services.service_manager.InterfaceProvider; +import org.chromium.url.Origin; /** * Mock class for {@link RenderFrameHost}. @@ -18,6 +19,11 @@ } @Override + public Origin getLastCommittedOrigin() { + return null; + } + + @Override public void getCanonicalUrlForSharing(Callback<String> callback) {} @Override
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DOMUtils.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DOMUtils.java index 6b28a93..a04301e0 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DOMUtils.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DOMUtils.java
@@ -37,7 +37,7 @@ * @param id The element's id to be played. */ public static void playMedia(final WebContents webContents, final String id) - throws InterruptedException, TimeoutException { + throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" var media = document.getElementById('" + id + "');"); @@ -53,7 +53,7 @@ * @param id The element's id to be paused. */ public static void pauseMedia(final WebContents webContents, final String id) - throws InterruptedException, TimeoutException { + throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" var media = document.getElementById('" + id + "');"); @@ -70,7 +70,7 @@ * @return whether the media is paused. */ public static boolean isMediaPaused(final WebContents webContents, final String id) - throws InterruptedException, TimeoutException { + throws TimeoutException { return getNodeField("paused", webContents, id, Boolean.class); } @@ -81,7 +81,7 @@ * @return whether the media has ended. */ public static boolean isMediaEnded(final WebContents webContents, final String id) - throws InterruptedException, TimeoutException { + throws TimeoutException { return getNodeField("ended", webContents, id, Boolean.class); } @@ -92,7 +92,7 @@ * @return the current time (in seconds) of the media. */ private static double getCurrentTime(final WebContents webContents, final String id) - throws InterruptedException, TimeoutException { + throws TimeoutException { return getNodeField("currentTime", webContents, id, Double.class); } @@ -109,9 +109,6 @@ // Playback can't be reliably detected until current time moves forward. return !DOMUtils.isMediaPaused(webContents, id) && DOMUtils.getCurrentTime(webContents, id) > 0; - } catch (InterruptedException e) { - // Intentionally do nothing - return false; } catch (TimeoutException e) { // Intentionally do nothing return false; @@ -132,9 +129,6 @@ try { return DOMUtils.isMediaPaused(webContents, id) && !DOMUtils.isMediaEnded(webContents, id); - } catch (InterruptedException e) { - // Intentionally do nothing - return false; } catch (TimeoutException e) { // Intentionally do nothing return false; @@ -148,8 +142,7 @@ * @param webContents The WebContents to check. * @return Whether the document is fullsscreen. */ - public static boolean isFullscreen(final WebContents webContents) - throws InterruptedException, TimeoutException { + public static boolean isFullscreen(final WebContents webContents) throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" return [document.webkitIsFullScreen];"); @@ -188,7 +181,7 @@ * @return The rect boundaries for the node. */ public static Rect getNodeBounds(final WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { String jsCode = "document.getElementById('" + nodeId + "')"; return getNodeBoundsByJs(webContents, jsCode); } @@ -199,7 +192,7 @@ * @param nodeId The id of the node. */ public static void focusNode(final WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" var node = document.getElementById('" + nodeId + "');"); @@ -214,8 +207,7 @@ * @param webContents The WebContents in which the node lives. * @return The id of the currently focused node. */ - public static String getFocusedNode(WebContents webContents) - throws InterruptedException, TimeoutException { + public static String getFocusedNode(WebContents webContents) throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" var node = document.activeElement;"); @@ -238,7 +230,7 @@ * @param nodeId The id of the node. */ public static boolean clickNode(final WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { return clickNode(webContents, nodeId, true /* goThroughRootAndroidView */); } @@ -250,7 +242,7 @@ * the CVC. */ public static boolean clickNode(final WebContents webContents, String nodeId, - boolean goThroughRootAndroidView) throws InterruptedException, TimeoutException { + boolean goThroughRootAndroidView) throws TimeoutException { return clickNode( webContents, nodeId, goThroughRootAndroidView, true /* shouldScrollIntoView */); } @@ -265,7 +257,7 @@ */ public static boolean clickNode(final WebContents webContents, String nodeId, boolean goThroughRootAndroidView, boolean shouldScrollIntoView) - throws InterruptedException, TimeoutException { + throws TimeoutException { if (shouldScrollIntoView) scrollNodeIntoView(webContents, nodeId); int[] clickTarget = getClickTargetForNode(webContents, nodeId); if (goThroughRootAndroidView) { @@ -288,7 +280,7 @@ * @param jsCode The JS code to find the node. */ public static void clickNodeByJs(final WebContents webContents, String jsCode) - throws InterruptedException, TimeoutException { + throws TimeoutException { scrollNodeIntoViewByJs(webContents, jsCode); int[] clickTarget = getClickTargetForNodeByJs(webContents, jsCode); TouchCommon.singleClickView(getContainerView(webContents), clickTarget[0], clickTarget[1]); @@ -314,7 +306,7 @@ * @param downTime When the drag was started, in millis since the epoch. */ public static void dragNodeStart(final WebContents webContents, String nodeId, long downTime) - throws InterruptedException, TimeoutException { + throws TimeoutException { scrollNodeIntoView(webContents, nodeId); String jsCode = "document.getElementById('" + nodeId + "')"; int[] fromTarget = getClickTargetForNodeByJs(webContents, jsCode); @@ -332,7 +324,7 @@ * @param downTime When the drag was started, in millis since the epoch. */ public static void dragNodeTo(final WebContents webContents, String fromNodeId, String toNodeId, - int stepCount, long downTime) throws InterruptedException, TimeoutException { + int stepCount, long downTime) throws TimeoutException { int[] fromTarget = getClickTargetForNodeByJs( webContents, "document.getElementById('" + fromNodeId + "')"); int[] toTarget = getClickTargetForNodeByJs( @@ -350,7 +342,7 @@ * @param downTime When the drag was started, in millis since the epoch. */ public static void dragNodeEnd(final WebContents webContents, String nodeId, long downTime) - throws InterruptedException, TimeoutException { + throws TimeoutException { scrollNodeIntoView(webContents, nodeId); String jsCode = "document.getElementById('" + nodeId + "')"; int[] endTarget = getClickTargetForNodeByJs(webContents, jsCode); @@ -363,8 +355,8 @@ * @param nodeId The id of the node. * @param downTime When the Long-press was started, in millis since the epoch. */ - public static void longPressNodeWithoutUp(final WebContents webContents, String nodeId, - long downTime) throws InterruptedException, TimeoutException { + public static void longPressNodeWithoutUp( + final WebContents webContents, String nodeId, long downTime) throws TimeoutException { scrollNodeIntoView(webContents, nodeId); String jsCode = "document.getElementById('" + nodeId + "')"; longPressNodeWithoutUpByJs(webContents, jsCode, downTime); @@ -378,8 +370,8 @@ * @param jsCode js code that returns an element. * @param downTime When the Long-press was started, in millis since the epoch. */ - public static void longPressNodeWithoutUpByJs(final WebContents webContents, String jsCode, - long downTime) throws InterruptedException, TimeoutException { + public static void longPressNodeWithoutUpByJs( + final WebContents webContents, String jsCode, long downTime) throws TimeoutException { int[] clickTarget = getClickTargetForNodeByJs(webContents, jsCode); TouchCommon.longPressViewWithoutUp( getContainerView(webContents), clickTarget[0], clickTarget[1], downTime); @@ -391,7 +383,7 @@ * @param nodeId The id of the node. */ public static void longPressNode(final WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { scrollNodeIntoView(webContents, nodeId); String jsCode = "document.getElementById('" + nodeId + "')"; longPressNodeByJs(webContents, jsCode); @@ -405,7 +397,7 @@ * @param jsCode js code that returns an element. */ public static void longPressNodeByJs(final WebContents webContents, String jsCode) - throws InterruptedException, TimeoutException { + throws TimeoutException { int[] clickTarget = getClickTargetForNodeByJs(webContents, jsCode); TouchCommon.longPressView(getContainerView(webContents), clickTarget[0], clickTarget[1]); } @@ -416,7 +408,7 @@ * @param nodeId The id of the node. */ public static void scrollNodeIntoView(WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { scrollNodeIntoViewByJs(webContents, "document.getElementById('" + nodeId + "')"); } @@ -426,7 +418,7 @@ * @param jsCode The JS code to find the node. */ public static void scrollNodeIntoViewByJs(WebContents webContents, String jsCode) - throws InterruptedException, TimeoutException { + throws TimeoutException { JavaScriptUtils.executeJavaScriptAndWaitForResult( webContents, jsCode + ".scrollIntoView()"); } @@ -438,7 +430,7 @@ * @return the text contents of the node. */ public static String getNodeContents(WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { return getNodeField("textContent", webContents, nodeId, String.class); } @@ -449,7 +441,7 @@ * @return the value of the node. */ public static String getNodeValue(final WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { return getNodeField("value", webContents, nodeId, String.class); } @@ -461,7 +453,7 @@ * @return the value of the field. */ public static String getNodeField(String fieldName, final WebContents webContents, - String nodeId) throws InterruptedException, TimeoutException { + String nodeId) throws TimeoutException { return getNodeField(fieldName, webContents, nodeId, String.class); } @@ -477,9 +469,6 @@ public boolean isSatisfied() { try { return !DOMUtils.getNodeBounds(webContents, nodeId).isEmpty(); - } catch (InterruptedException e) { - // Intentionally do nothing - return false; } catch (TimeoutException e) { // Intentionally do nothing return false; @@ -497,7 +486,7 @@ * @return the field's value. */ public static <T> T getNodeField(String fieldName, final WebContents webContents, String nodeId, - Class<T> valueType) throws InterruptedException, TimeoutException { + Class<T> valueType) throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" var node = document.getElementById('" + nodeId + "');"); @@ -559,7 +548,7 @@ * @return the click target of the node in the form of a [ x, y ] array. */ private static int[] getClickTargetForNode(WebContents webContents, String nodeId) - throws InterruptedException, TimeoutException { + throws TimeoutException { String jsCode = "document.getElementById('" + nodeId + "')"; return getClickTargetForNodeByJs(webContents, jsCode); } @@ -571,7 +560,7 @@ * @return the click target of the node in the form of a [ x, y ] array. */ private static int[] getClickTargetForNodeByJs(WebContents webContents, String jsCode) - throws InterruptedException, TimeoutException { + throws TimeoutException { Rect bounds = getNodeBoundsByJs(webContents, jsCode); Assert.assertNotNull( "Failed to get DOM element bounds of element='" + jsCode + "'.", bounds); @@ -616,7 +605,7 @@ * @return The rect boundaries for the node. */ private static Rect getNodeBoundsByJs(final WebContents webContents, String jsCode) - throws InterruptedException, TimeoutException { + throws TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" var node = " + jsCode + ";");
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DomAutomationController.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DomAutomationController.java index 7301e5a..b82c1e1 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DomAutomationController.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/DomAutomationController.java
@@ -19,7 +19,7 @@ * Enables domAutomationController on the given webContents. Must be called after every * page load. */ - public void inject(WebContents webContents) throws TimeoutException, InterruptedException { + public void inject(WebContents webContents) throws TimeoutException { mWebContents = webContents; JavaScriptUtils.executeJavaScriptAndWaitForResult(mWebContents, "window.domAutomationController = {" @@ -34,8 +34,7 @@ * Waits until domAutomationController.send(value) has been called and returns value in JSON * format. */ - public String waitForResult(String failureReason) - throws TimeoutException, InterruptedException { + public String waitForResult(String failureReason) throws TimeoutException { assert mWebContents != null; CriteriaHelper.pollInstrumentationThread(() -> { String result = JavaScriptUtils.executeJavaScriptAndWaitForResult(
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/HistoryUtils.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/HistoryUtils.java index 4c785fe..42ca1f82 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/HistoryUtils.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/HistoryUtils.java
@@ -54,7 +54,7 @@ return InstrumentationUtils.runOnMainSyncAndGetResult( instrumentation, new Callable<Boolean>() { @Override - public Boolean call() throws Exception { + public Boolean call() { return webContents.getNavigationController().canGoToOffset(offset); } }); @@ -84,10 +84,9 @@ * * @param instrumentation an Instrumentation instance. * @param webContents a WebContents instance. - * @throws Throwable */ public static void clearHistoryOnUiThread( - Instrumentation instrumentation, final WebContents webContents) throws Throwable { + Instrumentation instrumentation, final WebContents webContents) { instrumentation.runOnMainSync(new Runnable() { @Override public void run() { @@ -109,7 +108,7 @@ return InstrumentationUtils.runOnMainSyncAndGetResult( instrumentation, new Callable<String>() { @Override - public String call() throws Exception { + public String call() { return webContents.getLastCommittedUrl(); } });
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/JavaScriptUtils.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/JavaScriptUtils.java index 666814c2..ce0edd0 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/JavaScriptUtils.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/JavaScriptUtils.java
@@ -26,7 +26,7 @@ * Returns the result of its execution in JSON format. */ public static String executeJavaScriptAndWaitForResult(WebContents webContents, String code) - throws InterruptedException, TimeoutException { + throws TimeoutException { return executeJavaScriptAndWaitForResult( webContents, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS); } @@ -38,7 +38,7 @@ */ public static String executeJavaScriptAndWaitForResult(final WebContents webContents, final String code, final long timeout, final TimeUnit timeoutUnits) - throws InterruptedException, TimeoutException { + throws TimeoutException { final OnEvaluateJavaScriptResultHelper helper = new OnEvaluateJavaScriptResultHelper(); // Calling this from the UI thread causes it to time-out: the UI thread being blocked won't // have a chance to process the JavaScript eval response). @@ -58,7 +58,7 @@ * domAutomationController.send() in JSON format. */ public static String runJavascriptWithAsyncResult(WebContents webContents, String code) - throws TimeoutException, InterruptedException { + throws TimeoutException { DomAutomationController controller = new DomAutomationController(); controller.inject(webContents); executeJavaScript(webContents, code);
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TestCallbackHelperContainer.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TestCallbackHelperContainer.java index 4c817e86..cca054c3 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TestCallbackHelperContainer.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TestCallbackHelperContainer.java
@@ -153,8 +153,7 @@ * Waits till the JavaScript evaluation finishes and returns true if a value was returned, * false if it timed-out. */ - public boolean waitUntilHasValue(long timeout, TimeUnit unit) - throws InterruptedException, TimeoutException { + public boolean waitUntilHasValue(long timeout, TimeUnit unit) throws TimeoutException { int count = getCallCount(); // Reads and writes are atomic for reference variables in java, this is thread safe if (hasValue()) return true; @@ -162,7 +161,7 @@ return hasValue(); } - public boolean waitUntilHasValue() throws InterruptedException, TimeoutException { + public boolean waitUntilHasValue() throws TimeoutException { return waitUntilHasValue(CallbackHelper.WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); }
diff --git a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TouchCommon.java b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TouchCommon.java index de464db..61ca471 100644 --- a/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TouchCommon.java +++ b/content/public/test/android/javatests/src/org/chromium/content_public/browser/test/util/TouchCommon.java
@@ -212,7 +212,7 @@ try { View view = TestThreadUtils.runOnUiThreadBlocking(new Callable<View>() { @Override - public View call() throws Exception { + public View call() { return activity.findViewById(android.R.id.content).getRootView(); } });
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java index 352c108..847022e 100644 --- a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java +++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java
@@ -28,7 +28,7 @@ @SuppressWarnings("deprecation") @MediumTest @Feature({"TestInfrastructure"}) - public void testScreenIsOn() throws Exception { + public void testScreenIsOn() { PowerManager pm = (PowerManager) InstrumentationRegistry.getContext().getSystemService( Context.POWER_SERVICE);
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java index 673f1be1..cedbfa4 100644 --- a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java +++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java
@@ -36,7 +36,7 @@ @SmallTest @Feature({"Main"}) @RetryOnFailure - public void testMultipleShellsLaunched() throws InterruptedException, ExecutionException { + public void testMultipleShellsLaunched() throws ExecutionException { final ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(TEST_PAGE_1); Assert.assertEquals(TEST_PAGE_1, @@ -57,5 +57,4 @@ Assert.assertNull(previousActiveShell.getWebContents()); Assert.assertTrue(previousActiveShell.isDestroyed()); } - }
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellUrlTest.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellUrlTest.java index 658db632..8c033c2 100644 --- a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellUrlTest.java +++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellUrlTest.java
@@ -28,7 +28,7 @@ @Test @SmallTest @Feature({"Main"}) - public void testBaseStartup() throws Exception { + public void testBaseStartup() { ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(URL); // Make sure the activity was created as expected.
diff --git a/content/shell/test_runner/web_frame_test_client.cc b/content/shell/test_runner/web_frame_test_client.cc index 5e7b0b9..d441e7f 100644 --- a/content/shell/test_runner/web_frame_test_client.cc +++ b/content/shell/test_runner/web_frame_test_client.cc
@@ -418,8 +418,6 @@ delegate_->PrintMessage(" - willSendRequest <NSURLRequest URL "); delegate_->PrintMessage( DescriptionSuitableForTestResult(request_url).c_str()); - delegate_->PrintMessage(", main document URL "); - delegate_->PrintMessage(URLDescription(main_document_url).c_str()); delegate_->PrintMessage(", http method "); delegate_->PrintMessage(request.HttpMethod().Utf8().data()); delegate_->PrintMessage(">\n");
diff --git a/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java b/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java index bb5a828..599f9d2 100644 --- a/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java +++ b/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java
@@ -52,7 +52,7 @@ private float[] mRawAxes = new float[GamepadDevice.MAX_RAW_AXIS_VALUES]; @Before - public void setUp() throws Exception { + public void setUp() { // By default, we expect every button and axis to be mapped. mUnmappedButtons.clear(); mUnmappedAxes.clear(); @@ -72,7 +72,7 @@ @Test @Feature({"Gamepad"}) - public void testShieldGamepadMappings() throws Exception { + public void testShieldGamepadMappings() { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.NVIDIA_SHIELD_DEVICE_NAME_PREFIX); mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons); @@ -82,7 +82,7 @@ @Test @Feature({"Gamepad"}) - public void testXBox360GamepadMappings() throws Exception { + public void testXBox360GamepadMappings() { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.MICROSOFT_XBOX_PAD_DEVICE_NAME); mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons); @@ -92,7 +92,7 @@ @Test @Feature({"Gamepad"}) - public void testPS3SixAxisGamepadMappings() throws Exception { + public void testPS3SixAxisGamepadMappings() { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.PS3_SIXAXIS_DEVICE_NAME); mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons); @@ -119,7 +119,7 @@ @Test @Feature({"Gamepad"}) - public void testSamsungEIGP20GamepadMappings() throws Exception { + public void testSamsungEIGP20GamepadMappings() { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.SAMSUNG_EI_GP20_DEVICE_NAME); mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons); @@ -138,7 +138,7 @@ @Test @Feature({"Gamepad"}) - public void testAmazonFireGamepadMappings() throws Exception { + public void testAmazonFireGamepadMappings() { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.AMAZON_FIRE_DEVICE_NAME); mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons); @@ -157,7 +157,7 @@ @Test @Feature({"Gamepad"}) - public void testUnknownXBox360GamepadMappings() throws Exception { + public void testUnknownXBox360GamepadMappings() { int[] axes = new int[] { MotionEvent.AXIS_X, MotionEvent.AXIS_Y, @@ -186,7 +186,7 @@ @Test @Feature({"Gamepad"}) - public void testUnknownMogaProGamepadMappings() throws Exception { + public void testUnknownMogaProGamepadMappings() { int[] axes = new int[] { MotionEvent.AXIS_X, MotionEvent.AXIS_Y, @@ -215,7 +215,7 @@ @Test @Feature({"Gamepad"}) - public void testUnknownXiaomiGamepadMappings() throws Exception { + public void testUnknownXiaomiGamepadMappings() { int[] axes = new int[] { MotionEvent.AXIS_X, MotionEvent.AXIS_Y, @@ -244,7 +244,7 @@ @Test @Feature({"Gamepad"}) - public void testUnknownGpdXdGamepadMappings() throws Exception { + public void testUnknownGpdXdGamepadMappings() { int[] axes = new int[] { MotionEvent.AXIS_X, MotionEvent.AXIS_Y, @@ -270,7 +270,7 @@ @Test @Ignore("https://crbug.com/719765") @Feature({"Gamepad"}) - public void testPS4GamepadMappings() throws Exception { + public void testPS4GamepadMappings() { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.PS_DUALSHOCK_4_PRODUCT_ID, GamepadMappings.PS_DUALSHOCK_4_VENDOR_ID); @@ -306,7 +306,7 @@ @Test @Feature({"Gamepad"}) - public void testXboxOneSBluetooth2016FirmwareMappings() throws Exception { + public void testXboxOneSBluetooth2016FirmwareMappings() { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { GamepadMappings mappings = GamepadMappings.getMappings(GamepadMappings.XBOX_ONE_S_2016_FIRMWARE_PRODUCT_ID, @@ -356,7 +356,7 @@ @Test @Feature({"Gamepad"}) - public void testXboxOneSBluetoothUsesDefaultMappings() throws Exception { + public void testXboxOneSBluetoothUsesDefaultMappings() { // Test that Xbox One S gamepads with updated firmware connected over Bluetooth use the // default mapping. if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
diff --git a/docs/security/security-labels.md b/docs/security/security-labels.md index fa0eba1..b20bd36 100644 --- a/docs/security/security-labels.md +++ b/docs/security/security-labels.md
@@ -32,9 +32,25 @@ * **Security_Impact-**{**Head**, **Beta**, **Stable**, **None**}: Designates which branch(es) were impacted by the bug. Only apply the label corresponding with the earliest affected branch. **None** means that a security bug is in a -disabled feature, or otherwise doesn't impact Chrome. Note that -**Security_Severity** should still be set on **Security_Impact-None** issues, as -if the feature were enabled or the code reachable. +disabled feature, or otherwise doesn't impact Chrome. A disabled feature does +not _guarantee_ impact **None**: + * The feature really must be disabled on 100% of devices. Specifically, + if the feature is controlled by field trials or some other network + configuration service, the feature must also be disabled by default in + the code, such that the code is inactive even on devices that can't + access the network configuration service. + * The feature control check must be somewhere that the attacker could not + have influenced. For example a privilege escalation from a lower- + privileged process to a higher-privileged process assumes that the lower- + privileged process is already compromised. The attacker could overwrite + memory for any feature checks performed within that lower-privileged + process; the bug only qualifies as impact **None** if checks are + performed in the higher-privileged process. (For example, in a + privilege escalation from the renderer to the browser process, the + checks would need to be in the browser process.) + * Note that **Security_Severity** should still be set on + **Security_Impact-None** issues, as if the feature were enabled or the + code reachable. * **Restrict-View-**{**SecurityTeam**, **SecurityNotify**, **Google**, **SecurityEmbargo**}: Labels that restrict access to the bug. Meaning and usage guidelines are as follows: @@ -86,7 +102,7 @@ initial release of a M50 to Stable. * **CVE-####-####**: For security bugs that get assigned a CVE, we tag the appropriate bug(s) with the label for easy searching. -**Type-Bug-Security** bugs should always have **Security_Severity**, +**Type-Bug-Security** bugs should always have **Security_Severity**, **Security_Impact**, **OS**, **Pri**, **M**, **Component**, and an **owner** set. @@ -178,10 +194,11 @@ intended to become public immediately, we'd like to give access to external parties depending on Chromium via *security-notify@chromium.org*. -### Set **Merge-Request-X** For Beta Branch For Fixed Bugs +### Set **Merge-Request-X** For Fixed Bugs Fixed security bugs that affect stable or beta and are critical or high severity -will automatically trigger a merge request for the current beta branch. +will automatically trigger a merge request for the current beta branch, and +perhaps stable if also impacted. ### Drop **ReleaseBlock-X** Labels From **Security_Impact-None** Bugs
diff --git a/extensions/browser/extension_event_histogram_value.h b/extensions/browser/extension_event_histogram_value.h index 678827d8..77e13de 100644 --- a/extensions/browser/extension_event_histogram_value.h +++ b/extensions/browser/extension_event_histogram_value.h
@@ -46,8 +46,8 @@ AUDIO_ON_DEVICES_CHANGED = 25, AUDIO_ON_LEVEL_CHANGED = 26, AUDIO_ON_MUTE_CHANGED = 27, - AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED = 28, - AUTOFILL_PRIVATE_ON_CREDIT_CARD_LIST_CHANGED = 29, + AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED_DEPRECATED = 28, + AUTOFILL_PRIVATE_ON_CREDIT_CARD_LIST_CHANGED_DEPRECATED = 29, AUTOMATION_INTERNAL_ON_ACCESSIBILITY_EVENT = 30, AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED = 31, BLUETOOTH_LOW_ENERGY_ON_CHARACTERISTIC_VALUE_CHANGED = 32, @@ -463,6 +463,7 @@ LOGIN_STATE_ON_SESSION_STATE_CHANGED = 441, PRINTING_METRICS_ON_PRINT_JOB_FINISHED = 442, AUTOTESTPRIVATE_ON_CLIPBOARD_DATA_CHANGED = 443, + AUTOFILL_PRIVATE_ON_PERSONAL_DATA_CHANGED = 444, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h index ac89481..2d2514b 100644 --- a/extensions/browser/extension_registry.h +++ b/extensions/browser/extension_registry.h
@@ -45,11 +45,6 @@ TERMINATED = 1 << 2, BLACKLISTED = 1 << 3, BLOCKED = 1 << 4, - // Used for compatibility with ExtensionService::GetExtensionById. - // DO NOT USE THIS FOR NEW CODE! - // TODO(489687): Analyze uses of this enum and replace them with either a - // more-specific one, or EVERYTHING as appropriate. - COMPATIBILITY = ENABLED | DISABLED | BLACKLISTED | BLOCKED, EVERYTHING = (1 << 5) - 1, };
diff --git a/ios/chrome/browser/crash_report/BUILD.gn b/ios/chrome/browser/crash_report/BUILD.gn index fca86732..1ad917b 100644 --- a/ios/chrome/browser/crash_report/BUILD.gn +++ b/ios/chrome/browser/crash_report/BUILD.gn
@@ -62,6 +62,7 @@ "//ios/chrome/browser/infobars", "//ios/chrome/browser/sessions", "//ios/chrome/browser/sessions:serialisation", + "//ios/chrome/browser/ui/infobars:feature_flags", "//ios/chrome/browser/web:tab_id_tab_helper", "//ios/chrome/browser/web_state_list", "//ios/web",
diff --git a/ios/chrome/browser/crash_report/crash_restore_helper.mm b/ios/chrome/browser/crash_report/crash_restore_helper.mm index 8fd87ec..726a36c9b 100644 --- a/ios/chrome/browser/crash_report/crash_restore_helper.mm +++ b/ios/chrome/browser/crash_report/crash_restore_helper.mm
@@ -20,11 +20,13 @@ #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/crash_report/breakpad_helper.h" #include "ios/chrome/browser/infobars/infobar_manager_impl.h" +#include "ios/chrome/browser/infobars/infobar_utils.h" #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" #import "ios/chrome/browser/sessions/session_ios.h" #import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/chrome/browser/sessions/session_window_restoring.h" +#import "ios/chrome/browser/ui/infobars/infobar_feature.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/chrome/grit/ios_theme_resources.h" #import "ios/web/public/web_state.h" @@ -133,8 +135,14 @@ DCHECK(infobar_manager); std::unique_ptr<ConfirmInfoBarDelegate> delegate( new SessionCrashedInfoBarDelegate(crash_restore_helper)); - return !!infobar_manager->AddInfoBar( - infobar_manager->CreateConfirmInfoBar(std::move(delegate))); + + if (IsInfobarUIRebootEnabled()) { + return !!infobar_manager->AddInfoBar( + ::CreateHighPriorityConfirmInfoBar(std::move(delegate))); + } else { + return !!infobar_manager->AddInfoBar( + ::CreateConfirmInfoBar(std::move(delegate))); + } } infobars::InfoBarDelegate::InfoBarIdentifier
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm index 7c0d781..b521aa2 100644 --- a/ios/chrome/browser/flags/about_flags.mm +++ b/ios/chrome/browser/flags/about_flags.mm
@@ -551,6 +551,10 @@ flag_descriptions::kForceStartupSigninPromoName, flag_descriptions::kForceStartupSigninPromoDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(signin::kForceStartupSigninPromo)}, + {"embedder-block-restore-url", + flag_descriptions::kEmbedderBlockRestoreUrlName, + flag_descriptions::kEmbedderBlockRestoreUrlDescription, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(kEmbedderBlockRestoreUrl)}, }; // Add all switches from experimental flags to |command_line|.
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc index e48485be..7486a2e 100644 --- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
@@ -146,6 +146,11 @@ const char kDragAndDropName[] = "Drag and Drop"; const char kDragAndDropDescription[] = "Enable support for drag and drop."; +const char kEmbedderBlockRestoreUrlName[] = + "Allow embedders to prevent certain URLs from restoring."; +const char kEmbedderBlockRestoreUrlDescription[] = + "Embedders can prevent URLs from restoring."; + const char kEnableAutofillCreditCardUploadEditableCardholderNameName[] = "Make cardholder name editable in dialog during credit card upload"; const char kEnableAutofillCreditCardUploadEditableCardholderNameDescription[] =
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h index 076c4f9..3b722d04 100644 --- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
@@ -117,6 +117,10 @@ extern const char kDragAndDropName[]; extern const char kDragAndDropDescription[]; +// Title and description for the flag to block restore urls. +extern const char kEmbedderBlockRestoreUrlName[]; +extern const char kEmbedderBlockRestoreUrlDescription[]; + // Title and description for the flag to control if credit card upload can // display a cardholder name fix flow. extern const char kEnableAutofillCreditCardUploadEditableCardholderNameName[];
diff --git a/ios/chrome/browser/infobars/infobar_utils.h b/ios/chrome/browser/infobars/infobar_utils.h index 109c1f2..b91430b 100644 --- a/ios/chrome/browser/infobars/infobar_utils.h +++ b/ios/chrome/browser/infobars/infobar_utils.h
@@ -18,4 +18,11 @@ std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( std::unique_ptr<ConfirmInfoBarDelegate> delegate); +// Returns a confirm infobar with high priority presentation that owns +// |delegate|. +// TODO (crbug.com/961343):Reassess this method once there's more clarity on how +// to handle queueing and if priorities are actually needed. +std::unique_ptr<infobars::InfoBar> CreateHighPriorityConfirmInfoBar( + std::unique_ptr<ConfirmInfoBarDelegate> delegate); + #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_UTILS_H_
diff --git a/ios/chrome/browser/infobars/infobar_utils.mm b/ios/chrome/browser/infobars/infobar_utils.mm index 779b828..2f389007 100644 --- a/ios/chrome/browser/infobars/infobar_utils.mm +++ b/ios/chrome/browser/infobars/infobar_utils.mm
@@ -37,3 +37,17 @@ return std::make_unique<InfoBarIOS>(controller, std::move(delegate)); } } + +std::unique_ptr<infobars::InfoBar> CreateHighPriorityConfirmInfoBar( + std::unique_ptr<ConfirmInfoBarDelegate> delegate) { + DCHECK(IsInfobarUIRebootEnabled()); + // TODO(crbug.com/927064): Coordinators shouldn't be created at this level, + // we should probably send only the delegate and have the presenting + // Coordinator create the right Coordinator using that delegate. + InfobarConfirmCoordinator* coordinator = [[InfobarConfirmCoordinator alloc] + initWithInfoBarDelegate:delegate.get() + badgeSupport:NO + type:InfobarType::kInfobarTypeConfirm]; + coordinator.highPriorityPresentation = YES; + return std::make_unique<InfoBarIOS>(coordinator, std::move(delegate)); +}
diff --git a/ios/chrome/browser/prerender/preload_controller.h b/ios/chrome/browser/prerender/preload_controller.h index e713c70..dc3efa8 100644 --- a/ios/chrome/browser/prerender/preload_controller.h +++ b/ios/chrome/browser/prerender/preload_controller.h
@@ -71,10 +71,11 @@ // Returns whether |webState| is the WebState used for pre-rendering. - (BOOL)isWebStatePrerendered:(web::WebState*)webState; -// Returns the currently prerendered WebState, or nil if none exists. After -// this method is called, the PrerenderController reverts to a non-prerendering -// state. -- (std::unique_ptr<web::WebState>)releasePrerenderContents; +// Returns the currently prerendered WebState, or nil if it was not created +// while |oldWebState| was active, or nil if none exists. After this method is +// called, the PrerenderController reverts to a non-prerendering state. +- (std::unique_ptr<web::WebState>)releasePrerenderContentsForWebState: + (web::WebState*)oldWebState; @end
diff --git a/ios/chrome/browser/prerender/preload_controller.mm b/ios/chrome/browser/prerender/preload_controller.mm index a79762a1..46af71a 100644 --- a/ios/chrome/browser/prerender/preload_controller.mm +++ b/ios/chrome/browser/prerender/preload_controller.mm
@@ -32,6 +32,7 @@ #import "ios/web/public/navigation/web_state_policy_decider_bridge.h" #include "ios/web/public/thread/web_thread.h" #import "ios/web/public/ui/java_script_dialog_presenter.h" +#include "ios/web/public/web_client.h" #import "ios/web/public/web_state.h" #import "ios/web/public/web_state_observer_bridge.h" #import "ios/web/web_state/ui/crw_web_controller.h" @@ -186,6 +187,10 @@ // there is no prerender scheduled. @property(nonatomic, readonly) const GURL& scheduledURL; +// Contains the original webState that, for SlimNav, session history will be +// created from. +@property(nonatomic, assign) web::WebState* webStateToReplace; + // Whether or not the preference is enabled. @property(nonatomic, getter=isPreferenceEnabled) BOOL preferenceEnabled; @@ -299,6 +304,9 @@ } [self removeScheduledPrerenderRequests]; + + self.webStateToReplace = [self.delegate webStateToReplace]; + _scheduledRequest = std::make_unique<PrerenderRequest>(url, transition, referrer); @@ -321,10 +329,13 @@ return webState && _webState.get() == webState; } -- (std::unique_ptr<web::WebState>)releasePrerenderContents { - if (!_webState) +- (std::unique_ptr<web::WebState>)releasePrerenderContentsForWebState: + (web::WebState*)oldWebState { + if (!_webState || oldWebState != self.webStateToReplace || + _webState->GetNavigationManager()->IsRestoreSessionInProgress()) return nullptr; + self.webStateToReplace = nullptr; self.successfulPrerendersPerSessionCount++; [self recordReleaseMetrics]; [self removeScheduledPrerenderRequests]; @@ -501,7 +512,13 @@ } web::WebState::CreateParams createParams(self.browserState); - _webState = web::WebState::Create(createParams); + if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { + _webState = web::WebState::CreateWithStorageSession( + createParams, self.webStateToReplace->BuildSessionStorage()); + } else { + _webState = web::WebState::Create(createParams); + } + // Add the preload controller as a policyDecider before other tab helpers, so // that it can block the navigation if needed before other policy deciders // execute thier side effects (eg. AppLauncherTabHelper launching app). @@ -563,6 +580,7 @@ self.prerenderedURL = GURL(); self.startTime = base::TimeTicks(); + self.webStateToReplace = nullptr; } #pragma mark - Notification Helpers
diff --git a/ios/chrome/browser/prerender/preload_controller_delegate.h b/ios/chrome/browser/prerender/preload_controller_delegate.h index 691cbcd3..856d97d7 100644 --- a/ios/chrome/browser/prerender/preload_controller_delegate.h +++ b/ios/chrome/browser/prerender/preload_controller_delegate.h
@@ -12,6 +12,10 @@ // A protocol implemented by a delegate of PreloadController @protocol PreloadControllerDelegate +// WebState from which preload controller should copy the session history. +// This web state will be replaced on successful preload. +- (web::WebState*)webStateToReplace; + // Should preload controller request a desktop site. - (BOOL)preloadShouldUseDesktopUserAgent;
diff --git a/ios/chrome/browser/prerender/preload_controller_unittest.mm b/ios/chrome/browser/prerender/preload_controller_unittest.mm index e528a0c..d268690 100644 --- a/ios/chrome/browser/prerender/preload_controller_unittest.mm +++ b/ios/chrome/browser/prerender/preload_controller_unittest.mm
@@ -116,7 +116,7 @@ referrer:kReferrer transition:kTransition immediately:YES]; - EXPECT_FALSE([controller_ releasePrerenderContents]); + EXPECT_FALSE([controller_ releasePrerenderContentsForWebState:nil]); // Attempt to prerender the NTP and verify that no WebState was created // to preload. @@ -124,7 +124,7 @@ referrer:kReferrer transition:kTransition immediately:YES]; - EXPECT_FALSE([controller_ releasePrerenderContents]); + EXPECT_FALSE([controller_ releasePrerenderContentsForWebState:nil]); // Attempt to prerender the flags UI and verify that no WebState was created // to preload. @@ -132,7 +132,7 @@ referrer:kReferrer transition:kTransition immediately:YES]; - EXPECT_FALSE([controller_ releasePrerenderContents]); + EXPECT_FALSE([controller_ releasePrerenderContentsForWebState:nil]); } TEST_F(PreloadControllerTest, TestIsPrerenderingEnabled_preloadAlways) {
diff --git a/ios/chrome/browser/prerender/prerender_egtest.mm b/ios/chrome/browser/prerender/prerender_egtest.mm index c435a66f..42a5e47 100644 --- a/ios/chrome/browser/prerender/prerender_egtest.mm +++ b/ios/chrome/browser/prerender/prerender_egtest.mm
@@ -65,11 +65,6 @@ @"Disabled for iPad due to alternate letters educational screen."); } - if ([ChromeEarlGrey isSlimNavigationManagerEnabled]) { - // TODO(crbug.com/834116): Fix and enable this test. - EARL_GREY_TEST_DISABLED(@"Prerender is not supported by slim-nav yet."); - } - [ChromeEarlGrey clearBrowsingHistory]; // Set server up. int visitCounter = 0;
diff --git a/ios/chrome/browser/prerender/prerender_service.mm b/ios/chrome/browser/prerender/prerender_service.mm index 45961002..661e41f2 100644 --- a/ios/chrome/browser/prerender/prerender_service.mm +++ b/ios/chrome/browser/prerender/prerender_service.mm
@@ -39,13 +39,6 @@ const web::Referrer& referrer, ui::PageTransition transition, bool immediately) { - // PrerenderService is not compatible with WKBasedNavigationManager because it - // loads the URL in a new WKWebView, which doesn't have the current session - // history. TODO(crbug.com/814789): decide whether PrerenderService needs to - // be supported after evaluating the performance impact in Finch experiment. - if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) - return; - [controller_ prerenderURL:url referrer:referrer transition:transition @@ -62,12 +55,18 @@ return false; } + web::WebState* web_state = web_state_list->GetActiveWebState(); std::unique_ptr<web::WebState> new_web_state = - [controller_ releasePrerenderContents]; + [controller_ releasePrerenderContentsForWebState:web_state]; + if (!new_web_state) { + CancelPrerender(); + return false; + } + DCHECK_NE(WebStateList::kInvalidIndex, web_state_list->active_index()); web::NavigationManager* active_navigation_manager = - web_state_list->GetActiveWebState()->GetNavigationManager(); + web_state->GetNavigationManager(); int lastIndex = active_navigation_manager->GetLastCommittedItemIndex(); UMA_HISTOGRAM_COUNTS_100("Prerender.PrerenderLoadedOnIndex", lastIndex); @@ -79,8 +78,13 @@ web::NavigationManager* new_navigation_manager = new_web_state->GetNavigationManager(); - if (new_navigation_manager->CanPruneAllButLastCommittedItem()) { - new_navigation_manager->CopyStateFromAndPrune(active_navigation_manager); + bool slim_navigation_manager_enabled = + web::GetWebClient()->IsSlimNavigationManagerEnabled(); + if (new_navigation_manager->CanPruneAllButLastCommittedItem() || + slim_navigation_manager_enabled) { + if (!slim_navigation_manager_enabled) { + new_navigation_manager->CopyStateFromAndPrune(active_navigation_manager); + } loading_prerender_ = true; web_state_list->ReplaceWebStateAt(web_state_list->active_index(), std::move(new_web_state));
diff --git a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.h b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.h index 63c5637..d26d0774 100644 --- a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.h +++ b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.h
@@ -32,8 +32,8 @@ // 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, - ios::ChromeBrowserState* browser_state); +bool AreContentRequirementsMet(const GURL& gurl, + ios::ChromeBrowserState* browser_state); // Returns true if all conditions are true and shows the option onto the menu. bool ShouldOfferFeature(ios::ChromeBrowserState* browser_state,
diff --git a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.mm b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.mm index 9c024c7..ebbbf4af 100644 --- a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.mm +++ b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util.mm
@@ -55,8 +55,8 @@ service->GetSendTabToSelfModel()->HasValidTargetDevice(); } -bool IsContentRequirementsMet(const GURL& url, - ios::ChromeBrowserState* browser_state) { +bool AreContentRequirementsMet(const GURL& url, + ios::ChromeBrowserState* browser_state) { bool is_http_or_https = url.SchemeIsHTTPOrHTTPS(); bool is_native_page = url.SchemeIs(kChromeUIScheme); bool is_incognito_mode = browser_state->IsOffTheRecord(); @@ -68,7 +68,7 @@ // 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,
diff --git a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm index b7c3663..06505a8 100644 --- a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm +++ b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm
@@ -96,22 +96,23 @@ 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.
diff --git a/ios/chrome/browser/sync/device_info_sync_service_factory.mm b/ios/chrome/browser/sync/device_info_sync_service_factory.mm index 2a14001..8f63057 100644 --- a/ios/chrome/browser/sync/device_info_sync_service_factory.mm +++ b/ios/chrome/browser/sync/device_info_sync_service_factory.mm
@@ -44,6 +44,12 @@ return send_tab_to_self::IsReceivingEnabledByUserOnThisDevice(prefs_); } + // syncer::DeviceInfoSyncClient: + base::Optional<syncer::DeviceInfo::SharingInfo> GetLocalSharingInfo() + const override { + return base::nullopt; + } + private: PrefService* const prefs_; };
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index 90beec81..ad3ac22 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -958,8 +958,8 @@ fullscreenController->SetWebStateList(self.tabModel.webStateList); - _fullscreenUIUpdater = std::make_unique<FullscreenUIUpdater>(self); - fullscreenController->AddObserver(_fullscreenUIUpdater.get()); + _fullscreenUIUpdater = + std::make_unique<FullscreenUIUpdater>(fullscreenController, self); [self updateForFullscreenProgress:fullscreenController->GetProgress()]; } else { StopBroadcastingToolbarUI(broadcaster); @@ -970,7 +970,6 @@ [_webMainContentUIForwarder disconnect]; _webMainContentUIForwarder = nil; - fullscreenController->RemoveObserver(_fullscreenUIUpdater.get()); _fullscreenUIUpdater = nullptr; fullscreenController->SetWebStateList(nullptr); @@ -4758,6 +4757,10 @@ return [self userAgentType] == web::UserAgentType::DESKTOP; } +- (web::WebState*)webStateToReplace { + return self.currentWebState; +} + #pragma mark - NetExportTabHelperDelegate - (void)netExportTabHelper:(NetExportTabHelper*)tabHelper
diff --git a/ios/chrome/browser/ui/dialogs/non_modal/non_modal_alert_coordinator.mm b/ios/chrome/browser/ui/dialogs/non_modal/non_modal_alert_coordinator.mm index a1e5faea..c1ecd10 100644 --- a/ios/chrome/browser/ui/dialogs/non_modal/non_modal_alert_coordinator.mm +++ b/ios/chrome/browser/ui/dialogs/non_modal/non_modal_alert_coordinator.mm
@@ -18,8 +18,7 @@ #endif @interface NonModalAlertCoordinator () { - // Observer that updates the non-modal presentation for fullscreen events. - std::unique_ptr<FullscreenControllerObserver> _fullscreenObserver; + std::unique_ptr<FullscreenUIUpdater> _fullscreenUIUpdater; } // The non-modal presentation updater. @property(nonatomic, strong) @@ -50,19 +49,14 @@ FullscreenController* fullscreenController = FullscreenControllerFactory::GetInstance()->GetForBrowserState( self.browserState); - if (_fullscreenObserver) { - // Stop updating the old non-modal presentation controller. - fullscreenController->RemoveObserver(_fullscreenObserver.get()); - _fullscreenObserver = nullptr; - } + _fullscreenUIUpdater = nullptr; _nonModalPresentationUpdater = nonModalPresentationUpdater; if (_nonModalPresentationUpdater) { // Create an updater for the new non-modal presentation controller. - _fullscreenObserver = - std::make_unique<FullscreenUIUpdater>(_nonModalPresentationUpdater); - fullscreenController->AddObserver(_fullscreenObserver.get()); + _fullscreenUIUpdater = std::make_unique<FullscreenUIUpdater>( + fullscreenController, _nonModalPresentationUpdater); // Use the current viewport insets to set up the non-modal presentation. [_nonModalPresentationUpdater setUpNonModalPresentationWithViewportInsets:
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.h b/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.h index 58757e3..6751702 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.h +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.h
@@ -5,32 +5,61 @@ #ifndef IOS_CLEAN_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_UI_UPDATER_H_ #define IOS_CLEAN_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_UI_UPDATER_H_ +#include "base/scoped_observer.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_controller_observer.h" @protocol FullscreenUIElement; -// Observer that updates FullscreenUIElements for FullscreenController events. -class FullscreenUIUpdater : public FullscreenControllerObserver { +// Forwards signals received via FullscreenControllerObserver callbacks to +// FullscreenUIElements. +class FullscreenUIUpdater { public: - // Contructor for an observer that updates |ui_element|. |ui_element| is not - // retained. - explicit FullscreenUIUpdater(id<FullscreenUIElement> ui_element); + // Constructor for an updater that updates |ui_element| for observed events + // from |controller|. Both arguments must be non-null. |ui_element| is not + // retained. The updater will observe |controller| until the controller is + // shut down or the updater is destroyed. + FullscreenUIUpdater(FullscreenController* controller, + id<FullscreenUIElement> ui_element); + ~FullscreenUIUpdater(); private: - // FullscreenControllerObserver: - void FullscreenViewportInsetRangeChanged( - FullscreenController* controller, - UIEdgeInsets min_viewport_insets, - UIEdgeInsets max_viewport_insets) override; - void FullscreenProgressUpdated(FullscreenController* controller, - CGFloat progress) override; - void FullscreenEnabledStateChanged(FullscreenController* controller, - bool enabled) override; - void FullscreenWillAnimate(FullscreenController* controller, - FullscreenAnimator* animator) override; + // Stops observing |controller_|. + void Disconnect(); - // The UI element being updated by this observer. - __weak id<FullscreenUIElement> ui_element_; + // Helper object that forwards FullscreenControllerObserver callbacks to their + // FullscreenUIElement counterparts. + class FullscreenControllerObserverForwarder + : public FullscreenControllerObserver { + public: + // Constructor for a forwarder that updates |ui_element| for |updater|. + FullscreenControllerObserverForwarder(FullscreenUIUpdater* updater, + id<FullscreenUIElement> ui_element); + + // FullscreenControllerObserver: + void FullscreenViewportInsetRangeChanged( + FullscreenController* controller, + UIEdgeInsets min_viewport_insets, + UIEdgeInsets max_viewport_insets) override; + void FullscreenProgressUpdated(FullscreenController* controller, + CGFloat progress) override; + void FullscreenEnabledStateChanged(FullscreenController* controller, + bool enabled) override; + void FullscreenWillAnimate(FullscreenController* controller, + FullscreenAnimator* animator) override; + void FullscreenControllerWillShutDown( + FullscreenController* controller) override; + + private: + FullscreenUIUpdater* updater_ = nullptr; + __weak id<FullscreenUIElement> ui_element_ = nil; + }; + + // The FullscreenController being observed. + FullscreenController* controller_ = nullptr; + // The observer forwarder. + FullscreenControllerObserverForwarder forwarder_; + // Scoped observer for |forwarder_|. + ScopedObserver<FullscreenController, FullscreenControllerObserver> observer_; }; #endif // IOS_CLEAN_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_UI_UPDATER_H_
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.mm index db550373..0bd4a9d 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.mm
@@ -12,19 +12,42 @@ #error "This file requires ARC support." #endif -FullscreenUIUpdater::FullscreenUIUpdater(id<FullscreenUIElement> ui_element) - : ui_element_(ui_element) {} +FullscreenUIUpdater::FullscreenUIUpdater(FullscreenController* controller, + id<FullscreenUIElement> ui_element) + : controller_(controller), + forwarder_(this, ui_element), + observer_(&forwarder_) { + DCHECK(controller_); + observer_.Add(controller_); +} -void FullscreenUIUpdater::FullscreenProgressUpdated( - FullscreenController* controller, - CGFloat progress) { +FullscreenUIUpdater::~FullscreenUIUpdater() = default; + +void FullscreenUIUpdater::Disconnect() { + if (!controller_) + return; + observer_.Remove(controller_); + controller_ = nullptr; +} + +FullscreenUIUpdater::FullscreenControllerObserverForwarder:: + FullscreenControllerObserverForwarder(FullscreenUIUpdater* updater, + id<FullscreenUIElement> ui_element) + : updater_(updater), ui_element_(ui_element) { + DCHECK(updater_); + DCHECK(ui_element_); +} + +void FullscreenUIUpdater::FullscreenControllerObserverForwarder:: + FullscreenProgressUpdated(FullscreenController* controller, + CGFloat progress) { [ui_element_ updateForFullscreenProgress:progress]; } -void FullscreenUIUpdater::FullscreenViewportInsetRangeChanged( - FullscreenController* controller, - UIEdgeInsets min_viewport_insets, - UIEdgeInsets max_viewport_insets) { +void FullscreenUIUpdater::FullscreenControllerObserverForwarder:: + FullscreenViewportInsetRangeChanged(FullscreenController* controller, + UIEdgeInsets min_viewport_insets, + UIEdgeInsets max_viewport_insets) { SEL inset_range_selector = @selector(updateForFullscreenMinViewportInsets: maxViewportInsets:); if ([ui_element_ respondsToSelector:inset_range_selector]) { @@ -33,9 +56,9 @@ } } -void FullscreenUIUpdater::FullscreenEnabledStateChanged( - FullscreenController* controller, - bool enabled) { +void FullscreenUIUpdater::FullscreenControllerObserverForwarder:: + FullscreenEnabledStateChanged(FullscreenController* controller, + bool enabled) { if ([ui_element_ respondsToSelector:@selector(updateForFullscreenEnabled:)]) { [ui_element_ updateForFullscreenEnabled:enabled]; } else if (!enabled) { @@ -43,9 +66,9 @@ } } -void FullscreenUIUpdater::FullscreenWillAnimate( - FullscreenController* controller, - FullscreenAnimator* animator) { +void FullscreenUIUpdater::FullscreenControllerObserverForwarder:: + FullscreenWillAnimate(FullscreenController* controller, + FullscreenAnimator* animator) { SEL animator_selector = @selector(animateFullscreenWithAnimator:); if ([ui_element_ respondsToSelector:animator_selector]) { [ui_element_ animateFullscreenWithAnimator:animator]; @@ -56,3 +79,8 @@ }]; } } + +void FullscreenUIUpdater::FullscreenControllerObserverForwarder:: + FullscreenControllerWillShutDown(FullscreenController* controller) { + updater_->Disconnect(); +}
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater_unittest.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater_unittest.mm index d7aef47..c34df47 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater_unittest.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater_unittest.mm
@@ -5,7 +5,9 @@ #import "ios/chrome/browser/ui/fullscreen/fullscreen_ui_updater.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_animator.h" +#import "ios/chrome/browser/ui/fullscreen/fullscreen_model.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_ui_element.h" +#import "ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.h" #include "ios/chrome/browser/ui/util/ui_util.h" #include "testing/platform_test.h" @@ -72,14 +74,16 @@ class FullscreenUIUpdaterTest : public PlatformTest { public: FullscreenUIUpdaterTest() - : PlatformTest(), + : controller_(&model_), element_([[TestFullscreenUIElement alloc] init]), - updater_(element_) {} + updater_(&controller_, element_) {} + TestFullscreenController* controller() { return &controller_; } TestFullscreenUIElement* element() { return element_; } - FullscreenControllerObserver* observer() { return &updater_; } private: + FullscreenModel model_; + TestFullscreenController controller_; __strong TestFullscreenUIElement* element_; FullscreenUIUpdater updater_; }; @@ -88,7 +92,7 @@ TEST_F(FullscreenUIUpdaterTest, Progress) { ASSERT_TRUE(AreCGFloatsEqual(element().progress, 0.0)); const CGFloat kProgress = 0.5; - observer()->FullscreenProgressUpdated(nullptr, kProgress); + controller()->OnFullscreenProgressUpdated(kProgress); EXPECT_TRUE(AreCGFloatsEqual(element().progress, kProgress)); } @@ -96,8 +100,7 @@ TEST_F(FullscreenUIUpdaterTest, Insets) { const UIEdgeInsets kMinInsets = UIEdgeInsetsMake(10, 10, 10, 10); const UIEdgeInsets kMaxInsets = UIEdgeInsetsMake(20, 20, 20, 20); - observer()->FullscreenViewportInsetRangeChanged(nullptr, kMinInsets, - kMaxInsets); + controller()->OnFullscreenViewportInsetRangeChanged(kMinInsets, kMaxInsets); EXPECT_TRUE( UIEdgeInsetsEqualToEdgeInsets(element().minViewportInsets, kMinInsets)); EXPECT_TRUE( @@ -107,9 +110,9 @@ // Tests that the updater correctly changes the UI element's enabled state. TEST_F(FullscreenUIUpdaterTest, EnabledDisabled) { ASSERT_FALSE(element().enabled); - observer()->FullscreenEnabledStateChanged(nullptr, true); + controller()->OnFullscreenEnabledStateChanged(true); EXPECT_TRUE(element().enabled); - observer()->FullscreenEnabledStateChanged(nullptr, false); + controller()->OnFullscreenEnabledStateChanged(false); EXPECT_FALSE(element().enabled); } @@ -121,7 +124,7 @@ FullscreenAnimator* const kAnimator = [[FullscreenAnimator alloc] initWithStartProgress:0.0 style:FullscreenAnimatorStyle::ENTER_FULLSCREEN]; - observer()->FullscreenWillAnimate(nullptr, kAnimator); + controller()->OnFullscreenWillAnimate(kAnimator); EXPECT_EQ(element().animator, kAnimator); } @@ -132,14 +135,14 @@ // Verify that the fullscreen progress gets reset to 1.0 when the enabled // state selector is not implemented. ASSERT_TRUE(AreCGFloatsEqual(element().progress, 0.0)); - observer()->FullscreenEnabledStateChanged(nullptr, false); + controller()->OnFullscreenEnabledStateChanged(false); EXPECT_TRUE(AreCGFloatsEqual(element().progress, 1.0)); // Verify that the fullscreen progress gets reset to 0.0 for an // ENTER_FULLSCREEN animator when the animation selector is not implemented. FullscreenAnimator* animator = [[FullscreenAnimator alloc] initWithStartProgress:0.0 style:FullscreenAnimatorStyle::ENTER_FULLSCREEN]; - observer()->FullscreenWillAnimate(nullptr, animator); + controller()->OnFullscreenWillAnimate(animator); [animator startAnimation]; EXPECT_TRUE(AreCGFloatsEqual(element().progress, 0.0)); [animator stopAnimation:YES];
diff --git a/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.h b/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.h index 285c9f3..050085a7c 100644 --- a/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.h +++ b/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.h
@@ -10,6 +10,7 @@ #include "base/observer_list.h" class FullscreenModel; +@class FullscreenAnimator; // Test version of FullscreenController with limited functionality: // - Enables/disables a FullscreenModel. @@ -42,6 +43,16 @@ // KeyedService: void Shutdown() override; + // Calls FullscreenViewportInsetRangeChanged() on observers. + void OnFullscreenViewportInsetRangeChanged(UIEdgeInsets min_viewport_insets, + UIEdgeInsets max_viewport_insets); + // Calls FullscreenProgressUpdated() on observers. + void OnFullscreenProgressUpdated(CGFloat progress); + // Calls FullscreenEnabledStateChanged() on observers. + void OnFullscreenEnabledStateChanged(bool enabled); + // Calls FullscreenWillAnimate() on observers. + void OnFullscreenWillAnimate(FullscreenAnimator* animator); + private: // The model. FullscreenModel* model_ = nullptr;
diff --git a/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.mm b/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.mm index 7b0e7d346..66eb040 100644 --- a/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.mm +++ b/ios/chrome/browser/ui/fullscreen/test/test_fullscreen_controller.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/broadcaster/chrome_broadcaster.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_controller_observer.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_model.h" +#import "ios/chrome/browser/ui/fullscreen/fullscreen_model_observer.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -79,15 +80,43 @@ return model_ ? model_->current_toolbar_insets() : UIEdgeInsetsZero; } +void TestFullscreenController::EnterFullscreen() {} + +void TestFullscreenController::ExitFullscreen() { + if (model_) + model_->ResetForNavigation(); +} + void TestFullscreenController::Shutdown() { for (auto& observer : observers_) { observer.FullscreenControllerWillShutDown(this); } } -void TestFullscreenController::EnterFullscreen() {} +void TestFullscreenController::OnFullscreenViewportInsetRangeChanged( + UIEdgeInsets min_viewport_insets, + UIEdgeInsets max_viewport_insets) { + for (auto& observer : observers_) { + observer.FullscreenViewportInsetRangeChanged(this, min_viewport_insets, + max_viewport_insets); + } +} -void TestFullscreenController::ExitFullscreen() { - if (model_) - model_->ResetForNavigation(); +void TestFullscreenController::OnFullscreenProgressUpdated(CGFloat progress) { + for (auto& observer : observers_) { + observer.FullscreenProgressUpdated(this, progress); + } +} + +void TestFullscreenController::OnFullscreenEnabledStateChanged(bool enabled) { + for (auto& observer : observers_) { + observer.FullscreenEnabledStateChanged(this, enabled); + } +} + +void TestFullscreenController::OnFullscreenWillAnimate( + FullscreenAnimator* animator) { + for (auto& observer : observers_) { + observer.FullscreenWillAnimate(this, animator); + } }
diff --git a/ios/chrome/browser/ui/infobars/coordinators/infobar_coordinator.h b/ios/chrome/browser/ui/infobars/coordinators/infobar_coordinator.h index bf6a740b..1a229e9 100644 --- a/ios/chrome/browser/ui/infobars/coordinators/infobar_coordinator.h +++ b/ios/chrome/browser/ui/infobars/coordinators/infobar_coordinator.h
@@ -116,6 +116,13 @@ // YES if the banner has ever been presented for this Coordinator. @property(nonatomic, assign, readonly) BOOL bannerWasPresented; +// If YES this Coordinator's banner will have a higher presentation priority +// than other InfobarCoordinators with this property set to NO. The parent +// Coordinator will define what this means e.g. Longer presentation time before +// auto-dismiss and/or jumping the queue and being the next banner to present, +// etc. +@property(nonatomic, assign) BOOL highPriorityPresentation; + @end #endif // IOS_CHROME_BROWSER_UI_INFOBARS_COORDINATORS_INFOBAR_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/infobars/infobar_constants.h b/ios/chrome/browser/ui/infobars/infobar_constants.h index eb04181..64780fc 100644 --- a/ios/chrome/browser/ui/infobars/infobar_constants.h +++ b/ios/chrome/browser/ui/infobars/infobar_constants.h
@@ -15,6 +15,9 @@ // The duration in seconds that the InfobarCoordinator banner will be presented // for. -extern const NSTimeInterval kInfobarBannerPresentationDurationInSeconds; +extern const NSTimeInterval kInfobarBannerDefaultPresentationDurationInSeconds; +// The duration in seconds that a high priority presentation InfobarCoordinator +// banner will be presented for. +extern const NSTimeInterval kInfobarBannerLongPresentationDurationInSeconds; #endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_CONSTANTS_H_
diff --git a/ios/chrome/browser/ui/infobars/infobar_constants.mm b/ios/chrome/browser/ui/infobars/infobar_constants.mm index 0942eace..a60958e 100644 --- a/ios/chrome/browser/ui/infobars/infobar_constants.mm +++ b/ios/chrome/browser/ui/infobars/infobar_constants.mm
@@ -16,4 +16,5 @@ NSString* const kConfirmInfobarButton2AccessibilityIdentifier = @"confirmInfobarButton2AXID"; -const NSTimeInterval kInfobarBannerPresentationDurationInSeconds = 8.0; +const NSTimeInterval kInfobarBannerDefaultPresentationDurationInSeconds = 8.0; +const NSTimeInterval kInfobarBannerLongPresentationDurationInSeconds = 15.0;
diff --git a/ios/chrome/browser/ui/infobars/infobar_container_coordinator.mm b/ios/chrome/browser/ui/infobars/infobar_container_coordinator.mm index f3f195ad..068cfc2 100644 --- a/ios/chrome/browser/ui/infobars/infobar_container_coordinator.mm +++ b/ios/chrome/browser/ui/infobars/infobar_container_coordinator.mm
@@ -287,8 +287,7 @@ if (!(self.infobarBannerState == InfobarBannerPresentationState::NotPresented) || (!self.baseViewController.view.window)) { - if (![self.infobarCoordinatorsToPresent containsObject:infobarCoordinator]) - [self.infobarCoordinatorsToPresent addObject:infobarCoordinator]; + [self queueInfobarCoordinatorForPresentation:infobarCoordinator]; return; } @@ -300,9 +299,12 @@ // Dismisses the presented InfobarCoordinator banner after // kInfobarBannerPresentationDurationInSeconds seconds. if (!UIAccessibilityIsVoiceOverRunning()) { - dispatch_time_t popTime = dispatch_time( - DISPATCH_TIME_NOW, - kInfobarBannerPresentationDurationInSeconds * NSEC_PER_SEC); + NSTimeInterval timeInterval = + infobarCoordinator.highPriorityPresentation + ? kInfobarBannerLongPresentationDurationInSeconds + : kInfobarBannerDefaultPresentationDurationInSeconds; + dispatch_time_t popTime = + dispatch_time(DISPATCH_TIME_NOW, timeInterval * NSEC_PER_SEC); dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { [infobarCoordinator dismissInfobarBannerAfterInteraction]; }); @@ -322,4 +324,17 @@ return nil; } +// Queues an InfobarBanner for presentation. If it has already been queued it +// won't be added again. +- (void)queueInfobarCoordinatorForPresentation: + (InfobarCoordinator*)coordinator { + if (![self.infobarCoordinatorsToPresent containsObject:coordinator]) { + if (coordinator.highPriorityPresentation) { + [self.infobarCoordinatorsToPresent insertObject:coordinator atIndex:0]; + } else { + [self.infobarCoordinatorsToPresent addObject:coordinator]; + } + } +} + @end
diff --git a/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm b/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm index 28ccd75..1f033e7 100644 --- a/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm
@@ -106,16 +106,6 @@ YES; [infobar_container_coordinator_ start]; - // Setup the InfobarCoordinator and InfobarDelegate. - TestInfoBarDelegate* test_infobar_delegate = - new TestInfoBarDelegate(@"Title"); - coordinator_ = [[InfobarConfirmCoordinator alloc] - initWithInfoBarDelegate:test_infobar_delegate - badgeSupport:YES - type:InfobarType::kInfobarTypeConfirm]; - infobar_delegate_ = - std::unique_ptr<ConfirmInfoBarDelegate>(test_infobar_delegate); - // Setup the Legacy InfobarController and InfobarDelegate. TestInfoBarDelegate* test_legacy_infobar_delegate = new TestInfoBarDelegate(@"Legacy Infobar"); @@ -142,14 +132,25 @@ // Adds an Infobar to the InfobarManager, triggering an InfobarBanner // presentation. - void AddInfobar() { + void AddInfobar(bool high_priority_presentation) { + // Setup the InfobarCoordinator and InfobarDelegate. + TestInfoBarDelegate* test_infobar_delegate = + new TestInfoBarDelegate(@"Title"); + coordinator_ = [[InfobarConfirmCoordinator alloc] + initWithInfoBarDelegate:test_infobar_delegate + badgeSupport:YES + type:InfobarType::kInfobarTypeConfirm]; + coordinator_.highPriorityPresentation = high_priority_presentation; + infobar_delegate_ = + std::unique_ptr<ConfirmInfoBarDelegate>(test_infobar_delegate); + GetInfobarManager()->AddInfoBar(std::make_unique<InfoBarIOS>( coordinator_, std::move(infobar_delegate_))); } // Adds an Infobar to the InfobarManager, triggering an InfobarBanner // presentation. - void AddSecondInfobar() { + void AddSecondInfobar(bool high_priority_presentation) { // Setup the InfobarCoordinator and InfobarDelegate. TestInfoBarDelegate* test_infobar_delegate = new TestInfoBarDelegate(@"Title 2"); @@ -157,6 +158,7 @@ initWithInfoBarDelegate:test_infobar_delegate badgeSupport:YES type:InfobarType::kInfobarTypePasswordSave]; + second_coordinator_.highPriorityPresentation = high_priority_presentation; std::unique_ptr<ConfirmInfoBarDelegate> infobar_delegate = std::unique_ptr<ConfirmInfoBarDelegate>(test_infobar_delegate); @@ -209,7 +211,7 @@ InfobarBannerPresentationStatePresented) { EXPECT_NE(infobar_container_coordinator_.infobarBannerState, InfobarBannerPresentationState::Presented); - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -225,7 +227,7 @@ EXPECT_NE(infobar_container_coordinator_.infobarBannerState, InfobarBannerPresentationState::Presented); - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { @@ -236,7 +238,7 @@ ASSERT_EQ(infobar_container_coordinator_.infobarBannerState, InfobarBannerPresentationState::Presented); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( - kInfobarBannerPresentationDurationInSeconds, ^bool { + kInfobarBannerDefaultPresentationDurationInSeconds, ^bool { return infobar_container_coordinator_.infobarBannerState == InfobarBannerPresentationState::NotPresented; })); @@ -250,7 +252,7 @@ EXPECT_FALSE(infobar_container_coordinator_.infobarBannerState == InfobarBannerPresentationState::Presented); - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { @@ -291,7 +293,7 @@ TestInfobarBannerPresentationBeforeLegacyPresentation) { EXPECT_NE(infobar_container_coordinator_.infobarBannerState, InfobarBannerPresentationState::Presented); - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -315,7 +317,7 @@ isInfobarPresentingForWebState:web_state_list_->GetActiveWebState()]); ASSERT_NE(infobar_container_coordinator_.infobarBannerState, InfobarBannerPresentationState::Presented); - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -328,7 +330,7 @@ // Tests that the InfobarBanner is dismissed when changing Webstates. TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissAtWebStateChange) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); AddSecondWebstate(); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( @@ -354,7 +356,7 @@ // different Webstate. TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerNotPresentAfterWebStateChange) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); AddSecondWebstate(); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( @@ -389,7 +391,7 @@ // Tests infobarBannerState is NotPresented once an InfobarBanner has been // dismissed directly by its base VC. TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissalByBaseVC) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -411,7 +413,7 @@ // Tests that the Infobar is dismissed before its presentation is completed. TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissalMidPresentation) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); // Call dismiss without calling WaitUntilConditionOrTimeout before. [base_view_controller_ dismissViewControllerAnimated:NO completion:nil]; @@ -428,7 +430,7 @@ // presentation is completed. TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissedClosingWebstate) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); // Close the Webstate without calling WaitUntilConditionOrTimeout. web_state_list_->CloseWebStateAt(0, 0); ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( @@ -442,7 +444,7 @@ // Tests that the Infobar is dismissed when both the VC and Webstate are closed. TEST_F(InfobarContainerCoordinatorTest, TestDismissingAndClosingWebstate) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -467,7 +469,7 @@ // and there's more than one webstate. TEST_F(InfobarContainerCoordinatorTest, TestDismissingAndClosingWebstateSecondWebstate) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); AddSecondWebstate(); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { @@ -492,7 +494,7 @@ // Tests that the ChildCoordinators are deleted once the Webstate is closed. TEST_F(InfobarContainerCoordinatorTest, TestInfobarChildCoordinatorCountWebstate) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { @@ -515,7 +517,7 @@ InfobarBannerPresentationState::NotPresented; })); - AddSecondInfobar(); + AddSecondInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -549,7 +551,7 @@ // Tests that the ChildCoordinators are deleted once they stop. TEST_F(InfobarContainerCoordinatorTest, TestInfobarChildCoordinatorCountStop) { - AddInfobar(); + AddInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { @@ -572,7 +574,7 @@ InfobarBannerPresentationState::NotPresented; })); - AddSecondInfobar(); + AddSecondInfobar(/*high_priority_presentation=*/false); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForUIElementTimeout, ^bool { return infobar_container_coordinator_.infobarBannerState == @@ -605,8 +607,8 @@ // Tests that that a second Infobar (added right after the first one) is // displayed after the first one has been dismissed. TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueAndDisplay) { - AddInfobar(); - AddSecondInfobar(); + AddInfobar(/*high_priority_presentation=*/false); + AddSecondInfobar(/*high_priority_presentation=*/false); ASSERT_EQ(NSUInteger(2), infobar_container_coordinator_.childCoordinators.count); @@ -639,12 +641,13 @@ } // Tests that Infobars added while the baseVC is not in window will be displayed -// once the baseVC moves to it. +// once the baseVC moves to it. Also tests that a non high-priority Infobar +// added after a high priority one will appear first. TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueAndDisplayWhenAppeared) { [scoped_key_window_.Get() setRootViewController:nil]; - AddInfobar(); - AddSecondInfobar(); + AddInfobar(/*high_priority_presentation=*/true); + AddSecondInfobar(/*high_priority_presentation=*/false); ASSERT_EQ(infobar_container_coordinator_.infobarBannerState, InfobarBannerPresentationState::NotPresented); @@ -684,8 +687,8 @@ // Tests that that a second Infobar (added right after the first one) is // not displayed if its destroyed before presentation. TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueStoppedNoDisplay) { - AddInfobar(); - AddSecondInfobar(); + AddInfobar(/*high_priority_presentation=*/false); + AddSecondInfobar(/*high_priority_presentation=*/false); ASSERT_EQ(NSUInteger(2), infobar_container_coordinator_.childCoordinators.count); @@ -712,5 +715,89 @@ infobar_container_coordinator_.childCoordinators.count); } +// Tests that a High Priority Presentation Infobar added after a non High +// Priority Presentation Infobar is presented first. +TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueuePriority) { + [scoped_key_window_.Get() setRootViewController:nil]; + AddInfobar(/*high_priority_presentation=*/false); + AddSecondInfobar(/*high_priority_presentation=*/true); + + ASSERT_EQ(infobar_container_coordinator_.infobarBannerState, + InfobarBannerPresentationState::NotPresented); + ASSERT_EQ(NSUInteger(2), + infobar_container_coordinator_.childCoordinators.count); + + [scoped_key_window_.Get() setRootViewController:base_view_controller_]; + + EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, ^bool { + return second_coordinator_.infobarBannerState == + InfobarBannerPresentationState::Presented; + })); + ASSERT_EQ(second_coordinator_.infobarBannerState, + InfobarBannerPresentationState::Presented); + + [infobar_container_coordinator_ dismissInfobarBannerAnimated:NO + completion:nil]; + ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, ^bool { + return second_coordinator_.infobarBannerState == + InfobarBannerPresentationState::NotPresented; + })); + + EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, ^bool { + return coordinator_.infobarBannerState == + InfobarBannerPresentationState::Presented; + })); + ASSERT_EQ(infobar_container_coordinator_.infobarBannerState, + InfobarBannerPresentationState::Presented); + + ASSERT_EQ(NSUInteger(2), + infobar_container_coordinator_.childCoordinators.count); +} + +// Tests that a High Priority Presentation Infobar added after a High +// Priority Presentation Infobar is presented first. +TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueHighPriority) { + [scoped_key_window_.Get() setRootViewController:nil]; + AddInfobar(/*high_priority_presentation=*/true); + AddSecondInfobar(/*high_priority_presentation=*/true); + + ASSERT_EQ(infobar_container_coordinator_.infobarBannerState, + InfobarBannerPresentationState::NotPresented); + ASSERT_EQ(NSUInteger(2), + infobar_container_coordinator_.childCoordinators.count); + + [scoped_key_window_.Get() setRootViewController:base_view_controller_]; + + EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, ^bool { + return second_coordinator_.infobarBannerState == + InfobarBannerPresentationState::Presented; + })); + ASSERT_EQ(second_coordinator_.infobarBannerState, + InfobarBannerPresentationState::Presented); + + [infobar_container_coordinator_ dismissInfobarBannerAnimated:NO + completion:nil]; + ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, ^bool { + return second_coordinator_.infobarBannerState == + InfobarBannerPresentationState::NotPresented; + })); + + EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, ^bool { + return coordinator_.infobarBannerState == + InfobarBannerPresentationState::Presented; + })); + ASSERT_EQ(infobar_container_coordinator_.infobarBannerState, + InfobarBannerPresentationState::Presented); + + ASSERT_EQ(NSUInteger(2), + infobar_container_coordinator_.childCoordinators.count); +} + // TODO(crbug.com/961343): Add tests that use a BadgedInfobar, in order to do // this a new TestInfoBarDelegate needs to be created.
diff --git a/ios/chrome/browser/ui/infobars/legacy_infobar_container_view_controller.mm b/ios/chrome/browser/ui/infobars/legacy_infobar_container_view_controller.mm index 93b76c9..65325ec 100644 --- a/ios/chrome/browser/ui/infobars/legacy_infobar_container_view_controller.mm +++ b/ios/chrome/browser/ui/infobars/legacy_infobar_container_view_controller.mm
@@ -23,7 +23,7 @@ @interface LegacyInfobarContainerViewController () <FullscreenUIElement> { // Observer that notifies this object of fullscreen events. - std::unique_ptr<FullscreenControllerObserver> _fullscreenObserver; + std::unique_ptr<FullscreenUIUpdater> _fullscreenUIUpdater; } // Whether the controller's view is currently available. @@ -61,16 +61,15 @@ [super viewDidAppear:animated]; self.visible = YES; - if (!_fullscreenObserver && !self.disableFullscreenSupport) { - _fullscreenObserver = std::make_unique<FullscreenUIUpdater>(self); - self.fullscreenController->AddObserver(_fullscreenObserver.get()); + if (!_fullscreenUIUpdater && !self.disableFullscreenSupport) { + _fullscreenUIUpdater = + std::make_unique<FullscreenUIUpdater>(self.fullscreenController, self); } } - (void)viewDidDisappear:(BOOL)animated { - if (_fullscreenObserver && !self.disableFullscreenSupport) { - self.fullscreenController->RemoveObserver(_fullscreenObserver.get()); - _fullscreenObserver = nullptr; + if (_fullscreenUIUpdater && !self.disableFullscreenSupport) { + _fullscreenUIUpdater = nullptr; } self.visible = NO;
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm index d0729d66..6f2a2c84 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm
@@ -79,9 +79,9 @@ // API endpoint for omnibox. std::unique_ptr<WebOmniboxEditControllerImpl> _editController; // Observer that updates |viewController| for fullscreen events. - std::unique_ptr<FullscreenControllerObserver> _fullscreenObserver; + std::unique_ptr<FullscreenUIUpdater> _omniboxFullscreenUIUpdater; // Observer that updates BadgeViewController for fullscreen events. - std::unique_ptr<FullscreenControllerObserver> _fullscreenBadgeObserver; + std::unique_ptr<FullscreenUIUpdater> _badgeFullscreenUIUpdater; } // Whether the coordinator is started. @property(nonatomic, assign, getter=isStarted) BOOL started; @@ -190,11 +190,10 @@ static_cast<id<InfobarCommands, BrowserCoordinatorCommands>>( self.dispatcher); buttonFactory.delegate = self.badgeMediator; - _fullscreenBadgeObserver = - std::make_unique<FullscreenUIUpdater>(self.badgeViewController); - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->AddObserver(_fullscreenBadgeObserver.get()); + FullscreenController* fullscreenController = + FullscreenControllerFactory::GetForBrowserState(self.browserState); + _badgeFullscreenUIUpdater = std::make_unique<FullscreenUIUpdater>( + fullscreenController, self.badgeViewController); self.mediator = [[LocationBarMediator alloc] initWithLocationBarModel:[self locationBarModel]]; @@ -205,11 +204,8 @@ ios::TemplateURLServiceFactory::GetForBrowserState(self.browserState); self.mediator.consumer = self; - _fullscreenObserver = - std::make_unique<FullscreenUIUpdater>(self.viewController); - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->AddObserver(_fullscreenObserver.get()); + _omniboxFullscreenUIUpdater = std::make_unique<FullscreenUIUpdater>( + fullscreenController, self.viewController); self.started = YES; } @@ -228,12 +224,8 @@ [self.mediator disconnect]; self.mediator = nil; - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->RemoveObserver(_fullscreenObserver.get()); - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->RemoveObserver(_fullscreenBadgeObserver.get()); + _badgeFullscreenUIUpdater = nullptr; + _omniboxFullscreenUIUpdater = nullptr; self.started = NO; }
diff --git a/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm index 23a1c1c..caec1211 100644 --- a/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm
@@ -35,7 +35,7 @@ @interface PrimaryToolbarCoordinator () <PrimaryToolbarViewControllerDelegate> { // Observer that updates |toolbarViewController| for fullscreen events. - std::unique_ptr<FullscreenControllerObserver> _fullscreenObserver; + std::unique_ptr<FullscreenUIUpdater> _fullscreenUIUpdater; } // Whether the coordinator is started. @@ -87,11 +87,9 @@ self.orchestrator.editViewAnimatee = [self.locationBarCoordinator editViewAnimatee]; - _fullscreenObserver = - std::make_unique<FullscreenUIUpdater>(self.viewController); - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->AddObserver(_fullscreenObserver.get()); + _fullscreenUIUpdater = std::make_unique<FullscreenUIUpdater>( + FullscreenControllerFactory::GetForBrowserState(self.browserState), + self.viewController); [super start]; self.started = YES; @@ -103,10 +101,7 @@ [super stop]; [self.commandDispatcher stopDispatchingToTarget:self]; [self.locationBarCoordinator stop]; - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->RemoveObserver(_fullscreenObserver.get()); - _fullscreenObserver = nullptr; + _fullscreenUIUpdater = nullptr; self.started = NO; }
diff --git a/ios/chrome/browser/ui/toolbar_container/toolbar_container_coordinator.mm b/ios/chrome/browser/ui/toolbar_container/toolbar_container_coordinator.mm index b2f796b..e68022f 100644 --- a/ios/chrome/browser/ui/toolbar_container/toolbar_container_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar_container/toolbar_container_coordinator.mm
@@ -18,7 +18,7 @@ @interface ToolbarContainerCoordinator () { // The updater for the container view controller. - std::unique_ptr<FullscreenUIUpdater> _fullscreenUpdater; + std::unique_ptr<FullscreenUIUpdater> _fullscreenUIUpdater; } // The container view controller. @property(nonatomic, strong) @@ -86,11 +86,9 @@ self.containerViewController.collapsesSafeArea = !isPrimary; [self startToolbarCoordinators]; // Start observing fullscreen events. - _fullscreenUpdater = - std::make_unique<FullscreenUIUpdater>(self.containerViewController); - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->AddObserver(_fullscreenUpdater.get()); + _fullscreenUIUpdater = std::make_unique<FullscreenUIUpdater>( + FullscreenControllerFactory::GetForBrowserState(self.browserState), + self.containerViewController); self.started = YES; } @@ -103,10 +101,7 @@ [self.containerViewController removeFromParentViewController]; self.containerViewController = nil; [self stopToolbarCoordinators]; - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(self.browserState) - ->RemoveObserver(_fullscreenUpdater.get()); - _fullscreenUpdater = nullptr; + _fullscreenUIUpdater = nullptr; self.started = NO; }
diff --git a/ios/chrome/browser/ui/ui_feature_flags.cc b/ios/chrome/browser/ui/ui_feature_flags.cc index fb2e174..882adc3 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.cc +++ b/ios/chrome/browser/ui/ui_feature_flags.cc
@@ -33,3 +33,6 @@ const base::Feature kOptionalArticleThumbnail{"OptionalArticleThumbnail", base::FEATURE_ENABLED_BY_DEFAULT}; + +const base::Feature kEmbedderBlockRestoreUrl{"EmbedderBlockRestoreUrl", + base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/ios/chrome/browser/ui/ui_feature_flags.h b/ios/chrome/browser/ui/ui_feature_flags.h index b90f8f6..28ce1cf 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.h +++ b/ios/chrome/browser/ui/ui_feature_flags.h
@@ -39,4 +39,7 @@ // Feature flag for the optional article thumbnail. extern const base::Feature kOptionalArticleThumbnail; +// Feature flag for embedders to block restore urls. +extern const base::Feature kEmbedderBlockRestoreUrl; + #endif // IOS_CHROME_BROWSER_UI_UI_FEATURE_FLAGS_H_
diff --git a/ios/chrome/browser/web/chrome_web_client.h b/ios/chrome/browser/web/chrome_web_client.h index 032509a..4adcd19 100644 --- a/ios/chrome/browser/web/chrome_web_client.h +++ b/ios/chrome/browser/web/chrome_web_client.h
@@ -27,6 +27,10 @@ void AddAdditionalSchemes(Schemes* schemes) const override; std::string GetApplicationLocale() const override; bool IsAppSpecificURL(const GURL& url) const override; + bool ShouldBlockUrlDuringRestore(const GURL& url, + web::WebState* web_state) const override; + void AddSerializableData(web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state) override; base::string16 GetPluginNotSupportedText() const override; std::string GetUserAgent(web::UserAgentType type) const override; base::string16 GetLocalizedString(int message_id) const override;
diff --git a/ios/chrome/browser/web/chrome_web_client.mm b/ios/chrome/browser/web/chrome_web_client.mm index 26482284..92196d9 100644 --- a/ios/chrome/browser/web/chrome_web_client.mm +++ b/ios/chrome/browser/web/chrome_web_client.mm
@@ -25,6 +25,7 @@ #import "ios/chrome/browser/ui/elements/windowed_container_view.h" #import "ios/chrome/browser/web/error_page_util.h" #include "ios/public/provider/chrome/browser/browser_url_rewriter_provider.h" +#import "ios/public/provider/chrome/browser/chrome_browser_provider.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" #include "ios/public/provider/chrome/browser/voice/audio_session_controller.h" #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" @@ -103,6 +104,20 @@ return url.SchemeIs(kChromeUIScheme); } +bool ChromeWebClient::ShouldBlockUrlDuringRestore( + const GURL& url, + web::WebState* web_state) const { + return ios::GetChromeBrowserProvider()->ShouldBlockUrlDuringRestore( + url, web_state); +} + +void ChromeWebClient::AddSerializableData( + web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state) { + return ios::GetChromeBrowserProvider()->AddSerializableData(user_data_manager, + web_state); +} + base::string16 ChromeWebClient::GetPluginNotSupportedText() const { return l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_SUPPORTED); }
diff --git a/ios/chrome/test/earl_grey/chrome_test_case.mm b/ios/chrome/test/earl_grey/chrome_test_case.mm index f261c1e..f9e0857 100644 --- a/ios/chrome/test/earl_grey/chrome_test_case.mm +++ b/ios/chrome/test/earl_grey/chrome_test_case.mm
@@ -24,6 +24,10 @@ namespace { +// This flag indicates whether +setUpForTestCase has been executed in a test +// case. +bool gExecutedSetUpForTestCase = false; + NSString* const kFlakyEarlGreyTestTargetSuffix = @"_flaky_egtests"; // Contains a list of test names that run in multitasking test suite. @@ -205,6 +209,7 @@ + (void)setUpForTestCase { [super setUpForTestCase]; [ChromeTestCase setUpHelper]; + gExecutedSetUpForTestCase = true; } #endif // CHROME_EARL_GREY_2 @@ -214,6 +219,7 @@ [[self class] disableMockAuthentication]; [[self class] stopHTTPServer]; [super tearDown]; + gExecutedSetUpForTestCase = false; } - (net::EmbeddedTestServer*)testServer { @@ -428,7 +434,12 @@ #pragma mark AppLaunchManagerObserver method - (void)appLaunchManagerDidRelaunchApp:(AppLaunchManager*)appLaunchManager { - [ChromeTestCase setUpHelper]; + // Do not call +[ChromeTestCase setUpHelper] if the app was relaunched before + // +setUpForTestCase. +setUpForTestCase will call +setUpHelper, and + // +setUpHelper can not be called twice during setup process. + if (gExecutedSetUpForTestCase) { + [ChromeTestCase setUpHelper]; + } [self resetAppState]; }
diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.h b/ios/public/provider/chrome/browser/chrome_browser_provider.h index ea17aed..6a31458 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.h +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.h
@@ -32,9 +32,11 @@ } namespace web { +class SerializableUserDataManager; class WebState; } +class GURL; @protocol LogoVendor; @class TabModel; @class UITextField; @@ -108,6 +110,13 @@ virtual std::string GetRiskData(); // Creates and returns a new styled text field. virtual UITextField* CreateStyledTextField() const NS_RETURNS_RETAINED; + // Allow embedders to inject data. + virtual void AddSerializableData( + web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state); + // Allow embedders to block a specific URL. + virtual bool ShouldBlockUrlDuringRestore(const GURL& url, + web::WebState* web_state); // Initializes the cast service. Should be called soon after the given // |main_tab_model| is created.
diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.mm b/ios/public/provider/chrome/browser/chrome_browser_provider.mm index c46a0a75..6073e52 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.mm +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.mm
@@ -68,6 +68,16 @@ return std::string(); } +void ChromeBrowserProvider::AddSerializableData( + web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state) {} + +bool ChromeBrowserProvider::ShouldBlockUrlDuringRestore( + const GURL& url, + web::WebState* web_state) { + return false; +} + UITextField* ChromeBrowserProvider::CreateStyledTextField() const { return nil; }
diff --git a/ios/third_party/webkit/BUILD.gn b/ios/third_party/webkit/BUILD.gn index c6fbbd5..0b3b89c8 100644 --- a/ios/third_party/webkit/BUILD.gn +++ b/ios/third_party/webkit/BUILD.gn
@@ -5,19 +5,30 @@ import("//build/config/gclient_args.gni") import("//build/config/ios/ios_sdk.gni") +# Using a locally-built WebKit is only supported for Debug simulator builds. +_build_custom_webkit = checkout_ios_webkit && is_debug && use_ios_simulator + group("webkit") { - if (checkout_ios_webkit) { + if (_build_custom_webkit) { deps = [ - ":compile_webkit", + ":bundle_webkit_frameworks", ] } all_dependent_configs = [ ":_webkit_config" ] } -if (checkout_ios_webkit) { +if (_build_custom_webkit) { + # WebKit is built from source using xcodebuild (invoked via the + # build_webkit.py wrapper script). The WebKit build places its frameworks in + # a sub-directory named "Debug-iphonesimulator". + _webkit_xcodebuild_out_dir = "Debug-iphonesimulator" + action("compile_webkit") { - visibility = [ ":webkit" ] + visibility = [ + ":bundle_webkit_frameworks", + ":webkit", + ] script = "build_webkit.py" @@ -41,13 +52,18 @@ "src/WebKitLibraries/ChangeLog", ] + _framework_out_dir = "$target_out_dir/$_webkit_xcodebuild_out_dir" outputs = [ # The frameworks themselves include many resource files, but as a first # step, use just the binaries. - "$target_out_dir/Debug-iphonesimulator/JavaScriptCore.framework/JavaScriptCore", - "$target_out_dir/Debug-iphonesimulator/WebCore.framework/WebCore", - "$target_out_dir/Debug-iphonesimulator/WebKit.framework/WebKit", - "$target_out_dir/Debug-iphonesimulator/WebKitLegacy.framework/WebKitLegacy", + "$_framework_out_dir/JavaScriptCore.framework", + "$_framework_out_dir/JavaScriptCore.framework/JavaScriptCore", + "$_framework_out_dir/WebCore.framework", + "$_framework_out_dir/WebCore.framework/WebCore", + "$_framework_out_dir/WebKit.framework", + "$_framework_out_dir/WebKit.framework/WebKit", + "$_framework_out_dir/WebKitLegacy.framework", + "$_framework_out_dir/WebKitLegacy.framework/WebKitLegacy", ] # TODO(crbug.com/934252): "-j 4" restricts xcodebuild to four simultaneous @@ -63,16 +79,34 @@ "-quiet", ] } + + bundle_data("bundle_webkit_frameworks") { + public_deps = [ + ":compile_webkit", + ] + + _framework_out_dir = "$target_out_dir/$_webkit_xcodebuild_out_dir" + sources = [ + "$_framework_out_dir/JavaScriptCore.framework", + "$_framework_out_dir/WebCore.framework", + "$_framework_out_dir/WebKit.framework", + "$_framework_out_dir/WebKitLegacy.framework", + ] + outputs = [ + "{{bundle_contents_dir}}/WebKitFrameworks/{{source_file_part}}", + ] + } } config("_webkit_config") { - if (checkout_ios_webkit) { + if (_build_custom_webkit) { # From the ld documentation: "Directories specified with -F are searched in # the order they appear on the command line and before the default search # path." + _framework_out_dir = "$target_out_dir/$_webkit_xcodebuild_out_dir" common_flags = [ "-F", - rebase_path("$target_out_dir/Debug-iphonesimulator/", root_build_dir), + rebase_path("$_framework_out_dir/", root_build_dir), ] cflags = common_flags
diff --git a/ios/web/navigation/legacy_navigation_manager_impl.h b/ios/web/navigation/legacy_navigation_manager_impl.h index a6df61a..f3fa50d 100644 --- a/ios/web/navigation/legacy_navigation_manager_impl.h +++ b/ios/web/navigation/legacy_navigation_manager_impl.h
@@ -57,6 +57,7 @@ NSString* state_object, ui::PageTransition transition) override; bool IsRestoreSessionInProgress() const override; + bool ShouldBlockUrlDuringRestore(const GURL& url) override; void SetPendingItemIndex(int index) override; // NavigationManager:
diff --git a/ios/web/navigation/legacy_navigation_manager_impl.mm b/ios/web/navigation/legacy_navigation_manager_impl.mm index 16caac2..558230e 100644 --- a/ios/web/navigation/legacy_navigation_manager_impl.mm +++ b/ios/web/navigation/legacy_navigation_manager_impl.mm
@@ -357,6 +357,10 @@ return false; // Session restoration is synchronous. } +bool LegacyNavigationManagerImpl::ShouldBlockUrlDuringRestore(const GURL& url) { + return false; +} + void LegacyNavigationManagerImpl::SetPendingItemIndex(int index) { session_controller_.pendingItemIndex = index; }
diff --git a/ios/web/navigation/navigation_manager_impl.h b/ios/web/navigation/navigation_manager_impl.h index d9ea158b..3dcb36a 100644 --- a/ios/web/navigation/navigation_manager_impl.h +++ b/ios/web/navigation/navigation_manager_impl.h
@@ -174,6 +174,9 @@ // matches |url|. Applies the workaround for crbug.com/997182 virtual void SetWKWebViewNextPendingUrlNotSerializable(const GURL& url); + // Returns true if specific URL is blocked from session restore. + virtual bool ShouldBlockUrlDuringRestore(const GURL& url) = 0; + // Resets the transient url rewriter list. void RemoveTransientURLRewriters();
diff --git a/ios/web/navigation/session_storage_builder.mm b/ios/web/navigation/session_storage_builder.mm index 048b3c3..6b1a773 100644 --- a/ios/web/navigation/session_storage_builder.mm +++ b/ios/web/navigation/session_storage_builder.mm
@@ -14,6 +14,7 @@ #include "ios/web/navigation/navigation_manager_impl.h" #import "ios/web/public/session/crw_session_storage.h" #import "ios/web/public/session/serializable_user_data_manager.h" +#import "ios/web/public/web_client.h" #import "ios/web/session/session_certificate_policy_cache_impl.h" #include "ios/web/session/session_certificate_policy_cache_storage_builder.h" #import "ios/web/web_state/web_state_impl.h" @@ -68,6 +69,10 @@ web::SerializableUserDataManager::FromWebState(web_state); [session_storage setSerializableUserData:user_data_manager->CreateSerializableUserData()]; + if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { + web::GetWebClient()->AddSerializableData(user_data_manager, web_state); + } + return session_storage; }
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.h b/ios/web/navigation/wk_based_navigation_manager_impl.h index daba362..f14efd45 100644 --- a/ios/web/navigation/wk_based_navigation_manager_impl.h +++ b/ios/web/navigation/wk_based_navigation_manager_impl.h
@@ -116,6 +116,7 @@ NSString* state_object, ui::PageTransition transition) override; bool IsRestoreSessionInProgress() const override; + bool ShouldBlockUrlDuringRestore(const GURL& url) override; void SetPendingItemIndex(int index) override; void ApplyWKWebViewForwardHistoryClobberWorkaround() override; void SetWKWebViewNextPendingUrlNotSerializable(const GURL& url) override; @@ -249,6 +250,10 @@ bool CanTrustLastCommittedItem( const NavigationItem* last_committed_item) const; + // Update state to reflect session restore is complete, and call any post + // restore callbacks. + void FinalizeSessionRestore(); + // The pending main frame navigation item. This is nullptr if there is no // pending item or if the pending item is a back-forward navigation, in which // case the NavigationItemImpl is stored on the WKBackForwardListItem. @@ -292,8 +297,8 @@ WKWebViewCache web_view_cache_; // Whether this navigation manager is in the process of restoring session - // history into WKWebView. It is set in Restore() and unset in the first - // OnNavigationItemCommitted() callback. + // history into WKWebView. It is set in Restore() and unset in + // FinalizeSessionRestore(). bool is_restore_session_in_progress_ = false; // Set to true when delegate_->GoToBackForwardListItem is being called, which @@ -318,8 +323,8 @@ std::unique_ptr<NavigationItem> restored_visible_item_; // Non-empty only during the session restoration. The callbacks are - // registered in AddRestoreCompletionCallback() and are executed in the first - // OnNavigationItemCommitted() callback. + // registered in AddRestoreCompletionCallback() and are executed in + // FinalizeSessionRestore(). std::vector<base::OnceClosure> restore_session_completion_callbacks_; DISALLOW_COPY_AND_ASSIGN(WKBasedNavigationManagerImpl);
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.mm b/ios/web/navigation/wk_based_navigation_manager_impl.mm index 10dc540..6916d92 100644 --- a/ios/web/navigation/wk_based_navigation_manager_impl.mm +++ b/ios/web/navigation/wk_based_navigation_manager_impl.mm
@@ -107,7 +107,6 @@ !web::wk_navigation_util::ExtractTargetURL(url, &target_url)) { restoration_timer_ = std::make_unique<base::ElapsedTimer>(); } else if (!wk_navigation_util::IsRestoreSessionUrl(url)) { - is_restore_session_in_progress_ = false; // It's possible for there to be pending navigations for a session that is // going to be restored (such as for the -ForwardHistoryClobber workaround). // In this case, the pending navigation will start while the navigation @@ -121,16 +120,19 @@ restoration_timer_->Elapsed()); restoration_timer_.reset(); } - - for (base::OnceClosure& callback : restore_session_completion_callbacks_) { - std::move(callback).Run(); - } - restore_session_completion_callbacks_.clear(); - - LoadIfNecessary(); + FinalizeSessionRestore(); } } +void WKBasedNavigationManagerImpl::FinalizeSessionRestore() { + is_restore_session_in_progress_ = false; + for (base::OnceClosure& callback : restore_session_completion_callbacks_) { + std::move(callback).Run(); + } + restore_session_completion_callbacks_.clear(); + LoadIfNecessary(); +} + CRWSessionController* WKBasedNavigationManagerImpl::GetSessionController() const { return nil; @@ -423,6 +425,20 @@ return is_restore_session_in_progress_; } +bool WKBasedNavigationManagerImpl::ShouldBlockUrlDuringRestore( + const GURL& url) { + DCHECK(is_restore_session_in_progress_); + if (!web::GetWebClient()->ShouldBlockUrlDuringRestore(url, GetWebState())) + return false; + + // Abort restore. + DiscardNonCommittedItems(); + last_committed_item_index_ = web_view_cache_.GetCurrentItemIndex(); + restored_visible_item_.reset(); + FinalizeSessionRestore(); + return true; +} + void WKBasedNavigationManagerImpl::SetPendingItemIndex(int index) { pending_item_index_ = index; }
diff --git a/ios/web/public/test/fakes/test_web_client.h b/ios/web/public/test/fakes/test_web_client.h index 5fc000a4..8e17c38a1 100644 --- a/ios/web/public/test/fakes/test_web_client.h +++ b/ios/web/public/test/fakes/test_web_client.h
@@ -29,6 +29,12 @@ // Returns true for kTestWebUIScheme and kTestNativeContentScheme URL schemes. bool IsAppSpecificURL(const GURL& url) const override; + bool ShouldBlockUrlDuringRestore(const GURL& url, + WebState* web_state) const override; + + void AddSerializableData(web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state) override; + std::string GetUserAgent(UserAgentType type) const override; // Returns |plugin_not_supported_text_| as the text to be displayed for an
diff --git a/ios/web/public/test/fakes/test_web_client.mm b/ios/web/public/test/fakes/test_web_client.mm index 8bc7440..97f2eb3 100644 --- a/ios/web/public/test/fakes/test_web_client.mm +++ b/ios/web/public/test/fakes/test_web_client.mm
@@ -38,6 +38,15 @@ url.SchemeIs(kTestAppSpecificScheme); } +bool TestWebClient::ShouldBlockUrlDuringRestore(const GURL& url, + WebState* web_state) const { + return false; +} + +void TestWebClient::AddSerializableData( + web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state) {} + base::string16 TestWebClient::GetPluginNotSupportedText() const { return plugin_not_supported_text_; }
diff --git a/ios/web/public/web_client.h b/ios/web/public/web_client.h index f0e082a0..f3f870c 100644 --- a/ios/web/public/web_client.h +++ b/ios/web/public/web_client.h
@@ -38,6 +38,7 @@ class BrowserState; class BrowserURLRewriter; +class SerializableUserDataManager; class WebClient; class WebMainParts; class WebState; @@ -85,6 +86,14 @@ // browser would return true for "chrome://about" URL. virtual bool IsAppSpecificURL(const GURL& url) const; + // Returns true if URL should not be restored. + virtual bool ShouldBlockUrlDuringRestore(const GURL& url, + WebState* web_state) const; + + // Allow embedder to inject data. + virtual void AddSerializableData( + web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state); // Returns text to be displayed for an unsupported plugin. virtual base::string16 GetPluginNotSupportedText() const;
diff --git a/ios/web/web_client.mm b/ios/web/web_client.mm index 51ee3a4..dfea745 100644 --- a/ios/web/web_client.mm +++ b/ios/web/web_client.mm
@@ -44,6 +44,15 @@ return false; } +bool WebClient::ShouldBlockUrlDuringRestore(const GURL& url, + WebState* web_state) const { + return false; +} + +void WebClient::AddSerializableData( + web::SerializableUserDataManager* user_data_manager, + web::WebState* web_state) {} + base::string16 WebClient::GetPluginNotSupportedText() const { return base::string16(); }
diff --git a/ios/web/web_state/js/context_menu_js_unittest.mm b/ios/web/web_state/js/context_menu_js_unittest.mm index ac562f3..d0e6d50d 100644 --- a/ios/web/web_state/js/context_menu_js_unittest.mm +++ b/ios/web/web_state/js/context_menu_js_unittest.mm
@@ -54,12 +54,21 @@ // A point in the web view's coordinate space on the link returned by // |GetHtmlForLink()|. const CGPoint kPointOnLink = {5.0, 2.0}; + // A point in the web view's coordinate space on the image returned by // |GetHtmlForImage()|. const CGPoint kPointOnImage = {50.0, 10.0}; // A point in the web view's coordinate space within the document bounds but not // on the image returned by |GetHtmlForImage()|. const CGPoint kPointOutsideImage = {50.0, 75.0}; + +// A point in the web view's coordinate space on the svg link returned by +// |GetHtmlForSvgLink()| and |GetHtmlForSvgXlink()|. +const CGPoint kPointOnSvgLink = {50.0, 75.0}; +// A point in the web view's coordinate space within the svg element but not +// on the svg link returned by |GetHtmlForSvgLink()| and |GetHtmlForSvgXlink()|. +const CGPoint kPointOutsideSvgLink = {50.0, 10.0}; + // A point in the web view's coordinate space outside of the document bounds. const CGPoint kPointOutsideDocument = {150.0, 150.0}; @@ -96,6 +105,23 @@ stringWithFormat:@"<a %@href=\"%@\">%@</a>", style_attribute, href, text]; } +// Returns HTML for an SVG shape which links to |href|. +NSString* GetHtmlForSvgLink(NSString* href) { + NSString* svg_shape = @"<rect y=\"50\" width=\"100\" height=\"50\"/>"; + return [NSString + stringWithFormat: + @"<svg width=\"100\" height=\"100\"><a href=\"%@\">%@</a></svg>", + href, svg_shape]; +} + +// Returns HTML for an SVG shape which links to |href| with an xlink:href. +NSString* GetHtmlForSvgXlink(NSString* href) { + NSString* svg_shape = @"<rect y=\"50\" width=\"100\" height=\"50\"/>"; + return [NSString stringWithFormat:@"<svg width=\"100\" height=\"100\"><a " + @"xlink:href=\"%@\">%@</a></svg>", + href, svg_shape]; +} + // Returns HTML for a link to |href| and display text |text|. NSString* GetHtmlForLink(NSString* href, NSString* text) { return GetHtmlForLink(href, text, /*style=*/nil); @@ -432,6 +458,52 @@ EXPECT_NSEQ(expected_result, result); } +#pragma mark - SVG shape links + +// Tests that an SVG shape link returns details for the link. +TEST_F(ContextMenuJsFindElementAtPointTest, FindSvgLinkAtPoint) { + NSString* const link = @"file:///linky"; + NSString* html = GetHtmlForPage(/*head=*/nil, GetHtmlForSvgLink(link)); + ASSERT_TRUE(web::test::LoadHtml(web_view_, html, GetTestURL())); + + id result = FindElementAtPoint(kPointOnSvgLink); + NSDictionary* expected_value = @{ + kContextMenuElementRequestId : kRequestId, + kContextMenuElementReferrerPolicy : @"default", + kContextMenuElementHyperlink : link, + }; + EXPECT_NSEQ(expected_value, result); +} + +// Tests that an SVG shape xlink returns details for the link. +TEST_F(ContextMenuJsFindElementAtPointTest, FindSvgXlinkAtPoint) { + NSString* const link = @"file:///linky"; + NSString* html = GetHtmlForPage(/*head=*/nil, GetHtmlForSvgXlink(link)); + ASSERT_TRUE(web::test::LoadHtml(web_view_, html, GetTestURL())); + + id result = FindElementAtPoint(kPointOnSvgLink); + NSDictionary* expected_value = @{ + kContextMenuElementRequestId : kRequestId, + kContextMenuElementReferrerPolicy : @"default", + kContextMenuElementHyperlink : link, + }; + EXPECT_NSEQ(expected_value, result); +} + +// Tests that a point within an SVG element but outside a linked shape does not +// return details for the link. +TEST_F(ContextMenuJsFindElementAtPointTest, FindSvgLinkAtPointOutsideElement) { + NSString* const link = @"file:///linky"; + NSString* html = GetHtmlForPage(/*head=*/nil, GetHtmlForSvgXlink(link)); + ASSERT_TRUE(web::test::LoadHtml(web_view_, html, GetTestURL())); + + id result = FindElementAtPoint(kPointOutsideSvgLink); + NSDictionary* expected_value = @{ + kContextMenuElementRequestId : kRequestId, + }; + EXPECT_NSEQ(expected_value, result); +} + #pragma mark - // Tests that a text input field prevents returning details for an image behind
diff --git a/ios/web/web_state/js/resources/all_frames_context_menu.js b/ios/web/web_state/js/resources/all_frames_context_menu.js index 64bc859..14faaad 100644 --- a/ios/web/web_state/js/resources/all_frames_context_menu.js +++ b/ios/web/web_state/js/resources/all_frames_context_menu.js
@@ -26,7 +26,7 @@ */ var getResponseForLinkElement = function(element) { return { - href: element.href, + href: getElementHref_(element), referrerPolicy: getReferrerPolicy_(element), innerText: element.innerText }; @@ -329,6 +329,21 @@ return 'default'; }; + /** + * Returns the href of the given element. Handles standard <a> links as well as + * xlink:href links as used within <svg> tags. + * @param {HTMLElement} element The link triggering the navigation. + * @return {string} The href of the given element. + * @private + */ +var getElementHref_ = function(element) { + var href = element.href; + if (href instanceof SVGAnimatedString) { + return href.animVal + } + return href +}; + /** * Processes context menu messages received by the window. */
diff --git a/ios/web/web_state/ui/crw_web_request_controller.mm b/ios/web/web_state/ui/crw_web_request_controller.mm index f805fc18..ba754fc 100644 --- a/ios/web/web_state/ui/crw_web_request_controller.mm +++ b/ios/web/web_state/ui/crw_web_request_controller.mm
@@ -682,6 +682,10 @@ if (web::GetWebClient()->IsSlimNavigationManagerEnabled() && self.navigationManagerImpl->IsRestoreSessionInProgress()) { + if (self.navigationManagerImpl->ShouldBlockUrlDuringRestore( + navigationURL)) { + return; + } [_delegate webRequestControllerDisableNavigationGesturesUntilFinishNavigation: self];
diff --git a/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm b/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm index 10c4447..6800c1f 100644 --- a/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm +++ b/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm
@@ -38,6 +38,12 @@ // syncer::DeviceInfoSyncClient: bool GetSendTabToSelfReceivingEnabled() const override { return false; } + // syncer::DeviceInfoSyncClient: + base::Optional<syncer::DeviceInfo::SharingInfo> GetLocalSharingInfo() + const override { + return base::nullopt; + } + private: PrefService* const prefs_; };
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/MojoTestRule.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/MojoTestRule.java index 471a54a..58296a6c 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/MojoTestRule.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/MojoTestRule.java
@@ -40,7 +40,7 @@ } @Override - protected void before() throws Throwable { + protected void before() { LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); if (mShouldInitCore && !sIsCoreInitialized) { nativeInitCore();
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ConnectorTest.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ConnectorTest.java index 851998b1..e940bf2 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ConnectorTest.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ConnectorTest.java
@@ -48,7 +48,7 @@ * @see MojoTestCase#setUp() */ @Before - public void setUp() throws Exception { + public void setUp() { Core core = CoreImpl.getInstance(); Pair<MessagePipeHandle, MessagePipeHandle> handles = core.createMessagePipe(new MessagePipeHandle.CreateOptions()); @@ -68,7 +68,7 @@ * @see MojoTestCase#tearDown() */ @After - public void tearDown() throws Exception { + public void tearDown() { mConnector.close(); mHandle.close(); }
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ExecutorFactoryTest.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ExecutorFactoryTest.java index c6f2b30..8fed646d 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ExecutorFactoryTest.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ExecutorFactoryTest.java
@@ -43,7 +43,7 @@ * @see MojoTestCase#setUp() */ @Before - public void setUp() throws Exception { + public void setUp() { mExecutor = ExecutorFactory.getExecutorForCurrentThread(CoreImpl.getInstance()); mThreadContainer = new ArrayList<Thread>(); }
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ReadAndDispatchMessageTest.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ReadAndDispatchMessageTest.java index 90e763b1..7e2c40a 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ReadAndDispatchMessageTest.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/ReadAndDispatchMessageTest.java
@@ -50,7 +50,7 @@ * @see org.chromium.mojo.MojoTestCase#setUp() */ @Before - public void setUp() throws Exception { + public void setUp() { Core core = CoreImpl.getInstance(); mData = BindingsTestUtils.newRandomMessage(DATA_SIZE).getData(); mMessageReceiver = new RecordingMessageReceiver(); @@ -65,7 +65,7 @@ * @see org.chromium.mojo.MojoTestCase#tearDown() */ @After - public void tearDown() throws Exception { + public void tearDown() { for (Handle handle : mHandlesToClose) { handle.close(); }
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/RouterTest.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/RouterTest.java index edc426f..06f2562 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/RouterTest.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/bindings/RouterTest.java
@@ -45,7 +45,7 @@ * @see MojoTestCase#setUp() */ @Before - public void setUp() throws Exception { + public void setUp() { Core core = CoreImpl.getInstance(); Pair<MessagePipeHandle, MessagePipeHandle> handles = core.createMessagePipe(null); mHandle = handles.first;
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java index 92c42daf..da1e1093 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
@@ -57,7 +57,7 @@ * @see MojoTestCase#tearDown() */ @After - public void tearDown() throws Exception { + public void tearDown() { MojoException toThrow = null; for (Handle handle : mHandlesToClose) { try {
diff --git a/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java b/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java index 176c138..57ae90f9 100644 --- a/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java +++ b/mojo/public/java/system/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java
@@ -45,7 +45,7 @@ * @see MojoTestCase#setUp() */ @Before - public void setUp() throws Exception { + public void setUp() { mWatcher = new WatcherImpl(); mCore = CoreImpl.getInstance(); } @@ -54,7 +54,7 @@ * @see MojoTestCase#tearDown() */ @After - public void tearDown() throws Exception { + public void tearDown() { mWatcher.destroy(); MojoException toThrow = null; for (Handle handle : mHandlesToClose) {
diff --git a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java index b717fe6a..3bb9d3f 100644 --- a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java +++ b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
@@ -915,7 +915,13 @@ */ public void register() { assertOnThread(); - if (mRegistered) return; + if (mRegistered) { + // Even when registered previously, Android may not send callbacks about change of + // network state when the device screen is turned on from off. Get the most up-to-date + // network state. See https://crbug.com/1007998 for more details. + connectionTypeChanged(); + return; + } if (mShouldSignalObserver) { connectionTypeChanged();
diff --git a/net/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java b/net/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java index aefce5b..5523373 100644 --- a/net/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java +++ b/net/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java
@@ -16,7 +16,7 @@ * Helper for tests that simulates an app controlling cleartext traffic on M and newer. */ @CalledByNative - public static void setUpSecurityPolicyForTesting(boolean cleartextPermitted) throws Exception { + public static void setUpSecurityPolicyForTesting(boolean cleartextPermitted) { sDefaultCleartextCheckCount = 0; sPerHostCleartextCheckCount = 0; AndroidNetworkLibrary.NetworkSecurityPolicyProxy.setInstanceForTesting(
diff --git a/net/android/javatests/src/org/chromium/net/NetErrorsTest.java b/net/android/javatests/src/org/chromium/net/NetErrorsTest.java index 48e3c3e3..dd59cad4 100644 --- a/net/android/javatests/src/org/chromium/net/NetErrorsTest.java +++ b/net/android/javatests/src/org/chromium/net/NetErrorsTest.java
@@ -26,12 +26,11 @@ /** * Test whether we can include NetError.java and call to static integers defined in the file. * - * @throws Exception */ @Test @SmallTest @Feature({"Android-AppBase"}) - public void testExampleErrorDefined() throws Exception { + public void testExampleErrorDefined() { Assert.assertEquals(IO_PENDING_ERROR, NetError.ERR_IO_PENDING); Assert.assertEquals(FAILED_ERROR, NetError.ERR_FAILED); }
diff --git a/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java b/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java index 811e566e..ba56c39 100644 --- a/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java +++ b/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
@@ -827,7 +827,7 @@ @UiThreadTest @MediumTest @Feature({"Android-AppBase"}) - public void testQueryableAPIsReturnExpectedValuesFromMockDelegate() throws Exception { + public void testQueryableAPIsReturnExpectedValuesFromMockDelegate() { NetworkChangeNotifierAutoDetect.Observer observer = new TestNetworkChangeNotifierAutoDetectObserver(); @@ -1031,7 +1031,7 @@ @MediumTest @Feature({"Android-AppBase"}) @MinAndroidSdkLevel(Build.VERSION_CODES.M) - public void testIsProcessBoundToNetwork() throws Exception { + public void testIsProcessBoundToNetwork() { ConnectivityManager connectivityManager = (ConnectivityManager) InstrumentationRegistry.getTargetContext().getSystemService( Context.CONNECTIVITY_SERVICE);
diff --git a/net/disk_cache/blockfile/sparse_control.cc b/net/disk_cache/blockfile/sparse_control.cc index cdde574..a914ac0da 100644 --- a/net/disk_cache/blockfile/sparse_control.cc +++ b/net/disk_cache/blockfile/sparse_control.cc
@@ -43,6 +43,10 @@ // The maximum number of bytes that a child can store. const int kMaxEntrySize = 0x100000; +// How much we can address. 8 KiB bitmap (kMaxMapSize above) gives us offsets +// up to 64 GiB. +const int64_t kMaxEndOffset = 8ll * kMaxMapSize * kMaxEntrySize; + // The size of each data block (tracked by the child allocation bitmap). const int kBlockSize = 1024; @@ -264,12 +268,38 @@ if (offset < 0 || buf_len < 0) return net::ERR_INVALID_ARGUMENT; - // We only support up to 64 GB. - if (static_cast<uint64_t>(offset) + static_cast<unsigned int>(buf_len) >= - UINT64_C(0x1000000000)) { - return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; + int64_t end_offset = 0; // non-inclusive. + if (!base::CheckAdd(offset, buf_len).AssignIfValid(&end_offset)) { + // Writes aren't permitted to try to cross the end of address space; + // read/GetAvailableRange clip. + if (op == kWriteOperation) + return net::ERR_INVALID_ARGUMENT; + else + end_offset = std::numeric_limits<int64_t>::max(); } + if (offset >= kMaxEndOffset) { + // Interval is within valid offset space, but completely outside backend + // supported range. Permit GetAvailableRange to say "nothing here", actual + // I/O fails. + if (op == kGetRangeOperation) + return 0; + else + return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; + } + + if (end_offset > kMaxEndOffset) { + // Interval is partially what the backend can handle. Fail writes, clip + // reads. + if (op == kWriteOperation) + return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; + else + end_offset = kMaxEndOffset; + } + + DCHECK_GE(end_offset, offset); + buf_len = end_offset - offset; + DCHECK(!user_buf_.get()); DCHECK(user_callback_.is_null()); @@ -420,7 +450,7 @@ if (!(PARENT_ENTRY & entry_->GetEntryFlags())) return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; - // Dont't go over board with the bitmap. 8 KB gives us offsets up to 64 GB. + // Don't go over board with the bitmap. int map_len = data_len - sizeof(sparse_header_); if (map_len > kMaxMapSize || map_len % 4) return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index 045fcb32..d92587d 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc
@@ -83,7 +83,7 @@ void DoomSparseEntry(); void PartialSparseEntry(); void SparseInvalidArg(); - void SparseClipEnd(bool expected_unsupported); + void SparseClipEnd(int64_t max_index, bool expected_unsupported); bool SimpleCacheMakeBadChecksumEntry(const std::string& key, int data_size); bool SimpleCacheThirdStreamFileExists(const char* key); void SyncDoomEntry(const char* key); @@ -2461,7 +2461,8 @@ SparseInvalidArg(); } -void DiskCacheEntryTest::SparseClipEnd(bool expect_unsupported) { +void DiskCacheEntryTest::SparseClipEnd(int64_t max_index, + bool expect_unsupported) { std::string key("key"); disk_cache::Entry* entry = nullptr; ASSERT_THAT(CreateEntry(key, &entry), IsOk()); @@ -2474,7 +2475,7 @@ base::MakeRefCounted<net::IOBuffer>(kSize * 2); CacheTestFillBuffer(read_buf->data(), kSize * 2, false); - const int64_t kOffset = std::numeric_limits<int64_t>::max() - kSize; + const int64_t kOffset = max_index - kSize; int rv = WriteSparseData(entry, kOffset, buf.get(), kSize); EXPECT_EQ( rv, expect_unsupported ? net::ERR_CACHE_OPERATION_NOT_SUPPORTED : kSize); @@ -2494,7 +2495,8 @@ cb.callback()); rv = cb.GetResult(rv); if (expect_unsupported) { - EXPECT_EQ(rv, net::ERR_CACHE_OPERATION_NOT_SUPPORTED); + // GetAvailableRange just returns nothing found, not an error. + EXPECT_EQ(rv, 0); } else { EXPECT_EQ(kSize, rv); EXPECT_EQ(kOffset, out_start); @@ -2507,19 +2509,57 @@ InitCache(); // Blockfile refuses to deal with sparse indices over 64GiB. - SparseClipEnd(/* expect_unsupported = */ true); + SparseClipEnd(std::numeric_limits<int64_t>::max(), + /* expect_unsupported = */ true); +} + +TEST_F(DiskCacheEntryTest, SparseClipEnd2) { + InitCache(); + + const int64_t kLimit = 64ll * 1024 * 1024 * 1024; + // Separate test for blockfile for indices right at the edge of its address + // space limit. kLimit must match kMaxEndOffset in sparse_control.cc + SparseClipEnd(kLimit, /* expect_unsupported = */ false); + + // Test with things after kLimit, too, which isn't an issue for backends + // supporting the entire 64-bit offset range. + std::string key("key2"); + disk_cache::Entry* entry = nullptr; + ASSERT_THAT(CreateEntry(key, &entry), IsOk()); + + const int kSize = 1024; + scoped_refptr<net::IOBuffer> buf = base::MakeRefCounted<net::IOBuffer>(kSize); + CacheTestFillBuffer(buf->data(), kSize, false); + + // Try to write after --- fails. + int rv = WriteSparseData(entry, kLimit, buf.get(), kSize); + EXPECT_EQ(net::ERR_CACHE_OPERATION_NOT_SUPPORTED, rv); + + // Similarly for read. + rv = ReadSparseData(entry, kLimit, buf.get(), kSize); + EXPECT_EQ(net::ERR_CACHE_OPERATION_NOT_SUPPORTED, rv); + + // GetAvailableRange just returns nothing. + net::TestCompletionCallback cb; + int64_t out_start = 0; + rv = entry->GetAvailableRange(kLimit, kSize * 3, &out_start, cb.callback()); + rv = cb.GetResult(rv); + EXPECT_EQ(rv, 0); + entry->Close(); } TEST_F(DiskCacheEntryTest, MemoryOnlySparseClipEnd) { SetMemoryOnlyMode(); InitCache(); - SparseClipEnd(/* expect_unsupported = */ false); + SparseClipEnd(std::numeric_limits<int64_t>::max(), + /* expect_unsupported = */ false); } TEST_F(DiskCacheEntryTest, SimpleSparseClipEnd) { SetSimpleCacheMode(); InitCache(); - SparseClipEnd(/* expect_unsupported = */ false); + SparseClipEnd(std::numeric_limits<int64_t>::max(), + /* expect_unsupported = */ false); } // Tests that corrupt sparse children are removed automatically. @@ -5356,7 +5396,7 @@ void DiskCacheEntryTest::SparseOffset64Bit() { // Offsets to sparse ops are 64-bit, make sure we keep track of all of them. // (Or, as at least in case of blockfile, fail things cleanly, as it has a - // cap of 64GiB for indexes). + // cap on max offset that's much lower). bool blockfile = !memory_only_ && !simple_cache_mode_; InitCache(); @@ -5382,7 +5422,7 @@ EXPECT_EQ(0, GetAvailableRange(entry, /* offset = */ 0, kSize, &start_out)); start_out = -1; - EXPECT_EQ(blockfile ? net::ERR_CACHE_OPERATION_NOT_SUPPORTED : kSize, + EXPECT_EQ(blockfile ? 0 : kSize, GetAvailableRange(entry, kOffset, kSize, &start_out)); EXPECT_EQ(kOffset, start_out);
diff --git a/net/dns/host_resolver.cc b/net/dns/host_resolver.cc index 2f00bd5..9ad065c 100644 --- a/net/dns/host_resolver.cc +++ b/net/dns/host_resolver.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "net/base/address_list.h" @@ -23,6 +24,49 @@ namespace net { +namespace { + +class FailingRequestImpl : public HostResolver::ResolveHostRequest { + public: + explicit FailingRequestImpl(int error) : error_(error) {} + ~FailingRequestImpl() override = default; + + int Start(CompletionOnceCallback callback) override { return error_; } + + const base::Optional<AddressList>& GetAddressResults() const override { + static base::NoDestructor<base::Optional<AddressList>> nullopt_result; + return *nullopt_result; + } + + const base::Optional<std::vector<std::string>>& GetTextResults() + const override { + static const base::NoDestructor<base::Optional<std::vector<std::string>>> + nullopt_result; + return *nullopt_result; + } + + const base::Optional<std::vector<HostPortPair>>& GetHostnameResults() + const override { + static const base::NoDestructor<base::Optional<std::vector<HostPortPair>>> + nullopt_result; + return *nullopt_result; + } + + const base::Optional<HostCache::EntryStaleness>& GetStaleInfo() + const override { + static const base::NoDestructor<base::Optional<HostCache::EntryStaleness>> + nullopt_result; + return *nullopt_result; + } + + private: + const int error_; + + DISALLOW_COPY_AND_ASSIGN(FailingRequestImpl); +}; + +} // namespace + const size_t HostResolver::ManagerOptions::kDefaultRetryAttempts = static_cast<size_t>(-1); @@ -171,4 +215,10 @@ HostResolver::HostResolver() = default; +// static +std::unique_ptr<HostResolver::ResolveHostRequest> +HostResolver::CreateFailingRequest(int error) { + return std::make_unique<FailingRequestImpl>(error); +} + } // namespace net
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h index 6225841a..0b96a65 100644 --- a/net/dns/host_resolver.h +++ b/net/dns/host_resolver.h
@@ -342,6 +342,10 @@ protected: HostResolver(); + // Utility to create a request implementation that always fails with |error| + // immediately on start. + static std::unique_ptr<ResolveHostRequest> CreateFailingRequest(int error); + private: DISALLOW_COPY_AND_ASSIGN(HostResolver); };
diff --git a/net/dns/mapped_host_resolver.cc b/net/dns/mapped_host_resolver.cc index 78cfb7e..caa36fa95 100644 --- a/net/dns/mapped_host_resolver.cc +++ b/net/dns/mapped_host_resolver.cc
@@ -7,7 +7,6 @@ #include <string> #include <utility> -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/values.h" #include "net/base/host_port_pair.h" @@ -15,43 +14,6 @@ namespace net { -class MappedHostResolver::AlwaysErrorRequestImpl - : public HostResolver::ResolveHostRequest { - public: - explicit AlwaysErrorRequestImpl(int error) : error_(error) {} - - int Start(CompletionOnceCallback callback) override { return error_; } - - const base::Optional<AddressList>& GetAddressResults() const override { - static base::NoDestructor<base::Optional<AddressList>> nullopt_result; - return *nullopt_result; - } - - const base::Optional<std::vector<std::string>>& GetTextResults() - const override { - static const base::NoDestructor<base::Optional<std::vector<std::string>>> - nullopt_result; - return *nullopt_result; - } - - const base::Optional<std::vector<HostPortPair>>& GetHostnameResults() - const override { - static const base::NoDestructor<base::Optional<std::vector<HostPortPair>>> - nullopt_result; - return *nullopt_result; - } - - const base::Optional<HostCache::EntryStaleness>& GetStaleInfo() - const override { - static const base::NoDestructor<base::Optional<HostCache::EntryStaleness>> - nullopt_result; - return *nullopt_result; - } - - private: - const int error_; -}; - MappedHostResolver::MappedHostResolver(std::unique_ptr<HostResolver> impl) : impl_(std::move(impl)) {} @@ -70,7 +32,7 @@ rules_.RewriteHost(&rewritten); if (rewritten.host() == "~NOTFOUND") - return std::make_unique<AlwaysErrorRequestImpl>(ERR_NAME_NOT_RESOLVED); + return CreateFailingRequest(ERR_NAME_NOT_RESOLVED); return impl_->CreateRequest(rewritten, source_net_log, optional_parameters); }
diff --git a/net/dns/mapped_host_resolver.h b/net/dns/mapped_host_resolver.h index 264da0e..ce7ec88e 100644 --- a/net/dns/mapped_host_resolver.h +++ b/net/dns/mapped_host_resolver.h
@@ -61,8 +61,6 @@ HostResolverManager* GetManagerForTesting() override; private: - class AlwaysErrorRequestImpl; - std::unique_ptr<HostResolver> impl_; HostMappingRules rules_;
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc index 8a24ea15..152e696 100644 --- a/net/dns/mock_host_resolver.cc +++ b/net/dns/mock_host_resolver.cc
@@ -87,6 +87,11 @@ } } + void DetachFromResolver() { + id_ = 0; + resolver_ = nullptr; + } + int Start(CompletionOnceCallback callback) override { DCHECK(callback); // Start() may only be called once per request. @@ -269,12 +274,24 @@ MockHostResolverBase::~MockHostResolverBase() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + // Sanity check that pending requests are always cleaned up, by waiting for + // completion, manually cancelling, or calling OnShutdown(). DCHECK(requests_.empty()); } void MockHostResolverBase::OnShutdown() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - // TODO(crbug.com/1006902): Implement. + + // Cancel all pending requests. + for (auto& request : requests_) { + request.second->DetachFromResolver(); + } + requests_.clear(); + + // Prevent future requests by clearing resolution rules and the cache. + rules_map_.clear(); + cache_ = nullptr; } std::unique_ptr<HostResolver::ResolveHostRequest> @@ -872,10 +889,8 @@ class HangingHostResolver::RequestImpl : public HostResolver::ResolveHostRequest { public: - RequestImpl(base::WeakPtr<HangingHostResolver> resolver, bool is_local_only) - : resolver_(resolver), - is_running_(false), - is_local_only_(is_local_only) {} + explicit RequestImpl(base::WeakPtr<HangingHostResolver> resolver) + : resolver_(resolver) {} ~RequestImpl() override { if (is_running_ && resolver_) @@ -884,41 +899,27 @@ int Start(CompletionOnceCallback callback) override { DCHECK(resolver_); - if (is_local_only_) - return ERR_DNS_CACHE_MISS; - is_running_ = true; return ERR_IO_PENDING; } const base::Optional<AddressList>& GetAddressResults() const override { - DCHECK(is_local_only_); - static const base::NoDestructor<base::Optional<AddressList>> nullopt_result; - return *nullopt_result; + IMMEDIATE_CRASH(); } const base::Optional<std::vector<std::string>>& GetTextResults() const override { - DCHECK(is_local_only_); - static const base::NoDestructor<base::Optional<std::vector<std::string>>> - nullopt_result; - return *nullopt_result; + IMMEDIATE_CRASH(); } const base::Optional<std::vector<HostPortPair>>& GetHostnameResults() const override { - DCHECK(is_local_only_); - static const base::NoDestructor<base::Optional<std::vector<HostPortPair>>> - nullopt_result; - return *nullopt_result; + IMMEDIATE_CRASH(); } const base::Optional<HostCache::EntryStaleness>& GetStaleInfo() const override { - DCHECK(is_local_only_); - static const base::NoDestructor<base::Optional<HostCache::EntryStaleness>> - nullopt_result; - return *nullopt_result; + IMMEDIATE_CRASH(); } void ChangeRequestPriority(RequestPriority priority) override {} @@ -927,8 +928,7 @@ // Use a WeakPtr as the resolver may be destroyed while there are still // outstanding request objects. base::WeakPtr<HangingHostResolver> resolver_; - bool is_running_; - bool is_local_only_; + bool is_running_ = false; DISALLOW_COPY_AND_ASSIGN(RequestImpl); }; @@ -938,7 +938,7 @@ HangingHostResolver::~HangingHostResolver() = default; void HangingHostResolver::OnShutdown() { - // TODO(crbug.com/1006902): Implement. + shutting_down_ = true; } std::unique_ptr<HostResolver::ResolveHostRequest> @@ -946,12 +946,15 @@ const HostPortPair& host, const NetLogWithSource& source_net_log, const base::Optional<ResolveHostParameters>& optional_parameters) { - bool is_local_only = - optional_parameters - ? optional_parameters.value().source == HostResolverSource::LOCAL_ONLY - : false; - return std::make_unique<RequestImpl>(weak_ptr_factory_.GetWeakPtr(), - is_local_only); + if (shutting_down_) + return CreateFailingRequest(ERR_CONTEXT_SHUT_DOWN); + + if (optional_parameters && + optional_parameters.value().source == HostResolverSource::LOCAL_ONLY) { + return CreateFailingRequest(ERR_DNS_CACHE_MISS); + } + + return std::make_unique<RequestImpl>(weak_ptr_factory_.GetWeakPtr()); } //-----------------------------------------------------------------------------
diff --git a/net/dns/mock_host_resolver.h b/net/dns/mock_host_resolver.h index f4425c7d2..61250c89 100644 --- a/net/dns/mock_host_resolver.h +++ b/net/dns/mock_host_resolver.h
@@ -463,6 +463,7 @@ class RequestImpl; int num_cancellations_ = 0; + bool shutting_down_ = false; base::WeakPtrFactory<HangingHostResolver> weak_ptr_factory_{this}; };
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index c623deb..3838a85a 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc
@@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/files/scoped_temp_dir.h" #include "base/format_macros.h" #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -390,11 +391,13 @@ not_modified_ = false; modified_ = false; bad_200_ = false; + length_ = 80; } ~RangeTransactionServer() { not_modified_ = false; modified_ = false; bad_200_ = false; + length_ = 80; } // Returns only 416 or 304 when set. @@ -406,6 +409,9 @@ // Returns 200 instead of 206 (a malformed response overall). void set_bad_200(bool value) { bad_200_ = value; } + // Sets how long the resource is. (Default is 80) + void set_length(int64_t length) { length_ = length; } + // Other than regular range related behavior (and the flags mentioned above), // the server reacts to requests headers like so: // X-Require-Mock-Auth -> return 401. @@ -422,11 +428,13 @@ static bool not_modified_; static bool modified_; static bool bad_200_; + static int64_t length_; DISALLOW_COPY_AND_ASSIGN(RangeTransactionServer); }; bool RangeTransactionServer::not_modified_ = false; bool RangeTransactionServer::modified_ = false; bool RangeTransactionServer::bad_200_ = false; +int64_t RangeTransactionServer::length_ = 80; // A dummy extra header that must be preserved on a given request. @@ -492,20 +500,21 @@ byte_range.set_last_byte_position(49); } - if (byte_range.first_byte_position() > 79) { + if (byte_range.first_byte_position() >= length_) { response_status->assign("HTTP/1.1 416 Requested Range Not Satisfiable"); response_data->clear(); return; } - EXPECT_TRUE(byte_range.ComputeBounds(80)); - int start = static_cast<int>(byte_range.first_byte_position()); - int end = static_cast<int>(byte_range.last_byte_position()); + EXPECT_TRUE(byte_range.ComputeBounds(length_)); + int64_t start = byte_range.first_byte_position(); + int64_t end = byte_range.last_byte_position(); - EXPECT_LT(end, 80); + EXPECT_LT(end, length_); - std::string content_range = base::StringPrintf( - "Content-Range: bytes %d-%d/80\n", start, end); + std::string content_range = base::StringPrintf("Content-Range: bytes %" PRId64 + "-%" PRId64 "/%" PRId64 "\n", + start, end, length_); response_headers->append(content_range); if (!request->extra_headers.HasHeader("If-None-Match") || modified_) { @@ -515,18 +524,18 @@ data = "r"; } else { EXPECT_EQ(9, (end - start) % 10); - for (int block_start = start; block_start < end; block_start += 10) { - base::StringAppendF(&data, "rg: %02d-%02d ", - block_start, block_start + 9); + for (int64_t block_start = start; block_start < end; block_start += 10) { + base::StringAppendF(&data, "rg: %02" PRId64 "-%02" PRId64 " ", + block_start % 100, (block_start + 9) % 100); } } *response_data = data; if (end - start != 9) { // We also have to fix content-length. - int len = end - start + 1; - std::string content_length = base::StringPrintf("Content-Length: %d\n", - len); + int64_t len = end - start + 1; + std::string content_length = + base::StringPrintf("Content-Length: %" PRId64 "\n", len); response_headers->replace(response_headers->find("Content-Length:"), content_length.size(), content_length); } @@ -2879,6 +2888,71 @@ EXPECT_EQ(5, cache.disk_cache()->create_count()); } +TEST_F(HttpCacheTest, RangeGET_Enormous) { + // Test for how blockfile's limit on range namespace interacts with + // HttpCache::Transaction. + // See https://crbug.com/770694 + base::ScopedTempDir temp_dir; + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); + + auto backend_factory = std::make_unique<HttpCache::DefaultBackend>( + DISK_CACHE, CACHE_BACKEND_BLOCKFILE, temp_dir.GetPath(), 1024 * 1024); + MockHttpCache cache(std::move(backend_factory)); + + RangeTransactionServer handler; + handler.set_length(2305843009213693962); + + // Prime with a range it can store. + { + ScopedMockTransaction transaction(kRangeGET_TransactionOK); + transaction.request_headers = "Range: bytes = 0-9\r\n" EXTRA_HEADER; + transaction.data = "rg: 00-09 "; + MockHttpRequest request(transaction); + + HttpResponseInfo response; + RunTransactionTestWithRequest(cache.http_cache(), transaction, request, + &response); + ASSERT_TRUE(response.headers != nullptr); + EXPECT_EQ(206, response.headers->response_code()); + EXPECT_EQ(1, cache.network_layer()->transaction_count()); + } + + // Try with a range it can't. Should still work. + { + ScopedMockTransaction transaction(kRangeGET_TransactionOK); + transaction.request_headers = + "Range: bytes = " + "2305843009213693952-2305843009213693961\r\n" EXTRA_HEADER; + transaction.data = "rg: 52-61 "; + MockHttpRequest request(transaction); + + HttpResponseInfo response; + RunTransactionTestWithRequest(cache.http_cache(), transaction, request, + &response); + ASSERT_TRUE(response.headers != nullptr); + EXPECT_EQ(206, response.headers->response_code()); + EXPECT_EQ(2, cache.network_layer()->transaction_count()); + } + + // Can't actually cache it due to backend limitations. If the network + // transaction count is 2, this test isn't covering what it needs to. + { + ScopedMockTransaction transaction(kRangeGET_TransactionOK); + transaction.request_headers = + "Range: bytes = " + "2305843009213693952-2305843009213693961\r\n" EXTRA_HEADER; + transaction.data = "rg: 52-61 "; + MockHttpRequest request(transaction); + + HttpResponseInfo response; + RunTransactionTestWithRequest(cache.http_cache(), transaction, request, + &response); + ASSERT_TRUE(response.headers != nullptr); + EXPECT_EQ(206, response.headers->response_code()); + EXPECT_EQ(3, cache.network_layer()->transaction_count()); + } +} + // Parallel validation results in 200 for 1 transaction and validation matches // for subsequent transactions. TEST_F(HttpCacheTest, SimpleGET_ParallelValidationNoMatch1) {
diff --git a/net/http/transport_security_state_static.json b/net/http/transport_security_state_static.json index 8b120c32..ab836bf 100644 --- a/net/http/transport_security_state_static.json +++ b/net/http/transport_security_state_static.json
@@ -2401,7 +2401,6 @@ { "name": "musi.cx", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mykontool.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nostraforma.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "nzb.cat", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "orhideous.name", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ramsor-gaming.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "robertof.ovh", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -2765,7 +2764,6 @@ { "name": "nellacms.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nellacms.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nellafw.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "nextend.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nmd.so", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "null.tips", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ocrami.us", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -4606,7 +4604,6 @@ { "name": "bettween.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bike-shack.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bildermachr.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "bitok.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bizcms.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "blmiller.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "boxintense.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -5778,8 +5775,6 @@ { "name": "epicwalnutcreek.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "epublibre.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "eq8.net.au", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "equate.net.au", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "equatetechnologies.com.au", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "eressea.xyz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "esko.bar", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "esocweb.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -5982,7 +5977,6 @@ { "name": "jupp0r.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kalami.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kantankye.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "kapucini.si", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kaputt.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "karguine.in", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "katericke.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -6378,7 +6372,6 @@ { "name": "theinvisibletrailer.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "themerchandiser.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "theodorejones.info", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "therockawaysny.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "thescientists.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "thesled.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "thetradinghall.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -7120,7 +7113,6 @@ { "name": "zhaofeng.li", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "zima.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "zoomingin.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "zrn.in", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "zulu7.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "zvps.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "020wifi.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -8378,7 +8370,6 @@ { "name": "bithosting.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bitmoe.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bitref.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "bitsafe.systems", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bitskins.co", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bivsi.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bl4ckb0x.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -9233,7 +9224,6 @@ { "name": "kickerplaza.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kidbacker.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kiel-media.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "kienlen.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "killerrobots.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kimberg.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "kiocloud.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -10813,7 +10803,6 @@ { "name": "f-s-u.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "faretravel.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "fachschaft-informatik.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "exploit.cz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "experts-en-gestion.fr", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ess-cert.ru", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "familjenm.se", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -12631,7 +12620,6 @@ { "name": "ctrld.me", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cubecraftstore.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cubecraftstore.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "cubos.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cucc.date", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "culturedcode.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cuongquach.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -13277,7 +13265,6 @@ { "name": "mythengay.ch", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nakliyatsirketi.biz.tr", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "namaho.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "nametaken-cloud.duckdns.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "namu.moe", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nanokamo.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "naralogics.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -14417,7 +14404,6 @@ { "name": "doctor.dating", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "energydrinkblog.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "fm.ie", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "evasion-energie.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "fiix.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "fach-journalist.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "epizentrum.work", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -15022,7 +15008,6 @@ { "name": "oddsandevens.ca", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nossasenhora.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "northumbriagames.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "occasion-impro.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "net2o.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nextcairn.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "nothing.net.nz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -16042,7 +16027,6 @@ { "name": "financier.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "epichouse.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "esample.info", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "feedthefuture.gov", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "europapier.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "europapier.sk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "fastograph.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -17938,7 +17922,6 @@ { "name": "ilhansubasi.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "inforichjapan.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ict-radar.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "interchangedesign.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ict-radar.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ictradar.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "inviosolutions.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -18641,7 +18624,6 @@ { "name": "robust.ga", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "rro.rs", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "rootusers.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "rimo.site", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "sa.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "proteapower.co.za", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "rememberthis.co.za", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -19029,8 +19011,6 @@ { "name": "ttuwiki.ee", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "vavel.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "traderjoe-cloud.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "tyil.work", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "tyil.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "unblocked.works", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "upmchealthsecurity.us", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "tumagiri.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -21507,7 +21487,6 @@ { "name": "todaymeow.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "tubanten.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "trewe.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "tuttoandroid.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "thomalaudan.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "utox.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "unixtime.pro", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -22317,7 +22296,6 @@ { "name": "megagifs.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mehrleben.at", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "melchizedek-forum.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "meltzow.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "melvinlammerts.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "meme-photostudio.com.tw", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "memorytrace.space", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -22343,7 +22321,6 @@ { "name": "mobilebay.top", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mobileritelushi.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mobiwalk.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "mocurio.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "modelservis.cz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "moellers.it", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "moellers.systems", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -22899,7 +22876,6 @@ { "name": "acecerts.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "acerislaw.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "achterhoekseveiligheidsbeurs.nl", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "acme.beer", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "acrepairdrippingsprings.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "acs-chantal.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "actiontowingroundrock.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -23100,7 +23076,6 @@ { "name": "ayuru.info", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "azia.info", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "b-b-law.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "b-pi.duckdns.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "b-space.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "babyliss-pro.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "babyliss-pro.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -25725,7 +25700,6 @@ { "name": "slash64.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "slash64.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "slashbits.no", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "sleeklounge.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "sleepmap.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "sloths.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "slovenskycestovatel.sk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -29090,7 +29064,6 @@ { "name": "snatch.com.ua", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "sophiaandmatt.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "silvergoldbull.be", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "smsg-dev.ch", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "songsmp3.co", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "smit.com.ua", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "sgtsnookums.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -29318,7 +29291,6 @@ { "name": "tierarztpraxis-weinert.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "tlehseasyads.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "todaciencia.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "thinkswap.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "tibovanheule.site", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "tele-alarme.ch", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "tommounsey.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -29930,7 +29902,6 @@ { "name": "arenlor.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "altopartners.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "amoozesh98.ir", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "arox.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "azlo.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "astral.gq", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "acendealuz.com.br", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -29991,7 +29962,6 @@ { "name": "billy.pictures", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "24hrs.shopping", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "astutikhonda.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "bilder-designs.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bigerbio.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bgtgames.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "bernieware.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -30103,10 +30073,8 @@ { "name": "casamorelli.com.br", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ch-laborit.fr", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "chrisbrakebill.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "chattergalerie.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cheeseemergency.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "burlesquemakeup.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "chattergallery.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ci-fo.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "chinahighlights.ru", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "chat.cz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -30180,7 +30148,6 @@ { "name": "cryptorival.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cookingcrusade.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "csharpmarc.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "cosirex.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "controlarlaansiedad.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "csinfo.us", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "cultofperf.org.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -30242,7 +30209,6 @@ { "name": "deltadata.ch", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "capstansecurity.co.uk", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "depedtayo.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "deutschland-dsl.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "dao.spb.su", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "dhxxls.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "decorincasa.com.br", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -30383,7 +30349,6 @@ { "name": "eyesoccer-didikh.rhcloud.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "erotpo.cz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "fantasiapainter.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "evony.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "esb112.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ewsfeed.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "eonhive.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -30952,7 +30917,6 @@ { "name": "mtirc.co", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "luca.swiss", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "morphy2k.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "moso.io", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "merojob.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mojnet.net", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mojnet.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -30964,7 +30928,6 @@ { "name": "moviefreeze.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mycircleworks.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "motonauticaibiza.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "multimedia-pool.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mylifeabundant.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mschuessler.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "mopedreifen.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -31814,7 +31777,6 @@ { "name": "youngsook.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "xn--7ca.co", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "youruseragent.info", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "yoonas.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "yoitoko.city", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "w4.no", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ymblaw.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -32666,7 +32628,6 @@ { "name": "ittop-gabon.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "ivanpolchenko.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "izumi.tv", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "jakewalker.xyz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "janada.cz", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "jeremy-chen.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "jinmaguoji.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -33108,7 +33069,6 @@ { "name": "oliverspringer.eu", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "onelawsuit.com", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "papatest24.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, - { "name": "pathwaystoresilience.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "pik.bzh", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "politeiaudesa.org", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, { "name": "psw-consulting.de", "policy": "bulk-18-weeks", "mode": "force-https", "include_subdomains": true }, @@ -35599,7 +35559,6 @@ { "name": "blastentertainment.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "blastzoneentertainments.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "blivawesome.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "blivvektor.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bloggytalky.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bloglife-bb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bnbsinflatablehire.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -37430,7 +37389,6 @@ { "name": "pony-cl.co.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "pookl.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "poy-tech.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "preppertactics.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "prestige-portal.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "privatebanks.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "privilegevisa.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -37980,7 +37938,6 @@ { "name": "monothesis.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "moteksystems.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mundolarraz.es", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "muqu.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "murfy.kiwi", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "myalliancechurch.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "namethatporn.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -40758,7 +40715,6 @@ { "name": "garten-bau.ch", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "gaysexpositions.guide", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "gearallnews.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "gearseo.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "geecrat.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "geek1.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "genchev.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -40992,7 +40948,6 @@ { "name": "osepideasthatwork.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ostimwebyazilim.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "outlines.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "overtrolls.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "p.ki", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "pablo.im", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "pabloarteaga.name", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -42550,7 +42505,6 @@ { "name": "marketlinks.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "martasibaja.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "matt-royal.gr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "mauran.me", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mcfx.us", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mcivor.me", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mcprocdn.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -44996,7 +44950,6 @@ { "name": "u5.re", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "uhasseltctf.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "un.fo", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "unitedstreamers.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "unixfox.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "upupming.site", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "uradisam.rs", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -46394,7 +46347,6 @@ { "name": "778da.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "826468.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "826498.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "9vies.ca", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "a632079.me", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "abitur97ag.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "accord-application.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -46681,7 +46633,6 @@ { "name": "gigseekr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "girlz.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "giveaways.ph", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "globalipaction.ch", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "goand.run", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "goatbot.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "gowithflo.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -47619,7 +47570,6 @@ { "name": "londongallery.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "lost.report", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "lowerpricefinder.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "loxal.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "loxal.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ludovic-muller.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "luera1959.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -47687,7 +47637,6 @@ { "name": "mozgb.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mpa-pro.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mtasa.hu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "muctool.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "musicompare.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "muzhijy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "my-stuff-online.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -50749,7 +50698,6 @@ { "name": "davidforward.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "davidmn.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "dawgs.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "dbjc.duckdns.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ddy.tw", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "dentistesdarveauetrioux.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "der-fliesenzauberer.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -51340,7 +51288,6 @@ { "name": "ptfiber.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ptfiber.spb.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "pty.gg", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "pubmire.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "puggan.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "purplegrapegames.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "pusichatka.ddns.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -51897,7 +51844,6 @@ { "name": "futcre.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "galeria42.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "game4less.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "gamequest.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ganyouxuan.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "gazete.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "geniush.ovh", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -52364,7 +52310,6 @@ { "name": "ytx588.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "yugasun.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "yukari.cloud", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "yutaron.tokyo", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zacchaeus.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zakariya.blog", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zapmaster14.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -52423,7 +52368,6 @@ { "name": "brzy-svoji.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bst.gg", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bsuru.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "burningmarket.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "businesswebadmin.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bytemix.cloud", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "c5h8no4na.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -59722,7 +59666,6 @@ { "name": "9950p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "9box.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "a-care.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "abaev.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "abasalehngo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "abhibhat.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "abitidasposa.roma.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -62544,7 +62487,6 @@ { "name": "cannaffiliate.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "carlocksmithcarrollton.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "carplus.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "casaamor.ph", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "castellannenberg.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "castlemail.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "cchen.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -62609,7 +62551,6 @@ { "name": "esthernariyoshi.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "etwalldentalpractice.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "everlastingoak.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "expertnews.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "expressglobal.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "fabrykowski.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "factorit.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -63535,7 +63476,6 @@ { "name": "maikoloc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "martinbaileyphotography.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mcblain.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "medeurope.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "media101.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "medicine.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "medicsz.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -64078,7 +64018,6 @@ { "name": "vifsoft.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "viku.fi", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "washoedems.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "watchcow.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "wb2288.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "webandsun.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "well-around-the-world.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -64769,7 +64708,6 @@ { "name": "ssmic.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "stadtundbaum.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "startstunter.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "statistician-online.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "stoicatedy.ovh", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "sudya-dredd.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "svenskapsalmer.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -64793,7 +64731,6 @@ { "name": "topmmogames.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "totalsport-bg.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "travelinghacker.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "tsunami.gov", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "tyroremotes.pt", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "u17go.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ukuchordnamer.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -66175,7 +66112,6 @@ { "name": "saz9001.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "sbcargo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "scaffoldhiremidrand.co.za", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "sccwf.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "schlick.network", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "schuetzen-ehrenbreitstein.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "schultz.is", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -66736,7 +66672,6 @@ { "name": "nivelul2.ro", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "noiglosujemy.com.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "noiglosujemy.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "noobsunited.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "novema.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "noxx.solutions", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "olitham.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -70484,7 +70419,6 @@ { "name": "karinwerner.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kashadriskill.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kevinquintero.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "khouryalexandre.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kintana.ovh", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kirakirasoft.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kiumie.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -70836,7 +70770,6 @@ { "name": "emailtemporal.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "emcentrix-com-site-mvc.azurewebsites.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "emotionalmente.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "encryptlist.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "energybank.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "esalesclub.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "escobarservice7000.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -71448,7 +71381,6 @@ { "name": "model.earth", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "modul8infinity.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mondonet.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "mousemade.art", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mrsheep.win", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "muratatifsayar.com.tr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "murmashi.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -72321,7 +72253,6 @@ { "name": "nanshy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "naturalbijou.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "navroopsahdev.in", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "nerofox.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "netdiode.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "netdiode.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "netdiode.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -72854,7 +72785,6 @@ { "name": "dg68.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "digpath.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "distributore.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "djcatholic.or.kr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "doesinfotech.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "donghochinhhang.store", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "dragontours.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74071,34 +74001,6 @@ { "name": "1199bet.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "11b58.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "1220323.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365a.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365g.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365h.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365i.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365k.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365l.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365m.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365n.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365o.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365q.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365r.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365s.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365u.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365v.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365vip.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365w.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365x.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365y.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "1234365z.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "12344048.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "12345678365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "123456789365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74168,10 +74070,6 @@ { "name": "2033y.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "2033z.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "20n13.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "22245j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "22256j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "22267j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "22289j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "222b58.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "228668.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "2288bet.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74651,11 +74549,6 @@ { "name": "611165.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "611195.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "616675.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "635-488.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "635-588.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "635-788.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "635-888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "635-988.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "6365ah.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "6365am.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "6365bj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74767,7 +74660,6 @@ { "name": "66664048.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "666777bet.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "666888bet.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "66689j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "6669255.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "666999bet.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "666b58.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74813,7 +74705,6 @@ { "name": "77018dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "77018ee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "77774048.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "77789j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "7788bet.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "77b58.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "78365aa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74891,35 +74782,6 @@ { "name": "8521.me", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "8602012.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "8602013.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365a.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365g.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365h.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365i.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365k.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365l.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365m.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365n.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365o.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365q.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365r.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365s.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365u.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365v.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365vip.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365w.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365x.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365y.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "861365z.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "866300.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "866304.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "866305.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -74946,15 +74808,6 @@ { "name": "878365mm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "878365nn.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "88740n.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "8881234j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "8882345j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "888234j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "8883456j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "888345j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "8884567j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "888456j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "888567j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "8886789j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "888789j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "88884048.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "888b58.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -75002,10 +74855,7 @@ { "name": "97739.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "9836952.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "988316.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "99123j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "99456j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "9977432.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "99789j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "9988551.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "9988959.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "99994048.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -75324,14 +75174,7 @@ { "name": "bet365q9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet365r8.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet365u.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip4.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet365vip7.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet365vip9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet365x0.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet365x1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet365x2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -75343,7 +75186,6 @@ { "name": "bet66669999.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet666888.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "bet721.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "bet916.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "betaa0.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "betaa1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "betaa2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -75604,7 +75446,6 @@ { "name": "d-consultant.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "d-soft.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "d30365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "d365.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "d88.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "daemon-hentai.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "dahobo.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -75807,7 +75648,6 @@ { "name": "eyetooth.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ezik-ido.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "f30365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "f365.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "f51365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "f9850.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "f9851.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -76203,9 +76043,6 @@ { "name": "lasdelgadas.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "lavozdelamusicachilena.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "lbc-podcast.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ld66999.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ld699.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ld6999.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "learnhowtoplayguitar.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "learningladderacademy.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "lesbianlovers.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -76472,7 +76309,6 @@ { "name": "numericall.gq", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "nurmio.fi", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "o30365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "o365.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "o3c.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "oakparkmedicalcentre.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "oaktravel.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -77713,18 +77549,9 @@ { "name": "zumberak.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zverskij-site.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zzzz365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "011ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "015ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "017ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "019ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "026ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "031ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "032ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "033ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "036ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "039ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "050ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "052ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "05am8.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "1080.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "1lc11.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -78353,7 +78180,6 @@ { "name": "hamiltonzinelibrary.cf", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hamsystems.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "harabar.ml", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "hardcore-bodybuilding.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hbaa.ml", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hbxianghang.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "healthcarereviews.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -78451,14 +78277,6 @@ { "name": "kateysagal.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "katherineswynford.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kavatasygarety.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb22.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb28.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb35.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb38.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb57.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb65.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb68.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb99.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kemerovo.gq", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kemerovo.ml", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kemerovo42.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -78492,17 +78310,8 @@ { "name": "krovatka.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks015.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks05.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks06.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks17.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks19.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks35.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks410.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks56.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks82.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks82.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks85.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks96.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks97.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kudinilam.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kulthist.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kupibilet.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -78529,7 +78338,6 @@ { "name": "lazer.cf", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "leak.media", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "leeyoungaeph.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "lelux.site", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "lenn-blaschke.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "leomwilson.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "leon-tec.co.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -79645,8 +79453,6 @@ { "name": "zuitaotu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zwergenfreiheit.at", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zxfiles.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "030ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "035ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "080261.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "1000wordsevents.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "166jk.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -80101,7 +79907,6 @@ { "name": "jw66.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kajabutik.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kamagraerektion.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb82.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kf2000.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kocka.cf", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kocka.tech", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -80350,7 +80155,6 @@ { "name": "zerobajt.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zeusec.co.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zixin.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "053ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "0x3bb.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "11335835.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "11445835.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -80539,7 +80343,6 @@ { "name": "hohlhupen.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "homeandliving.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "homs.design", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "hosting-tools.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "houstonlockout.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hugonote.cf", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hugonote.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -80579,9 +80382,6 @@ { "name": "kasperstad.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kassarsoap.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "katcr.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb15.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb86.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb96.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kf200.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "khojhealth.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kireilign.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -80605,12 +80405,10 @@ { "name": "ks6829.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks6830.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks6831.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks70.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks8126.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks8892.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks8895.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ks8915.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "ks91.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kuhnerts.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kupu.maori.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "l81818.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -81259,7 +81057,6 @@ { "name": "zombmage.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zoohaus.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "04d88.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "051ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "111plus.design", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "168fff.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "281ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -81446,7 +81243,6 @@ { "name": "justeducationonline.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kartoffel-tobi.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kazmamall.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "kb98.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kcfmradio.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kerner.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "kettinggeleider.be", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -81911,7 +81707,6 @@ { "name": "meran.in", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "miklagard.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mlathrom.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "moca-2080.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "momocogames.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "monitord.at", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "ms-australia.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -82636,7 +82431,6 @@ { "name": "277z6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "27is.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "288z6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "299ks.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "299ks.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "31du.cn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "3369p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -82842,7 +82636,6 @@ { "name": "gorgeconnect.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "grasscity.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "gridtennis.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "gurkenberry.ddns.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "h-server.myfirewall.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "heightselectrical.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "histoiresdecontenu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -82972,7 +82765,6 @@ { "name": "macaos.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "madeinolive.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "magniflood.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "mandrill.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mangabank.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mansora.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "marijuanajobscannabiscareers.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -83279,7 +83071,6 @@ { "name": "artifexnet.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "artigoos.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "asesoriaglobalenseguros.com.mx", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "atlantacustomfab.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "autodius.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "autogestioninmobiliaria.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "awangardaszkola.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -83419,7 +83210,6 @@ { "name": "homelabalert.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "horizon.ne.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hotelstanford.com.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "howardscholars.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "husk.house", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "i-pinged-everyone.today", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "icanhas.report", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -84112,7 +83902,6 @@ { "name": "happyhourboard.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "harrisonm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hendranicholas.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "hillshandymate.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hl8id.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hl8th.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "hosteons.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -84245,7 +84034,6 @@ { "name": "micamisetaestampada.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "mmassemblyline.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "motscroises.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "mpoonamchandpearls.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "multicore.cl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "multimatte.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "muralswallpaper.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, @@ -84471,6 +84259,986 @@ { "name": "zl888.ag", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zlatom.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "zugfahrplan.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228555.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228999.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228aa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228bb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228cc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228ee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228g.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228gg.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228h.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228hh.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228jj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228k.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228kk.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228m.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228mm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228nn.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228pp.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228q.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228r.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228rr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228s.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228ss.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228tt.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228u.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228v.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228vip1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228vip3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228vip5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228vip6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228vip8.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228vv.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228w.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228ww.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228x.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228xx.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228y.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228yy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228z.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00228zz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "00365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "01365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "02365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "0355z6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "04365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "05365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "06365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "07365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "08365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "09365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1002712.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "105318.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1068511.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1088.fun", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "11018vip.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "11018xpj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1111365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "111365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "11168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1119968.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "11365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "123365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "12365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836500.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683651.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836511.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683652.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836522.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683653.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836533.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683654.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836544.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683655.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836555.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683657.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836577.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836588.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "1683659.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "16836599.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "168365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "169xpj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2222365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "222321365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2288422.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2288499.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884a.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884g.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22884h.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "22994.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299411.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299422.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299433.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299455.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299466.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299477.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "2299488.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "23365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "235998.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "242712.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "25north.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "3033888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "308xpj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "30bet365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "313xpj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "315xpj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "319xpj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "32bet365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "33168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "3333365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "333365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "33365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "34365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "36525.hk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "37987a.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "37987c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "37987d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "37987e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "37987f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "37987g.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "396228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "4048.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "44168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "44365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "444321365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "45365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "456365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017701.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017702.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017703.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017704.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017705.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017801.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017802.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017803.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017804.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5017805.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "505343.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "55365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "555321365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "56365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5795111.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "579533.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5795333.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5795444.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5795885.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5795886.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5795887.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "5lc8.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396ooo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396qqq.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396rrr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396sss.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396ttt.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396vvv.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396www.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396xxx.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396yyy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "6396zzz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131g.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131k.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131l.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131n.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131q.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131r.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131s.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131u.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131v.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "65131y.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "66168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365i.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365j.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365k.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365l.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365m.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365n.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365o.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365p.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365q.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365r.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365s.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365u.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365v.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365w.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365x.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365y.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "663365z.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "666321365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "666365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "678365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "67877777.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "7652.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "7654321c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "77018vip.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "77168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "777234567.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "777365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "789365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "88168365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "88365.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "88365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "888321365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "88yule3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "88yule5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "89365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "96002e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "99365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968131.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968166.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968282.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968363.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968389.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968393.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968404.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968505.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968508.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968535.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968595.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968600.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968656.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968707.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968717.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968838.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968909.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968959.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968969.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968aa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968aaa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ab.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968abc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968app.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968bbb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968caipiao.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968cc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ccc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968com.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ddd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968eee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ff.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968fff.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968gg.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ggg.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968go.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968hh.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968hhh.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ii.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968iii.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968jj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968jjj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ll.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968lll.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968mm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968mmm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968nn.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968nnn.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ok.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968oo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ooo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968pp.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ppp.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968qq.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968qqq.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968rr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968rrr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ss.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968sss.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ttt.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968uu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968uuu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968vv.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968vvv.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968ww.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968www.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968xl.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968xx.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968xxx.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968yy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968yyy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968zz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "9968zzz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "999321365.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "999365t.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "99qp.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "a00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "a77018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "aa00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "abruzzobeautybar.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "acces-elevation.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "adelgace.top", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "adonisgrup.ro", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "adoptionpregnancycenter.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "adoptionpregnancycenter.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "agromotorsburzaco.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "akeenext.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "alamo-analytics.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "allinsuranceinformation.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "almeeraloyalty.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "almusbahperfume.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "alpineplumbingandrooter.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "amxpj888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "anageorgia.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "anepsa.com.mx", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "anzacparkeast.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "aperture-science.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "aplazame.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "app00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "app11018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "app77018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "appliancesrepairservice.ca", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "aquasun.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "artmosfilms.co.za", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "asmanyasgiven.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "assemblytechnicianjobs.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "atrias.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "audiohub.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "autopower.gr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "autotrac.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "autozet.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "avtosept.by", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "az11018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b131000.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b2222.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62101.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62102.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62103.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62104.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62105.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62a.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62aa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62bb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62cc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62ee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62f.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b62h.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b6730.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b6740.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67772.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67773.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67774.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67775.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67801.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67802.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67803.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67804.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b67805.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b70881.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b70882.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b70883.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b70884.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b70885.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b77018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "b789.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baanpingchan.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "babblenotes.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "balsamaiso.es", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bandeirasnacionais.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "banderas-mundo.es", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bandiere-mondo.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue7.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue8.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "baoxue9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "barakayu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "barbaderespeito.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bayraklar.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bb00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "beercast.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "beers.my", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bekchy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bescoutednow.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bestinbarter.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166111.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166222.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166333.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166444.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166555.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166777.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet1668888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166999.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166bbb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166ddd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166eee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166fff.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166hhh.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166tt.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166uu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166ww.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166xx.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet166yy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet819.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bet820.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bfanis.ir", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bienestarfacial.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bigbrotherco.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "biol.spb.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bitcoingah.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bitvps.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bizpay.su", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bizzit.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "blue-nijmegen.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bodrumhotelsresorts.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bonn.digital", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bosekarmelitky.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "boutiqueinfantil.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "brawlstarsitalia.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "breadpirates.chat", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bretech.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "brindesgrafica.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "brisq.design", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "brownesgas.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "buttoned.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj4.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj66.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj666.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj7.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj8.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj88.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxdj9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx4.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx7.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "bxzx9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "c3kidspace.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "c86255.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "calluro.hr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "camago.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "camping-aupigeonnier.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "cc00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "cdbtech.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "centurion-consulting-cie.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "centurystonedental.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ceskaexpedice.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "chapek9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "chemical-shark.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "chicagobreastaugdrs.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "chriswilding.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "chronograph.pe", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "chronosgroup.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "classicfg.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "climed.com.tr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "cmpsc.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "comicbank.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "computingsociety.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "comschool.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "contentmarathon.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "coteibem.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "couponbre.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "cozumel-activities.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "crafted.cat", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "creaintel.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "crownsterling.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "curanderosantiago.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "cvdc.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "d00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "danskefilm.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dartydiscount.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dc-acupuncture.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dd00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "deanstreettacochips.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "decofiori.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "denisadinu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "desert-maroc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "destinfloor.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5101.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5102.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5103.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5104.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5105.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5aa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5bb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5cc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "df5ee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dfafacts.gov", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "digimaat.agency", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "digital-sign.com.cn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "digitalarchives.tw", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ditec.sk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip10.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip2.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip4.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip5.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip6.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip7.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "djvip9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "domainevanina.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "donsremovals.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dragowebdesign.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "drapeauxdespays.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dreamhouses.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dtleague.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dubbningshemsidan.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "dziscover.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "e00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ee00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "eentertain.com.my", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "eldoradocylinders.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "electricfencesandton.co.za", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "engagelogic.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "engima.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "engym.com.tw", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "eprojectfreetv.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ericsilva.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "erperium.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "exbolivo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "express-vyvoz.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f88yule3.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f88yule9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f8cp1.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f8cp4.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f8cp7.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "f8cp9.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "faizanullah.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fam-borsch.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fantasticcleanersbristol.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fastighetsekonomi.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ferc.gov", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fetishbazar.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ff00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fffinfo.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fibroarrendacaseton.mx", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "firstnet.gov", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "flaggorvarlden.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "flagi-panstw.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "flagistrany.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "flagpedia.asia", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "flagpedia.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "flixtube.me", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fordtrac.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "forextraders.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "francescopalazzo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "franchisehive.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "freedomhk.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "freedomhkg.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "freedomhkg.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "freevision.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fujieb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "fxsshiwo.cn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "g00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "galeriakobylarz.pl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "gchc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "geohoney.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "getbookked.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "getsmarterinsurance.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "go9968.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "goc4wraps.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "grabtech.vn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "grand-city38.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "grimm.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "grupocata.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "haircode.gr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "hardcore-bodybuilding.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "hbudd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "hearthstonehungary.hu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "hedys.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "helderneves.pt", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "houhuayuan.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "hygieneproclean.co.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "i00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ibhgospel.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ifoa.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "infinityvr.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "inh.gob.ve", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "iopool.us", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ios11018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "iosprivacy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "isigmaonline.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j70101.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j70102.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j70103.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j70104.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j70105.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j7051.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j7052.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "j7053.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jaimesotelo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jamestown.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jebengotai.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jenslody.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jessietessiephptrouble.herokuapp.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jftw.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jinduoduo666.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jtl-connect.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "jtl-pos.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kappershuis-meppel.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kb88dc29.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kettlemetalbbq.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kidsphysiotherapy.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kingnutrition.com.ar", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kinothek.at", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "koki.cl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kuscu.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "kwickshop.co.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "laopcionb.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lasonorastereo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "last-strike.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "latanews.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "latinosup.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "latinosuptv.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lc3732.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lc3751.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lc861.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lc862.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lc863.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lc865.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "le-cameleon.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "leemankuiper.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lelux.email", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "levittasaude.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "liberhk.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "liberhk.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "librehk.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "librehk.info", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "librehk.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "librehk.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lifeinsuranceresource.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "linuxhilux.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "livelondon.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "livingspace.co.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "liz-fry.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lohr.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lowestpriceremovals.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lsmarketing.ie", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lumierewithinspirato.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "lushnikov-alex.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "macbay.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "maidenliput.fi", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "manchestercleaner.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "maquinariastitan.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "marilynhartman.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "master-tmb.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mattknight.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mcfarlow.sk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "meditest.in", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "meetfranz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "memoirmedie.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "metalartbylaser.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "meuautotrac.com.br", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "micr0lab.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "midlandslotus.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mindseyesolutions.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mlohr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mml.cx", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mojitoparty-articlespara.website", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "momentumcoach.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mountbatten.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "msoll.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "msoll.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "msopopop.cn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "murmu.re", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "myinjuryattorney.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "mythoughtmachine.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n16.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n18.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n29.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n32.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n37.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n48.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n56.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n69.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n78.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888000.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888010.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888020.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888101.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888111.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888118.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888131.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888151.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888158.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888161.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n88828.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888292.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888378.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888383.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888459.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888555.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888569.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888668.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888689.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888727.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888777.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n888909.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "n98.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "naidonline.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "nccfa.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "nei.st", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "nemzetizaszlok.hu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ngonkitchen.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "novonegoc.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "nr-sputnik.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "nutrizionista.roma.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "nvmo.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "o00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "o2oxy.cn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "officiants.wedding", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "oldtimerparts.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "onlinevergidanismani.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "orablanket.co.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "otherlandlabs.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ounage.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ozli.ga", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pablovaldiviesoar.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pandemic.group", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pantsu.club", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "parkers.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "part.la", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pascal90.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "paulalutz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pbfashionexhibition.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "penconsultants.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "philipdeussen.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "philipdeussen.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "philo.shop", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "phongthuytaitam.vn", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pj1100.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pj11018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "pj4488.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "planhub.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "platform39.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "playinfinityvr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "plumbingofmesquite.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "prismintl.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "proclassifieds.in", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "prodesigntools.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "prof-toplivo.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "promexbol.com.bo", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "publivate.ca", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "q00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "qoptalk.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "qr1.at", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "qrd.by", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "quiq-uri.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "randomdata.sh", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ranwest.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "rebellionbrewing.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "refinedroomsllc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "regon.hu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "repuestosmedellin.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "revampweb-development.azurewebsites.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "rightpol.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "romanticasfm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "royaume-smoke.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "rubenroy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ruddick.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sailanitours.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sakuradata.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "saltedfish.network", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sandiegoopticas.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "saskadoodle.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "scip.ch", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "seaviewkohchang.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "secoseal.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sedlakovalegal.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sekainokokki.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "seolotsen.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sexyfotosvandep.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "shahpurjat.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "shearin.pro", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "shixuen.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "shotsleeve.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "shulyaka.org.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "simbamail.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sinanaydemir.com.tr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sneakersmexs.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sofaclean.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "speventos.es", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ssmm88.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "starfishconstruction.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "statnevlajky.sk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "statnivlajky.cz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "stefan.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "stina-vino.hr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "stmohrael.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "stortiservices.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "straat.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "strathspeycrown.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "studiokilund.se", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "suchtv.pk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "summitlighthousela.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "sunsdesign.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "swindontennisclub.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "swisstacticaldevelopment.ch", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "swrelay.xyz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t1208.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t2183.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t3dynamics.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t6354.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t6360.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t6364.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t6371.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t6880.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t6881.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t7809.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "t8250.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tackleyourfeelings.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tanks.je", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tarek.wtf", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "taskworld.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "taylorshillsamoan.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "teamif.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "teedb.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "theheatingoilclub.co.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "timeai.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tobefree.eu", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "togtider.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tommyemo.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "toolnerds.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "towellconstruction.ca", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "trajano.net", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "treintijden.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "trisect.uk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tropicaltravelco.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "turuncu-sepet.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "tves.gob.ve", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "u00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ucngame.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "uddin.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "unionconsulting.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "uwe-r.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "uwe.training", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v5017.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v6004.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v700bb.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v700cc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v700dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v700w.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v88522.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "v9037.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "valx.jp", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vandommelenart.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vaperion.me", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "verdensflag.dk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "veteranreservecorps.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "villagenscamuria.it", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vilnagaon.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vip00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vip11018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vip22884.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vip22994.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vip77018.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "viveport.biz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "viveport.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "viveport.io", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "viveport.life", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "viveportal.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "viveportchina.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vizeyurdu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vlaggen-landen.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vrba.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vscm888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vttnordisere.fr", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "vtupro.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "w00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "waivcollective.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "wealthsetsyoufree.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "webhostingzzp.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "webpagetest.org", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "wedohair.co", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "weinboxbuilders.co.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "weitsolutions.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "welt-flaggen.de", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "wepa.pe", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "westlandplacestudios.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "whatnot.ai", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "whattodo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "williamtai.moe", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "worldonwheels.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "worongarymedical.com.au", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "wossl.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "wppeeps.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ww00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "www00228a.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "www00228b.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "www00228c.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "www00228d.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "www00228e.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "wwwn888.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x00701.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x00708.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x00738.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x00776.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x00786.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x10007.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x10008.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x668.cc", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x9016.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x9017.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "x9718.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xinnermedia.nl", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xinpujing198.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xinpujing200.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xinpujing518.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xinpujing918.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xn--80aacilurl7aclgj2aw2e.xn--p1ai", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xn--80accdc8alelmbe9n.xn--p1ai", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xn--80aeczhjbkbcw0bk0h.xn--p1ai", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xn--80akcnmdfaffwoxl7h.xn--p1ai", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xp16.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "xs00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68aa.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68cc.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68dd.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68ee.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68ff.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68gg.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68hh.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68ii.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68jj.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68ll.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68oo.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68pp.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68qq.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68rr.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68tt.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68uu.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68yy.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y68zz.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y70102.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y70301.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y70302.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "y70303.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "yert.pink", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "z00228.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "zach.vip", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "zaledia.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "zijemvedu.sk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, + { "name": "ziledelaultimagafaavioricai.ro", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, // END OF 1-YEAR BULK HSTS ENTRIES // Only eTLD+1 domains can be submitted automatically to hstspreload.org,
diff --git a/net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java b/net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java index f5c82ad..48ac6c0 100644 --- a/net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java +++ b/net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java
@@ -9,7 +9,6 @@ import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; import android.accounts.AuthenticatorException; -import android.accounts.NetworkErrorException; import android.accounts.OperationCanceledException; import android.app.Activity; import android.content.Context; @@ -48,7 +47,7 @@ @Override public Bundle addAccount(AccountAuthenticatorResponse arg0, String accountType, String arg2, - String[] arg3, Bundle arg4) throws NetworkErrorException { + String[] arg3, Bundle arg4) { Bundle result = new Bundle(); result.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_BAD_REQUEST); result.putString(AccountManager.KEY_ERROR_MESSAGE, "Can't add new SPNEGO accounts"); @@ -56,8 +55,7 @@ } @Override - public Bundle confirmCredentials(AccountAuthenticatorResponse arg0, Account arg1, Bundle arg2) - throws NetworkErrorException { + public Bundle confirmCredentials(AccountAuthenticatorResponse arg0, Account arg1, Bundle arg2) { Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true); return result; @@ -70,7 +68,7 @@ @Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, - String authTokenType, Bundle options) throws NetworkErrorException { + String authTokenType, Bundle options) { long nativeQuery = nativeGetNextQuery(sNativeDummySpnegoAuthenticator); String incomingToken = options.getString(HttpNegotiateConstants.KEY_INCOMING_AUTH_TOKEN); nativeCheckGetTokenArguments(nativeQuery, incomingToken); @@ -106,8 +104,7 @@ } @Override - public Bundle hasFeatures(AccountAuthenticatorResponse arg0, Account arg1, String[] features) - throws NetworkErrorException { + public Bundle hasFeatures(AccountAuthenticatorResponse arg0, Account arg1, String[] features) { Bundle result = new Bundle(); for (String feature : features) { if (!feature.equals(HttpNegotiateConstants.SPNEGO_FEATURE)) { @@ -120,8 +117,8 @@ } @Override - public Bundle updateCredentials(AccountAuthenticatorResponse arg0, Account arg1, String arg2, - Bundle arg3) throws NetworkErrorException { + public Bundle updateCredentials( + AccountAuthenticatorResponse arg0, Account arg1, String arg2, Bundle arg3) { Bundle result = new Bundle(); result.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_BAD_REQUEST); result.putString(AccountManager.KEY_ERROR_MESSAGE, "Can't add new SPNEGO accounts");
diff --git a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java index 2e4df562..815524c 100644 --- a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java +++ b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java
@@ -140,8 +140,7 @@ * the service at server destruction time. * @param httpsSetting Whether the server should use HTTPS. */ - public void initializeNative(Context context, ServerHTTPSSetting httpsSetting) - throws InterruptedException { + public void initializeNative(Context context, ServerHTTPSSetting httpsSetting) { mContext = context; Intent intent = new Intent(EMBEDDED_TEST_SERVER_SERVICE); @@ -153,7 +152,11 @@ synchronized (mImplMonitor) { Log.i(TAG, "Waiting for EmbeddedTestServer service connection."); while (mImpl == null) { - mImplMonitor.wait(SERVICE_CONNECTION_WAIT_INTERVAL_MS); + try { + mImplMonitor.wait(SERVICE_CONNECTION_WAIT_INTERVAL_MS); + } catch (InterruptedException e) { + // Ignore the InterruptedException. Rely on the outer while loop to re-run. + } Log.i(TAG, "Still waiting for EmbeddedTestServer service connection."); } Log.i(TAG, "EmbeddedTestServer service connected."); @@ -322,8 +325,7 @@ * @param context The context in which the server will run. * @return The created server. */ - public static EmbeddedTestServer createAndStartServer(Context context) - throws InterruptedException { + public static EmbeddedTestServer createAndStartServer(Context context) { return createAndStartServerWithPort(context, 0); } @@ -336,8 +338,7 @@ * @param port The port to use for the server, 0 to auto-select an unused port. * @return The created server. */ - public static EmbeddedTestServer createAndStartServerWithPort(Context context, int port) - throws InterruptedException { + public static EmbeddedTestServer createAndStartServerWithPort(Context context, int port) { Assert.assertNotEquals("EmbeddedTestServer should not be created on UiThread, " + "the instantiation will hang forever waiting for tasks to post to UI thread", Looper.getMainLooper(), Looper.myLooper()); @@ -355,7 +356,7 @@ * @return The created server. */ public static EmbeddedTestServer createAndStartHTTPSServer( - Context context, @ServerCertificate int serverCertificate) throws InterruptedException { + Context context, @ServerCertificate int serverCertificate) { return createAndStartHTTPSServerWithPort(context, serverCertificate, 0 /* port */); } @@ -369,8 +370,8 @@ * @param port The port to use for the server, 0 to auto-select an unused port. * @return The created server. */ - public static EmbeddedTestServer createAndStartHTTPSServerWithPort(Context context, - @ServerCertificate int serverCertificate, int port) throws InterruptedException { + public static EmbeddedTestServer createAndStartHTTPSServerWithPort( + Context context, @ServerCertificate int serverCertificate, int port) { Assert.assertNotEquals("EmbeddedTestServer should not be created on UiThread, " + "the instantiation will hang forever waiting for tasks" + " to post to UI thread", @@ -390,7 +391,7 @@ * @return The created server. */ public static <T extends EmbeddedTestServer> T initializeAndStartServer( - T server, Context context, int port) throws InterruptedException { + T server, Context context, int port) { server.initializeNative(context, ServerHTTPSSetting.USE_HTTP); server.addDefaultHandlers(""); if (!server.start(port)) { @@ -412,8 +413,7 @@ * @return The created server. */ public static <T extends EmbeddedTestServer> T initializeAndStartHTTPSServer( - T server, Context context, @ServerCertificate int serverCertificate, int port) - throws InterruptedException { + T server, Context context, @ServerCertificate int serverCertificate, int port) { server.initializeNative(context, ServerHTTPSSetting.USE_HTTPS); server.addDefaultHandlers(""); server.setSSLConfig(serverCertificate);
diff --git a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerRule.java b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerRule.java index 236ae63..bd1282df 100644 --- a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerRule.java +++ b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerRule.java
@@ -51,16 +51,11 @@ public EmbeddedTestServer getServer() { synchronized (mLock) { if (mServer == null) { - try { - Context context = InstrumentationRegistry.getContext(); - mServer = mUseHttps - ? EmbeddedTestServer.createAndStartHTTPSServerWithPort( - context, mCertificateType, mServerPort) - : EmbeddedTestServer.createAndStartServerWithPort(context, mServerPort); - } catch (InterruptedException e) { - throw new EmbeddedTestServer.EmbeddedTestServerFailure( - "Test server didn't start"); - } + Context context = InstrumentationRegistry.getContext(); + mServer = mUseHttps + ? EmbeddedTestServer.createAndStartHTTPSServerWithPort( + context, mCertificateType, mServerPort) + : EmbeddedTestServer.createAndStartServerWithPort(context, mServerPort); } return mServer; }
diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc index 2515e7f..eee1294 100644 --- a/net/url_request/url_request_context_builder_unittest.cc +++ b/net/url_request/url_request_context_builder_unittest.cc
@@ -7,6 +7,7 @@ #include "base/run_loop.h" #include "build/build_config.h" #include "net/base/request_priority.h" +#include "net/base/test_completion_callback.h" #include "net/dns/host_resolver.h" #include "net/dns/host_resolver_manager.h" #include "net/dns/mock_host_resolver.h" @@ -16,6 +17,7 @@ #include "net/log/net_log_with_source.h" #include "net/ssl/ssl_info.h" #include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/gtest_util.h" #include "net/test/test_with_task_environment.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/url_request/url_request.h" @@ -208,6 +210,33 @@ } #endif // BUILDFLAG(ENABLE_REPORTING) +TEST_F(URLRequestContextBuilderTest, ShutdownHostResolverWithPendingRequest) { + auto mock_host_resolver = std::make_unique<MockHostResolver>(); + mock_host_resolver->rules()->AddRule("example.com", "1.2.3.4"); + mock_host_resolver->set_ondemand_mode(true); + + std::unique_ptr<URLRequestContext> context(builder_.Build()); + context->set_host_resolver(mock_host_resolver.get()); + + std::unique_ptr<HostResolver::ResolveHostRequest> request = + context->host_resolver()->CreateRequest( + HostPortPair("example.com", 1234), NetLogWithSource(), base::nullopt); + TestCompletionCallback callback; + int rv = request->Start(callback.callback()); + ASSERT_TRUE(mock_host_resolver->has_pending_requests()); + + context.reset(); + mock_host_resolver->ResolveAllPending(); + + EXPECT_FALSE(mock_host_resolver->has_pending_requests()); + EXPECT_TRUE(mock_host_resolver->rules_map().empty()); + + // Request should never complete. + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(rv, test::IsError(ERR_IO_PENDING)); + EXPECT_FALSE(callback.have_result()); +} + TEST_F(URLRequestContextBuilderTest, DefaultHostResolver) { auto manager = std::make_unique<HostResolverManager>( HostResolver::ManagerOptions(), nullptr /* system_dns_config_notifier */,
diff --git a/printing/backend/cups_ipp_util.cc b/printing/backend/cups_ipp_util.cc index b6fc510..3c07b4b4 100644 --- a/printing/backend/cups_ipp_util.cc +++ b/printing/backend/cups_ipp_util.cc
@@ -129,13 +129,14 @@ // We read the media name expressed by |value| and return a Paper // with the vendor_id and size_um members populated. -// We don't handle l10n here, so we don't populate the display_name -// member, deferring that to the caller. +// We don't handle l10n here. We do populate the display_name member +// with the prettified vendor ID, but fully expect the caller to clobber +// this if a better localization exists. PrinterSemanticCapsAndDefaults::Paper ParsePaper(base::StringPiece value) { // <name>_<width>x<height>{in,mm} // e.g. na_letter_8.5x11in, iso_a4_210x297mm - const std::vector<base::StringPiece> pieces = base::SplitStringPiece( + std::vector<base::StringPiece> pieces = base::SplitStringPiece( value, "_", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); // we expect at least a display string and a dimension string if (pieces.size() < 2) @@ -146,6 +147,9 @@ PrinterSemanticCapsAndDefaults::Paper paper; paper.vendor_id = value.as_string(); paper.size_um = DimensionsToMicrons(dimensions); + // Omits the final token describing the media dimensions. + pieces.pop_back(); + paper.display_name = base::JoinString(pieces, " "); return paper; }
diff --git a/printing/backend/cups_ipp_util_unittest.cc b/printing/backend/cups_ipp_util_unittest.cc index 6c29db8..dce6598 100644 --- a/printing/backend/cups_ipp_util_unittest.cc +++ b/printing/backend/cups_ipp_util_unittest.cc
@@ -186,9 +186,9 @@ CapsAndDefaultsFromPrinter(*printer_, &caps); PrinterSemanticCapsAndDefaults::Paper paper = caps.papers[0]; - // media display name localization is handled in + // media display name localization is handled more fully in // GetPrinterCapabilitiesOnBlockingPoolThread(). - EXPECT_EQ("", paper.display_name); + EXPECT_EQ("iso a4", paper.display_name); EXPECT_EQ("iso_a4_210x297mm", paper.vendor_id); EXPECT_EQ(210000, paper.size_um.width()); EXPECT_EQ(297000, paper.size_um.height()); @@ -199,9 +199,9 @@ PrinterSemanticCapsAndDefaults caps; CapsAndDefaultsFromPrinter(*printer_, &caps); - // media display name localization is handled in + // media display name localization is handled more fully in // GetPrinterCapabilitiesOnBlockingPoolThread(). - EXPECT_EQ("", caps.default_paper.display_name); + EXPECT_EQ("na legal", caps.default_paper.display_name); EXPECT_EQ("na_legal_8.5x14in", caps.default_paper.vendor_id); EXPECT_EQ(215900, caps.default_paper.size_um.width()); EXPECT_EQ(355600, caps.default_paper.size_um.height());
diff --git a/printing/common/printing_features.cc b/printing/common/printing_features.cc index 41b37e0..731f33d 100644 --- a/printing/common/printing_features.cc +++ b/printing/common/printing_features.cc
@@ -8,7 +8,7 @@ namespace features { const base::Feature kHarfBuzzPDFSubsetter{"HarfBuzzPDFSubsetter", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; } // namespace features } // namespace printing
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java b/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java index 79cdc00..e11251c2 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java
@@ -69,7 +69,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testSwipeRecognition() throws Exception { + public void testSwipeRecognition() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); Assert.assertFalse(mDetector.isSwiping()); Assert.assertFalse(mDetector.isPinching()); @@ -86,7 +86,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testPinchRecognition() throws Exception { + public void testPinchRecognition() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); Assert.assertFalse(mDetector.isSwiping()); Assert.assertFalse(mDetector.isPinching()); @@ -103,7 +103,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testNoMotion() throws Exception { + public void testNoMotion() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); mCurrentPositions[0].x += mTouchSlop / 2; mCurrentPositions[0].y += mTouchSlop / 2; @@ -118,7 +118,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerStationary() throws Exception { + public void testOneFingerStationary() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); // The triggering threshold in this case (one finger stationary) is mTouchSlop * 2; @@ -142,7 +142,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testUnevenPinch() throws Exception { + public void testUnevenPinch() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); for (int i = 0; i < 50; i++) { mCurrentPositions[0].x -= 2; @@ -158,7 +158,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testUnevenPinch2() throws Exception { + public void testUnevenPinch2() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); for (int i = 0; i < 50; i++) { mCurrentPositions[0].x -= 3; @@ -174,7 +174,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testUnevenSwipe() throws Exception { + public void testUnevenSwipe() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); for (int i = 0; i < 50; i++) { // The fingers need to move similarly enough so that one finger moves a distance of @@ -193,7 +193,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testUnevenSwipe2() throws Exception { + public void testUnevenSwipe2() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); for (int i = 0; i < 50; i++) { // The fingers need to move similarly enough so that one finger moves a distance of @@ -212,7 +212,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testDetectorReset() throws Exception { + public void testDetectorReset() { injectEvent(MotionEvent.ACTION_POINTER_DOWN); mCurrentPositions[0].x += mTouchSlop * 3; injectEvent(MotionEvent.ACTION_MOVE);
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java b/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java index f51900ac..d26b6797 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java
@@ -113,7 +113,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerDownUp() throws Exception { + public void testOneFingerDownUp() { injectDownEvent(0, 0, 0); injectUpEvent(0); mListener.assertTapDetected(1, 0, 0); @@ -123,7 +123,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testMultipleFingerDownUp() throws Exception { + public void testMultipleFingerDownUp() { injectDownEvent(0, 0, 0); injectDownEvent(1, 100, 100); injectDownEvent(2, 200, 200); @@ -137,7 +137,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testMultipleFingerDownUpReversed() throws Exception { + public void testMultipleFingerDownUpReversed() { injectDownEvent(0, 0, 0); injectDownEvent(1, 100, 100); injectDownEvent(2, 200, 200); @@ -151,7 +151,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testMultipleFingerSmallMovements() throws Exception { + public void testMultipleFingerSmallMovements() { injectDownEvent(0, 0, 0); injectDownEvent(1, 100, 100); injectDownEvent(2, 200, 200); @@ -168,7 +168,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testLargeMotion() throws Exception { + public void testLargeMotion() { injectDownEvent(0, 0, 0); injectDownEvent(1, 100, 100); injectDownEvent(2, 200, 200);
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java b/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java index 5f4858828..b2502fa 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java
@@ -71,7 +71,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOnTapWithNoEvents() throws Exception { + public void testOnTapWithNoEvents() { Assert.assertFalse(mInputStrategy.onTap(InputStub.BUTTON_LEFT)); mInputInjector.assertEmpty(); } @@ -79,7 +79,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerTap() throws Exception { + public void testOneFingerTap() { injectDownEvent(0, 0, 0); injectUpEvent(0); mInputInjector.assertEmpty(); @@ -93,7 +93,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testLifoTwoFingerTap() throws Exception { + public void testLifoTwoFingerTap() { // Verify that the right click coordinates occur at the point of the first tap when the // initial finger is lifted up last. injectDownEvent(0, 0, 0); @@ -111,7 +111,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testFifoTwoFingerTap() throws Exception { + public void testFifoTwoFingerTap() { // Verify that the right click coordinates occur at the point of the first tap when the // initial finger is lifted up first. injectDownEvent(0, 0, 0); @@ -129,7 +129,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testThreeFingerTap() throws Exception { + public void testThreeFingerTap() { injectDownEvent(0, 0, 0); injectDownEvent(1, 25, 25); injectDownEvent(2, 50, 50); @@ -145,7 +145,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerTapSequence() throws Exception { + public void testOneFingerTapSequence() { int tapSequenceCount = 10; for (int i = 0; i < tapSequenceCount; i++) { injectDownEvent(0, i, i); @@ -163,7 +163,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testInvalidThenValidTap() throws Exception { + public void testInvalidThenValidTap() { // First an invalid tap, verify it is ignored. injectDownEvent(0, 0, 0); injectDownEvent(1, 25, 25); @@ -190,7 +190,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOnPressAndHoldWithNoEvents() throws Exception { + public void testOnPressAndHoldWithNoEvents() { Assert.assertFalse(mInputStrategy.onPressAndHold(InputStub.BUTTON_LEFT)); mInputInjector.assertEmpty(); } @@ -198,7 +198,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerLongPress() throws Exception { + public void testOneFingerLongPress() { injectDownEvent(0, 0, 0); mInputInjector.assertEmpty(); @@ -215,7 +215,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerLongPressThenPan() throws Exception { + public void testOneFingerLongPressThenPan() { injectDownEvent(0, 0, 0); mInputInjector.assertEmpty(); @@ -238,7 +238,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testTwoFingerLongPress() throws Exception { + public void testTwoFingerLongPress() { injectDownEvent(0, 0, 0); injectDownEvent(1, 1, 1); mInputInjector.assertEmpty(); @@ -254,7 +254,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testOneFingerPan() throws Exception { + public void testOneFingerPan() { injectDownEvent(0, 0, 0); // Inject a few move events to simulate a pan. @@ -270,7 +270,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testVerticalTwoFingerPan() throws Exception { + public void testVerticalTwoFingerPan() { final int fingerOnePosX = 0; final int fingerTwoPosX = 10; injectDownEvent(0, fingerOnePosX, 0); @@ -311,7 +311,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testHorizontalTwoFingerPan() throws Exception { + public void testHorizontalTwoFingerPan() { final int fingerOnePosY = 0; final int fingerTwoPosY = 10; injectDownEvent(0, 0, fingerOnePosY); @@ -352,7 +352,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testCancelledTwoFingerPan() throws Exception { + public void testCancelledTwoFingerPan() { final int fingerOnePosX = 0; final int fingerTwoPosX = 10; injectDownEvent(0, fingerOnePosX, 0); @@ -402,7 +402,7 @@ @Test @SmallTest @Feature({"Chromoting"}) - public void testTooManyEventsCancelsGesture() throws Exception { + public void testTooManyEventsCancelsGesture() { final int fingerOnePosX = 0; final int fingerTwoPosX = 10; injectDownEvent(0, fingerOnePosX, 0);
diff --git a/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java b/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java index f70c7a3..22aec77 100644 --- a/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java +++ b/services/device/generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java
@@ -107,7 +107,7 @@ doReturn(mSensorManager).when(mContext).getSystemService(Context.SENSOR_SERVICE); doAnswer(new Answer<List<Sensor>>() { @Override - public List<Sensor> answer(final InvocationOnMock invocation) throws Throwable { + public List<Sensor> answer(final InvocationOnMock invocation) { return getMockSensors((int) (Integer) (invocation.getArguments())[0]); } })
diff --git a/services/shape_detection/android/javatests/src/org/chromium/shape_detection/FaceDetectionImplTest.java b/services/shape_detection/android/javatests/src/org/chromium/shape_detection/FaceDetectionImplTest.java index be281d9a..85a7fdce8 100644 --- a/services/shape_detection/android/javatests/src/org/chromium/shape_detection/FaceDetectionImplTest.java +++ b/services/shape_detection/android/javatests/src/org/chromium/shape_detection/FaceDetectionImplTest.java
@@ -104,7 +104,7 @@ @Test @SmallTest @Feature({"ShapeDetection"}) - public void testDetectHandlesOddWidthWithAndroidAPI() throws Exception { + public void testDetectHandlesOddWidthWithAndroidAPI() { // Pad the image so that the width is odd. Bitmap paddedBitmap = Bitmap.createBitmap(MONA_LISA_BITMAP.imageInfo.width + 1, MONA_LISA_BITMAP.imageInfo.height, Bitmap.Config.ARGB_8888);
diff --git a/services/shape_detection/barcode_detection_impl_mac_vision.h b/services/shape_detection/barcode_detection_impl_mac_vision.h index 5c31b03..5de3667 100644 --- a/services/shape_detection/barcode_detection_impl_mac_vision.h +++ b/services/shape_detection/barcode_detection_impl_mac_vision.h
@@ -14,7 +14,7 @@ #include "base/mac/sdk_forward_declarations.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/barcode_detection_impl_mac_vision_api.h" #include "services/shape_detection/detection_utils_mac.h" #include "services/shape_detection/public/mojom/barcodedetection.mojom.h" @@ -39,8 +39,9 @@ void Detect(const SkBitmap& bitmap, mojom::BarcodeDetection::DetectCallback callback) override; - void SetBinding(mojo::StrongBindingPtr<mojom::BarcodeDetection> binding) { - binding_ = std::move(binding); + void SetReceiver( + mojo::SelfOwnedReceiverRef<mojom::BarcodeDetection> receiver) { + receiver_ = std::move(receiver); } static std::vector<shape_detection::mojom::BarcodeFormat> @@ -55,7 +56,7 @@ base::scoped_nsobject<NSSet<NSString*>> symbology_hints_; std::unique_ptr<VisionAPIAsyncRequestMac> barcodes_async_request_; DetectCallback detected_callback_; - mojo::StrongBindingPtr<mojom::BarcodeDetection> binding_; + mojo::SelfOwnedReceiverRef<mojom::BarcodeDetection> receiver_; base::WeakPtrFactory<BarcodeDetectionImplMacVision> weak_factory_; DISALLOW_COPY_AND_ASSIGN(BarcodeDetectionImplMacVision);
diff --git a/services/shape_detection/barcode_detection_impl_mac_vision.mm b/services/shape_detection/barcode_detection_impl_mac_vision.mm index 1dbb3b2..2e59312 100644 --- a/services/shape_detection/barcode_detection_impl_mac_vision.mm +++ b/services/shape_detection/barcode_detection_impl_mac_vision.mm
@@ -165,14 +165,14 @@ detected_callback_ = std::move(callback); // This prevents the Detect function from being called before the // VisionAPIAsyncRequestMac completes. - if (binding_) // Can be unbound in unit testing. - binding_->PauseIncomingMethodCallProcessing(); + if (receiver_) // Can be unbound in unit testing. + receiver_->PauseIncomingMethodCallProcessing(); } void BarcodeDetectionImplMacVision::OnBarcodesDetected(VNRequest* request, NSError* error) { - if (binding_) // Can be unbound in unit testing. - binding_->ResumeIncomingMethodCallProcessing(); + if (receiver_) // Can be unbound in unit testing. + receiver_->ResumeIncomingMethodCallProcessing(); if ([request.results count] == 0 || error) { std::move(detected_callback_).Run({});
diff --git a/services/shape_detection/barcode_detection_provider_impl.h b/services/shape_detection/barcode_detection_provider_impl.h index cff6f22..36ab1199 100644 --- a/services/shape_detection/barcode_detection_provider_impl.h +++ b/services/shape_detection/barcode_detection_provider_impl.h
@@ -8,7 +8,8 @@ #include <memory> #include <utility> -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h" namespace shape_detection { @@ -19,9 +20,10 @@ ~BarcodeDetectionProviderImpl() override = default; static void Create( - shape_detection::mojom::BarcodeDetectionProviderRequest request) { - mojo::MakeStrongBinding(std::make_unique<BarcodeDetectionProviderImpl>(), - std::move(request)); + mojo::PendingReceiver<shape_detection::mojom::BarcodeDetectionProvider> + receiver) { + mojo::MakeSelfOwnedReceiver( + std::make_unique<BarcodeDetectionProviderImpl>(), std::move(receiver)); } void CreateBarcodeDetection(
diff --git a/services/shape_detection/barcode_detection_provider_mac.h b/services/shape_detection/barcode_detection_provider_mac.h index 0fa741b..0b3719d 100644 --- a/services/shape_detection/barcode_detection_provider_mac.h +++ b/services/shape_detection/barcode_detection_provider_mac.h
@@ -9,6 +9,7 @@ #include <vector> #include "base/macros.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "services/shape_detection/barcode_detection_impl_mac_vision_api.h" #include "services/shape_detection/public/mojom/barcodedetection.mojom.h" #include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h" @@ -27,9 +28,10 @@ explicit BarcodeDetectionProviderMac(std::unique_ptr<VisionAPIInterface>); ~BarcodeDetectionProviderMac() override; - // Binds BarcodeDetection provider request to the implementation of + // Binds BarcodeDetection provider receiver to the implementation of // mojom::BarcodeDetectionProvider. - static void Create(mojom::BarcodeDetectionProviderRequest request); + static void Create( + mojo::PendingReceiver<mojom::BarcodeDetectionProvider> receiver); void CreateBarcodeDetection( mojo::PendingReceiver<mojom::BarcodeDetection> receiver,
diff --git a/services/shape_detection/barcode_detection_provider_mac.mm b/services/shape_detection/barcode_detection_provider_mac.mm index d46b2c5..2fd913c 100644 --- a/services/shape_detection/barcode_detection_provider_mac.mm +++ b/services/shape_detection/barcode_detection_provider_mac.mm
@@ -8,6 +8,7 @@ #include <utility> #include "base/logging.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/barcode_detection_impl_mac.h" #include "services/shape_detection/barcode_detection_impl_mac_vision.h" @@ -23,9 +24,9 @@ // static void BarcodeDetectionProviderMac::Create( - mojom::BarcodeDetectionProviderRequest request) { - mojo::MakeStrongBinding(std::make_unique<BarcodeDetectionProviderMac>(), - std::move(request)); + mojo::PendingReceiver<mojom::BarcodeDetectionProvider> receiver) { + mojo::MakeSelfOwnedReceiver(std::make_unique<BarcodeDetectionProviderMac>(), + std::move(receiver)); } void BarcodeDetectionProviderMac::CreateBarcodeDetection( @@ -40,9 +41,8 @@ auto impl = std::make_unique<BarcodeDetectionImplMacVision>(std::move(options)); auto* impl_ptr = impl.get(); - impl_ptr->SetBinding(mojo::MakeStrongBinding( - std::move(impl), mojo::InterfaceRequest<mojom::BarcodeDetection>( - std::move(receiver)))); + impl_ptr->SetReceiver( + mojo::MakeSelfOwnedReceiver(std::move(impl), std::move(receiver))); return; } }
diff --git a/services/shape_detection/barcode_detection_provider_mac_unittest.mm b/services/shape_detection/barcode_detection_provider_mac_unittest.mm index 1c0aa3a..121c015 100644 --- a/services/shape_detection/barcode_detection_provider_mac_unittest.mm +++ b/services/shape_detection/barcode_detection_provider_mac_unittest.mm
@@ -15,7 +15,7 @@ #include "base/test/bind_test_util.h" #include "base/test/task_environment.h" #include "mojo/public/cpp/bindings/remote.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "services/shape_detection/barcode_detection_impl_mac_vision.h" #include "services/shape_detection/barcode_detection_provider_mac.h" @@ -234,18 +234,17 @@ vision_framework_ = dlopen("/System/Library/Frameworks/Vision.framework/Vision", RTLD_LAZY); - mojom::BarcodeDetectionProviderPtr provider_ptr; - auto provider_request = mojo::MakeRequest(&provider_ptr); - mojo::MakeStrongBinding(CreateBarcodeProviderMac(CreateVisionAPI()), - std::move(provider_request)); + mojo::Remote<mojom::BarcodeDetectionProvider> provider_remote; + mojo::MakeSelfOwnedReceiver(CreateBarcodeProviderMac(CreateVisionAPI()), + provider_remote.BindNewPipeAndPassReceiver()); auto options = mojom::BarcodeDetectorOptions::New(); options->formats = {mojom::BarcodeFormat::UNKNOWN}; mojo::test::BadMessageObserver observer; mojo::Remote<mojom::BarcodeDetection> impl; - provider_ptr->CreateBarcodeDetection(impl.BindNewPipeAndPassReceiver(), - std::move(options)); + provider_remote->CreateBarcodeDetection(impl.BindNewPipeAndPassReceiver(), + std::move(options)); EXPECT_EQ("Formats hint contains UNKNOWN BarcodeFormat.", observer.WaitForBadMessage());
diff --git a/services/shape_detection/face_detection_impl_mac_vision.h b/services/shape_detection/face_detection_impl_mac_vision.h index c66be68..a087dbc9 100644 --- a/services/shape_detection/face_detection_impl_mac_vision.h +++ b/services/shape_detection/face_detection_impl_mac_vision.h
@@ -12,7 +12,7 @@ #include "base/mac/sdk_forward_declarations.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/detection_utils_mac.h" #include "services/shape_detection/public/mojom/facedetection.mojom.h" @@ -31,8 +31,8 @@ void Detect(const SkBitmap& bitmap, mojom::FaceDetection::DetectCallback callback) override; - void SetBinding(mojo::StrongBindingPtr<mojom::FaceDetection> binding) { - binding_ = std::move(binding); + void SetReceiver(mojo::SelfOwnedReceiverRef<mojom::FaceDetection> receiver) { + receiver_ = std::move(receiver); } private: @@ -41,7 +41,7 @@ CGSize image_size_; std::unique_ptr<VisionAPIAsyncRequestMac> landmarks_async_request_; DetectCallback detected_callback_; - mojo::StrongBindingPtr<mojom::FaceDetection> binding_; + mojo::SelfOwnedReceiverRef<mojom::FaceDetection> receiver_; base::WeakPtrFactory<FaceDetectionImplMacVision> weak_factory_; DISALLOW_COPY_AND_ASSIGN(FaceDetectionImplMacVision);
diff --git a/services/shape_detection/face_detection_impl_mac_vision.mm b/services/shape_detection/face_detection_impl_mac_vision.mm index 52bef29e..69e3696 100644 --- a/services/shape_detection/face_detection_impl_mac_vision.mm +++ b/services/shape_detection/face_detection_impl_mac_vision.mm
@@ -63,14 +63,14 @@ detected_callback_ = std::move(callback); // This prevents the Detect function from being called before the // VisionAPIAsyncRequestMac completes. - if (binding_) // Can be unbound in unit testing. - binding_->PauseIncomingMethodCallProcessing(); + if (receiver_) // Can be unbound in unit testing. + receiver_->PauseIncomingMethodCallProcessing(); } void FaceDetectionImplMacVision::OnFacesDetected(VNRequest* request, NSError* error) { - if (binding_) // Can be unbound in unit testing. - binding_->ResumeIncomingMethodCallProcessing(); + if (receiver_) // Can be unbound in unit testing. + receiver_->ResumeIncomingMethodCallProcessing(); if (![request.results count] || error) { std::move(detected_callback_).Run({});
diff --git a/services/shape_detection/face_detection_impl_win.cc b/services/shape_detection/face_detection_impl_win.cc index 389a3cb..369d021a 100644 --- a/services/shape_detection/face_detection_impl_win.cc +++ b/services/shape_detection/face_detection_impl_win.cc
@@ -47,7 +47,7 @@ detected_face_callback_ = std::move(callback); // This prevents the Detect function from being called before the // AsyncOperation completes. - binding_->PauseIncomingMethodCallProcessing(); + receiver_->PauseIncomingMethodCallProcessing(); } HRESULT FaceDetectionImplWin::BeginDetect(const SkBitmap& bitmap) { @@ -122,7 +122,7 @@ ComPtr<IVector<DetectedFace*>> result) { std::move(detected_face_callback_) .Run(BuildFaceDetectionResult(std::move(result))); - binding_->ResumeIncomingMethodCallProcessing(); + receiver_->ResumeIncomingMethodCallProcessing(); } } // namespace shape_detection
diff --git a/services/shape_detection/face_detection_impl_win.h b/services/shape_detection/face_detection_impl_win.h index b86f807..9af4ffa78 100644 --- a/services/shape_detection/face_detection_impl_win.h +++ b/services/shape_detection/face_detection_impl_win.h
@@ -16,7 +16,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/public/mojom/facedetection.mojom.h" class SkBitmap; @@ -34,8 +34,8 @@ ABI::Windows::Graphics::Imaging::BitmapPixelFormat pixel_format); ~FaceDetectionImplWin() override; - void SetBinding(mojo::StrongBindingPtr<mojom::FaceDetection> binding) { - binding_ = std::move(binding); + void SetReceiver(mojo::SelfOwnedReceiverRef<mojom::FaceDetection> receiver) { + receiver_ = std::move(receiver); } // mojom::FaceDetection implementation. @@ -62,7 +62,7 @@ ABI::Windows::Graphics::Imaging::BitmapPixelFormat pixel_format_; DetectCallback detected_face_callback_; - mojo::StrongBindingPtr<mojom::FaceDetection> binding_; + mojo::SelfOwnedReceiverRef<mojom::FaceDetection> receiver_; base::WeakPtrFactory<FaceDetectionImplWin> weak_factory_{this};
diff --git a/services/shape_detection/face_detection_provider_impl.h b/services/shape_detection/face_detection_provider_impl.h index 195df92..18fcb4c 100644 --- a/services/shape_detection/face_detection_provider_impl.h +++ b/services/shape_detection/face_detection_provider_impl.h
@@ -5,7 +5,8 @@ #ifndef SERVICES_SHAPE_DETECTION_FACE_DETECTION_PROVIDER_IMPL_H_ #define SERVICES_SHAPE_DETECTION_FACE_DETECTION_PROVIDER_IMPL_H_ -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/public/mojom/facedetection_provider.mojom.h" namespace shape_detection { @@ -16,9 +17,10 @@ ~FaceDetectionProviderImpl() override = default; static void Create( - shape_detection::mojom::FaceDetectionProviderRequest request) { - mojo::MakeStrongBinding(std::make_unique<FaceDetectionProviderImpl>(), - std::move(request)); + mojo::PendingReceiver<shape_detection::mojom::FaceDetectionProvider> + receiver) { + mojo::MakeSelfOwnedReceiver(std::make_unique<FaceDetectionProviderImpl>(), + std::move(receiver)); } void CreateFaceDetection(
diff --git a/services/shape_detection/face_detection_provider_mac.h b/services/shape_detection/face_detection_provider_mac.h index 0ccfc356..a8f878bb 100644 --- a/services/shape_detection/face_detection_provider_mac.h +++ b/services/shape_detection/face_detection_provider_mac.h
@@ -6,6 +6,7 @@ #define SERVICES_SHAPE_DETECTION_FACE_DETECTION_PROVIDER_MAC_H_ #include "base/macros.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "services/shape_detection/public/mojom/facedetection_provider.mojom.h" namespace shape_detection { @@ -18,9 +19,10 @@ FaceDetectionProviderMac(); ~FaceDetectionProviderMac() override; - // Binds FaceDetection provider request to the implementation of + // Binds FaceDetection provider receiver to the implementation of // mojom::FaceDetectionProvider. - static void Create(mojom::FaceDetectionProviderRequest request); + static void Create( + mojo::PendingReceiver<mojom::FaceDetectionProvider> receiver); void CreateFaceDetection(mojo::PendingReceiver<mojom::FaceDetection> receiver, mojom::FaceDetectorOptionsPtr options) override;
diff --git a/services/shape_detection/face_detection_provider_mac.mm b/services/shape_detection/face_detection_provider_mac.mm index e3b1a28b..8cf672ad 100644 --- a/services/shape_detection/face_detection_provider_mac.mm +++ b/services/shape_detection/face_detection_provider_mac.mm
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/face_detection_impl_mac.h" #include "services/shape_detection/face_detection_impl_mac_vision.h" @@ -19,9 +20,9 @@ // static void FaceDetectionProviderMac::Create( - mojom::FaceDetectionProviderRequest request) { - mojo::MakeStrongBinding(std::make_unique<FaceDetectionProviderMac>(), - std::move(request)); + mojo::PendingReceiver<mojom::FaceDetectionProvider> receiver) { + mojo::MakeSelfOwnedReceiver(std::make_unique<FaceDetectionProviderMac>(), + std::move(receiver)); } void FaceDetectionProviderMac::CreateFaceDetection( @@ -34,9 +35,8 @@ if (!options->fast_mode) { auto impl = std::make_unique<FaceDetectionImplMacVision>(); auto* impl_ptr = impl.get(); - impl_ptr->SetBinding(mojo::MakeStrongBinding( - std::move(impl), - mojo::InterfaceRequest<mojom::FaceDetection>(std::move(receiver)))); + impl_ptr->SetReceiver( + mojo::MakeSelfOwnedReceiver(std::move(impl), std::move(receiver))); return; } }
diff --git a/services/shape_detection/face_detection_provider_win.cc b/services/shape_detection/face_detection_provider_win.cc index b87feabad..341884e 100644 --- a/services/shape_detection/face_detection_provider_win.cc +++ b/services/shape_detection/face_detection_provider_win.cc
@@ -13,7 +13,8 @@ #include "base/win/post_async_results.h" #include "base/win/scoped_hstring.h" #include "base/win/windows_version.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" namespace shape_detection { @@ -111,7 +112,7 @@ // the message pipe, then the callback OnFaceDetectorCreated will be not // called. This prevents this object from being destroyed before the // AsyncOperation completes. - binding_->PauseIncomingMethodCallProcessing(); + receiver_->PauseIncomingMethodCallProcessing(); } FaceDetectionProviderWin::FaceDetectionProviderWin() {} @@ -122,7 +123,7 @@ mojo::PendingReceiver<shape_detection::mojom::FaceDetection> receiver, BitmapPixelFormat pixel_format, ComPtr<IFaceDetector> face_detector) { - binding_->ResumeIncomingMethodCallProcessing(); + receiver_->ResumeIncomingMethodCallProcessing(); if (!face_detector) return; @@ -140,10 +141,8 @@ auto impl = std::make_unique<FaceDetectionImplWin>( std::move(face_detector), std::move(bitmap_factory), pixel_format); auto* impl_ptr = impl.get(); - impl_ptr->SetBinding(mojo::MakeStrongBinding( - std::move(impl), - mojo::InterfaceRequest<shape_detection::mojom::FaceDetection>( - std::move(receiver)))); + impl_ptr->SetReceiver( + mojo::MakeSelfOwnedReceiver(std::move(impl), std::move(receiver))); } } // namespace shape_detection
diff --git a/services/shape_detection/face_detection_provider_win.h b/services/shape_detection/face_detection_provider_win.h index c46ed82..1cb4ff0b 100644 --- a/services/shape_detection/face_detection_provider_win.h +++ b/services/shape_detection/face_detection_provider_win.h
@@ -13,7 +13,8 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/face_detection_impl_win.h" #include "services/shape_detection/public/mojom/facedetection_provider.mojom.h" @@ -26,11 +27,12 @@ ~FaceDetectionProviderWin() override; static void Create( - shape_detection::mojom::FaceDetectionProviderRequest request) { + mojo::PendingReceiver<shape_detection::mojom::FaceDetectionProvider> + receiver) { auto provider = std::make_unique<FaceDetectionProviderWin>(); auto* provider_ptr = provider.get(); - provider_ptr->binding_ = - mojo::MakeStrongBinding(std::move(provider), std::move(request)); + provider_ptr->receiver_ = + mojo::MakeSelfOwnedReceiver(std::move(provider), std::move(receiver)); } void CreateFaceDetection( @@ -44,7 +46,7 @@ Microsoft::WRL::ComPtr<ABI::Windows::Media::FaceAnalysis::IFaceDetector> face_detector); - mojo::StrongBindingPtr<mojom::FaceDetectionProvider> binding_; + mojo::SelfOwnedReceiverRef<mojom::FaceDetectionProvider> receiver_; base::WeakPtrFactory<FaceDetectionProviderWin> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(FaceDetectionProviderWin);
diff --git a/services/shape_detection/text_detection_impl.cc b/services/shape_detection/text_detection_impl.cc index 0582f96..2f146e6 100644 --- a/services/shape_detection/text_detection_impl.cc +++ b/services/shape_detection/text_detection_impl.cc
@@ -8,7 +8,7 @@ // static void TextDetectionImpl::Create( - mojom::TextDetectionRequest request) { + mojo::PendingReceiver<mojom::TextDetection> receiver) { DLOG(ERROR) << "Platform not supported for Text Detection Service."; }
diff --git a/services/shape_detection/text_detection_impl.h b/services/shape_detection/text_detection_impl.h index 24a999f..d305e3a9 100644 --- a/services/shape_detection/text_detection_impl.h +++ b/services/shape_detection/text_detection_impl.h
@@ -5,14 +5,15 @@ #ifndef SERVICES_SHAPE_DETECTION_TEXT_DETECTION_IMPL_H_ #define SERVICES_SHAPE_DETECTION_TEXT_DETECTION_IMPL_H_ +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "services/shape_detection/public/mojom/textdetection.mojom.h" namespace shape_detection { class TextDetectionImpl { public: - // Binds TextDetection request to an implementation of mojom::TextDetection. - static void Create(mojom::TextDetectionRequest request); + // Binds TextDetection receiver to an implementation of mojom::TextDetection. + static void Create(mojo::PendingReceiver<mojom::TextDetection> receiver); private: ~TextDetectionImpl() = default;
diff --git a/services/shape_detection/text_detection_impl_mac.mm b/services/shape_detection/text_detection_impl_mac.mm index 23cdc0e..fc03bd8 100644 --- a/services/shape_detection/text_detection_impl_mac.mm +++ b/services/shape_detection/text_detection_impl_mac.mm
@@ -8,18 +8,20 @@ #include "base/mac/scoped_cftyperef.h" #include "base/mac/sdk_forward_declarations.h" #include "base/strings/sys_string_conversions.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/detection_utils_mac.h" #include "services/shape_detection/text_detection_impl.h" namespace shape_detection { // static -void TextDetectionImpl::Create(mojom::TextDetectionRequest request) { +void TextDetectionImpl::Create( + mojo::PendingReceiver<mojom::TextDetection> receiver) { // Text detection needs at least MAC OS X 10.11. if (@available(macOS 10.11, *)) { - mojo::MakeStrongBinding(std::make_unique<TextDetectionImplMac>(), - std::move(request)); + mojo::MakeSelfOwnedReceiver(std::make_unique<TextDetectionImplMac>(), + std::move(receiver)); } }
diff --git a/services/shape_detection/text_detection_impl_win.cc b/services/shape_detection/text_detection_impl_win.cc index aefc6b3..e28efbf 100644 --- a/services/shape_detection/text_detection_impl_win.cc +++ b/services/shape_detection/text_detection_impl_win.cc
@@ -15,7 +15,8 @@ #include "base/win/post_async_results.h" #include "base/win/scoped_hstring.h" #include "base/win/windows_version.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/detection_utils_win.h" #include "services/shape_detection/text_detection_impl.h" #include "ui/gfx/geometry/rect_f.h" @@ -40,7 +41,8 @@ using Microsoft::WRL::ComPtr; // static -void TextDetectionImpl::Create(mojom::TextDetectionRequest request) { +void TextDetectionImpl::Create( + mojo::PendingReceiver<mojom::TextDetection> receiver) { // OcrEngine class is only available in Win 10 onwards (v10.0.10240.0) that // documents in // https://docs.microsoft.com/en-us/uwp/api/windows.media.ocr.ocrengine. @@ -120,8 +122,8 @@ auto impl = std::make_unique<TextDetectionImplWin>(std::move(ocr_engine), std::move(bitmap_factory)); auto* impl_ptr = impl.get(); - impl_ptr->SetBinding( - mojo::MakeStrongBinding(std::move(impl), std::move(request))); + impl_ptr->SetReceiver( + mojo::MakeSelfOwnedReceiver(std::move(impl), std::move(receiver))); } TextDetectionImplWin::TextDetectionImplWin( @@ -146,7 +148,7 @@ recognize_text_callback_ = std::move(callback); // This prevents the Detect function from being called before the // AsyncOperation completes. - binding_->PauseIncomingMethodCallProcessing(); + receiver_->PauseIncomingMethodCallProcessing(); } HRESULT TextDetectionImplWin::BeginDetect(const SkBitmap& bitmap) { @@ -246,7 +248,7 @@ ComPtr<IOcrResult> ocr_result) { std::move(recognize_text_callback_) .Run(BuildTextDetectionResult(std::move(ocr_result))); - binding_->ResumeIncomingMethodCallProcessing(); + receiver_->ResumeIncomingMethodCallProcessing(); } } // namespace shape_detection
diff --git a/services/shape_detection/text_detection_impl_win.h b/services/shape_detection/text_detection_impl_win.h index 77e63cb0..f7bc396 100644 --- a/services/shape_detection/text_detection_impl_win.h +++ b/services/shape_detection/text_detection_impl_win.h
@@ -14,7 +14,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/shape_detection/public/mojom/textdetection.mojom.h" class SkBitmap; @@ -34,8 +34,8 @@ void Detect(const SkBitmap& bitmap, mojom::TextDetection::DetectCallback callback) override; - void SetBinding(mojo::StrongBindingPtr<mojom::TextDetection> binding) { - binding_ = std::move(binding); + void SetReceiver(mojo::SelfOwnedReceiverRef<mojom::TextDetection> receiver) { + receiver_ = std::move(receiver); } private: @@ -44,7 +44,7 @@ ABI::Windows::Graphics::Imaging::ISoftwareBitmapStatics> bitmap_factory_; DetectCallback recognize_text_callback_; - mojo::StrongBindingPtr<mojom::TextDetection> binding_; + mojo::SelfOwnedReceiverRef<mojom::TextDetection> receiver_; HRESULT BeginDetect(const SkBitmap& bitmap); std::vector<mojom::TextDetectionResultPtr> BuildTextDetectionResult(
diff --git a/services/shape_detection/text_detection_impl_win_unittest.cc b/services/shape_detection/text_detection_impl_win_unittest.cc index 5bea7680..1b5522b9 100644 --- a/services/shape_detection/text_detection_impl_win_unittest.cc +++ b/services/shape_detection/text_detection_impl_win_unittest.cc
@@ -15,7 +15,7 @@ #include "base/test/task_environment.h" #include "base/win/scoped_com_initializer.h" #include "base/win/windows_version.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/shape_detection/public/mojom/textdetection.mojom.h" #include "services/shape_detection/text_detection_impl.h" #include "testing/gtest/include/gtest/gtest.h" @@ -58,9 +58,8 @@ if (base::win::GetVersion() < base::win::Version::WIN10) return; - mojom::TextDetectionPtr text_service; - auto request = mojo::MakeRequest(&text_service); - TextDetectionImpl::Create(std::move(request)); + mojo::Remote<mojom::TextDetection> text_service; + TextDetectionImpl::Create(text_service.BindNewPipeAndPassReceiver()); // Load image data from test directory. base::FilePath image_path;
diff --git a/services/tracing/public/cpp/perfetto/perfetto_config.cc b/services/tracing/public/cpp/perfetto/perfetto_config.cc index 91754811..0b1eba3 100644 --- a/services/tracing/public/cpp/perfetto/perfetto_config.cc +++ b/services/tracing/public/cpp/perfetto/perfetto_config.cc
@@ -71,14 +71,19 @@ // 5 seconds of the trace (if we wrap around perfetto's central buffer). perfetto_config.mutable_incremental_state_config()->set_clear_period_ms(5000); - // We strip the process filter from the config string we send to Perfetto, - // so perfetto doesn't reject it from a future - // TracingService::ChangeTraceConfig call due to being an unsupported - // update. - base::trace_event::TraceConfig processfilter_stripped_config(chrome_config); - processfilter_stripped_config.SetProcessFilterConfig( + // We strip the process filter from the config string we send to Perfetto, so + // perfetto doesn't reject it from a future TracingService::ChangeTraceConfig + // call due to being an unsupported update. We also strip the trace buffer + // size configuration to prevent chrome from rejecting an update to it after + // startup tracing via TraceConfig::Merge (see trace_startup.cc). For + // perfetto, the buffer size is configured via perfetto's buffer config and + // only affects the perfetto service. + base::trace_event::TraceConfig stripped_config(chrome_config); + stripped_config.SetProcessFilterConfig( base::trace_event::TraceConfig::ProcessFilterConfig()); - std::string chrome_config_string = processfilter_stripped_config.ToString(); + stripped_config.SetTraceBufferSizeInKb(0); + stripped_config.SetTraceBufferSizeInEvents(0); + std::string chrome_config_string = stripped_config.ToString(); // Capture actual trace events. auto* trace_event_data_source = AddDataSourceConfig(
diff --git a/services/tracing/public/cpp/perfetto/trace_event_data_source.cc b/services/tracing/public/cpp/perfetto/trace_event_data_source.cc index 8e83ee5..e9c1741c 100644 --- a/services/tracing/public/cpp/perfetto/trace_event_data_source.cc +++ b/services/tracing/public/cpp/perfetto/trace_event_data_source.cc
@@ -401,16 +401,24 @@ &TraceEventDataSource::OnAddTraceEvent, &TraceEventDataSource::FlushCurrentThread, &TraceEventDataSource::OnUpdateDuration); + base::AutoLock l(lock_); + is_enabled_ = true; } void TraceEventDataSource::UnregisterFromTraceLog() { RegisterTracedValueProtoWriter(false); TraceLog::GetInstance()->SetAddTraceEventOverrides(nullptr, nullptr, nullptr); base::AutoLock l(lock_); + is_enabled_ = false; flushing_trace_log_ = false; DCHECK(!flush_complete_task_); } +bool TraceEventDataSource::IsEnabled() { + base::AutoLock l(lock_); + return is_enabled_; +} + void TraceEventDataSource::SetupStartupTracing(bool privacy_filtering_enabled) { { base::AutoLock lock(lock_);
diff --git a/services/tracing/public/cpp/perfetto/trace_event_data_source.h b/services/tracing/public/cpp/perfetto/trace_event_data_source.h index 96967d20..5a8d30b 100644 --- a/services/tracing/public/cpp/perfetto/trace_event_data_source.h +++ b/services/tracing/public/cpp/perfetto/trace_event_data_source.h
@@ -157,6 +157,10 @@ startup_tracing_timeout_ = timeout_us; } + bool privacy_filtering_enabled() const { return privacy_filtering_enabled_; } + + bool IsEnabled(); + private: friend class base::NoDestructor<TraceEventDataSource>; @@ -219,6 +223,7 @@ startup_writer_registry_; std::unique_ptr<perfetto::StartupTraceWriter> trace_writer_; base::OneShotTimer startup_tracing_timer_; + bool is_enabled_ = false; bool flushing_trace_log_ = false; base::OnceClosure flush_complete_task_; std::vector<std::string> histograms_;
diff --git a/services/tracing/public/cpp/trace_startup.cc b/services/tracing/public/cpp/trace_startup.cc index 2f22b0c..a9b0f7ea 100644 --- a/services/tracing/public/cpp/trace_startup.cc +++ b/services/tracing/public/cpp/trace_startup.cc
@@ -14,6 +14,7 @@ #include "services/tracing/public/cpp/perfetto/trace_event_data_source.h" #include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h" #include "services/tracing/public/cpp/trace_event_agent.h" +#include "services/tracing/public/cpp/trace_event_args_whitelist.h" #include "services/tracing/public/cpp/tracing_features.h" namespace tracing { @@ -44,19 +45,39 @@ auto* startup_config = TraceStartupConfig::GetInstance(); if (startup_config->IsEnabled()) { - const TraceConfig& trace_config = startup_config->GetTraceConfig(); - if (trace_config.IsCategoryGroupEnabled( - TRACE_DISABLED_BY_DEFAULT("cpu_profiler"))) { - TracingSamplerProfiler::SetupStartupTracing(); - } - TraceEventDataSource::GetInstance()->SetupStartupTracing( - startup_config->GetSessionOwner() == - TraceStartupConfig::SessionOwner::kBackgroundTracing); + TraceConfig trace_config = startup_config->GetTraceConfig(); + + // Make sure we only record whitelisted arguments even during early startup + // tracing if the config specifies argument filtering. + if (trace_config.IsArgumentFilterEnabled() && + base::trace_event::TraceLog::GetInstance() + ->GetArgumentFilterPredicate() + .is_null()) { + base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate( + base::BindRepeating(&IsTraceEventArgsWhitelisted)); + base::trace_event::TraceLog::GetInstance()->SetMetadataFilterPredicate( + base::BindRepeating(&IsMetadataWhitelisted)); + } + + // Perfetto backend configures buffer sizes when tracing is started in the + // service (see perfetto_config.cc). Zero them out here to avoid DCHECKs + // in TraceConfig::Merge. + trace_config.SetTraceBufferSizeInKb(0); + trace_config.SetTraceBufferSizeInEvents(0); + + if (trace_config.IsCategoryGroupEnabled( + TRACE_DISABLED_BY_DEFAULT("cpu_profiler"))) { + TracingSamplerProfiler::SetupStartupTracing(); + } + TraceEventDataSource::GetInstance()->SetupStartupTracing( + startup_config->GetSessionOwner() == + TraceStartupConfig::SessionOwner::kBackgroundTracing || + command_line.HasSwitch(switches::kTraceStartupEnablePrivacyFiltering)); uint8_t modes = TraceLog::RECORDING_MODE; if (!trace_config.event_filters().empty()) modes |= TraceLog::FILTERING_MODE; - trace_log->SetEnabled(startup_config->GetTraceConfig(), modes); + trace_log->SetEnabled(trace_config, modes); } else if (command_line.HasSwitch(switches::kTraceToConsole)) { // TODO(eseckler): Remove ability to trace to the console, perfetto doesn't // support this and noone seems to use it. @@ -71,9 +92,8 @@ } void InitTracingPostThreadPoolStartAndFeatureList() { - if (g_tracing_initialized_after_threadpool_and_featurelist) { + if (g_tracing_initialized_after_threadpool_and_featurelist) return; - } g_tracing_initialized_after_threadpool_and_featurelist = true; // TODO(nuskos): We should switch these to DCHECK once we're reasonably // confident we've ensured this is called properly in all processes. Probably @@ -91,4 +111,59 @@ } } +void PropagateTracingFlagsToChildProcessCmdLine(base::CommandLine* cmd_line) { + base::trace_event::TraceLog* trace_log = + base::trace_event::TraceLog::GetInstance(); + + if (!trace_log->IsEnabled()) + return; + + // It's possible that tracing is enabled only for atrace, in which case the + // TraceEventDataSource isn't registered. In that case, there's no reason to + // enable startup tracing in the child process (and we wouldn't know the + // correct value for privacy_filtering_enabled below). + if (!TraceEventDataSource::GetInstance()->IsEnabled()) + return; + + // The child process startup may race with a concurrent disabling of the + // tracing session by the tracing service. To avoid being stuck in startup + // tracing mode forever, the child process will discard the startup session + // after a timeout (|startup_tracing_timer_| in TraceEventDataSource). + // + // Note that we disregard the config's process filter, since it's possible + // that the trace consumer will update the config to include the process + // shortly. Otherwise, the startup tracing timeout in the child will + // eventually disable tracing for the process. + + const auto trace_config = trace_log->GetCurrentTraceConfig(); + + // We can't currently propagate event filter options, memory dump configs, or + // trace buffer sizes via command line flags (they only support categories, + // trace options, record mode). If event filters are set, we bail out here to + // avoid recording events that we shouldn't in the child process. Even if + // memory dump config is set, it's OK to propagate the remaining config, + // because the child won't record events it shouldn't without it and will + // adopt the memory dump config once it connects to the tracing service. + // Buffer sizes configure the tracing service's central buffer, so also don't + // affect local tracing. + // + // TODO(eseckler): Support propagating the full config via command line flags + // somehow (--trace-config?). This will also need some rethinking to support + // multiple concurrent tracing sessions in the future. + if (!trace_config.event_filters().empty()) + return; + + // Make sure that the startup session uses privacy filtering mode if it's + // enabled for the browser's session. + if (TraceEventDataSource::GetInstance()->privacy_filtering_enabled()) + cmd_line->AppendSwitch(switches::kTraceStartupEnablePrivacyFiltering); + + cmd_line->AppendSwitchASCII(switches::kTraceStartup, + trace_config.ToCategoryFilterString()); + // The argument filtering setting is passed via trace options as part of + // --trace-startup-record-mode. + cmd_line->AppendSwitchASCII(switches::kTraceStartupRecordMode, + trace_config.ToTraceOptionsString()); +} + } // namespace tracing
diff --git a/services/tracing/public/cpp/trace_startup.h b/services/tracing/public/cpp/trace_startup.h index 658856a..089ba9d 100644 --- a/services/tracing/public/cpp/trace_startup.h +++ b/services/tracing/public/cpp/trace_startup.h
@@ -7,6 +7,10 @@ #include "base/component_export.h" +namespace base { +class CommandLine; +} // namespace base + namespace tracing { // Returns true if InitTracingPostThreadPoolStartAndFeatureList has been called @@ -23,6 +27,11 @@ void COMPONENT_EXPORT(TRACING_CPP) InitTracingPostThreadPoolStartAndFeatureList(); +// If tracing is enabled, grabs the current trace config & mode and tells the +// child to begin tracing right away via startup tracing command line flags. +void COMPONENT_EXPORT(TRACING_CPP) + PropagateTracingFlagsToChildProcessCmdLine(base::CommandLine* cmd_line); + } // namespace tracing #endif // SERVICES_TRACING_PUBLIC_CPP_TRACE_STARTUP_H_
diff --git a/testing/perf/perf_result_reporter.cc b/testing/perf/perf_result_reporter.cc index 272e6ca..7897f8a 100644 --- a/testing/perf/perf_result_reporter.cc +++ b/testing/perf/perf_result_reporter.cc
@@ -52,6 +52,15 @@ iter->second.units, iter->second.important); } +void PerfResultReporter::AddResultList(const std::string& metric_suffix, + const std::string& values) { + auto iter = metric_map_.find(metric_suffix); + CHECK(iter != metric_map_.end()); + + PrintResultList(metric_basename_, metric_suffix, story_name_, values, + iter->second.units, iter->second.important); +} + bool PerfResultReporter::GetMetricInfo(const std::string& metric_suffix, MetricInfo* out) { auto iter = metric_map_.find(metric_suffix);
diff --git a/testing/perf/perf_result_reporter.h b/testing/perf/perf_result_reporter.h index 3188d90..7de998a1d 100644 --- a/testing/perf/perf_result_reporter.h +++ b/testing/perf/perf_result_reporter.h
@@ -45,6 +45,8 @@ void AddResult(const std::string& metric_suffix, size_t value); void AddResult(const std::string& metric_suffix, double value); void AddResult(const std::string& metric_suffix, const std::string& value); + void AddResultList(const std::string& metric_suffix, + const std::string& values); // Returns true and fills the pointer if the metric is registered, otherwise // returns false.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 434246a..e80e933 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -6151,6 +6151,26 @@ ] } ], + "TranslateDesktopRefresh": [ + { + "platforms": [ + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "EnabledTab", + "params": { + "translate_ui_bubble_style": "tab" + }, + "enable_features": [ + "UseButtonTranslateBubbleUI" + ] + } + ] + } + ], "TranslateRankerModel": [ { "platforms": [
diff --git a/third_party/arcore-android-sdk-client/BUILD.gn b/third_party/arcore-android-sdk-client/BUILD.gn index 7d018ac0..29a715a 100644 --- a/third_party/arcore-android-sdk-client/BUILD.gn +++ b/third_party/arcore-android-sdk-client/BUILD.gn
@@ -8,5 +8,4 @@ aar_path = "core-partner_chrome-1.10.0.aar" info_path = "core-partner_chrome-1.10.0.info" extract_native_libraries = true - split_compat_class_names = [ "com/google/ar/core/InstallActivity" ] }
diff --git a/third_party/blink/public/mojom/payments/payment_handler_host.mojom b/third_party/blink/public/mojom/payments/payment_handler_host.mojom index b951796..665a3c9 100644 --- a/third_party/blink/public/mojom/payments/payment_handler_host.mojom +++ b/third_party/blink/public/mojom/payments/payment_handler_host.mojom
@@ -6,6 +6,7 @@ module payments.mojom; import "components/payments/mojom/payment_request_data.mojom"; +import "third_party/blink/public/mojom/payments/payment_request.mojom"; struct PaymentHandlerMethodData { // Either a short string (e.g., "basic-string") or URL (e.g., @@ -31,9 +32,11 @@ // renderer. The browser sends this to the Payment Handler renderer. struct PaymentMethodChangeResponse { PaymentCurrencyAmount? total; + array<PaymentShippingOption>? shipping_options; array<PaymentHandlerModifier>? modifiers; string error = ""; string? stringified_payment_method_errors; + AddressErrors? shipping_address_errors; }; // The interface for a PaymentRequest object in the browser, so a PaymentHandler @@ -44,22 +47,35 @@ // components/payments/content/payment_request.h interface PaymentHandlerHost { // Called by the Payment Handler renderer to let the browser know that the - // user has selected a different payment instrument. + // user has selected a different payment instrument or shipping option, or + // when the user has changed the shipping address. // - // The browser validates the |method_data| and passes it on to the Merchant - // renderer via + // The browser validates the |method_data|, |shipping address|, or + // |shipping option_id| and passes it on to the Merchant renderer via one of + // the following methods which are all defined in + // third_party/blink/public/mojom/payments/payment_request.mojom: // PaymentRequestClient.OnPaymentMethodChange(method_name,stringified_data), - // defined in third_party/blink/public/mojom/payments/payment_request.mojom. + // PaymentRequestClient.OnShippingAddressChange(PaymentAddress address), + // PaymentRequestClient.OnShippingOptionChange(string shipping_option_id). // - // The Merchant renderer than responds to the browser via - // PaymentRequest.UpdateWith(details) to update the total based on the - // selected instrument or PaymentRequest.NoUpdatedPaymentDetails() if the - // total is unchanged. The total can change, for example, based on the - // billing address of the selected instrument. + // The Merchant renderer then responds to the browser via + // PaymentRequest.UpdateWith(details) to update the total or other details of + // the payment request based on the selected instrument/shipping address/ + // shipping option or PaymentRequest.NoUpdatedPaymentDetails() if the + // total and other details are unchanged. The total can change, for example, + // based on the billing address of the selected instrument or the selected + // shipping address/option. The list of available shipping options can change + // based on the selected shipping address. // // The browser validates the |details| from the Merchant renderer and sends // their subset to the Payment Handler renderer as - // |PaymentMethodChangeResponse|, so it can show the updated total. + // |PaymentMethodChangeResponse|, so it can show the updated details. + // Todo(sahel): Rename PaymentMethodChangeResponse to + // PaymentRequestDetailsUpdate which is a more generic name. crbug.com/984694 ChangePaymentMethod(PaymentHandlerMethodData method_data) => (PaymentMethodChangeResponse response_data); + ChangeShippingOption(string shipping_option_id) => + (PaymentMethodChangeResponse response_data); + ChangeShippingAddress(PaymentAddress shipping_address) => + (PaymentMethodChangeResponse response_data); };
diff --git a/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc index e2b28dd..05174e2 100644 --- a/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc
@@ -67,53 +67,6 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSTextIndentNonInterpolableValue); DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSTextIndentNonInterpolableValue); -// TODO(xiaochengh): Clean up. With |InterpolableLength| introduced and -// |LengthNonInterpolableValue| removed, the following no longer makes sense. -// -// A wrapper for the UnderlyingValue passed to -// CSSTextIndentInterpolationType::Composite which can be forwarded to -// LengthInterpolationFunctions::Composite. -// -// If LengthInterpolationFunctions::Composite calls SetNonInterpolableValue with -// a new NonInterpolableValue, this class wraps it in a new -// CSSTextIndentNonInterpolableValue before being set on the inner -// UnderlyingValue. -class UnderlyingTextIndentAsLengthValue : public UnderlyingValue { - STACK_ALLOCATED(); - - public: - UnderlyingTextIndentAsLengthValue(UnderlyingValue& inner_underlying_value, - IndentMode mode) - : inner_underlying_value_(inner_underlying_value), mode_(mode) {} - - InterpolableValue& MutableInterpolableValue() final { - return inner_underlying_value_.MutableInterpolableValue(); - } - - void SetInterpolableValue( - std::unique_ptr<InterpolableValue> interpolable_value) final { - inner_underlying_value_.SetInterpolableValue(std::move(interpolable_value)); - } - - const NonInterpolableValue* GetNonInterpolableValue() const final { - const auto& text_indent_non_interpolable_value = - ToCSSTextIndentNonInterpolableValue( - *inner_underlying_value_.GetNonInterpolableValue()); - return text_indent_non_interpolable_value.LengthNonInterpolableValue(); - } - - void SetNonInterpolableValue( - scoped_refptr<const NonInterpolableValue> non_interpolable_value) final { - inner_underlying_value_.SetNonInterpolableValue( - CSSTextIndentNonInterpolableValue::Create( - std::move(non_interpolable_value), mode_)); - } - - private: - UnderlyingValue& inner_underlying_value_; - const IndentMode mode_; -}; - namespace { class UnderlyingIndentModeChecker @@ -266,9 +219,7 @@ return; } - UnderlyingTextIndentAsLengthValue underlying_text_indent_as_length( - underlying_value_owner, mode); - underlying_text_indent_as_length.MutableInterpolableValue().ScaleAndAdd( + underlying_value_owner.MutableInterpolableValue().ScaleAndAdd( underlying_fraction, *value.interpolable_value); }
diff --git a/third_party/blink/renderer/core/animation/size_interpolation_functions.cc b/third_party/blink/renderer/core/animation/size_interpolation_functions.cc index b2b2ed6..a2fca49 100644 --- a/third_party/blink/renderer/core/animation/size_interpolation_functions.cc +++ b/third_party/blink/renderer/core/animation/size_interpolation_functions.cc
@@ -56,48 +56,6 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSSizeNonInterpolableValue); DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSSizeNonInterpolableValue); -// TODO(xiaochengh): Clean up. With |InterpolableLength| introduced and -// |LengthNonInterpolableValue| removed, the following no longer makes sense. -// -// A wrapper for the UnderlyingValue passed to -// SizeInterpolationFunctions::Composite which can be forwarded to -// LengthInterpolationFunctions::Composite. -// -// If LengthInterpolationFunctions::Composite calls SetNonInterpolableValue with -// a new NonInterpolableValue, this class wraps it in a new -// CSSSizeNonInterpolableValue before being set on the inner UnderlyingValue. -class UnderlyingSizeAsLengthValue : public UnderlyingValue { - STACK_ALLOCATED(); - - public: - UnderlyingSizeAsLengthValue(UnderlyingValue& inner_underlying_value) - : inner_underlying_value_(inner_underlying_value) {} - - InterpolableValue& MutableInterpolableValue() final { - return inner_underlying_value_.MutableInterpolableValue(); - } - - void SetInterpolableValue( - std::unique_ptr<InterpolableValue> interpolable_value) final { - inner_underlying_value_.SetInterpolableValue(std::move(interpolable_value)); - } - - const NonInterpolableValue* GetNonInterpolableValue() const final { - const auto& size_non_interpolable_value = ToCSSSizeNonInterpolableValue( - *inner_underlying_value_.GetNonInterpolableValue()); - return size_non_interpolable_value.LengthNonInterpolableValue(); - } - - void SetNonInterpolableValue( - scoped_refptr<const NonInterpolableValue> non_interpolable_value) final { - inner_underlying_value_.SetNonInterpolableValue( - CSSSizeNonInterpolableValue::Create(std::move(non_interpolable_value))); - } - - private: - UnderlyingValue& inner_underlying_value_; -}; - static InterpolationValue ConvertKeyword(CSSValueID keyword) { return InterpolationValue(std::make_unique<InterpolableList>(0), CSSSizeNonInterpolableValue::Create(keyword)); @@ -204,9 +162,8 @@ ToCSSSizeNonInterpolableValue(*non_interpolable_value); if (size_non_interpolable_value.IsKeyword()) return; - UnderlyingSizeAsLengthValue underlying_size_as_length(underlying_value); - underlying_size_as_length.MutableInterpolableValue().ScaleAndAdd( - underlying_fraction, interpolable_value); + underlying_value.MutableInterpolableValue().ScaleAndAdd(underlying_fraction, + interpolable_value); } static Length CreateLength(
diff --git a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc index a4917ca..6be6d02 100644 --- a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc +++ b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc
@@ -36,25 +36,31 @@ callback_collection_.CancelFrameCallback(id); } -void WorkerAnimationFrameProvider::BeginFrame( - const base::TimeTicks& frame_time) { - TRACE_EVENT0("blink", "WorkerAnimationFrameProvider::BeginFrame"); +void WorkerAnimationFrameProvider::BeginFrame(const viz::BeginFrameArgs& args) { + TRACE_EVENT_WITH_FLOW0("blink", "WorkerAnimationFrameProvider::BeginFrame", + TRACE_ID_GLOBAL(args.trace_id), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); - double time = (frame_time - base::TimeTicks()).InMillisecondsF(); Microtask::EnqueueMicrotask(WTF::Bind( - [](base::WeakPtr<WorkerAnimationFrameProvider> provider, double time) { + [](base::WeakPtr<WorkerAnimationFrameProvider> provider, + const viz::BeginFrameArgs& args) { if (!provider) return; - TRACE_EVENT0("blink", - "WorkerAnimationFrameProvider::RequestAnimationFrame"); - OffscreenCanvas::ScopedInsideWorkerRAF inside_raf_scope; - for (auto& offscreen_canvas : provider->offscreen_canvases_) { - inside_raf_scope.AddOffscreenCanvas(offscreen_canvas); - } + TRACE_EVENT_WITH_FLOW0( + "blink", "WorkerAnimationFrameProvider::RequestAnimationFrame", + TRACE_ID_GLOBAL(args.trace_id), TRACE_EVENT_FLAG_FLOW_IN); + { + OffscreenCanvas::ScopedInsideWorkerRAF inside_raf_scope(args); + for (auto& offscreen_canvas : provider->offscreen_canvases_) { + inside_raf_scope.AddOffscreenCanvas(offscreen_canvas); + } - provider->callback_collection_.ExecuteFrameCallbacks(time, time); + double time = (args.frame_time - base::TimeTicks()).InMillisecondsF(); + provider->callback_collection_.ExecuteFrameCallbacks(time, time); + } + provider->begin_frame_provider_->FinishBeginFrame(args); }, - weak_factory_.GetWeakPtr(), time)); + weak_factory_.GetWeakPtr(), args)); } void WorkerAnimationFrameProvider::RegisterOffscreenCanvas(
diff --git a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.h b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.h index b398620..fdb656b 100644 --- a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.h +++ b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.h
@@ -39,7 +39,7 @@ void Trace(blink::Visitor* visitor); // BeginFrameProviderClient - void BeginFrame(const base::TimeTicks& frame_time) override; + void BeginFrame(const viz::BeginFrameArgs&) override; void RegisterOffscreenCanvas(OffscreenCanvas*); void DeregisterOffscreenCanvas(OffscreenCanvas*);
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.cc b/third_party/blink/renderer/core/display_lock/display_lock_context.cc index c64cb15..86ea242b 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.cc
@@ -540,7 +540,7 @@ // Since setting the attribute might trigger a commit if we are still locked, // we set it after we start the commit. if (element_->hasAttribute(html_names::kRendersubtreeAttr)) - element_->setAttribute(html_names::kRendersubtreeAttr, "visible"); + element_->setAttribute(html_names::kRendersubtreeAttr, ""); } bool DisplayLockContext::ShouldCommitForActivation() const {
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 828909c..8b662e7 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -6094,53 +6094,22 @@ if (!GetFrame()) return NullURL(); - // TODO(mkwst): This doesn't correctly handle sandboxed documents; we want to - // look at their URL, but we can't because we don't know what it is. Frame& top = GetFrame()->Tree().Top(); - KURL top_document_url; - auto* top_local_frame = DynamicTo<LocalFrame>(&top); - if (top_local_frame) { - top_document_url = top_local_frame->GetDocument()->Url(); - } else { - const SecurityOrigin* origin = - top.GetSecurityContext()->GetSecurityOrigin(); - // TODO(yhirano): Ideally |origin| should not be null here. - if (origin) - top_document_url = KURL(NullURL(), origin->ToString()); - else - top_document_url = NullURL(); - } + const SecurityOrigin* origin = top.GetSecurityContext()->GetSecurityOrigin(); + // TODO(yhirano): Ideally |origin| should not be null here. + if (!origin) + return NullURL(); if (SchemeRegistry::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel( - top_document_url.Protocol())) - return top_document_url; - - // We're intentionally using the URL of each document rather than the - // document's SecurityOrigin. A sandboxed document has a unique opaque - // origin, but that shouldn't affect first-/third-party status for cookies - // and site data. - base::Optional<OriginAccessEntry> remote_entry; - if (!top_local_frame) { - remote_entry.emplace( - top_document_url, - network::mojom::CorsDomainMatchMode::kAllowRegistrableDomains); + origin->Protocol())) { + return origin->IsOpaque() ? NullURL() : KURL(origin->ToString()); } - const OriginAccessEntry& access_entry = - remote_entry ? *remote_entry - : top_local_frame->GetDocument()->AccessEntryFromURL(); + + OriginAccessEntry access_entry( + *origin, network::mojom::CorsDomainMatchMode::kAllowRegistrableDomains); const Frame* current_frame = GetFrame(); while (current_frame) { - // Skip over srcdoc documents, as they are always same-origin with their - // closest non-srcdoc parent. - auto is_srcdoc = [](const Frame* frame) { - const auto* local_frame = DynamicTo<LocalFrame>(frame); - return local_frame && local_frame->GetDocument()->IsSrcdocDocument(); - }; - while (is_srcdoc(current_frame)) - current_frame = current_frame->Tree().Parent(); - DCHECK(current_frame); - // We use 'matchesDomain' here, as it turns out that some folks embed HTTPS // login forms into HTTP pages; we should allow this kind of upgrade. if (access_entry.MatchesDomain( @@ -6152,7 +6121,7 @@ current_frame = current_frame->Tree().Parent(); } - return top_document_url; + return origin->IsOpaque() ? NullURL() : KURL(origin->ToString()); } ScriptPromise Document::hasStorageAccess(ScriptState* script_state) const {
diff --git a/third_party/blink/renderer/core/exported/web_document_test.cc b/third_party/blink/renderer/core/exported/web_document_test.cc index 85973ba4c..ebeb44a 100644 --- a/third_party/blink/renderer/core/exported/web_document_test.cc +++ b/third_party/blink/renderer/core/exported/web_document_test.cc
@@ -190,6 +190,7 @@ const char* g_base_url_origin_a = "http://example.test:0/"; const char* g_base_url_origin_sub_a = "http://subdomain.example.test:0/"; const char* g_base_url_origin_secure_a = "https://example.test:0/"; +const char* g_base_url_sandbox_origin_a = "http://sandbox.example.test:0/"; const char* g_base_url_origin_b = "http://not-example.test:0/"; const char* g_empty_file = "first_party/empty.html"; const char* g_nested_data = "first_party/nested-data.html"; @@ -219,6 +220,10 @@ return ToKURL(std::string(g_base_url_origin_secure_a) + file); } +KURL ToOriginSandboxA(const char* file) { + return ToKURL(std::string(g_base_url_sandbox_origin_a) + file); +} + KURL ToOriginB(const char* file) { return ToKURL(std::string(g_base_url_origin_b) + file); } @@ -261,6 +266,17 @@ RegisterMockedURLLoad(ToOriginSubA(g_empty_file), g_empty_file); RegisterMockedURLLoad(ToOriginSecureA(g_empty_file), g_empty_file); + WebURLResponse response(ToOriginSandboxA(g_empty_file)); + response.SetMimeType(WebString::FromUTF8("text/html")); + response.SetHttpHeaderField(http_names::kContentType, + WebString::FromUTF8("text/html")); + response.SetHttpHeaderField(http_names::kContentSecurityPolicy, + WebString::FromUTF8("sandbox")); + response.SetHttpStatusCode(200); + url_test_helpers::RegisterMockedURLLoadWithCustomResponse( + ToOriginSandboxA(g_empty_file), test::CoreTestDataPath(g_empty_file), + response); + RegisterMockedURLLoad(ToOriginB(g_empty_file), g_empty_file); RegisterMockedURLLoad(ToOriginB(g_nested_origin_a), g_nested_origin_a); RegisterMockedURLLoad(ToOriginB(g_nested_origin_b), g_nested_origin_b); @@ -299,15 +315,29 @@ TEST_F(WebDocumentFirstPartyTest, Empty) { Load(g_empty_file); - ASSERT_EQ(ToOriginA(g_empty_file), TopDocument()->SiteForCookies()); + ASSERT_TRUE(OriginsEqual( + g_empty_file, SecurityOrigin::Create(TopDocument()->SiteForCookies()))); ASSERT_TRUE(OriginsEqual(g_empty_file, TopDocument()->TopFrameOrigin())); } +TEST_F(WebDocumentFirstPartyTest, EmptySandbox) { + web_view_helper_.InitializeAndLoad(std::string(g_base_url_sandbox_origin_a) + + g_empty_file); + + ASSERT_TRUE(TopDocument()->TopFrameOrigin()->IsOpaque()) + << TopDocument()->TopFrameOrigin()->ToUrlOrigin().GetDebugString(); + ASSERT_EQ(NullURL(), TopDocument()->SiteForCookies()); +} + TEST_F(WebDocumentFirstPartyTest, NestedOriginA) { Load(g_nested_origin_a); - ASSERT_EQ(ToOriginA(g_nested_origin_a), TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_a), NestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); ASSERT_TRUE(OriginsEqual(g_nested_origin_a, TopDocument()->TopFrameOrigin())); ASSERT_TRUE( @@ -317,9 +347,12 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginSubA) { Load(g_nested_origin_sub_a); - ASSERT_EQ(ToOriginA(g_nested_origin_sub_a), TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_sub_a), - NestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_sub_a, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_sub_a, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); ASSERT_TRUE( OriginsEqual(g_nested_origin_sub_a, TopDocument()->TopFrameOrigin())); @@ -330,10 +363,12 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginSecureA) { Load(g_nested_origin_secure_a); - ASSERT_EQ(ToOriginA(g_nested_origin_secure_a), - TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_secure_a), - NestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_secure_a, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_secure_a, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); ASSERT_TRUE( OriginsEqual(g_nested_origin_secure_a, TopDocument()->TopFrameOrigin())); @@ -344,12 +379,15 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginAInOriginA) { Load(g_nested_origin_a_in_origin_a); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_a), - TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_a), - NestedDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_a), - NestedNestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a_in_origin_a, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a_in_origin_a, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); + ASSERT_TRUE(OriginsEqual( + g_nested_origin_a_in_origin_a, + SecurityOrigin::Create(NestedNestedDocument()->SiteForCookies()))); ASSERT_TRUE(OriginsEqual(g_nested_origin_a_in_origin_a, TopDocument()->TopFrameOrigin())); @@ -360,8 +398,9 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginAInOriginB) { Load(g_nested_origin_a_in_origin_b); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), - TopDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a_in_origin_b, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); ASSERT_EQ(NullURL(), NestedDocument()->SiteForCookies()); ASSERT_EQ(NullURL(), NestedNestedDocument()->SiteForCookies()); @@ -376,7 +415,9 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginB) { Load(g_nested_origin_b); - ASSERT_EQ(ToOriginA(g_nested_origin_b), TopDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_b, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); ASSERT_EQ(NullURL(), NestedDocument()->SiteForCookies()); ASSERT_TRUE(OriginsEqual(g_nested_origin_b, TopDocument()->TopFrameOrigin())); @@ -387,10 +428,12 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginBInOriginA) { Load(g_nested_origin_b_in_origin_a); - ASSERT_EQ(ToOriginA(g_nested_origin_b_in_origin_a), - TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_b_in_origin_a), - NestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_b_in_origin_a, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_b_in_origin_a, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); ASSERT_EQ(NullURL(), NestedNestedDocument()->SiteForCookies()); ASSERT_TRUE(OriginsEqual(g_nested_origin_b_in_origin_a, @@ -404,8 +447,9 @@ TEST_F(WebDocumentFirstPartyTest, NestedOriginBInOriginB) { Load(g_nested_origin_b_in_origin_b); - ASSERT_EQ(ToOriginA(g_nested_origin_b_in_origin_b), - TopDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_b_in_origin_b, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); ASSERT_EQ(NullURL(), NestedDocument()->SiteForCookies()); ASSERT_EQ(NullURL(), NestedNestedDocument()->SiteForCookies()); @@ -420,8 +464,12 @@ TEST_F(WebDocumentFirstPartyTest, NestedSrcdoc) { Load(g_nested_src_doc); - ASSERT_EQ(ToOriginA(g_nested_src_doc), TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_src_doc), NestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_src_doc, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_src_doc, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); ASSERT_TRUE(OriginsEqual(g_nested_src_doc, TopDocument()->TopFrameOrigin())); ASSERT_TRUE( @@ -431,7 +479,8 @@ TEST_F(WebDocumentFirstPartyTest, NestedData) { Load(g_nested_data); - ASSERT_EQ(ToOriginA(g_nested_data), TopDocument()->SiteForCookies()); + ASSERT_TRUE(OriginsEqual( + g_nested_data, SecurityOrigin::Create(TopDocument()->SiteForCookies()))); ASSERT_EQ(NullURL(), NestedDocument()->SiteForCookies()); ASSERT_TRUE(OriginsEqual(g_nested_data, TopDocument()->TopFrameOrigin())); @@ -444,12 +493,15 @@ SchemeRegistry::RegisterURLSchemeAsFirstPartyWhenTopLevel("http"); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), - TopDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), - NestedDocument()->SiteForCookies()); - ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), - NestedNestedDocument()->SiteForCookies()); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a_in_origin_b, + SecurityOrigin::Create(TopDocument()->SiteForCookies()))); + ASSERT_TRUE( + OriginsEqual(g_nested_origin_a_in_origin_b, + SecurityOrigin::Create(NestedDocument()->SiteForCookies()))); + ASSERT_TRUE(OriginsEqual( + g_nested_origin_a_in_origin_b, + SecurityOrigin::Create(NestedNestedDocument()->SiteForCookies()))); ASSERT_TRUE(OriginsEqual(g_nested_origin_a_in_origin_b, TopDocument()->TopFrameOrigin()));
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index b17b1677..cfe8769 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -7022,10 +7022,12 @@ frame_test_helpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "first_party_redirect.html"); - EXPECT_TRUE(web_view_helper.GetWebView() - ->MainFrameImpl() - ->GetDocument() - .SiteForCookies() == redirect_url); + EXPECT_TRUE( + SecurityOrigin::AreSameSchemeHostPort(web_view_helper.GetWebView() + ->MainFrameImpl() + ->GetDocument() + .SiteForCookies(), + redirect_url)); } class TestNewWindowWebViewClient
diff --git a/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc b/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc index ce8b2e3..bc3f6932 100644 --- a/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_emulation_agent.cc
@@ -94,10 +94,10 @@ std::make_unique<protocol::Array<protocol::Emulation::MediaFeature>>(); for (auto const& name : emulated_media_features_.Keys()) { auto const& value = emulated_media_features_.Get(name); - features->push_back(std::move(protocol::Emulation::MediaFeature::create() - .setName(name) - .setValue(value) - .build())); + features->push_back(protocol::Emulation::MediaFeature::create() + .setName(name) + .setValue(value) + .build()); } setEmulatedMedia(emulated_media_.Get(), std::move(features)); auto rgba = ParseRGBA(default_background_color_override_rgba_.Get());
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc b/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc index 90afdb4c..f274d819 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
@@ -1279,8 +1279,8 @@ SetFirstPartyCookie(request); - EXPECT_EQ(document_url, request.SiteForCookies()); - EXPECT_EQ(document_url.GetString(), request.SiteForCookies().GetString()); + EXPECT_TRUE(SecurityOrigin::AreSameSchemeHostPort(document_url, + request.SiteForCookies())); } TEST_F(FrameFetchContextTest, TopFrameOrigin) {
diff --git a/third_party/blink/renderer/core/loader/threaded_icon_loader.cc b/third_party/blink/renderer/core/loader/threaded_icon_loader.cc index 5a9c983..355a5542 100644 --- a/third_party/blink/renderer/core/loader/threaded_icon_loader.cc +++ b/third_party/blink/renderer/core/loader/threaded_icon_loader.cc
@@ -152,10 +152,16 @@ // Use the RESIZE_GOOD quality allowing the implementation to pick an // appropriate method for the resize. Can be increased to RESIZE_BETTER // or RESIZE_BEST if the quality looks poor. - decoded_icon_ = skia::ImageOperations::Resize( + SkBitmap resized_icon = skia::ImageOperations::Resize( decoded_icon_, skia::ImageOperations::RESIZE_GOOD, resized_width, resized_height); + if (resized_icon.isNull()) { + notify_complete(1.0); + return; + } + + decoded_icon_ = std::move(resized_icon); notify_complete(scale); }
diff --git a/third_party/blink/renderer/core/loader/threaded_icon_loader_test.cc b/third_party/blink/renderer/core/loader/threaded_icon_loader_test.cc index 18f20c13..d515b09f4 100644 --- a/third_party/blink/renderer/core/loader/threaded_icon_loader_test.cc +++ b/third_party/blink/renderer/core/loader/threaded_icon_loader_test.cc
@@ -137,5 +137,18 @@ histogram_tester.ExpectTotalCount("Blink.ThreadedIconLoader.LoadTime", 1); } +TEST_F(ThreadedIconLoaderTest, ResizeFailed) { + WebSize dimensions = {25, 0}; + auto result = LoadIcon(RegisterMockedURL(kIconLoaderIcon100x100), dimensions); + const SkBitmap& icon = result.first; + double resize_scale = result.second; + + // Resizing should have failed so the original will be returned. + ASSERT_FALSE(icon.isNull()); + EXPECT_EQ(icon.width(), 100); + EXPECT_EQ(icon.height(), 100); + EXPECT_EQ(resize_scale, 1.0); +} + } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h index 92542d20..dea3a6b5 100644 --- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h +++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h
@@ -183,7 +183,8 @@ STACK_ALLOCATED(); public: - ScopedInsideWorkerRAF() {} + ScopedInsideWorkerRAF(const viz::BeginFrameArgs& args) + : begin_frame_args_(args) {} void AddOffscreenCanvas(OffscreenCanvas* canvas) { DCHECK(!canvas->inside_worker_raf_); @@ -195,11 +196,15 @@ for (auto canvas : canvases_) { DCHECK(canvas->inside_worker_raf_); canvas->inside_worker_raf_ = false; + if (canvas->frame_dispatcher_) { + canvas->frame_dispatcher_->ReplaceBeginFrameAck(begin_frame_args_); + } canvas->PushFrameIfNeeded(); } } private: + const viz::BeginFrameArgs& begin_frame_args_; HeapVector<Member<OffscreenCanvas>> canvases_; };
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc b/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc index 9e8b529..7cf1f75 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc
@@ -70,12 +70,6 @@ reasons |= CompositingReasonsForAnimation(style); reasons |= CompositingReasonsForWillChange(style); - if (style.UsedTransformStyle3D() == ETransformStyle3D::kPreserve3d) - reasons |= CompositingReason::kPreserve3DWith3DDescendants; - - if (style.HasPerspective()) - reasons |= CompositingReason::kPerspectiveWith3DDescendants; - // If the implementation of CreatesGroup changes, we need to be aware of that // in this part of code. DCHECK((style.HasOpacity() || layout_object.HasMask() || @@ -124,7 +118,9 @@ auto* layer = ToLayoutBoxModelObject(object).Layer(); if (layer->Has3DTransformedDescendant()) { - if (style.HasPerspective()) + // Perspective (specified either by perspective or transform properties) + // with 3d descendants need a render surface for flattening purposes. + if (style.HasPerspective() || style.Transform().HasPerspective()) reasons |= CompositingReason::kPerspectiveWith3DDescendants; if (style.Preserves3D()) reasons |= CompositingReason::kPreserve3DWith3DDescendants; @@ -151,7 +147,7 @@ // may have transforms, but the layoutObject may be an inline that doesn't // support them. return layout_object.HasTransformRelatedProperty() && - layout_object.StyleRef().Has3DTransform() && + layout_object.StyleRef().Has3DTransformOperation() && // Don't composite "trivial" 3D transforms such as translateZ(0) on // low-end devices. These devices are much more sensitive to memory // and per-composited-layer commit overhead.
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc index b3ae108..ccffedae 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc
@@ -192,8 +192,14 @@ // there are descendant layers that will be affected by the preserve-3d or // perspective. if (has3d_transformed_descendants) { - subtree_reasons |= layer->PotentialCompositingReasonsFromStyle() & - CompositingReason::kCombo3DDescendants; + const ComputedStyle& style = layer->GetLayoutObject().StyleRef(); + if (style.UsedTransformStyle3D() == ETransformStyle3D::kPreserve3d) + subtree_reasons |= CompositingReason::kPreserve3DWith3DDescendants; + + // Perspective (specified either by perspective or transform properties) + // with 3d descendants need a render surface for flattening purposes. + if (style.HasPerspective() || style.Transform().HasPerspective()) + subtree_reasons |= CompositingReason::kPerspectiveWith3DDescendants; } return subtree_reasons;
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc index 3bca46b..d82e4b1c 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc
@@ -125,4 +125,44 @@ EXPECT_EQ(IntRect(0, 0, 100, 100), tracking->Invalidations()[0].rect); } +TEST_F(CompositingRequirementsUpdaterTest, + DontPromotePerspectiveOnlyTransform) { + ScopedCSSIndependentTransformPropertiesForTest feature_scope(true); + + SetBodyInnerHTML(R"HTML( + <!DOCTYPE html> + <div id="perspective-no-3d-descendant" + style="transform:perspective(1px) scale(2)"> + <div id="transform2d" style="transform:translate(1px, 2px);"></div> + </div> + <div id="perspective-with-3d-descendant" + style="transform:perspective(1px) scale(2)"> + <div id="3d-descendant" style="rotate: 0 1 0 1deg;"></div> + </div> + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + // Perspective with descendant with only a 2d transform should not be layered + // (neither should the descendant). + EXPECT_FALSE(ToLayoutBoxModelObject( + GetLayoutObjectByElementId("perspective-no-3d-descendant")) + ->Layer() + ->GetCompositingState()); + EXPECT_FALSE(ToLayoutBoxModelObject(GetLayoutObjectByElementId("transform2d")) + ->Layer() + ->GetCompositingReasons()); + + // Both the perspective and 3d descendant should be layered, the former for + // flattening purposes, as it contains 3d transformed content. + EXPECT_EQ(CompositingReason::kPerspectiveWith3DDescendants, + ToLayoutBoxModelObject( + GetLayoutObjectByElementId("perspective-with-3d-descendant")) + ->Layer() + ->GetCompositingReasons()); + EXPECT_EQ(CompositingReason::k3DTransform, + ToLayoutBoxModelObject(GetLayoutObjectByElementId("3d-descendant")) + ->Layer() + ->GetCompositingReasons()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc index d503bff..297d4df 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc
@@ -716,6 +716,29 @@ } TEST_P(PaintPropertyTreeBuilderTest, + TransformPerspective3DTransformedDescendant) { + SetBodyInnerHTML(R"HTML( + <style> body { margin: 0 } </style> + <div id='perspective' style='transform: perspective(800px);'> + <div id='transform' style='margin-left: 50px; margin-top: 100px; + width: 400px; height: 300px; + transform: translate3d(123px, 456px, 789px)'> + </div> + </div> + )HTML"); + + Element* perspective = GetDocument().getElementById("perspective"); + const ObjectPaintProperties* perspective_properties = + perspective->GetLayoutObject()->FirstFragment().PaintProperties(); + + EXPECT_TRUE(perspective_properties->Transform()); + if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) { + EXPECT_TRUE( + perspective_properties->Transform()->HasDirectCompositingReasons()); + } +} + +TEST_P(PaintPropertyTreeBuilderTest, TransformNodeWithActiveAnimationHasDirectCompositingReason) { LoadTestData("transform-animation.html"); EXPECT_TRUE(PaintPropertiesForElement("target")
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 9ecbada..727299e 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -2215,9 +2215,12 @@ return TableLayout() == ETableLayout::kFixed && !LogicalWidth().IsAuto(); } - // Filter/transform utility functions. - bool Has3DTransform() const { - return Transform().Has3DOperation() || + // Returns true if the computed style contains a 3D transform operation. + // This can be individual operations from the transform property, or + // individual values from translate/rotate/scale properties. Note that + // perspective is omitted, since it does not by itself specify a 3D transform. + bool Has3DTransformOperation() const { + return Transform().HasNonPerspective3DOperation() || (Translate() && Translate()->Z() != 0) || (Rotate() && (Rotate()->X() != 0 || Rotate()->Y() != 0)) || (Scale() && Scale()->Z() != 1);
diff --git a/third_party/blink/renderer/devtools/BUILD.gn b/third_party/blink/renderer/devtools/BUILD.gn index 734379d9..22aa080 100644 --- a/third_party/blink/renderer/devtools/BUILD.gn +++ b/third_party/blink/renderer/devtools/BUILD.gn
@@ -570,7 +570,6 @@ "front_end/resources/serviceWorkersView.css", "front_end/resources/ServiceWorkersView.js", "front_end/resources/StorageItemsView.js", - "front_end/Runtime.js", "front_end/shell.json", "front_end/screencast/InputModel.js", "front_end/screencast/module.json", @@ -955,6 +954,7 @@ all_devtools_modules = [ "front_end/root.js", + "front_end/Runtime.js", "front_end/ui/ARIAUtils.js", "front_end/ui/ui.js", "front_end/common/common.js", @@ -1178,6 +1178,7 @@ copied_devtools_modules = [ "$resources_out_dir/root.js", + "$resources_out_dir/Runtime.js", "$resources_out_dir/ui/ARIAUtils.js", "$resources_out_dir/ui/ui.js", "$resources_out_dir/common/common.js",
diff --git a/third_party/blink/renderer/devtools/docs/langpacks/README.md b/third_party/blink/renderer/devtools/docs/langpacks/README.md new file mode 100644 index 0000000..065125b --- /dev/null +++ b/third_party/blink/renderer/devtools/docs/langpacks/README.md
@@ -0,0 +1,6 @@ +Localization FAQs + +- [How to add a localizable string?](adding_strings.md) +- [What are the localization APIs?](localization_apis.md) +- [How to add descriptive information to GRDP messages?](grdp_files.md) +- [How to prevent specific terms being localized?](locked_terms.md) \ No newline at end of file
diff --git a/third_party/blink/renderer/devtools/docs/langpacks/adding_strings.md b/third_party/blink/renderer/devtools/docs/langpacks/adding_strings.md new file mode 100644 index 0000000..471581e --- /dev/null +++ b/third_party/blink/renderer/devtools/docs/langpacks/adding_strings.md
@@ -0,0 +1,116 @@ +When you introduce a new UI string or modify an existing one that will be displayed to the users, or remove a string that is localized, follow these steps so that it can be localized. + +**Table of Contents** +- [Adding a string](#adding-a-string) + - [Frontend source code](#frontend-source-code) + - [Frontend GRDP file](#frontend-grdp-file) +- [Modifying a string](#modifying-a-string) +- [Removing a string](#removing-a-string) +- [Adding a GRD file](#adding-a-grd-file) + +## Adding a string +Before proceeding, make sure you know the different [[localization APIs|]] and know which one you should use. + +### Frontend source code + +1. Wrap your string with the appropriate localization API for your use case, for example, `` ls`Add breakpoint` ``. + +2. If your string contains variables, consider the following cases: + 1. Directly substitute variables, as how you would normally inject variables into a template literal with `${}`, **only if** your variable satisfies one of the following + + 1. If the variable is a number, e.g. `` ls`${renderedWidth} \xd7 ${renderedHeight} pixels` `` + 2. or if your variable is a string that likely doesn't need to be localized (for example, DOM, or a url), + + 3. or if it's a string that is already localized somewhere (for example, Console and other tool titles) + + 2. Localize your variable with `ls`, then do variable substitution in your template literal, for example + + ```javascript + const title = ls`New Tool` + const message = ls`Click ${title} for more details` + ``` + +3. Make sure your string is localizable: + + 1. Do not assume word order by using concatenation. Use the whole string. + - ❌ `` ls`Add` + ls`breakpoint` `` --> ✅ `` ls`Add breakpoint` `` + 2. Variable substitution over concatenation. This is so that the translators can adjust variable order based on what works in another language. For example: + ```javascript + // ❌ + ls`Check ` + title + ls` for more information.` + // ✅ + ls`Check ${title} for more information.` + ``` + 3. Only inject variables when necessary, i.e., do not extract common substrings from similar messages. + - Example: <https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_content_best_practices#Idiom> + 4. Prefer simple strings whenever possible. Try to move conditionals out of the string. For example: + + ```javascript + // ❌ + ls`Reveal${destination ? ls` in ${destination}` : ``}` + // ✅ + destination ? ls`Reveal in ${destination}` : ls`Reveal` + ``` + 5. When your string contains plurals, make sure you pluralize by pulling conditionals outside of the string. This is because in other languages, plurals can be different from English ones. For example: + + ```javascript + // ❌ + ls`${count} insertion${count !== 1 ? `s` : ``}` + // ✅ + if (count === 0) + ls`No insertion` + else if (count === 1) + ls`1 insertion` + else + ls`${count} insertions` + ``` + 6. In general, a complete sentence is preferred. This usually increases the localizability of a string, as the translators have the context of the string. For example: + ```javascript + // ❌ + let description = ls`first part` + if (condition) + description += ls` second part` + // ✅ + let description + if (condition) + description = ls`first part second part` + else + description = ls`first part` + ``` + 7. If your string contains leading or trailing white space, it's usually an indication that it's half of a sentence. This decreases localizability as it's essentially concatenating. Modify it so that it doesn't contain leading or trailing white space anymore if you can. + 8. Do not use nested template literals. This is due to a limitation of the release minifier. For more info see https://crbug.com/973285. + ```javascript + // ❌ + UI.Fragment.build`<a>${ls`Learn more`}</a>` + // ✅ + const link = ls`Learn more` + UI.Fragment.build`<a>${link}</a>` + ``` + 9. What kinds of terms should be localized? + ``` + // ❌ + Numbers: 1, 1.23, 1.2e3, etc. + Application data: error codes, enums, database names, rgba, urls, etc. + // ✅ + Words and sentences + Punctuation + Units of measurement: kb/s, mph, etc. + ``` + +### Frontend GRDP file +1. Run any of the following commands to have new strings automatically added to the corresponding grdp file: + - `git cl presubmit --upload`, or + - `node scripts/check_localizable_resources.js --autofix` under the devtools folder +2. Manually add information to the new grdp message. See [[Adding Descriptive Information to GRDP Messages|]]. + +## Modifying a string +Follow the above steps. + +## Removing a string +Just remove the string from the frontend and it will be automatically removed by the presubmit script. + +## Adding a new GRD file +This is a rare case, but if a new GRD file is introduced, please read the guidance here: +* https://www.chromium.org/developers/tools-we-use-in-chromium/grit/grit-users-guide +* https://cs.chromium.org/chromium/src/tools/gritsettings/README.md. + * Note that you need to add the grd file to translation_expecations.pyl. If you don't an error will occur when Google's translation pipeline runs. \ No newline at end of file
diff --git a/third_party/blink/renderer/devtools/docs/langpacks/grdp_files.md b/third_party/blink/renderer/devtools/docs/langpacks/grdp_files.md new file mode 100644 index 0000000..89d66ba0 --- /dev/null +++ b/third_party/blink/renderer/devtools/docs/langpacks/grdp_files.md
@@ -0,0 +1,41 @@ +Descriptive information in .grdp messages can improve localizability as it will provide more context to the translators. + +Types of descriptive information: +- [Description](#Description) +- [Placeholder name and example](#Placeholder) + +## Description +**Good description**: +```html + <message name="IDS_DEVTOOLS_04efed137e5da6d8b456e83d87915f16" desc="Tooltip text that appears when hovering over the 'Focusable' attribute name under the Computed Properties section in the Accessibility pane of the Elements pane"> + If true, this element can receive focus. + </message> +``` + +**Bad description**: +```html + <message name="IDS_DEVTOOLS_04efed137e5da6d8b456e83d87915f16" desc="Elements pane 'Focusable' tooltip"> + If true, this element can receive focus. + </message> +``` + +### Process to add descriptions +1. Locate the string in the source code +2. Figure out where/how the string shows up in which tool from the content of source code +3. Write a description. See below for guidelines on what to add. + +### What information should I provide in the message description? +- Where is the text located? (e.g. button, title, link, pull-down menu in the Sources pane) +- What triggers the string and/or what is the result? What page or text comes before and after? +- What do the placeholders stand for? Will this message replace a placeholder in another message? Do they need to be arranged in a certain way? +- Is this a verb or a noun? If it's an adjective, what does it refer to? +- Who is the message intended for (e.g. accessible label)? + +## Placeholder +- If the auto-generated `<ph>` tag name is not descriptive, change it to something that explains what the placeholder is used for. Use all uppercase letters connected by underscores. +- Placeholder tag names under the same message tag cannot be the same. +- Use `<ex></ex>` to add an example to a placeholder. Text between `<ex>` will be used as an example for the placeholder content. +- Example: +```xml +Hey <ph name="USER_NAME">$1<ex>Joe</ex></ph>, you have <ph name="COUNT"><ex>10</ex>$2</ph> messages. +``` \ No newline at end of file
diff --git a/third_party/blink/renderer/devtools/docs/langpacks/localization_apis.md b/third_party/blink/renderer/devtools/docs/langpacks/localization_apis.md new file mode 100644 index 0000000..fb579c36 --- /dev/null +++ b/third_party/blink/renderer/devtools/docs/langpacks/localization_apis.md
@@ -0,0 +1,44 @@ +Localizable strings in the DevTools frontend need to be wrapped in localization calls. This guide walks you through a few choices. + +## ls tagged template literal [preferred] +Template literal prefixed with `ls` that returns a translation string. Use on string with or without substitution and return a translation string. To substitute variable, wrap it with `${}`, e.g. ``` ls`Hi ${name}` ```. + +`ls` is generally preferred as it's more readable. The only thing to pay attention to is that all the variables will be converted to string, so if you want to format the variable in a specific way, you have to manually do it. Example: + +```javascript +const progress = 0.734156; +ls`${Number.parseFloat(progress).toPrecision(2)}% done`; +``` + +## Common.UIString(string, variable1, variable2, ...) [deprecated] +Functionally equivalent to `ls` as it also returns a translation string. To substitute variables, use formatters (%s, %d, %.1f, %.2f, and so on) inside the string as the first argument, and use variables as the rest of the call arguments. Example: `Common.UIString('Hi %s, you have %d unread messages', name, count)`. + +If you want to format a float with a specific precision, use a float formatter with precision (e.g. %.1f, %.2f), e.g. `Common.UIString('Default: %.1f', defaultValue)`. This is the only case where `Common.UIString` may be more preferable, but of course you can write/use a precision conversion function and call it in `ls`. + +## UI.formatLocalized(string, [...]) +This call returns a **span element**, not a string. It is used when you want to construct a DOM element with a localizable string, or localizable content that contains some other DOM element. Use the %s formatter inside the localizable string, which is the first argument, and use a list of strings or DOM elements as the second argument. When %s is replaced by a string, it's added as text to the DOM element. For example: + +```javascript +// Create a span element with localizable string +reasonElement = UI.formatLocalized('Element has empty alt text.', []); + +// Element with localizable content containing two DOM elements that are buttons +const recordButton = UI.createInlineButton(UI.Toolbar.createActionButton(this._toggleRecordAction)); +const reloadButton = UI.createInlineButton(UI.Toolbar.createActionButtonForId('coverage.start-with-reload')); +message = UI.formatLocalized( + 'Click the record button %s to start capturing coverage.\nClick the reload button %s to reload and start capturing coverage.', + [recordButton, reloadButton]); + +// Element with error message text and a link +UI.formatLocalized('%s. Read % for more.', [errorMessage, link]) +``` + +## Common.UIStringFormat(string) +This call creates a **formatter** that takes a set number of variables and substitute them in. Call `format(var1, var2, ...)` on the formatter. If you need to use the same format for different variables repeatedly, use this function to save redundant code. + +```javascript +// Format minute to 1 decimal place +const minutesFormat = new Common.UIStringFormat('%.1f min'); + +minutesFormat.format(1.256); // --> '1.2 min' +``` \ No newline at end of file
diff --git a/third_party/blink/renderer/devtools/docs/langpacks/locked_terms.md b/third_party/blink/renderer/devtools/docs/langpacks/locked_terms.md new file mode 100644 index 0000000..c25f80d --- /dev/null +++ b/third_party/blink/renderer/devtools/docs/langpacks/locked_terms.md
@@ -0,0 +1,25 @@ +##How to prevent a term being localized? +If a string contains some terms that should not be localized, they should be wrapped inside placeholder tags `<ph name="LOCKED_[1-9]"></ph>` in the .grdp file. The number after `LOCKED_` starts from 1, and increments when a single string has more then 1 terms that should not be localized. + +**example:** +Frontend javascript file +```javascript +ls`You can log your messages using console.log() in the DevTools console.` +``` + +Frontend .grdp file +(`console.log()` and `DevTools` should not be translated) +```html + <message name="IDS_DEVTOOLS_d59048f21fd887ad520398ce677be586" desc="Text show up in the information bar in the DevTools"> + You can log your messages using <ph name="LOCKED_1">console.log()</ph> in the <ph name="LOCKED_2">DevTools</ph> console. + </message> +``` + +##What should not be localized? +In general, branding related terms and code snippets are the ones to look for. + +Some examples: +- **Brandings:** +Lighthouse, GitHub, DevTools, Chrome Data Saver, Safari, BlackBerry Z30, Kindle Fire HDX, Pixel 2, Microsoft Lumia 550 +- **Code snippets:** +localhost:9229, console.clear(), --memlog=all, url:a.com
diff --git a/third_party/blink/renderer/devtools/front_end/Runtime.js b/third_party/blink/renderer/devtools/front_end/Runtime.js index 7e1d7e0d..e958c077a 100644 --- a/third_party/blink/renderer/devtools/front_end/Runtime.js +++ b/third_party/blink/renderer/devtools/front_end/Runtime.js
@@ -27,17 +27,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// This gets all concatenated module descriptors in the release mode. -const allDescriptors = []; -let applicationDescriptor; const _loadedScripts = {}; -// FIXME: This is a workaround to force Closure compiler provide -// the standard ES6 runtime for all modules. This should be removed -// once Closure provides standard externs for Map et al. -for (const k of []) { // eslint-disable-line -} - (function() { const baseUrl = self.location ? self.location.origin + self.location.pathname : ''; self._importScriptPathPrefix = baseUrl.substring(0, baseUrl.lastIndexOf('/') + 1); @@ -48,20 +39,20 @@ /** * @unrestricted */ -var Runtime = class { // eslint-disable-line +class Runtime { /** - * @param {!Array.<!Runtime.ModuleDescriptor>} descriptors + * @param {!Array.<!ModuleDescriptor>} descriptors */ constructor(descriptors) { /** @type {!Array<!Runtime.Module>} */ this._modules = []; /** @type {!Object<string, !Runtime.Module>} */ this._modulesMap = {}; - /** @type {!Array<!Runtime.Extension>} */ + /** @type {!Array<!Extension>} */ this._extensions = []; /** @type {!Object<string, !function(new:Object)>} */ this._cachedTypeClasses = {}; - /** @type {!Object<string, !Runtime.ModuleDescriptor>} */ + /** @type {!Object<string, !ModuleDescriptor>} */ this._descriptorsMap = {}; for (let i = 0; i < descriptors.length; ++i) { @@ -264,26 +255,26 @@ * @return {!Promise.<undefined>} */ static async startApplication(appName) { - console.timeStamp('Runtime.startApplication'); + console.timeStamp('Root.Runtime.startApplication'); const allDescriptorsByName = {}; - for (let i = 0; i < allDescriptors.length; ++i) { - const d = allDescriptors[i]; + for (let i = 0; i < Root.allDescriptors.length; ++i) { + const d = Root.allDescriptors[i]; allDescriptorsByName[d['name']] = d; } - if (!applicationDescriptor) { + if (!Root.applicationDescriptor) { let data = await Runtime.loadResourcePromise(appName + '.json'); - applicationDescriptor = JSON.parse(data); - let descriptor = applicationDescriptor; + Root.applicationDescriptor = JSON.parse(data); + let descriptor = Root.applicationDescriptor; while (descriptor.extends) { data = await Runtime.loadResourcePromise(descriptor.extends + '.json'); descriptor = JSON.parse(data); - applicationDescriptor.modules = descriptor.modules.concat(applicationDescriptor.modules); + Root.applicationDescriptor.modules = descriptor.modules.concat(Root.applicationDescriptor.modules); } } - const configuration = applicationDescriptor.modules; + const configuration = Root.applicationDescriptor.modules; const moduleJSONPromises = []; const coreModuleNames = []; for (let i = 0; i < configuration.length; ++i) { @@ -319,7 +310,7 @@ * @return {!Promise.<undefined>} */ static startWorker(appName) { - return Runtime.startApplication(appName).then(sendWorkerReady); + return Root.Runtime.startApplication(appName).then(sendWorkerReady); function sendWorkerReady() { self.postMessage('workerReady'); @@ -431,7 +422,7 @@ } /** - * @param {!Runtime.ModuleDescriptor} descriptor + * @param {!ModuleDescriptor} descriptor */ _registerModule(descriptor) { const module = new Runtime.Module(this, descriptor); @@ -460,7 +451,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Extension} extension * @param {?function(function(new:Object)):boolean} predicate * @return {boolean} */ @@ -483,7 +474,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Extension} extension * @param {?Object} context * @return {boolean} */ @@ -503,7 +494,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Extension} extension * @param {!Set.<!Function>=} currentContextTypes * @return {boolean} */ @@ -527,13 +518,13 @@ * @param {*} type * @param {?Object=} context * @param {boolean=} sortByTitle - * @return {!Array.<!Runtime.Extension>} + * @return {!Array.<!Extension>} */ extensions(type, context, sortByTitle) { return this._extensions.filter(filter).sort(sortByTitle ? titleComparator : orderComparator); /** - * @param {!Runtime.Extension} extension + * @param {!Extension} extension * @return {boolean} */ function filter(extension) { @@ -547,8 +538,8 @@ } /** - * @param {!Runtime.Extension} extension1 - * @param {!Runtime.Extension} extension2 + * @param {!Extension} extension1 + * @param {!Extension} extension2 * @return {number} */ function orderComparator(extension1, extension2) { @@ -558,8 +549,8 @@ } /** - * @param {!Runtime.Extension} extension1 - * @param {!Runtime.Extension} extension2 + * @param {!Extension} extension1 + * @param {!Extension} extension2 * @return {number} */ function titleComparator(extension1, extension2) { @@ -572,7 +563,7 @@ /** * @param {*} type * @param {?Object=} context - * @return {?Runtime.Extension} + * @return {?Extension} */ extension(type, context) { return this.extensions(type, context)[0] || null; @@ -619,7 +610,7 @@ constructorFunction[Runtime._instanceSymbol] = instance; return instance; } -}; +} /** @type {!URLSearchParams} */ Runtime._queryParamsObject = new URLSearchParams(Runtime.queryParamsString()); @@ -644,7 +635,7 @@ /** * @unrestricted */ -Runtime.ModuleDescriptor = class { +class ModuleDescriptor { constructor() { /** * @type {string} @@ -652,7 +643,7 @@ this.name; /** - * @type {!Array.<!Runtime.ExtensionDescriptor>} + * @type {!Array.<!RuntimeExtensionDescriptor>} */ this.extensions; @@ -676,12 +667,14 @@ */ this.remote; } -}; +} +// This class is named like this, because we already have an "ExtensionDescriptor" in the externs +// These two do not share the same structure /** * @unrestricted */ -Runtime.ExtensionDescriptor = class { +class RuntimeExtensionDescriptor { constructor() { /** * @type {string} @@ -703,28 +696,28 @@ */ this.contextTypes; } -}; +} /** * @unrestricted */ -Runtime.Module = class { +class Module { /** * @param {!Runtime} manager - * @param {!Runtime.ModuleDescriptor} descriptor + * @param {!ModuleDescriptor} descriptor */ constructor(manager, descriptor) { this._manager = manager; this._descriptor = descriptor; this._name = descriptor.name; - /** @type {!Array<!Runtime.Extension>} */ + /** @type {!Array<!Extension>} */ this._extensions = []; - /** @type {!Map<string, !Array<!Runtime.Extension>>} */ + /** @type {!Map<string, !Array<!Extension>>} */ this._extensionsByClassName = new Map(); - const extensions = /** @type {?Array.<!Runtime.ExtensionDescriptor>} */ (descriptor.extensions); + const extensions = /** @type {?Array.<!RuntimeExtensionDescriptor>} */ (descriptor.extensions); for (let i = 0; extensions && i < extensions.length; ++i) { - const extension = new Runtime.Extension(this, extensions[i]); + const extension = new Extension(this, extensions[i]); this._manager._extensions.push(extension); this._extensions.push(extension); } @@ -868,16 +861,15 @@ return base + this._modularizeURL(url); } } -}; +} /** * @unrestricted */ -Runtime.Extension = class { - /** +class Extension { /** * @param {!Runtime.Module} module - * @param {!Runtime.ExtensionDescriptor} descriptor + * @param {!RuntimeExtensionDescriptor} descriptor */ constructor(module, descriptor) { this._module = module; @@ -991,12 +983,12 @@ } return false; } -}; +} /** * @unrestricted */ -Runtime.ExperimentsSupport = class { +class ExperimentsSupport { constructor() { this._supportEnabled = Runtime.queryParam('experiments') !== null; this._experiments = []; @@ -1136,12 +1128,12 @@ _checkExperiment(experimentName) { Runtime._assert(this._experimentNames[experimentName], 'Unknown experiment ' + experimentName); } -}; +} /** * @unrestricted */ -Runtime.Experiment = class { +class Experiment { /** * @param {!Runtime.ExperimentsSupport} experiments * @param {string} name @@ -1168,10 +1160,10 @@ setEnabled(enabled) { this._experiments.setEnabled(this.name, enabled); } -}; +} // This must be constructed after the query parameters have been parsed. -Runtime.experiments = new Runtime.ExperimentsSupport(); +Runtime.experiments = new ExperimentsSupport(); /** @type {Function} */ Runtime._appStartedPromiseCallback; @@ -1193,31 +1185,34 @@ } })(); +self.Root = self.Root || {}; +Root = Root || {}; -/** - * @interface - */ -function ServicePort() { -} +// This gets all concatenated module descriptors in the release mode. +Root.allDescriptors = []; -ServicePort.prototype = { - /** - * @param {function(string)} messageHandler - * @param {function(string)} closeHandler - */ - setHandlers(messageHandler, closeHandler) {}, +Root.applicationDescriptor = undefined; - /** - * @param {string} message - * @return {!Promise<boolean>} - */ - send(message) {}, - - /** - * @return {!Promise<boolean>} - */ - close() {} -}; +/** @constructor */ +Root.Runtime = Runtime; /** @type {!Runtime} */ -var runtime; // eslint-disable-line +Root.runtime; + +/** @constructor */ +Root.Runtime.ModuleDescriptor = ModuleDescriptor; + +/** @constructor */ +Root.Runtime.ExtensionDescriptor = RuntimeExtensionDescriptor; + +/** @constructor */ +Root.Runtime.Extension = Extension; + +/** @constructor */ +Root.Runtime.Module = Module; + +/** @constructor */ +Root.Runtime.ExperimentsSupport = ExperimentsSupport; + +/** @constructor */ +Root.Runtime.Experiment = Experiment; \ No newline at end of file
diff --git a/third_party/blink/renderer/devtools/front_end/Tests.js b/third_party/blink/renderer/devtools/front_end/Tests.js index 9717a79..8704a71 100644 --- a/third_party/blink/renderer/devtools/front_end/Tests.js +++ b/third_party/blink/renderer/devtools/front_end/Tests.js
@@ -1033,7 +1033,7 @@ } function reset() { - Runtime.experiments.clearForTest(); + Root.Runtime.experiments.clearForTest(); InspectorFrontendHost.getPreferences(gotPreferences); } @@ -1230,7 +1230,7 @@ }; TestSuite.prototype.enableExperiment = function(name) { - Runtime.experiments.enableForTest(name); + Root.Runtime.experiments.enableForTest(name); }; TestSuite.prototype.checkInputEventsPresent = function() {
diff --git a/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js b/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js index baf1029..75eeb92 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js +++ b/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js
@@ -147,7 +147,7 @@ const dom = new DOM(/** @type {!Document} */ (this._auditResultsElement.ownerDocument)); const renderer = new Audits.ReportRenderer(dom); - const templatesHTML = Runtime.cachedResources['audits/lighthouse/templates.html']; + const templatesHTML = Root.Runtime.cachedResources['audits/lighthouse/templates.html']; const templatesDOM = new DOMParser().parseFromString(templatesHTML, 'text/html'); if (!templatesDOM) { return;
diff --git a/third_party/blink/renderer/devtools/front_end/audits/AuditsReportRenderer.js b/third_party/blink/renderer/devtools/front_end/audits/AuditsReportRenderer.js index daa33aec..958c4469 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/AuditsReportRenderer.js +++ b/third_party/blink/renderer/devtools/front_end/audits/AuditsReportRenderer.js
@@ -130,7 +130,7 @@ const clonedReport = document.querySelector('.lh-root').cloneNode(true /* deep */); const printWindow = window.open('', '_blank', 'channelmode=1,status=1,resizable=1'); const style = printWindow.document.createElement('style'); - style.textContent = Runtime.cachedResources['audits/lighthouse/report.css']; + style.textContent = Root.Runtime.cachedResources['audits/lighthouse/report.css']; printWindow.document.head.appendChild(style); printWindow.document.body.replaceWith(clonedReport); // Linkified nodes are shadow elements, which aren't exposed via `cloneNode`.
diff --git a/third_party/blink/renderer/devtools/front_end/audits/lighthouse/report-generator.js b/third_party/blink/renderer/devtools/front_end/audits/lighthouse/report-generator.js index 829a1b1..9827150 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/lighthouse/report-generator.js +++ b/third_party/blink/renderer/devtools/front_end/audits/lighthouse/report-generator.js
@@ -8,14 +8,14 @@ /** * @fileoverview Instead of loading report assets form the filesystem, in Devtools we must load - * them via Runtime.cachedResources. We use this module to shim + * them via Root.Runtime.cachedResources. We use this module to shim * lighthouse-core/report/html/html-report-assets.js in Devtools. */ /* global Runtime */ // @ts-ignore: Runtime exists in Devtools. -const cachedResources = Runtime.cachedResources; +const cachedResources = Root.Runtime.cachedResources; // Getters are necessary because the DevTools bundling processes // resources after this module is resolved. These properties are not
diff --git a/third_party/blink/renderer/devtools/front_end/audits_worker.js b/third_party/blink/renderer/devtools/front_end/audits_worker.js index 77fad7f..56b8146 100644 --- a/third_party/blink/renderer/devtools/front_end/audits_worker.js +++ b/third_party/blink/renderer/devtools/front_end/audits_worker.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Release build has Runtime.js bundled. -if (!self.Runtime) { +if (!self.Root || !self.Root.Runtime) { self.importScripts('Runtime.js'); } -Runtime.startWorker('audits_worker'); +Root.Runtime.startWorker('audits_worker');
diff --git a/third_party/blink/renderer/devtools/front_end/audits_worker/AuditsService.js b/third_party/blink/renderer/devtools/front_end/audits_worker/AuditsService.js index 80689072..a66191c 100644 --- a/third_party/blink/renderer/devtools/front_end/audits_worker/AuditsService.js +++ b/third_party/blink/renderer/devtools/front_end/audits_worker/AuditsService.js
@@ -42,7 +42,7 @@ * @return {!Promise<!ReportRenderer.RunnerResult>} */ start(params) { - if (Runtime.queryParam('isUnderTest')) { + if (Root.Runtime.queryParam('isUnderTest')) { this._disableLoggingForTest(); params.flags.maxWaitForLoad = 2 * 1000; }
diff --git a/third_party/blink/renderer/devtools/front_end/cm_modes/DefaultCodeMirrorMimeMode.js b/third_party/blink/renderer/devtools/front_end/cm_modes/DefaultCodeMirrorMimeMode.js index 31497d4..c76bf67e 100644 --- a/third_party/blink/renderer/devtools/front_end/cm_modes/DefaultCodeMirrorMimeMode.js +++ b/third_party/blink/renderer/devtools/front_end/cm_modes/DefaultCodeMirrorMimeMode.js
@@ -6,19 +6,16 @@ * @constructor * @implements {TextEditor.CodeMirrorMimeMode} */ -CmModes.DefaultCodeMirrorMimeMode = function() -{ -} +CmModes.DefaultCodeMirrorMimeMode = function() {}; CmModes.DefaultCodeMirrorMimeMode.prototype = { - /** - * @param {!Runtime.Extension} extension + /** + * @param {!Root.Runtime.Extension} extension * @override */ - install: function(extension) - { - var modeFileName = extension.descriptor()["fileName"]; - var modeContent = extension.module().resource(modeFileName); - self.eval(modeContent + "\n//# sourceURL=" + modeFileName); - } + install: function(extension) { + var modeFileName = extension.descriptor()['fileName']; + var modeContent = extension.module().resource(modeFileName); + self.eval(modeContent + '\n//# sourceURL=' + modeFileName); + } }
diff --git a/third_party/blink/renderer/devtools/front_end/common/Console.js b/third_party/blink/renderer/devtools/front_end/common/Console.js index 9695527..06510fda 100644 --- a/third_party/blink/renderer/devtools/front_end/common/Console.js +++ b/third_party/blink/renderer/devtools/front_end/common/Console.js
@@ -1,24 +1,26 @@ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + +import ObjectWrapper from './Object.js'; + /** * @unrestricted */ -export default class Console extends Common.Object { +export default class Console extends ObjectWrapper { constructor() { super(); - /** @type {!Array.<!Common.Console.Message>} */ + /** @type {!Array.<!Message>} */ this._messages = []; } /** * @param {string} text - * @param {!Common.Console.MessageLevel} level + * @param {!MessageLevel} level * @param {boolean=} show */ addMessage(text, level, show) { - const message = - new Common.Console.Message(text, level || Common.Console.MessageLevel.Info, Date.now(), show || false); + const message = new Message(text, level || MessageLevel.Info, Date.now(), show || false); this._messages.push(message); this.dispatchEventToListeners(Common.Console.Events.MessageAdded, message); } @@ -27,25 +29,25 @@ * @param {string} text */ log(text) { - this.addMessage(text, Common.Console.MessageLevel.Info); + this.addMessage(text, MessageLevel.Info); } /** * @param {string} text */ warn(text) { - this.addMessage(text, Common.Console.MessageLevel.Warning); + this.addMessage(text, MessageLevel.Warning); } /** * @param {string} text */ error(text) { - this.addMessage(text, Common.Console.MessageLevel.Error, true); + this.addMessage(text, MessageLevel.Error, true); } /** - * @return {!Array.<!Common.Console.Message>} + * @return {!Array.<!Message>} */ messages() { return this._messages; @@ -83,7 +85,7 @@ export class Message { /** * @param {string} text - * @param {!Common.Console.MessageLevel} level + * @param {!MessageLevel} level * @param {number} timestamp * @param {boolean} show */
diff --git a/third_party/blink/renderer/devtools/front_end/common/ParsedURL.js b/third_party/blink/renderer/devtools/front_end/common/ParsedURL.js index 280a37fd..16718fa 100644 --- a/third_party/blink/renderer/devtools/front_end/common/ParsedURL.js +++ b/third_party/blink/renderer/devtools/front_end/common/ParsedURL.js
@@ -269,7 +269,7 @@ if (hrefPath.charAt(0) !== '/') { hrefPath = parsedURL.folderPathComponents + '/' + hrefPath; } - return securityOrigin + Runtime.normalizePath(hrefPath) + hrefSuffix; + return securityOrigin + Root.Runtime.normalizePath(hrefPath) + hrefSuffix; } /**
diff --git a/third_party/blink/renderer/devtools/front_end/common/Settings.js b/third_party/blink/renderer/devtools/front_end/common/Settings.js index d60d453..2c10023 100644 --- a/third_party/blink/renderer/devtools/front_end/common/Settings.js +++ b/third_party/blink/renderer/devtools/front_end/common/Settings.js
@@ -50,7 +50,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ _registerModuleSetting(extension) { const descriptor = extension.descriptor(); @@ -77,7 +77,7 @@ setting.setTitle(extension.title()); } if (descriptor['userActionCondition']) { - setting.setRequiresUserAction(!!Runtime.queryParam(descriptor['userActionCondition'])); + setting.setRequiresUserAction(!!Root.Runtime.queryParam(descriptor['userActionCondition'])); } setting._extension = extension; this._moduleSettings.set(settingName, setting); @@ -367,7 +367,7 @@ } /** - * @return {?Runtime.Extension} + * @return {?Root.Runtime.Extension} */ extension() { return this._extension;
diff --git a/third_party/blink/renderer/devtools/front_end/common/Worker.js b/third_party/blink/renderer/devtools/front_end/common/Worker.js index 62c243a8..bdf73e88 100644 --- a/third_party/blink/renderer/devtools/front_end/common/Worker.js +++ b/third_party/blink/renderer/devtools/front_end/common/Worker.js
@@ -37,7 +37,7 @@ */ constructor(appName) { let url = appName + '.js'; - url += Runtime.queryParamsString(); + url += Root.Runtime.queryParamsString(); /** @type {!Promise<!Worker>} */ this._workerPromise = new Promise(fulfill => {
diff --git a/third_party/blink/renderer/devtools/front_end/console_counters/WarningErrorCounter.js b/third_party/blink/renderer/devtools/front_end/console_counters/WarningErrorCounter.js index 172463d..b218fdc 100644 --- a/third_party/blink/renderer/devtools/front_end/console_counters/WarningErrorCounter.js +++ b/third_party/blink/renderer/devtools/front_end/console_counters/WarningErrorCounter.js
@@ -24,14 +24,14 @@ }); const violationShadowRoot = UI.createShadowRootWithCoreStyles(this._violationCounter, 'console_counters/errorWarningCounter.css'); - if (Runtime.experiments.isEnabled('spotlight')) { + if (Root.Runtime.experiments.isEnabled('spotlight')) { countersWrapper.appendChild(this._violationCounter); } this._errors = this._createItem(shadowRoot, 'smallicon-error'); this._warnings = this._createItem(shadowRoot, 'smallicon-warning'); - if (Runtime.experiments.isEnabled('spotlight')) { + if (Root.Runtime.experiments.isEnabled('spotlight')) { this._violations = this._createItem(violationShadowRoot, 'smallicon-info'); } this._titles = []; @@ -121,7 +121,7 @@ this._titles.push(warningCountTitle); } - if (Runtime.experiments.isEnabled('spotlight')) { + if (Root.Runtime.experiments.isEnabled('spotlight')) { let violationCountTitle = ''; if (violations === 1) { violationCountTitle = ls`${violations} violation`;
diff --git a/third_party/blink/renderer/devtools/front_end/devtools_app.html b/third_party/blink/renderer/devtools/front_end/devtools_app.html index 2460c329..7387941 100644 --- a/third_party/blink/renderer/devtools/front_end/devtools_app.html +++ b/third_party/blink/renderer/devtools/front_end/devtools_app.html
@@ -10,7 +10,6 @@ <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <meta name="referrer" content="no-referrer"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="devtools_app.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/devtools_app.js b/third_party/blink/renderer/devtools/front_end/devtools_app.js index 17310fa..75cbe26a 100644 --- a/third_party/blink/renderer/devtools/front_end/devtools_app.js +++ b/third_party/blink/renderer/devtools/front_end/devtools_app.js
@@ -1,4 +1,4 @@ // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('devtools_app'); +Root.Runtime.startApplication('devtools_app');
diff --git a/third_party/blink/renderer/devtools/front_end/elements/InspectElementModeController.js b/third_party/blink/renderer/devtools/front_end/elements/InspectElementModeController.js index a2e8462a..900c89d 100644 --- a/third_party/blink/renderer/devtools/front_end/elements/InspectElementModeController.js +++ b/third_party/blink/renderer/devtools/front_end/elements/InspectElementModeController.js
@@ -161,4 +161,4 @@ /** @type {?Elements.InspectElementModeController} */ Elements.inspectElementModeController = - Runtime.queryParam('isSharedWorker') ? null : new Elements.InspectElementModeController(); + Root.Runtime.queryParam('isSharedWorker') ? null : new Elements.InspectElementModeController();
diff --git a/third_party/blink/renderer/devtools/front_end/elements/MarkerDecorator.js b/third_party/blink/renderer/devtools/front_end/elements/MarkerDecorator.js index 1b67e5d5..a39c9c7 100644 --- a/third_party/blink/renderer/devtools/front_end/elements/MarkerDecorator.js +++ b/third_party/blink/renderer/devtools/front_end/elements/MarkerDecorator.js
@@ -21,7 +21,7 @@ */ Elements.GenericDecorator = class { /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ constructor(extension) { this._title = Common.UIString(extension.title());
diff --git a/third_party/blink/renderer/devtools/front_end/emulation/DeviceModeWrapper.js b/third_party/blink/renderer/devtools/front_end/emulation/DeviceModeWrapper.js index 91f0680..8dd0897 100644 --- a/third_party/blink/renderer/devtools/front_end/emulation/DeviceModeWrapper.js +++ b/third_party/blink/renderer/devtools/front_end/emulation/DeviceModeWrapper.js
@@ -17,7 +17,7 @@ this._toggleDeviceModeAction = UI.actionRegistry.action('emulation.toggle-device-mode'); const model = self.singleton(Emulation.DeviceModeModel); this._showDeviceModeSetting = model.enabledSetting(); - this._showDeviceModeSetting.setRequiresUserAction(!!Runtime.queryParam('hasOtherClients')); + this._showDeviceModeSetting.setRequiresUserAction(!!Root.Runtime.queryParam('hasOtherClients')); this._showDeviceModeSetting.addChangeListener(this._update.bind(this, false)); SDK.targetManager.addModelListener( SDK.OverlayModel, SDK.OverlayModel.Events.ScreenshotRequested, this._screenshotRequestedFromOverlay, this);
diff --git a/third_party/blink/renderer/devtools/front_end/emulation/EmulatedDevices.js b/third_party/blink/renderer/devtools/front_end/emulation/EmulatedDevices.js index 81d092ed..1456deac 100644 --- a/third_party/blink/renderer/devtools/front_end/emulation/EmulatedDevices.js +++ b/third_party/blink/renderer/devtools/front_end/emulation/EmulatedDevices.js
@@ -28,7 +28,7 @@ /** @type {boolean} */ this._showByDefault = true; - /** @type {?Runtime.Extension} */ + /** @type {?Root.Runtime.Extension} */ this._extension = null; } @@ -191,14 +191,14 @@ } /** - * @return {?Runtime.Extension} + * @return {?Root.Runtime.Extension} */ extension() { return this._extension; } /** - * @param {?Runtime.Extension} extension + * @param {?Root.Runtime.Extension} extension */ setExtension(extension) { this._extension = extension;
diff --git a/third_party/blink/renderer/devtools/front_end/extensions/ExtensionServer.js b/third_party/blink/renderer/devtools/front_end/extensions/ExtensionServer.js index a2d05e6..17fc8ce 100644 --- a/third_party/blink/renderer/devtools/front_end/extensions/ExtensionServer.js +++ b/third_party/blink/renderer/devtools/front_end/extensions/ExtensionServer.js
@@ -236,7 +236,7 @@ * @suppressGlobalPropertiesCheck */ _onApplyStyleSheet(message) { - if (!Runtime.experiments.isEnabled('applyCustomStylesheet')) { + if (!Root.Runtime.experiments.isEnabled('applyCustomStylesheet')) { return; } const styleSheet = createElement('style');
diff --git a/third_party/blink/renderer/devtools/front_end/externs.js b/third_party/blink/renderer/devtools/front_end/externs.js index eaaf2a7..00ac005 100644 --- a/third_party/blink/renderer/devtools/front_end/externs.js +++ b/third_party/blink/renderer/devtools/front_end/externs.js
@@ -1475,4 +1475,29 @@ statusCode: number, headers: (!Object.<string, string>|undefined) }} */ -InspectorFrontendHostAPI.LoadNetworkResourceResult; \ No newline at end of file +InspectorFrontendHostAPI.LoadNetworkResourceResult; + +/** + * @interface + */ +class ServicePort { + /** + * @param {function(string)} messageHandler + * @param {function(string)} closeHandler + */ + setHandlers(messageHandler, closeHandler) { + } + + /** + * @param {string} message + * @return {!Promise<boolean>} + */ + send(message) { + } + + /** + * @return {!Promise<boolean>} + */ + close() { + } +} \ No newline at end of file
diff --git a/third_party/blink/renderer/devtools/front_end/formatter_worker.js b/third_party/blink/renderer/devtools/front_end/formatter_worker.js index 26dd25ea..dd63d31f 100644 --- a/third_party/blink/renderer/devtools/front_end/formatter_worker.js +++ b/third_party/blink/renderer/devtools/front_end/formatter_worker.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Release build has Runtime.js bundled. -if (!self.Runtime) { +if (!self.Root || !self.Root.Runtime) { self.importScripts('Runtime.js'); } -Runtime.startWorker('formatter_worker'); +Root.Runtime.startWorker('formatter_worker');
diff --git a/third_party/blink/renderer/devtools/front_end/formatter_worker/FormatterWorker.js b/third_party/blink/renderer/devtools/front_end/formatter_worker/FormatterWorker.js index c37f746..56649a6 100644 --- a/third_party/blink/renderer/devtools/front_end/formatter_worker/FormatterWorker.js +++ b/third_party/blink/renderer/devtools/front_end/formatter_worker/FormatterWorker.js
@@ -597,7 +597,7 @@ extension.instance().then(instance => instance.parse(content)).catchException(null).then(postMessage); /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @return {boolean} */ function findExtension(extension) { @@ -606,7 +606,7 @@ }; (function disableLoggingForTest() { - if (Runtime.queryParam('test')) { + if (Root.Runtime.queryParam('test')) { console.error = () => undefined; } })();
diff --git a/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker.js b/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker.js index 1a3552b6..6b63f51 100644 --- a/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker.js +++ b/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. // Release build has Runtime.js bundled. -if (!self.Runtime) { +if (!self.Root || !self.Root.Runtime) { self.importScripts('Runtime.js'); } @@ -65,4 +65,4 @@ self.serializeUIString = serializeUIString; self.deserializeUIString = deserializeUIString; -Runtime.startWorker('heap_snapshot_worker'); +Root.Runtime.startWorker('heap_snapshot_worker');
diff --git a/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker/HeapSnapshot.js b/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker/HeapSnapshot.js index 3b59ae28..2c8a778 100644 --- a/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker/HeapSnapshot.js +++ b/third_party/blink/renderer/devtools/front_end/heap_snapshot_worker/HeapSnapshot.js
@@ -3281,7 +3281,7 @@ (function disableLoggingForTest() { // Runtime doesn't exist because this file is loaded as a one-off // file in some inspector-protocol tests. - if (self.Runtime && Runtime.queryParam('test')) { + if (self.Root && self.Root.Runtime && Root.Runtime.queryParam('test')) { console.warn = () => undefined; } })();
diff --git a/third_party/blink/renderer/devtools/front_end/host/InspectorFrontendHost.js b/third_party/blink/renderer/devtools/front_end/host/InspectorFrontendHost.js index 0fff65c..33cbc85e 100644 --- a/third_party/blink/renderer/devtools/front_end/host/InspectorFrontendHost.js +++ b/third_party/blink/renderer/devtools/front_end/host/InspectorFrontendHost.js
@@ -285,7 +285,7 @@ * @param {function(!InspectorFrontendHostAPI.LoadNetworkResourceResult)} callback */ loadNetworkResource(url, headers, streamId, callback) { - Runtime.loadResourcePromise(url) + Root.Runtime.loadResourcePromise(url) .then(function(text) { Host.ResourceLoader.streamWrite(streamId, text); callback({statusCode: 200}); @@ -506,7 +506,7 @@ Host.InspectorFrontendAPIImpl = class { constructor() { this._debugFrontend = - !!Runtime.queryParam('debugFrontend') || (window['InspectorTest'] && window['InspectorTest']['debugTest']); + !!Root.Runtime.queryParam('debugFrontend') || (window['InspectorTest'] && window['InspectorTest']['debugTest']); const descriptors = Host.InspectorFrontendAPIImpl.EventDescriptors; for (let i = 0; i < descriptors.length; ++i) { @@ -640,7 +640,7 @@ */ Host.isUnderTest = function(prefs) { // Integration tests rely on test queryParam. - if (Runtime.queryParam('test')) { + if (Root.Runtime.queryParam('test')) { return true; } // Browser tests rely on prefs.
diff --git a/third_party/blink/renderer/devtools/front_end/inspector.html b/third_party/blink/renderer/devtools/front_end/inspector.html index 1ab4d319..e26cd22 100644 --- a/third_party/blink/renderer/devtools/front_end/inspector.html +++ b/third_party/blink/renderer/devtools/front_end/inspector.html
@@ -10,7 +10,6 @@ <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <meta name="referrer" content="no-referrer"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="inspector.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/inspector.js b/third_party/blink/renderer/devtools/front_end/inspector.js index c690b32..bfb7f06 100644 --- a/third_party/blink/renderer/devtools/front_end/inspector.js +++ b/third_party/blink/renderer/devtools/front_end/inspector.js
@@ -1,4 +1,4 @@ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('inspector'); +Root.Runtime.startApplication('inspector');
diff --git a/third_party/blink/renderer/devtools/front_end/inspector_main/InspectorMain.js b/third_party/blink/renderer/devtools/front_end/inspector_main/InspectorMain.js index 19146a8f..f948cac5 100644 --- a/third_party/blink/renderer/devtools/front_end/inspector_main/InspectorMain.js +++ b/third_party/blink/renderer/devtools/front_end/inspector_main/InspectorMain.js
@@ -12,8 +12,8 @@ async run() { let firstCall = true; await SDK.initMainConnection(async () => { - const type = Runtime.queryParam('v8only') ? SDK.Target.Type.Node : SDK.Target.Type.Frame; - const waitForDebuggerInPage = type === SDK.Target.Type.Frame && Runtime.queryParam('panel') === 'sources'; + const type = Root.Runtime.queryParam('v8only') ? SDK.Target.Type.Node : SDK.Target.Type.Frame; + const waitForDebuggerInPage = type === SDK.Target.Type.Frame && Root.Runtime.queryParam('panel') === 'sources'; const target = SDK.targetManager.createTarget('main', Common.UIString('Main'), type, null, undefined, waitForDebuggerInPage);
diff --git a/third_party/blink/renderer/devtools/front_end/integration_test_runner.html b/third_party/blink/renderer/devtools/front_end/integration_test_runner.html index 073b301..ebf13c4e 100644 --- a/third_party/blink/renderer/devtools/front_end/integration_test_runner.html +++ b/third_party/blink/renderer/devtools/front_end/integration_test_runner.html
@@ -9,7 +9,6 @@ <meta charset="utf-8"> <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="integration_test_runner.js"></script> </head> <body id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/integration_test_runner.js b/third_party/blink/renderer/devtools/front_end/integration_test_runner.js index 3eddfa01..f6f6a7a0 100644 --- a/third_party/blink/renderer/devtools/front_end/integration_test_runner.js +++ b/third_party/blink/renderer/devtools/front_end/integration_test_runner.js
@@ -7,4 +7,4 @@ testRunner.waitUntilDone(); } -Runtime.startApplication('integration_test_runner'); +Root.Runtime.startApplication('integration_test_runner');
diff --git a/third_party/blink/renderer/devtools/front_end/js_app.html b/third_party/blink/renderer/devtools/front_end/js_app.html index 8cc144c..8d7b199 100644 --- a/third_party/blink/renderer/devtools/front_end/js_app.html +++ b/third_party/blink/renderer/devtools/front_end/js_app.html
@@ -10,7 +10,6 @@ <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <meta name="referrer" content="no-referrer"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="js_app.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/js_app.js b/third_party/blink/renderer/devtools/front_end/js_app.js index 11427a08..076e3f7 100644 --- a/third_party/blink/renderer/devtools/front_end/js_app.js +++ b/third_party/blink/renderer/devtools/front_end/js_app.js
@@ -1,4 +1,4 @@ // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('js_app'); +Root.Runtime.startApplication('js_app');
diff --git a/third_party/blink/renderer/devtools/front_end/main/Main.js b/third_party/blink/renderer/devtools/front_end/main/Main.js index d0e24d3..04d62f0 100644 --- a/third_party/blink/renderer/devtools/front_end/main/Main.js +++ b/third_party/blink/renderer/devtools/front_end/main/Main.js
@@ -62,9 +62,9 @@ async _loaded() { console.timeStamp('Main._loaded'); - await Runtime.appStarted(); - Runtime.setPlatform(Host.platform()); - Runtime.setL10nCallback(ls); + await Root.Runtime.appStarted(); + Root.Runtime.setPlatform(Host.platform()); + Root.Runtime.setL10nCallback(ls); InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); } @@ -89,7 +89,8 @@ let storagePrefix = ''; if (Host.isCustomDevtoolsFrontend()) { storagePrefix = '__custom__'; - } else if (!Runtime.queryParam('can_dock') && !!Runtime.queryParam('debugFrontend') && !Host.isUnderTest()) { + } else if ( + !Root.Runtime.queryParam('can_dock') && !!Root.Runtime.queryParam('debugFrontend') && !Host.isUnderTest()) { storagePrefix = '__bundled__'; } @@ -111,51 +112,56 @@ _initializeExperiments() { // Keep this sorted alphabetically: both keys and values. - Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI themes'); - Runtime.experiments.register('captureNodeCreationStacks', 'Capture node creation stacks'); - Runtime.experiments.register('sourcesPrettyPrint', 'Automatically pretty print in the Sources Panel'); - Runtime.experiments.register('backgroundServices', 'Background web platform feature events', true); - Runtime.experiments.register('backgroundServicesNotifications', 'Background services section for Notifications'); - Runtime.experiments.register('backgroundServicesPaymentHandler', 'Background services section for Payment Handler'); - Runtime.experiments.register('backgroundServicesPushMessaging', 'Background services section for Push Messaging'); - Runtime.experiments.register( + Root.Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI themes'); + Root.Runtime.experiments.register('captureNodeCreationStacks', 'Capture node creation stacks'); + Root.Runtime.experiments.register('sourcesPrettyPrint', 'Automatically pretty print in the Sources Panel'); + Root.Runtime.experiments.register('backgroundServices', 'Background web platform feature events', true); + Root.Runtime.experiments.register( + 'backgroundServicesNotifications', 'Background services section for Notifications'); + Root.Runtime.experiments.register( + 'backgroundServicesPaymentHandler', 'Background services section for Payment Handler'); + Root.Runtime.experiments.register( + 'backgroundServicesPushMessaging', 'Background services section for Push Messaging'); + Root.Runtime.experiments.register( 'backgroundServicesPeriodicBackgroundSync', 'Background services section for Periodic Background Sync'); - Runtime.experiments.register('blackboxJSFramesOnTimeline', 'Blackbox JavaScript frames on Timeline', true); - Runtime.experiments.register('cssOverview', 'CSS Overview'); - Runtime.experiments.register('emptySourceMapAutoStepping', 'Empty sourcemap auto-stepping'); - Runtime.experiments.register('inputEventsOnTimelineOverview', 'Input events on Timeline overview', true); - Runtime.experiments.register('liveHeapProfile', 'Live heap profile', true); - Runtime.experiments.register('nativeHeapProfiler', 'Native memory sampling heap profiler', true); - Runtime.experiments.register('protocolMonitor', 'Protocol Monitor'); - Runtime.experiments.register('recordCoverageWithPerformanceTracing', 'Record coverage while performance tracing'); - Runtime.experiments.register('samplingHeapProfilerTimeline', 'Sampling heap profiler timeline', true); - Runtime.experiments.register('sourceDiff', 'Source diff'); - Runtime.experiments.register('splitInDrawer', 'Split in drawer', true); - Runtime.experiments.register('spotlight', 'Spotlight', true); - Runtime.experiments.register('terminalInDrawer', 'Terminal in drawer', true); + Root.Runtime.experiments.register('blackboxJSFramesOnTimeline', 'Blackbox JavaScript frames on Timeline', true); + Root.Runtime.experiments.register('cssOverview', 'CSS Overview'); + Root.Runtime.experiments.register('emptySourceMapAutoStepping', 'Empty sourcemap auto-stepping'); + Root.Runtime.experiments.register('inputEventsOnTimelineOverview', 'Input events on Timeline overview', true); + Root.Runtime.experiments.register('liveHeapProfile', 'Live heap profile', true); + Root.Runtime.experiments.register('nativeHeapProfiler', 'Native memory sampling heap profiler', true); + Root.Runtime.experiments.register('protocolMonitor', 'Protocol Monitor'); + Root.Runtime.experiments.register( + 'recordCoverageWithPerformanceTracing', 'Record coverage while performance tracing'); + Root.Runtime.experiments.register('samplingHeapProfilerTimeline', 'Sampling heap profiler timeline', true); + Root.Runtime.experiments.register('sourceDiff', 'Source diff'); + Root.Runtime.experiments.register('splitInDrawer', 'Split in drawer', true); + Root.Runtime.experiments.register('spotlight', 'Spotlight', true); + Root.Runtime.experiments.register('terminalInDrawer', 'Terminal in drawer', true); // Timeline - Runtime.experiments.register('timelineEventInitiators', 'Timeline: event initiators'); - Runtime.experiments.register('timelineFlowEvents', 'Timeline: flow events', true); - Runtime.experiments.register('timelineInvalidationTracking', 'Timeline: invalidation tracking', true); - Runtime.experiments.register('timelineShowAllEvents', 'Timeline: show all events', true); - Runtime.experiments.register('timelineV8RuntimeCallStats', 'Timeline: V8 Runtime Call Stats on Timeline', true); - Runtime.experiments.register('timelineWebGL', 'Timeline: WebGL-based flamechart'); + Root.Runtime.experiments.register('timelineEventInitiators', 'Timeline: event initiators'); + Root.Runtime.experiments.register('timelineFlowEvents', 'Timeline: flow events', true); + Root.Runtime.experiments.register('timelineInvalidationTracking', 'Timeline: invalidation tracking', true); + Root.Runtime.experiments.register('timelineShowAllEvents', 'Timeline: show all events', true); + Root.Runtime.experiments.register( + 'timelineV8RuntimeCallStats', 'Timeline: V8 Runtime Call Stats on Timeline', true); + Root.Runtime.experiments.register('timelineWebGL', 'Timeline: WebGL-based flamechart'); - Runtime.experiments.cleanUpStaleExperiments(); - const enabledExperiments = Runtime.queryParam('enabledExperiments'); + Root.Runtime.experiments.cleanUpStaleExperiments(); + const enabledExperiments = Root.Runtime.queryParam('enabledExperiments'); if (enabledExperiments) { - Runtime.experiments.setServerEnabledExperiments(enabledExperiments.split(';')); + Root.Runtime.experiments.setServerEnabledExperiments(enabledExperiments.split(';')); } - Runtime.experiments.setDefaultExperiments([ + Root.Runtime.experiments.setDefaultExperiments([ 'backgroundServices', 'backgroundServicesNotifications', 'backgroundServicesPushMessaging', 'backgroundServicesPaymentHandler', ]); - if (Host.isUnderTest() && Runtime.queryParam('test').includes('live-line-level-heap-profile.js')) { - Runtime.experiments.enableForTest('liveHeapProfile'); + if (Host.isUnderTest() && Root.Runtime.queryParam('test').includes('live-line-level-heap-profile.js')) { + Root.Runtime.experiments.enableForTest('liveHeapProfile'); } } @@ -178,7 +184,7 @@ this._addMainEventListeners(document); - const canDock = !!Runtime.queryParam('can_dock'); + const canDock = !!Root.Runtime.queryParam('can_dock'); UI.zoomManager = new UI.ZoomManager(window, InspectorFrontendHost); UI.inspectorView = UI.InspectorView.instance(); UI.ContextMenu.initialize(); @@ -255,7 +261,7 @@ const extensions = self.runtime.extensions(Common.QueryParamHandler); for (const extension of extensions) { - const value = Runtime.queryParam(extension.descriptor()['name']); + const value = Root.Runtime.queryParam(extension.descriptor()['name']); if (value !== null) { extension.instance().then(handleQueryParam.bind(null, value)); }
diff --git a/third_party/blink/renderer/devtools/front_end/ndb_app.html b/third_party/blink/renderer/devtools/front_end/ndb_app.html index d6f17486..9c25b868 100644 --- a/third_party/blink/renderer/devtools/front_end/ndb_app.html +++ b/third_party/blink/renderer/devtools/front_end/ndb_app.html
@@ -10,7 +10,6 @@ <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <meta name="referrer" content="no-referrer"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="ndb_app.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/ndb_app.js b/third_party/blink/renderer/devtools/front_end/ndb_app.js index c3eb0e5..379d9b27 100644 --- a/third_party/blink/renderer/devtools/front_end/ndb_app.js +++ b/third_party/blink/renderer/devtools/front_end/ndb_app.js
@@ -1,4 +1,4 @@ // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('ndb_app'); +Root.Runtime.startApplication('ndb_app');
diff --git a/third_party/blink/renderer/devtools/front_end/node_app.html b/third_party/blink/renderer/devtools/front_end/node_app.html index 5b475a11..f24991c 100644 --- a/third_party/blink/renderer/devtools/front_end/node_app.html +++ b/third_party/blink/renderer/devtools/front_end/node_app.html
@@ -10,7 +10,6 @@ <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <meta name="referrer" content="no-referrer"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="node_app.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/node_app.js b/third_party/blink/renderer/devtools/front_end/node_app.js index 6517c7d..1125741 100644 --- a/third_party/blink/renderer/devtools/front_end/node_app.js +++ b/third_party/blink/renderer/devtools/front_end/node_app.js
@@ -2,4 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('node_app'); +Root.Runtime.startApplication('node_app');
diff --git a/third_party/blink/renderer/devtools/front_end/perf_ui/FlameChart.js b/third_party/blink/renderer/devtools/front_end/perf_ui/FlameChart.js index 3e3f6736..43581450 100644 --- a/third_party/blink/renderer/devtools/front_end/perf_ui/FlameChart.js +++ b/third_party/blink/renderer/devtools/front_end/perf_ui/FlameChart.js
@@ -73,7 +73,7 @@ this._groupExpansionState = groupExpansionSetting && groupExpansionSetting.get() || {}; this._flameChartDelegate = flameChartDelegate; - this._useWebGL = Runtime.experiments.isEnabled('timelineWebGL'); + this._useWebGL = Root.Runtime.experiments.isEnabled('timelineWebGL'); this._chartViewport = new PerfUI.ChartViewport(this); this._chartViewport.show(this.contentElement);
diff --git a/third_party/blink/renderer/devtools/front_end/profiler/HeapProfileView.js b/third_party/blink/renderer/devtools/front_end/profiler/HeapProfileView.js index 61e0a088..b3d87f7 100644 --- a/third_party/blink/renderer/devtools/front_end/profiler/HeapProfileView.js +++ b/third_party/blink/renderer/devtools/front_end/profiler/HeapProfileView.js
@@ -32,7 +32,7 @@ this._selectedSizeText = new UI.ToolbarText(); - if (Runtime.experiments.isEnabled('samplingHeapProfilerTimeline')) { + if (Root.Runtime.experiments.isEnabled('samplingHeapProfilerTimeline')) { this._timelineOverview = new Profiler.HeapTimelineOverview(); this._timelineOverview.addEventListener( Profiler.HeapTimelineOverview.IdsRangeChanged, this._onIdsRangeChanged.bind(this)); @@ -372,7 +372,7 @@ * @return {boolean} */ hasTemporaryView() { - return Runtime.experiments.isEnabled('samplingHeapProfilerTimeline'); + return Root.Runtime.experiments.isEnabled('samplingHeapProfilerTimeline'); } /** @@ -380,7 +380,7 @@ */ _startSampling() { this.profileBeingRecorded().heapProfilerModel().startSampling(); - if (Runtime.experiments.isEnabled('samplingHeapProfilerTimeline')) { + if (Root.Runtime.experiments.isEnabled('samplingHeapProfilerTimeline')) { this._updateTimer = setTimeout(this._updateStats.bind(this), this._updateIntervalMs); } }
diff --git a/third_party/blink/renderer/devtools/front_end/profiler/HeapProfilerPanel.js b/third_party/blink/renderer/devtools/front_end/profiler/HeapProfilerPanel.js index 284f885..a9bfc1d 100644 --- a/third_party/blink/renderer/devtools/front_end/profiler/HeapProfilerPanel.js +++ b/third_party/blink/renderer/devtools/front_end/profiler/HeapProfilerPanel.js
@@ -11,7 +11,7 @@ const registry = Profiler.ProfileTypeRegistry.instance; const profileTypes = [registry.heapSnapshotProfileType, registry.trackingHeapSnapshotProfileType, registry.samplingHeapProfileType]; - if (Runtime.experiments.isEnabled('nativeHeapProfiler')) { + if (Root.Runtime.experiments.isEnabled('nativeHeapProfiler')) { profileTypes.push(registry.samplingNativeHeapProfileType); profileTypes.push(registry.samplingNativeHeapSnapshotRendererType); profileTypes.push(registry.samplingNativeHeapSnapshotBrowserType);
diff --git a/third_party/blink/renderer/devtools/front_end/quick_open/CommandMenu.js b/third_party/blink/renderer/devtools/front_end/quick_open/CommandMenu.js index 90edd467..b16bdc5 100644 --- a/third_party/blink/renderer/devtools/front_end/quick_open/CommandMenu.js +++ b/third_party/blink/renderer/devtools/front_end/quick_open/CommandMenu.js
@@ -31,7 +31,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @param {string} title * @param {V} value * @return {!QuickOpen.CommandMenu.Command} @@ -63,7 +63,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @param {string} category * @return {!QuickOpen.CommandMenu.Command} */
diff --git a/third_party/blink/renderer/devtools/front_end/quick_open/HelpQuickOpen.js b/third_party/blink/renderer/devtools/front_end/quick_open/HelpQuickOpen.js index 89b2d9ad..9834c69 100644 --- a/third_party/blink/renderer/devtools/front_end/quick_open/HelpQuickOpen.js +++ b/third_party/blink/renderer/devtools/front_end/quick_open/HelpQuickOpen.js
@@ -10,7 +10,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ _addProvider(extension) { if (extension.title()) {
diff --git a/third_party/blink/renderer/devtools/front_end/quick_open/QuickOpen.js b/third_party/blink/renderer/devtools/front_end/quick_open/QuickOpen.js index 742014d..3f3fe24 100644 --- a/third_party/blink/renderer/devtools/front_end/quick_open/QuickOpen.js +++ b/third_party/blink/renderer/devtools/front_end/quick_open/QuickOpen.js
@@ -30,7 +30,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ _addProvider(extension) { const prefix = extension.descriptor()['prefix'];
diff --git a/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js b/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js index 46983629..b52aed8b 100644 --- a/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js +++ b/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js
@@ -104,7 +104,7 @@ cacheTreeElement.appendChild(this.applicationCacheListTreeElement); - if (Runtime.experiments.isEnabled('backgroundServices')) { + if (Root.Runtime.experiments.isEnabled('backgroundServices')) { const backgroundServiceTreeElement = this._addSidebarSection(ls`Background Services`); this.backgroundFetchTreeElement = @@ -114,22 +114,22 @@ new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.BackgroundSync); backgroundServiceTreeElement.appendChild(this.backgroundSyncTreeElement); - if (Runtime.experiments.isEnabled('backgroundServicesNotifications')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesNotifications')) { this.notificationsTreeElement = new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.Notifications); backgroundServiceTreeElement.appendChild(this.notificationsTreeElement); } - if (Runtime.experiments.isEnabled('backgroundServicesPaymentHandler')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPaymentHandler')) { this.paymentHandlerTreeElement = new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.PaymentHandler); backgroundServiceTreeElement.appendChild(this.paymentHandlerTreeElement); } - if (Runtime.experiments.isEnabled('backgroundServicesPeriodicBackgroundSync')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPeriodicBackgroundSync')) { this.periodicBackgroundSyncTreeElement = new Resources.BackgroundServiceTreeElement( panel, Protocol.BackgroundService.ServiceName.PeriodicBackgroundSync); backgroundServiceTreeElement.appendChild(this.periodicBackgroundSyncTreeElement); } - if (Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) { this.pushMessagingTreeElement = new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.PushMessaging); backgroundServiceTreeElement.appendChild(this.pushMessagingTreeElement); @@ -265,19 +265,19 @@ const serviceWorkerCacheModel = this._target.model(SDK.ServiceWorkerCacheModel); this.cacheStorageListTreeElement._initialize(serviceWorkerCacheModel); const backgroundServiceModel = this._target.model(Resources.BackgroundServiceModel); - if (Runtime.experiments.isEnabled('backgroundServices')) { + if (Root.Runtime.experiments.isEnabled('backgroundServices')) { this.backgroundFetchTreeElement._initialize(backgroundServiceModel); this.backgroundSyncTreeElement._initialize(backgroundServiceModel); - if (Runtime.experiments.isEnabled('backgroundServicesNotifications')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesNotifications')) { this.notificationsTreeElement._initialize(backgroundServiceModel); } - if (Runtime.experiments.isEnabled('backgroundServicesPaymentHandler')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPaymentHandler')) { this.paymentHandlerTreeElement._initialize(backgroundServiceModel); } - if (Runtime.experiments.isEnabled('backgroundServicesPeriodicBackgroundSync')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPeriodicBackgroundSync')) { this.periodicBackgroundSyncTreeElement._initialize(backgroundServiceModel); } - if (Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) { this.pushMessagingTreeElement._initialize(backgroundServiceModel); } }
diff --git a/third_party/blink/renderer/devtools/front_end/resources/ServiceWorkersView.js b/third_party/blink/renderer/devtools/front_end/resources/ServiceWorkersView.js index db9e13a..01b793a 100644 --- a/third_party/blink/renderer/devtools/front_end/resources/ServiceWorkersView.js +++ b/third_party/blink/renderer/devtools/front_end/resources/ServiceWorkersView.js
@@ -353,7 +353,7 @@ this._push.bind(this)); this._createSyncNotificationField( Common.UIString('Sync'), this._syncTagNameSetting.get(), Common.UIString('Sync tag'), this._sync.bind(this)); - if (Runtime.experiments.isEnabled('backgroundServicesPeriodicBackgroundSync')) { + if (Root.Runtime.experiments.isEnabled('backgroundServicesPeriodicBackgroundSync')) { this._createSyncNotificationField( ls`Periodic Sync`, this._periodicSyncTagNameSetting.get(), ls`Periodic Sync tag`, tag => this._periodicSync(tag));
diff --git a/third_party/blink/renderer/devtools/front_end/root.js b/third_party/blink/renderer/devtools/front_end/root.js index 022ced9..df20787 100644 --- a/third_party/blink/renderer/devtools/front_end/root.js +++ b/third_party/blink/renderer/devtools/front_end/root.js
@@ -2,5 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import './Runtime.js'; import './common/common.js'; import './ui/ui.js';
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/Connections.js b/third_party/blink/renderer/devtools/front_end/sdk/Connections.js index bc44429..3580a03 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/Connections.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/Connections.js
@@ -329,8 +329,8 @@ * @return {!Protocol.Connection} */ SDK._createMainConnection = function(websocketConnectionLost) { - const wsParam = Runtime.queryParam('ws'); - const wssParam = Runtime.queryParam('wss'); + const wsParam = Root.Runtime.queryParam('ws'); + const wssParam = Root.Runtime.queryParam('wss'); if (wsParam || wssParam) { const ws = wsParam ? `ws://${wsParam}` : `wss://${wssParam}`; return new SDK.WebSocketConnection(ws, websocketConnectionLost);
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/DOMModel.js b/third_party/blink/renderer/devtools/front_end/sdk/DOMModel.js index 9c80dbf..015701a4 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/DOMModel.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/DOMModel.js
@@ -1188,7 +1188,7 @@ this._agent.enable(); } - if (Runtime.experiments.isEnabled('captureNodeCreationStacks')) { + if (Root.Runtime.experiments.isEnabled('captureNodeCreationStacks')) { this._agent.setNodeStackTracesEnabled(true); } }
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js b/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js index c577767..ead515ca 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js
@@ -121,7 +121,7 @@ // Set a limit for the total size of collected script sources retained by debugger. // 10MB for remote frontends, 100MB for others. - const isRemoteFrontend = Runtime.queryParam('remoteFrontend') || Runtime.queryParam('ws'); + const isRemoteFrontend = Root.Runtime.queryParam('remoteFrontend') || Root.Runtime.queryParam('ws'); const maxScriptsCacheSize = isRemoteFrontend ? 10e6 : 100e6; const enablePromise = this._agent.enable(maxScriptsCacheSize); enablePromise.then(this._registerDebugger.bind(this)); @@ -515,7 +515,7 @@ this._isPausing = false; this._debuggerPausedDetails = debuggerPausedDetails; if (this._debuggerPausedDetails) { - if (Runtime.experiments.isEnabled('emptySourceMapAutoStepping') && this._beforePausedCallback) { + if (Root.Runtime.experiments.isEnabled('emptySourceMapAutoStepping') && this._beforePausedCallback) { if (!this._beforePausedCallback.call(null, this._debuggerPausedDetails)) { return false; }
diff --git a/third_party/blink/renderer/devtools/front_end/services/ServiceManager.js b/third_party/blink/renderer/devtools/front_end/services/ServiceManager.js index 9c0ee7fa..36fb53c8 100644 --- a/third_party/blink/renderer/devtools/front_end/services/ServiceManager.js +++ b/third_party/blink/renderer/devtools/front_end/services/ServiceManager.js
@@ -11,7 +11,7 @@ */ createRemoteService(serviceName) { if (!this._remoteConnection) { - const url = Runtime.queryParam('service-backend'); + const url = Root.Runtime.queryParam('service-backend'); if (!url) { console.error('No endpoint address specified'); return /** @type {!Promise<?Services.ServiceManager.Service>} */ (Promise.resolve(null)); @@ -29,8 +29,8 @@ */ createAppService(appName, serviceName) { let url = appName + '.js'; - const remoteBase = Runtime.queryParam('remoteBase'); - const debugFrontend = Runtime.queryParam('debugFrontend'); + const remoteBase = Root.Runtime.queryParam('remoteBase'); + const debugFrontend = Root.Runtime.queryParam('debugFrontend'); const isUnderTest = Host.isUnderTest(); const queryParams = [];
diff --git a/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js b/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js index 5d0405f..13c505f 100644 --- a/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js +++ b/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js
@@ -172,7 +172,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @return {boolean} */ static isSettingVisible(extension) { @@ -187,7 +187,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ _addSetting(extension) { if (!Settings.GenericSettingsTab.isSettingVisible(extension)) { @@ -202,7 +202,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ _addSettingUI(extension) { const descriptor = extension.descriptor(); @@ -244,7 +244,7 @@ constructor() { super(Common.UIString('Experiments'), 'experiments-tab-content'); - const experiments = Runtime.experiments.allConfigurableExperiments(); + const experiments = Root.Runtime.experiments.allConfigurableExperiments(); if (experiments.length) { const experimentsSection = this._appendSection(); experimentsSection.appendChild(this._createExperimentsWarningSubsection()); @@ -332,7 +332,7 @@ return success ? Promise.resolve() : Promise.reject(); /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ function revealModuleSetting(extension) { if (!Settings.GenericSettingsTab.isSettingVisible(extension)) { @@ -346,7 +346,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ function revealSettingUI(extension) { const settings = extension.descriptor()['settings']; @@ -358,7 +358,7 @@ } /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ function revealSettingsView(extension) { const location = extension.descriptor()['location'];
diff --git a/third_party/blink/renderer/devtools/front_end/sources/DebuggerPlugin.js b/third_party/blink/renderer/devtools/front_end/sources/DebuggerPlugin.js index b03d58a..763d1d63 100644 --- a/third_party/blink/renderer/devtools/front_end/sources/DebuggerPlugin.js +++ b/third_party/blink/renderer/devtools/front_end/sources/DebuggerPlugin.js
@@ -138,7 +138,7 @@ this._hasLineWithoutMapping = false; this._updateLinesWithoutMappingHighlight(); - if (!Runtime.experiments.isEnabled('sourcesPrettyPrint')) { + if (!Root.Runtime.experiments.isEnabled('sourcesPrettyPrint')) { /** @type {?UI.Infobar} */ this._prettyPrintInfobar = null; this._detectMinified();
diff --git a/third_party/blink/renderer/devtools/front_end/sources/SourcesView.js b/third_party/blink/renderer/devtools/front_end/sources/SourcesView.js index 226a54e..4bab3e0 100644 --- a/third_party/blink/renderer/devtools/front_end/sources/SourcesView.js +++ b/third_party/blink/renderer/devtools/front_end/sources/SourcesView.js
@@ -36,7 +36,7 @@ this._historyManager = new Sources.EditingLocationHistoryManager(this, this.currentSourceFrame.bind(this)); this._toolbarContainerElement = this.element.createChild('div', 'sources-toolbar'); - if (!Runtime.experiments.isEnabled('sourcesPrettyPrint')) { + if (!Root.Runtime.experiments.isEnabled('sourcesPrettyPrint')) { this._toolbarEditorActions = new UI.Toolbar('', this._toolbarContainerElement); self.runtime.allInstances(Sources.SourcesView.EditorAction).then(appendButtonsForExtensions.bind(this)); }
diff --git a/third_party/blink/renderer/devtools/front_end/sources/UISourceCodeFrame.js b/third_party/blink/renderer/devtools/front_end/sources/UISourceCodeFrame.js index 137d817..4bc5fd0 100644 --- a/third_party/blink/renderer/devtools/front_end/sources/UISourceCodeFrame.js +++ b/third_party/blink/renderer/devtools/front_end/sources/UISourceCodeFrame.js
@@ -34,7 +34,7 @@ super(workingCopy); this._uiSourceCode = uiSourceCode; - if (Runtime.experiments.isEnabled('sourceDiff')) { + if (Root.Runtime.experiments.isEnabled('sourceDiff')) { this._diff = new SourceFrame.SourceCodeDiff(this.textEditor); } @@ -172,7 +172,7 @@ this._updateStyle(); this._decorateAllTypes(); this._refreshHighlighterType(); - if (Runtime.experiments.isEnabled('sourcesPrettyPrint')) { + if (Root.Runtime.experiments.isEnabled('sourcesPrettyPrint')) { const supportedPrettyTypes = new Set(['text/html', 'text/css', 'text/javascript']); this.setCanPrettyPrint(supportedPrettyTypes.has(this.highlighterType()), true); } @@ -352,7 +352,7 @@ if (Sources.ScriptOriginPlugin.accepts(pluginUISourceCode)) { this._plugins.push(new Sources.ScriptOriginPlugin(this.textEditor, pluginUISourceCode)); } - if (!this.pretty && Runtime.experiments.isEnabled('sourceDiff') && + if (!this.pretty && Root.Runtime.experiments.isEnabled('sourceDiff') && Sources.GutterDiffPlugin.accepts(pluginUISourceCode)) { this._plugins.push(new Sources.GutterDiffPlugin(this.textEditor, pluginUISourceCode)); }
diff --git a/third_party/blink/renderer/devtools/front_end/test_runner/TestRunner.js b/third_party/blink/renderer/devtools/front_end/test_runner/TestRunner.js index eec2722..040c362 100644 --- a/third_party/blink/renderer/devtools/front_end/test_runner/TestRunner.js +++ b/third_party/blink/renderer/devtools/front_end/test_runner/TestRunner.js
@@ -30,7 +30,7 @@ }; TestRunner._executeTestScript = function() { - const testScriptURL = /** @type {string} */ (Runtime.queryParam('test')); + const testScriptURL = /** @type {string} */ (Root.Runtime.queryParam('test')); fetch(testScriptURL) .then(data => data.text()) .then(testScript => { @@ -428,7 +428,7 @@ const lines = new Error().stack.split('at '); // Handles cases where the function is safe wrapped - const testScriptURL = /** @type {string} */ (Runtime.queryParam('test')); + const testScriptURL = /** @type {string} */ (Root.Runtime.queryParam('test')); const functionLine = lines.reduce((acc, line) => line.includes(testScriptURL) ? line : acc, lines[lines.length - 2]); const components = functionLine.trim().split('/'); @@ -1296,7 +1296,7 @@ }; /** - * @return {!Array<!Runtime.Module>} + * @return {!Array<!Root.Runtime.Module>} */ TestRunner.loadedModules = function() { return self.runtime._modules.filter(module => module._loadedForTest) @@ -1305,8 +1305,8 @@ }; /** - * @param {!Array<!Runtime.Module>} relativeTo - * @return {!Array<!Runtime.Module>} + * @param {!Array<!Root.Runtime.Module>} relativeTo + * @return {!Array<!Root.Runtime.Module>} */ TestRunner.dumpLoadedModules = function(relativeTo) { const previous = new Set(relativeTo || []); @@ -1369,7 +1369,7 @@ * @return {string} */ TestRunner.url = function(url = '') { - const testScriptURL = /** @type {string} */ (Runtime.queryParam('test')); + const testScriptURL = /** @type {string} */ (Root.Runtime.queryParam('test')); // This handles relative (e.g. "../file"), root (e.g. "/resource"), // absolute (e.g. "http://", "data:") and empty (e.g. "") paths @@ -1474,14 +1474,14 @@ * @return {boolean} */ TestRunner._isDebugTest = function() { - return !self.testRunner || !!Runtime.queryParam('debugFrontend'); + return !self.testRunner || !!Root.Runtime.queryParam('debugFrontend'); }; /** * @return {boolean} */ TestRunner._isStartupTest = function() { - return Runtime.queryParam('test').includes('/startup/'); + return Root.Runtime.queryParam('test').includes('/startup/'); }; (async function() {
diff --git a/third_party/blink/renderer/devtools/front_end/text_editor/CodeMirrorTextEditor.js b/third_party/blink/renderer/devtools/front_end/text_editor/CodeMirrorTextEditor.js index 486dd04..62be767 100644 --- a/third_party/blink/renderer/devtools/front_end/text_editor/CodeMirrorTextEditor.js +++ b/third_party/blink/renderer/devtools/front_end/text_editor/CodeMirrorTextEditor.js
@@ -288,7 +288,7 @@ /** * @param {string} mimeType - * @return {!Array<!Runtime.Extension>}} + * @return {!Array<!Root.Runtime.Extension>}} */ static _collectUninstalledModes(mimeType) { const installed = TextEditor.CodeMirrorTextEditor._loadedMimeModeExtensions; @@ -319,7 +319,7 @@ } /** - * @param {!Array<!Runtime.Extension>} extensions + * @param {!Array<!Root.Runtime.Extension>} extensions * @return {!Promise} */ static _installMimeTypeModes(extensions) { @@ -327,7 +327,7 @@ return Promise.all(promises); /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @param {!Object} instance */ function installMode(extension, instance) { @@ -1764,7 +1764,7 @@ TextEditor.CodeMirrorTextEditor._overrideModeWithPrefixedTokens('javascript', 'js-'); TextEditor.CodeMirrorTextEditor._overrideModeWithPrefixedTokens('xml', 'xml-'); -/** @type {!Set<!Runtime.Extension>} */ +/** @type {!Set<!Root.Runtime.Extension>} */ TextEditor.CodeMirrorTextEditor._loadedMimeModeExtensions = new Set(); @@ -1775,7 +1775,7 @@ TextEditor.CodeMirrorMimeMode.prototype = { /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ install(extension) {} };
diff --git a/third_party/blink/renderer/devtools/front_end/timeline/TimelineController.js b/third_party/blink/renderer/devtools/front_end/timeline/TimelineController.js index 0d6e19e3..6b28cbb 100644 --- a/third_party/blink/renderer/devtools/front_end/timeline/TimelineController.js +++ b/third_party/blink/renderer/devtools/front_end/timeline/TimelineController.js
@@ -59,21 +59,21 @@ ]; categoriesArray.push(TimelineModel.TimelineModel.Category.LatencyInfo); - if (Runtime.experiments.isEnabled('timelineFlowEvents')) { + if (Root.Runtime.experiments.isEnabled('timelineFlowEvents')) { categoriesArray.push('devtools.timeline.async'); } - if (Runtime.experiments.isEnabled('timelineV8RuntimeCallStats') && options.enableJSSampling) { + if (Root.Runtime.experiments.isEnabled('timelineV8RuntimeCallStats') && options.enableJSSampling) { categoriesArray.push(disabledByDefault('v8.runtime_stats_sampling')); } - if (!Runtime.queryParam('timelineTracingJSProfileDisabled') && options.enableJSSampling) { + if (!Root.Runtime.queryParam('timelineTracingJSProfileDisabled') && options.enableJSSampling) { categoriesArray.push(disabledByDefault('v8.cpu_profiler')); if (Common.moduleSetting('highResolutionCpuProfiling').get()) { categoriesArray.push(disabledByDefault('v8.cpu_profiler.hires')); } } categoriesArray.push(disabledByDefault('devtools.timeline.stack')); - if (Runtime.experiments.isEnabled('timelineInvalidationTracking')) { + if (Root.Runtime.experiments.isEnabled('timelineInvalidationTracking')) { categoriesArray.push(disabledByDefault('devtools.timeline.invalidationTracking')); } if (options.capturePictures) { @@ -198,7 +198,7 @@ // caused by starting CPU profiler, that needs to traverse JS heap to collect // all the functions data. await SDK.targetManager.suspendAllTargets('performance-timeline'); - if (enableJSSampling && Runtime.queryParam('timelineTracingJSProfileDisabled')) { + if (enableJSSampling && Root.Runtime.queryParam('timelineTracingJSProfileDisabled')) { await this._startProfilingOnAllModels(); } if (!this._tracingManager) {
diff --git a/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartDataProvider.js b/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartDataProvider.js index b2a177a..5943e1c 100644 --- a/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartDataProvider.js +++ b/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartDataProvider.js
@@ -417,8 +417,8 @@ } const isExtension = entryType === Timeline.TimelineFlameChartDataProvider.EntryType.ExtensionEvent; const openEvents = []; - const flowEventsEnabled = Runtime.experiments.isEnabled('timelineFlowEvents'); - const blackboxingEnabled = !isExtension && Runtime.experiments.isEnabled('blackboxJSFramesOnTimeline'); + const flowEventsEnabled = Root.Runtime.experiments.isEnabled('timelineFlowEvents'); + const blackboxingEnabled = !isExtension && Root.Runtime.experiments.isEnabled('blackboxJSFramesOnTimeline'); let maxStackDepth = 0; let group = null; if (track && track.type === TimelineModel.TimelineModel.TrackType.MainThread) {
diff --git a/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartView.js b/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartView.js index 24b29d8..4c10ef63 100644 --- a/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartView.js +++ b/third_party/blink/renderer/devtools/front_end/timeline/TimelineFlameChartView.js
@@ -301,7 +301,7 @@ */ _onEntrySelected(dataProvider, event) { const entryIndex = /** @type{number} */ (event.data); - if (Runtime.experiments.isEnabled('timelineEventInitiators') && dataProvider === this._mainDataProvider) { + if (Root.Runtime.experiments.isEnabled('timelineEventInitiators') && dataProvider === this._mainDataProvider) { if (this._mainDataProvider.buildFlowForInitiator(entryIndex)) { this._mainFlameChart.scheduleUpdate(); }
diff --git a/third_party/blink/renderer/devtools/front_end/timeline/TimelinePanel.js b/third_party/blink/renderer/devtools/front_end/timeline/TimelinePanel.js index 74d990cb..d9ac62e 100644 --- a/third_party/blink/renderer/devtools/front_end/timeline/TimelinePanel.js +++ b/third_party/blink/renderer/devtools/front_end/timeline/TimelinePanel.js
@@ -73,7 +73,7 @@ this._startCoverage = Common.settings.createSetting('timelineStartCoverage', false); this._startCoverage.setTitle(ls`Coverage`); - if (!Runtime.experiments.isEnabled('recordCoverageWithPerformanceTracing')) { + if (!Root.Runtime.experiments.isEnabled('recordCoverageWithPerformanceTracing')) { this._startCoverage.set(false); } @@ -235,7 +235,7 @@ this._createSettingCheckbox(this._showMemorySetting, Common.UIString('Show memory timeline')); this._panelToolbar.appendToolbarItem(this._showMemoryToolbarCheckbox); - if (Runtime.experiments.isEnabled('recordCoverageWithPerformanceTracing')) { + if (Root.Runtime.experiments.isEnabled('recordCoverageWithPerformanceTracing')) { this._startCoverageCheckbox = this._createSettingCheckbox(this._startCoverage, ls`Record coverage with performance trace`); this._panelToolbar.appendToolbarItem(this._startCoverageCheckbox); @@ -431,7 +431,7 @@ _updateOverviewControls() { this._overviewControls = []; this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness()); - if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) { + if (Root.Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) { this._overviewControls.push(new Timeline.TimelineEventOverviewInput()); } this._overviewControls.push(new Timeline.TimelineEventOverviewFrames()); @@ -626,7 +626,7 @@ * @param {!Timeline.PerformanceModel} model */ _applyFilters(model) { - if (model.timelineModel().isGenericTrace() || Runtime.experiments.isEnabled('timelineShowAllEvents')) { + if (model.timelineModel().isGenericTrace() || Root.Runtime.experiments.isEnabled('timelineShowAllEvents')) { return; } model.setFilters([Timeline.TimelineUIUtils.visibleEventsFilter()]);
diff --git a/third_party/blink/renderer/devtools/front_end/timeline_model/TimelineJSProfile.js b/third_party/blink/renderer/devtools/front_end/timeline_model/TimelineJSProfile.js index d2478f2..0d453391 100644 --- a/third_party/blink/renderer/devtools/front_end/timeline_model/TimelineJSProfile.js +++ b/third_party/blink/renderer/devtools/front_end/timeline_model/TimelineJSProfile.js
@@ -81,8 +81,8 @@ const jsFramesStack = []; const lockedJsStackDepth = []; let ordinal = 0; - const showAllEvents = Runtime.experiments.isEnabled('timelineShowAllEvents'); - const showRuntimeCallStats = Runtime.experiments.isEnabled('timelineV8RuntimeCallStats'); + const showAllEvents = Root.Runtime.experiments.isEnabled('timelineShowAllEvents'); + const showRuntimeCallStats = Root.Runtime.experiments.isEnabled('timelineV8RuntimeCallStats'); const showNativeFunctions = Common.moduleSetting('showNativeFunctionsInJSProfile').get(); /**
diff --git a/third_party/blink/renderer/devtools/front_end/toolbox.html b/third_party/blink/renderer/devtools/front_end/toolbox.html index ab892052..98dbdd3 100644 --- a/third_party/blink/renderer/devtools/front_end/toolbox.html +++ b/third_party/blink/renderer/devtools/front_end/toolbox.html
@@ -9,7 +9,6 @@ <meta charset="utf-8"> <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' "> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="toolbox.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/toolbox.js b/third_party/blink/renderer/devtools/front_end/toolbox.js index fe47ccc7..0a1583c4 100644 --- a/third_party/blink/renderer/devtools/front_end/toolbox.js +++ b/third_party/blink/renderer/devtools/front_end/toolbox.js
@@ -1,4 +1,4 @@ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('toolbox'); +Root.Runtime.startApplication('toolbox');
diff --git a/third_party/blink/renderer/devtools/front_end/ui/ActionRegistry.js b/third_party/blink/renderer/devtools/front_end/ui/ActionRegistry.js index a4b37a1..247505e 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/ActionRegistry.js +++ b/third_party/blink/renderer/devtools/front_end/ui/ActionRegistry.js
@@ -15,7 +15,7 @@ self.runtime.extensions('action').forEach(registerExtension, this); /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @this {UI.ActionRegistry} */ function registerExtension(extension) { @@ -58,7 +58,7 @@ return context.applicableExtensions(extensions).valuesArray().map(extensionToAction.bind(this)); /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @return {!UI.Action} * @this {UI.ActionRegistry} */ @@ -81,7 +81,7 @@ */ UI.Action = class extends Common.Object { /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ constructor(extension) { super();
diff --git a/third_party/blink/renderer/devtools/front_end/ui/Context.js b/third_party/blink/renderer/devtools/front_end/ui/Context.js index 062c83c..8c08f9d 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/Context.js +++ b/third_party/blink/renderer/devtools/front_end/ui/Context.js
@@ -95,8 +95,8 @@ } /** - * @param {!Array.<!Runtime.Extension>} extensions - * @return {!Set.<!Runtime.Extension>} + * @param {!Array.<!Root.Runtime.Extension>} extensions + * @return {!Set.<!Root.Runtime.Extension>} */ applicableExtensions(extensions) { const targetExtensionSet = new Set();
diff --git a/third_party/blink/renderer/devtools/front_end/ui/InspectorView.js b/third_party/blink/renderer/devtools/front_end/ui/InspectorView.js index 7337570..8b2af91 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/InspectorView.js +++ b/third_party/blink/renderer/devtools/front_end/ui/InspectorView.js
@@ -44,7 +44,7 @@ this._drawerSplitWidget.enableShowModeSaving(); this._drawerSplitWidget.show(this.element); - if (Runtime.experiments.isEnabled('splitInDrawer')) { + if (Root.Runtime.experiments.isEnabled('splitInDrawer')) { this._innerDrawerSplitWidget = new UI.SplitWidget(true, true, 'Inspector.drawerSidebarSplitViewState', 200, 200); this._drawerSplitWidget.setSidebarWidget(this._innerDrawerSplitWidget); this._drawerSidebarTabbedLocation = @@ -78,7 +78,7 @@ // Create main area tabbed pane. this._tabbedLocation = UI.viewManager.createTabbedLocation( InspectorFrontendHost.bringToFront.bind(InspectorFrontendHost), 'panel', true, true, - Runtime.queryParam('panel')); + Root.Runtime.queryParam('panel')); this._tabbedPane = this._tabbedLocation.tabbedPane(); this._tabbedPane.registerRequiredCSS('ui/inspectorViewTabbedPane.css');
diff --git a/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js b/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js index c017e8b7..3a2cefe 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js +++ b/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js
@@ -210,7 +210,7 @@ extensions.forEach(registerExtension, this); /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension * @this {UI.ShortcutRegistry} */ function registerExtension(extension) {
diff --git a/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js b/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js index 3a0baddb..a0ec7038 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js +++ b/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js
@@ -1375,7 +1375,7 @@ * @suppressGlobalPropertiesCheck */ UI.appendStyle = function(node, cssFile) { - const content = Runtime.cachedResources[cssFile] || ''; + const content = Root.Runtime.cachedResources[cssFile] || ''; if (!content) { console.error(cssFile + ' not preloaded. Check module.json'); } @@ -1386,7 +1386,7 @@ const themeStyleSheet = UI.themeSupport.themeStyleSheet(cssFile, content); if (themeStyleSheet) { styleElement = createElement('style'); - styleElement.textContent = themeStyleSheet + '\n' + Runtime.resolveSourceURL(cssFile + '.theme'); + styleElement.textContent = themeStyleSheet + '\n' + Root.Runtime.resolveSourceURL(cssFile + '.theme'); node.appendChild(styleElement); } };
diff --git a/third_party/blink/renderer/devtools/front_end/ui/View.js b/third_party/blink/renderer/devtools/front_end/ui/View.js index 53efa5e..a55c478 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/View.js +++ b/third_party/blink/renderer/devtools/front_end/ui/View.js
@@ -145,7 +145,7 @@ */ UI.ProvidedView = class { /** - * @param {!Runtime.Extension} extension + * @param {!Root.Runtime.Extension} extension */ constructor(extension) { this._extension = extension;
diff --git a/third_party/blink/renderer/devtools/front_end/worker_app.html b/third_party/blink/renderer/devtools/front_end/worker_app.html index c041d37..09f263de 100644 --- a/third_party/blink/renderer/devtools/front_end/worker_app.html +++ b/third_party/blink/renderer/devtools/front_end/worker_app.html
@@ -10,7 +10,6 @@ <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> <meta name="referrer" content="no-referrer"> <script type="module" src="root.js"></script> - <script defer src="Runtime.js"></script> <script defer src="worker_app.js"></script> </head> <body class="undocked" id="-blink-dev-tools"></body>
diff --git a/third_party/blink/renderer/devtools/front_end/worker_app.js b/third_party/blink/renderer/devtools/front_end/worker_app.js index 4cd27a8..6864279 100644 --- a/third_party/blink/renderer/devtools/front_end/worker_app.js +++ b/third_party/blink/renderer/devtools/front_end/worker_app.js
@@ -2,4 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('worker_app'); +Root.Runtime.startApplication('worker_app');
diff --git a/third_party/blink/renderer/devtools/scripts/build/build_release_applications.py b/third_party/blink/renderer/devtools/scripts/build/build_release_applications.py index db32b006..c9f78af 100755 --- a/third_party/blink/renderer/devtools/scripts/build/build_release_applications.py +++ b/third_party/blink/renderer/devtools/scripts/build/build_release_applications.py
@@ -183,7 +183,7 @@ def _write_module_resources(self, resource_names, output): for resource_name in resource_names: resource_name = path.normpath(resource_name).replace('\\', '/') - output.write('Runtime.cachedResources["%s"] = "' % resource_name) + output.write('Root.Runtime.cachedResources["%s"] = "' % resource_name) resource_content = read_file(path.join(self.application_dir, resource_name)) resource_content += resource_source_url(resource_name).encode('utf-8') resource_content = resource_content.replace('\\', '\\\\') @@ -221,15 +221,15 @@ runtime_contents = read_file(join(self.application_dir, 'Runtime.js')) output.write('/* Runtime.js */\n') output.write(runtime_contents) - output.write('allDescriptors.push(...%s);' % self._release_module_descriptors()) + output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors()) output.write('/* Application descriptor %s */\n' % self.app_file('json')) - output.write('applicationDescriptor = ') + output.write('Root.applicationDescriptor = ') output.write(self.descriptors.application_json()) else: output.write('/* Additional descriptors */\n') - output.write('allDescriptors.push(...%s);' % self._release_module_descriptors()) + output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors()) output.write('/* Additional descriptors %s */\n' % self.app_file('json')) - output.write('applicationDescriptor.modules.push(...%s)' % json.dumps(self.descriptors.application.values())) + output.write('Root.applicationDescriptor.modules.push(...%s)' % json.dumps(self.descriptors.application.values())) output.write('\n/* Autostart modules */\n') self._concatenate_autostart_modules(output)
diff --git a/third_party/blink/renderer/devtools/scripts/compile_frontend.py b/third_party/blink/renderer/devtools/scripts/compile_frontend.py index a15c1bc3..befedb9 100755 --- a/third_party/blink/renderer/devtools/scripts/compile_frontend.py +++ b/third_party/blink/renderer/devtools/scripts/compile_frontend.py
@@ -279,9 +279,9 @@ '--externs', namespace_externs_path, '--js', - ROOT_MODULE_FILE, - '--js', RUNTIME_FILE, + '--js', + ROOT_MODULE_FILE, ] all_files = descriptors.all_compiled_files() @@ -317,6 +317,7 @@ namespaces.sort() namespace_externs_file = tempfile.NamedTemporaryFile(mode='wt', delete=False) try: + namespace_externs_file.write('var Root = {};\n') for namespace in namespaces: namespace_externs_file.write('var %s = {};\n' % namespace) finally:
diff --git a/third_party/blink/renderer/devtools/tests/front_end/common/Console.ts b/third_party/blink/renderer/devtools/tests/front_end/common/Console.ts new file mode 100644 index 0000000..a3e3ab4 --- /dev/null +++ b/third_party/blink/renderer/devtools/tests/front_end/common/Console.ts
@@ -0,0 +1,60 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const { assert } = chai; + +import { default as Console, Events, MessageLevel } from '../../../front_end/common/Console.js'; + +describe('Console', () => { + let consoleImpl: Console; + beforeEach(() => { + consoleImpl = new Console(); + }); + + it('adds messages', () => { + consoleImpl.addMessage('Foo', MessageLevel.Info, true); + const messages = consoleImpl.messages(); + assert.equal(messages.length, 1); + assert.equal(messages[0].text, 'Foo'); + }); + + it('adds handles messages of all types', () => { + const messageTypes = new Map<string, string>([ + ['Info', 'log'], + ['Warning', 'warn'], + ['Error', 'error'] + ]); + + for (const [type, method] of messageTypes) { + consoleImpl = new Console(); + + // Dispatch the message of the appropriate type. + consoleImpl[method](type); + + // Now read the message back and check it. + const messages = consoleImpl.messages(); + assert.equal(messages.length, 1); + assert.equal(messages[0].text, type); + assert.equal(messages[0].level, MessageLevel[type]); + } + }); + + it('stores messages', () => { + consoleImpl.addMessage('Foo', MessageLevel.Info, true); + consoleImpl.addMessage('Baz', MessageLevel.Warning, true); + consoleImpl.addMessage('Bar', MessageLevel.Error, true); + consoleImpl.addMessage('Donkey', MessageLevel.Info, true); + const messages = consoleImpl.messages(); + assert.equal(messages.length, 4); + }); + + it('dispatches events to listeners', (done) => { + consoleImpl.addEventListener(Events.MessageAdded, ({ data }) => { + assert.equal(data.text, 'Foo'); + done(); + }); + + consoleImpl.addMessage('Foo', MessageLevel.Info, true); + }); +});
diff --git a/third_party/blink/renderer/devtools/tsconfig.json b/third_party/blink/renderer/devtools/tsconfig.json index 1dbc1cc..1d010b6 100644 --- a/third_party/blink/renderer/devtools/tsconfig.json +++ b/third_party/blink/renderer/devtools/tsconfig.json
@@ -1,5 +1,7 @@ { "compilerOptions": { + "module": "esnext", + "target": "esnext", "typeRoots": ["../../../devtools-node-modules/third_party/node_modules/@types"] } }
diff --git a/third_party/blink/renderer/modules/payments/payment_method_change_response.idl b/third_party/blink/renderer/modules/payments/payment_method_change_response.idl index 17f7d2a..46100b01 100644 --- a/third_party/blink/renderer/modules/payments/payment_method_change_response.idl +++ b/third_party/blink/renderer/modules/payments/payment_method_change_response.idl
@@ -3,10 +3,15 @@ // found in the LICENSE file. // https://w3c.github.io/payment-handler/#dom-paymentmethodchangeresponse +// Todo(sahel): Change the link to the updated spec. crbug.com/984694 +// Todo(sahel): Rename PaymentMethodChangeResponse to +// PaymentRequestDetailsUpdate which is a more generic name. crbug.com/984694 dictionary PaymentMethodChangeResponse { DOMString error; PaymentCurrencyAmount total; FrozenArray<PaymentDetailsModifier> modifiers; + FrozenArray<PaymentShippingOption> shippingOptions; object paymentMethodErrors; + AddressErrors shippingAddressErrors; };
diff --git a/third_party/blink/renderer/modules/payments/payment_request_event.cc b/third_party/blink/renderer/modules/payments/payment_request_event.cc index b60d272..163e87e 100644 --- a/third_party/blink/renderer/modules/payments/payment_request_event.cc +++ b/third_party/blink/renderer/modules/payments/payment_request_event.cc
@@ -181,12 +181,12 @@ const String& method_name, const ScriptValue& method_details, ExceptionState& exception_state) { - if (change_payment_method_resolver_) { + if (change_payment_request_details_resolver_) { return ScriptPromise::RejectWithDOMException( - script_state, - MakeGarbageCollected<DOMException>( - DOMExceptionCode::kInvalidStateError, - "Waiting for response to the previous payment method change")); + script_state, MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + "Waiting for response to the previous payment " + "request details change")); } if (!payment_handler_host_.is_bound()) { @@ -208,11 +208,106 @@ method_data->method_name = method_name; payment_handler_host_->ChangePaymentMethod( std::move(method_data), - WTF::Bind(&PaymentRequestEvent::OnChangePaymentMethodResponse, + WTF::Bind(&PaymentRequestEvent::OnChangePaymentRequestDetailsResponse, WrapWeakPersistent(this))); - change_payment_method_resolver_ = + change_payment_request_details_resolver_ = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - return change_payment_method_resolver_->Promise(); + return change_payment_request_details_resolver_->Promise(); +} + +ScriptPromise PaymentRequestEvent::changeShippingAddress( + ScriptState* script_state, + PaymentAddressInit* shipping_address) { + if (change_payment_request_details_resolver_) { + return ScriptPromise::RejectWithDOMException( + script_state, MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + "Waiting for response to the previous payment " + "request details change")); + } + + if (!payment_handler_host_.is_bound()) { + return ScriptPromise::RejectWithDOMException( + script_state, MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + "No corresponding PaymentRequest object found")); + } + if (!shipping_address) { + return ScriptPromise::RejectWithDOMException( + script_state, + MakeGarbageCollected<DOMException>(DOMExceptionCode::kSyntaxError, + "Shipping address cannot be null")); + } + + auto shipping_address_ptr = payments::mojom::blink::PaymentAddress::New(); + shipping_address_ptr->country = shipping_address->country(); + shipping_address_ptr->address_line = shipping_address->addressLine(); + shipping_address_ptr->region = shipping_address->region(); + shipping_address_ptr->city = shipping_address->city(); + shipping_address_ptr->dependent_locality = + shipping_address->dependentLocality(); + shipping_address_ptr->postal_code = shipping_address->postalCode(); + shipping_address_ptr->sorting_code = shipping_address->sortingCode(); + shipping_address_ptr->organization = shipping_address->organization(); + shipping_address_ptr->recipient = shipping_address->recipient(); + shipping_address_ptr->phone = shipping_address->phone(); + String shipping_address_error; + if (!PaymentsValidators::IsValidShippingAddress(shipping_address_ptr, + &shipping_address_error)) { + return ScriptPromise::RejectWithDOMException( + script_state, + MakeGarbageCollected<DOMException>(DOMExceptionCode::kSyntaxError, + shipping_address_error)); + } + + payment_handler_host_->ChangeShippingAddress( + std::move(shipping_address_ptr), + WTF::Bind(&PaymentRequestEvent::OnChangePaymentRequestDetailsResponse, + WrapWeakPersistent(this))); + change_payment_request_details_resolver_ = + MakeGarbageCollected<ScriptPromiseResolver>(script_state); + return change_payment_request_details_resolver_->Promise(); +} + +ScriptPromise PaymentRequestEvent::changeShippingOption( + ScriptState* script_state, + const String& shipping_option_id) { + if (change_payment_request_details_resolver_) { + return ScriptPromise::RejectWithDOMException( + script_state, MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + "Waiting for response to the previous payment " + "request details change")); + } + + if (!payment_handler_host_.is_bound()) { + return ScriptPromise::RejectWithDOMException( + script_state, MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + "No corresponding PaymentRequest object found")); + } + + bool shipping_option_id_is_valid = false; + for (const auto& option : shipping_options_) { + if (option->id() == shipping_option_id) { + shipping_option_id_is_valid = true; + break; + } + } + if (!shipping_option_id_is_valid) { + return ScriptPromise::RejectWithDOMException( + script_state, MakeGarbageCollected<DOMException>( + DOMExceptionCode::kSyntaxError, + "Shipping option identifier is invalid")); + } + + payment_handler_host_->ChangeShippingOption( + shipping_option_id, + WTF::Bind(&PaymentRequestEvent::OnChangePaymentRequestDetailsResponse, + WrapWeakPersistent(this))); + change_payment_request_details_resolver_ = + MakeGarbageCollected<ScriptPromiseResolver>(script_state); + return change_payment_request_details_resolver_->Promise(); } void PaymentRequestEvent::respondWith(ScriptState* script_state, @@ -237,14 +332,14 @@ visitor->Trace(modifiers_); visitor->Trace(payment_options_); visitor->Trace(shipping_options_); - visitor->Trace(change_payment_method_resolver_); + visitor->Trace(change_payment_request_details_resolver_); visitor->Trace(observer_); ExtendableEvent::Trace(visitor); } -void PaymentRequestEvent::OnChangePaymentMethodResponse( +void PaymentRequestEvent::OnChangePaymentRequestDetailsResponse( payments::mojom::blink::PaymentMethodChangeResponsePtr response) { - if (!change_payment_method_resolver_) + if (!change_payment_request_details_resolver_) return; auto* dictionary = MakeGarbageCollected<PaymentMethodChangeResponse>(); @@ -259,7 +354,8 @@ dictionary->setTotal(total); } - ScriptState* script_state = change_payment_method_resolver_->GetScriptState(); + ScriptState* script_state = + change_payment_request_details_resolver_->GetScriptState(); ScriptState::Scope scope(script_state); ExceptionState exception_state(script_state->GetIsolate(), ExceptionState::kConstructionContext, @@ -290,10 +386,10 @@ script_state->GetIsolate(), script_state->GetContext(), response_modifier->method_data->stringified_data, exception_state); if (exception_state.HadException()) { - change_payment_method_resolver_->Reject( + change_payment_request_details_resolver_->Reject( MakeGarbageCollected<DOMException>(DOMExceptionCode::kSyntaxError, exception_state.Message())); - change_payment_method_resolver_.Clear(); + change_payment_request_details_resolver_.Clear(); return; } mod->setData(ScriptValue(script_state->GetIsolate(), parsed_value)); @@ -303,36 +399,83 @@ dictionary->setModifiers(*modifiers); } + if (response->shipping_options) { + auto* shipping_options = + MakeGarbageCollected<HeapVector<Member<PaymentShippingOption>>>(); + for (const auto& response_shipping_option : *response->shipping_options) { + if (!response_shipping_option) + continue; + + auto* shipping_option = MakeGarbageCollected<PaymentShippingOption>(); + auto* amount = MakeGarbageCollected<PaymentCurrencyAmount>(); + amount->setCurrency(response_shipping_option->amount->currency); + amount->setValue(response_shipping_option->amount->value); + shipping_option->setAmount(amount); + shipping_option->setId(response_shipping_option->id); + shipping_option->setLabel(response_shipping_option->label); + shipping_option->setSelected(response_shipping_option->selected); + shipping_options->emplace_back(shipping_option); + } + dictionary->setShippingOptions(*shipping_options); + } + if (response->stringified_payment_method_errors && !response->stringified_payment_method_errors.IsEmpty()) { v8::Local<v8::Value> parsed_value = FromJSONString( script_state->GetIsolate(), script_state->GetContext(), response->stringified_payment_method_errors, exception_state); if (exception_state.HadException()) { - change_payment_method_resolver_->Reject( + change_payment_request_details_resolver_->Reject( MakeGarbageCollected<DOMException>(DOMExceptionCode::kSyntaxError, exception_state.Message())); - change_payment_method_resolver_.Clear(); + change_payment_request_details_resolver_.Clear(); return; } dictionary->setPaymentMethodErrors( ScriptValue(script_state->GetIsolate(), parsed_value)); } - change_payment_method_resolver_->Resolve( + if (response->shipping_address_errors) { + auto* shipping_address_errors = MakeGarbageCollected<AddressErrors>(); + shipping_address_errors->setAddressLine( + response->shipping_address_errors->address_line); + shipping_address_errors->setCity(response->shipping_address_errors->city); + shipping_address_errors->setCountry( + response->shipping_address_errors->country); + shipping_address_errors->setDependentLocality( + response->shipping_address_errors->dependent_locality); + shipping_address_errors->setOrganization( + response->shipping_address_errors->organization); + shipping_address_errors->setPhone(response->shipping_address_errors->phone); + shipping_address_errors->setPostalCode( + response->shipping_address_errors->postal_code); + shipping_address_errors->setRecipient( + response->shipping_address_errors->recipient); + shipping_address_errors->setRegion( + response->shipping_address_errors->region); + shipping_address_errors->setSortingCode( + response->shipping_address_errors->sorting_code); + dictionary->setShippingAddressErrors(shipping_address_errors); + } + + change_payment_request_details_resolver_->Resolve( dictionary->hasError() || dictionary->hasTotal() || - dictionary->hasModifiers() || dictionary->hasPaymentMethodErrors() + dictionary->hasModifiers() || + dictionary->hasPaymentMethodErrors() || + dictionary->hasShippingOptions() || + dictionary->hasShippingAddressErrors() ? dictionary : nullptr); - change_payment_method_resolver_.Clear(); + change_payment_request_details_resolver_.Clear(); } void PaymentRequestEvent::OnHostConnectionError() { - if (change_payment_method_resolver_) { - change_payment_method_resolver_->Reject(MakeGarbageCollected<DOMException>( - DOMExceptionCode::kAbortError, "Browser process disconnected")); + if (change_payment_request_details_resolver_) { + change_payment_request_details_resolver_->Reject( + MakeGarbageCollected<DOMException>(DOMExceptionCode::kAbortError, + "Browser process disconnected")); } - change_payment_method_resolver_.Clear(); + change_payment_request_details_resolver_.Clear(); payment_handler_host_.reset(); }
diff --git a/third_party/blink/renderer/modules/payments/payment_request_event.h b/third_party/blink/renderer/modules/payments/payment_request_event.h index 12194062..6d65dbf 100644 --- a/third_party/blink/renderer/modules/payments/payment_request_event.h +++ b/third_party/blink/renderer/modules/payments/payment_request_event.h
@@ -11,6 +11,7 @@ #include "third_party/blink/public/mojom/payments/payment_handler_host.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/modules/event_modules.h" +#include "third_party/blink/renderer/modules/payments/payment_address_init.h" #include "third_party/blink/renderer/modules/payments/payment_request_event_init.h" #include "third_party/blink/renderer/modules/service_worker/extendable_event.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -68,12 +69,16 @@ const String& method_name, const ScriptValue& method_details, ExceptionState& exception_state); + ScriptPromise changeShippingAddress(ScriptState*, + PaymentAddressInit* shippingAddress); + ScriptPromise changeShippingOption(ScriptState*, + const String& shipping_option_id); void respondWith(ScriptState*, ScriptPromise, ExceptionState&); void Trace(blink::Visitor*) override; private: - void OnChangePaymentMethodResponse( + void OnChangePaymentRequestDetailsResponse( payments::mojom::blink::PaymentMethodChangeResponsePtr); void OnHostConnectionError(); @@ -87,7 +92,7 @@ Member<PaymentOptions> payment_options_; HeapVector<Member<PaymentShippingOption>> shipping_options_; - Member<ScriptPromiseResolver> change_payment_method_resolver_; + Member<ScriptPromiseResolver> change_payment_request_details_resolver_; Member<RespondWithObserver> observer_; mojo::Remote<payments::mojom::blink::PaymentHandlerHost> payment_handler_host_;
diff --git a/third_party/blink/renderer/modules/payments/payment_request_event.idl b/third_party/blink/renderer/modules/payments/payment_request_event.idl index 9b9d67ed..2aac585f 100644 --- a/third_party/blink/renderer/modules/payments/payment_request_event.idl +++ b/third_party/blink/renderer/modules/payments/payment_request_event.idl
@@ -22,4 +22,6 @@ [CallWith=ScriptState] Promise<WindowClient?> openWindow(USVString url); [CallWith=ScriptState, RaisesException, RuntimeEnabled=PaymentHandlerChangePaymentMethod] Promise<PaymentMethodChangeResponse?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null); [CallWith=ScriptState, RaisesException] void respondWith(Promise<PaymentResponse> response); + [CallWith=ScriptState, RuntimeEnabled=PaymentHandlerHandlesShippingAndContact] Promise<PaymentMethodChangeResponse?> changeShippingAddress(PaymentAddressInit shippingAddress); + [CallWith=ScriptState, RuntimeEnabled=PaymentHandlerHandlesShippingAndContact] Promise<PaymentMethodChangeResponse?> changeShippingOption(DOMString shippingOption); };
diff --git a/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.cc b/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.cc index 6257552..b55f86c 100644 --- a/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.cc +++ b/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.cc
@@ -66,9 +66,9 @@ // See https://bit.ly/2S0zRAS for task types. auto task_runner = context->GetTaskRunner(TaskType::kMiscPlatformAPI); - auto request = mojo::MakeRequest(&service_, task_runner); - context->GetInterfaceProvider()->GetInterface(std::move(request)); - service_.set_connection_error_handler(WTF::Bind( + context->GetInterfaceProvider()->GetInterface( + service_.BindNewPipeAndPassReceiver(task_runner)); + service_.set_disconnect_handler(WTF::Bind( &BarcodeDetectorStatics::OnConnectionError, WrapWeakPersistent(this))); }
diff --git a/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.h b/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.h index c6fcb737..fc94f08 100644 --- a/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.h +++ b/third_party/blink/renderer/modules/shapedetection/barcode_detector_statics.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_BARCODE_DETECTOR_STATICS_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_BARCODE_DETECTOR_STATICS_H_ +#include "mojo/public/cpp/bindings/remote.h" #include "services/shape_detection/public/mojom/barcodedetection_provider.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" @@ -46,7 +47,8 @@ const Vector<shape_detection::mojom::blink::BarcodeFormat>&); void OnConnectionError(); - shape_detection::mojom::blink::BarcodeDetectionProviderPtr service_; + mojo::Remote<shape_detection::mojom::blink::BarcodeDetectionProvider> + service_; // Holds Promises returned by EnumerateSupportedFormats() so that they can be // resolve in the case of a Mojo connection error.
diff --git a/third_party/blink/renderer/modules/shapedetection/face_detector.cc b/third_party/blink/renderer/modules/shapedetection/face_detector.cc index dda96e7..64ee1a7e 100644 --- a/third_party/blink/renderer/modules/shapedetection/face_detector.cc +++ b/third_party/blink/renderer/modules/shapedetection/face_detector.cc
@@ -37,12 +37,12 @@ face_detector_options->max_detected_faces = options->maxDetectedFaces(); face_detector_options->fast_mode = options->fastMode(); - shape_detection::mojom::blink::FaceDetectionProviderPtr provider; + mojo::Remote<shape_detection::mojom::blink::FaceDetectionProvider> provider; // See https://bit.ly/2S0zRAS for task types. auto task_runner = context->GetTaskRunner(TaskType::kMiscPlatformAPI); - auto request = mojo::MakeRequest(&provider, task_runner); if (auto* interface_provider = context->GetInterfaceProvider()) { - interface_provider->GetInterface(std::move(request)); + interface_provider->GetInterface( + provider.BindNewPipeAndPassReceiver(task_runner)); } provider->CreateFaceDetection( face_service_.BindNewPipeAndPassReceiver(task_runner),
diff --git a/third_party/blink/renderer/modules/shapedetection/text_detector.cc b/third_party/blink/renderer/modules/shapedetection/text_detector.cc index 0db9dc3..ca4d0b3 100644 --- a/third_party/blink/renderer/modules/shapedetection/text_detector.cc +++ b/third_party/blink/renderer/modules/shapedetection/text_detector.cc
@@ -25,12 +25,12 @@ TextDetector::TextDetector(ExecutionContext* context) : ShapeDetector() { // See https://bit.ly/2S0zRAS for task types. auto task_runner = context->GetTaskRunner(TaskType::kMiscPlatformAPI); - auto request = mojo::MakeRequest(&text_service_, task_runner); if (auto* interface_provider = context->GetInterfaceProvider()) { - interface_provider->GetInterface(std::move(request)); + interface_provider->GetInterface( + text_service_.BindNewPipeAndPassReceiver(task_runner)); } - text_service_.set_connection_error_handler(WTF::Bind( + text_service_.set_disconnect_handler(WTF::Bind( &TextDetector::OnTextServiceConnectionError, WrapWeakPersistent(this))); }
diff --git a/third_party/blink/renderer/modules/shapedetection/text_detector.h b/third_party/blink/renderer/modules/shapedetection/text_detector.h index 89136af..48e06af 100644 --- a/third_party/blink/renderer/modules/shapedetection/text_detector.h +++ b/third_party/blink/renderer/modules/shapedetection/text_detector.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_TEXT_DETECTOR_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_TEXT_DETECTOR_H_ +#include "mojo/public/cpp/bindings/remote.h" #include "services/shape_detection/public/mojom/textdetection.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" @@ -35,7 +36,7 @@ Vector<shape_detection::mojom::blink::TextDetectionResultPtr>); void OnTextServiceConnectionError(); - shape_detection::mojom::blink::TextDetectionPtr text_service_; + mojo::Remote<shape_detection::mojom::blink::TextDetection> text_service_; HeapHashSet<Member<ScriptPromiseResolver>> text_service_requests_; };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.cc b/third_party/blink/renderer/modules/webgpu/gpu_device.cc index 7aa2a529..f8d3a993 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.cc
@@ -247,7 +247,7 @@ v8::Isolate* isolate = resolver->GetScriptState()->GetIsolate(); switch (type) { case DAWN_ERROR_TYPE_NO_ERROR: - resolver->Resolve(ScriptValue::CreateNull(isolate)); + resolver->Resolve(v8::Null(isolate)); break; case DAWN_ERROR_TYPE_OUT_OF_MEMORY: resolver->Resolve(GPUOutOfMemoryError::Create());
diff --git a/third_party/blink/renderer/platform/graphics/begin_frame_provider.cc b/third_party/blink/renderer/platform/graphics/begin_frame_provider.cc index 1d8ddf5..9524ea3 100644 --- a/third_party/blink/renderer/platform/graphics/begin_frame_provider.cc +++ b/third_party/blink/renderer/platform/graphics/begin_frame_provider.cc
@@ -95,6 +95,10 @@ void BeginFrameProvider::OnBeginFrame( const viz::BeginFrameArgs& args, WTF::HashMap<uint32_t, ::viz::mojom::blink::FrameTimingDetailsPtr>) { + TRACE_EVENT_WITH_FLOW0("blink", "BeginFrameProvider::OnBeginFrame", + TRACE_ID_GLOBAL(args.trace_id), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); + if (args.deadline < base::TimeTicks::Now()) { compositor_frame_sink_->DidNotProduceFrame(viz::BeginFrameAck(args, false)); return; @@ -103,14 +107,16 @@ // If there was no need for a BeginFrame, just skip it. if (needs_begin_frame_ && requested_needs_begin_frame_) { requested_needs_begin_frame_ = false; - begin_frame_client_->BeginFrame(args.frame_time); + begin_frame_client_->BeginFrame(args); } else { if (!requested_needs_begin_frame_) { needs_begin_frame_ = false; compositor_frame_sink_->SetNeedsBeginFrame(false); } } +} +void BeginFrameProvider::FinishBeginFrame(const viz::BeginFrameArgs& args) { compositor_frame_sink_->DidNotProduceFrame(viz::BeginFrameAck(args, false)); }
diff --git a/third_party/blink/renderer/platform/graphics/begin_frame_provider.h b/third_party/blink/renderer/platform/graphics/begin_frame_provider.h index 6c4a271..85dd881 100644 --- a/third_party/blink/renderer/platform/graphics/begin_frame_provider.h +++ b/third_party/blink/renderer/platform/graphics/begin_frame_provider.h
@@ -24,7 +24,7 @@ class PLATFORM_EXPORT BeginFrameProviderClient { public: - virtual void BeginFrame(const base::TimeTicks& frame_time) = 0; + virtual void BeginFrame(const viz::BeginFrameArgs&) = 0; virtual ~BeginFrameProviderClient() = default; }; @@ -39,6 +39,7 @@ void CreateCompositorFrameSinkIfNeeded(); void RequestBeginFrame(); + void FinishBeginFrame(const viz::BeginFrameArgs&); // viz::mojom::blink::CompositorFrameSinkClient implementation. void DidReceiveCompositorFrameAck(
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h index 018ac27..d3a926c 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h
@@ -60,6 +60,9 @@ const SkIRect& damage_rect, bool needs_vertical_flip, bool is_opaque); + void ReplaceBeginFrameAck(const viz::BeginFrameArgs& args) { + current_begin_frame_ack_ = viz::BeginFrameAck(args, true); + } void Reshape(const IntSize&);
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 3f9fa32..192a6a3b 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -385,7 +385,7 @@ // CSS min(), max() and clamp() // https://drafts.csswg.org/css-values-4/#comp-func name: "CSSComparisonFunctions", - status: "test", + status: "stable", }, { // Support for CSS content-size property.
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations.h b/third_party/blink/renderer/platform/transforms/transform_operations.h index c7ef91f..51d2536 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations.h +++ b/third_party/blink/renderer/platform/transforms/transform_operations.h
@@ -72,6 +72,17 @@ return false; } + // Return true if any of the operation types are non-perspective 3D operation + // types (even if the values describe affine transforms) + bool HasNonPerspective3DOperation() const { + for (auto& operation : operations_) { + if (operation->Is3DOperation() && + operation->GetType() != TransformOperation::kPerspective) + return true; + } + return false; + } + bool PreservesAxisAlignment() const { for (auto& operation : operations_) { if (!operation->PreservesAxisAlignment()) @@ -90,6 +101,15 @@ return false; } + // Returns true if any operation is perspective. + bool HasPerspective() const { + for (auto& operation : operations_) { + if (operation->GetType() == TransformOperation::kPerspective) + return true; + } + return false; + } + bool DependsOnBoxSize() const { for (auto& operation : operations_) { if (operation->DependsOnBoxSize())
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc index 45ac39a..2a9c9c3 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc +++ b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc
@@ -546,4 +546,24 @@ EXPECT_EQ(result1, result2); } +TEST(TransformOperationsTest, PerspectiveOpsTest) { + TransformOperations ops; + EXPECT_FALSE(ops.HasPerspective()); + EXPECT_FALSE(ops.HasNonPerspective3DOperation()); + + ops.Operations().push_back(TranslateTransformOperation::Create( + Length::Fixed(1), Length::Fixed(2), TransformOperation::kTranslate)); + EXPECT_FALSE(ops.HasPerspective()); + EXPECT_FALSE(ops.HasNonPerspective3DOperation()); + + ops.Operations().push_back(PerspectiveTransformOperation::Create(1234)); + EXPECT_TRUE(ops.HasPerspective()); + EXPECT_FALSE(ops.HasNonPerspective3DOperation()); + + ops.Operations().push_back(TranslateTransformOperation::Create( + Length::Fixed(1), Length::Fixed(2), 3, TransformOperation::kTranslate3D)); + EXPECT_TRUE(ops.HasPerspective()); + EXPECT_TRUE(ops.HasNonPerspective3DOperation()); +} + } // namespace blink
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index 5afe36f..38a1e1f 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -664,7 +664,5 @@ crbug.com/984003 http/tests/virtual-scroller/find-element-66-0px.html [ Slow ] crbug.com/984003 http/tests/virtual-scroller/find-element-66-10px.html [ Slow ] -crbug.com/1003715 [ Win10 ] http/tests/notifications/serviceworker-notification-properties.html [ Slow ] - # Slow when using Vulkan. crbug.com/994331 compositing/lots-of-img-layers.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index bccd2ee..81e2b2d 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -61,7 +61,7 @@ # issues (e.g. missing OOPIF support in the test harness). # TODO(lukasza, alexmos): Burn down this list. crbug.com/645641 external/wpt/html/syntax/parsing/html5lib_tests19.html [ Crash Failure ] -crbug.com/665058 http/tests/local/drag-over-remote-content.html [ Crash ] +crbug.com/665058 http/tests/local/drag-over-remote-content.html [ Crash Timeout ] crbug.com/771003 http/tests/security/mixedContent/insecure-iframe-in-main-frame.html [ Failure ] # Tests temporarily disabled with Site Isolation - uninvestigated bugs: @@ -6226,3 +6226,8 @@ # Sheriff 2019-09-27 crbug.com/1008826 [ Mac10.13 ] http/tests/security/frameNavigation/xss-ALLOWED-parent-navigation-change.html [ Pass Failure ] + +# Sheriff 2019-09-30 +crbug.com/1009016 [ Win10 ] http/tests/devtools/portals/portals-elements-nesting-after-adoption.js [ Pass Failure ] +crbug.com/1003715 [ Win10 ] http/tests/notifications/serviceworker-notification-properties.html [ Pass Failure ] +
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json index 6f1e902a..ffd30d3 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -162196,6 +162196,9 @@ "interfaces/webrtc-dscp.idl": [ [] ], + "interfaces/webrtc-identity.idl": [ + [] + ], "interfaces/webrtc-stats.idl": [ [] ], @@ -175759,6 +175762,9 @@ "webrtc-identity/identity-helper.sub.js": [ [] ], + "webrtc-identity/idlharness.https.window-expected.txt": [ + [] + ], "webrtc-quic/META.yml": [ [] ], @@ -201012,6 +201018,18 @@ {} ] ], + "cookies/samesite/about-blank-subresource.https.html": [ + [ + "cookies/samesite/about-blank-subresource.https.html", + {} + ] + ], + "cookies/samesite/about-blank-toplevel.https.html": [ + [ + "cookies/samesite/about-blank-toplevel.https.html", + {} + ] + ], "cookies/samesite/fetch.https.html": [ [ "cookies/samesite/fetch.https.html", @@ -203243,6 +203261,12 @@ {} ] ], + "css/css-box/animation/margin-interpolation.html": [ + [ + "css/css-box/animation/margin-interpolation.html", + {} + ] + ], "css/css-box/animation/padding-interpolation.html": [ [ "css/css-box/animation/padding-interpolation.html", @@ -208223,6 +208247,12 @@ {} ] ], + "css/css-masking/animations/clip-path-interpolation.html": [ + [ + "css/css-masking/animations/clip-path-interpolation.html", + {} + ] + ], "css/css-masking/clip-path/interpolation.html": [ [ "css/css-masking/clip-path/interpolation.html", @@ -211313,6 +211343,12 @@ {} ] ], + "css/css-tables/animations/border-spacing-interpolation.html": [ + [ + "css/css-tables/animations/border-spacing-interpolation.html", + {} + ] + ], "css/css-tables/border-spacing-included-in-sizes-001.html": [ [ "css/css-tables/border-spacing-included-in-sizes-001.html", @@ -302666,6 +302702,23 @@ {} ] ], + "webrtc-identity/idlharness.https.window.js": [ + [ + "webrtc-identity/idlharness.https.window.html", + { + "script_metadata": [ + [ + "script", + "/resources/WebIDLParser.js" + ], + [ + "script", + "/resources/idlharness.js" + ] + ] + } + ] + ], "webrtc-quic/RTCQuicStream.https.html": [ [ "webrtc-quic/RTCQuicStream.https.html", @@ -335643,6 +335696,14 @@ "d5c9b8ada3f1bce6ebfe35efd0d6f288aa5ca5e3", "testharness" ], + "cookies/samesite/about-blank-subresource.https.html": [ + "0a19f30d34758e0b9865b2300e5658ec6efbfe0c", + "testharness" + ], + "cookies/samesite/about-blank-toplevel.https.html": [ + "3a4dde7673d13dec2daf7f83b3082a5589e2e688", + "testharness" + ], "cookies/samesite/fetch.https.html": [ "4daf357004a71cea5b0e58a44bf8919d96ad7ce8", "testharness" @@ -335684,7 +335745,7 @@ "support" ], "cookies/samesite/resources/iframe-subresource-report.html": [ - "fad80534f22bdc63e7a4827cef07b17335134b71", + "1dceb4e43681c81b6c1b8877fd2d9f2b34391a02", "support" ], "cookies/samesite/resources/navigate.html": [ @@ -355359,6 +355420,10 @@ "dde409360faf79a301c3ae3ea34a995d154d7bb4", "support" ], + "css/css-box/animation/margin-interpolation.html": [ + "088836cbbd18d0daf203de7dbacfb65733e35813", + "testharness" + ], "css/css-box/animation/padding-interpolation.html": [ "3bf284117960fe78300e95140244d309f8f439a4", "testharness" @@ -375579,6 +375644,10 @@ "5f3e240be54b8b3d8d86991a78652708cbc1a999", "support" ], + "css/css-masking/animations/clip-path-interpolation.html": [ + "21c34f1f2b75ec7345a97b00db62a49b038cf026", + "testharness" + ], "css/css-masking/clip-path-svg-content/clip-path-clip-nested-twice.svg": [ "269e8feed2d3c21774a7c94729c3551899ce4d92", "reftest" @@ -384203,6 +384272,10 @@ "91439a69c9b1765cdbaf7e9614180d080ab32907", "reftest" ], + "css/css-tables/animations/border-spacing-interpolation.html": [ + "02e1cc62296501417b7ce8d02136b57e5342f332", + "testharness" + ], "css/css-tables/anonymous-table-cell-margin-collapsing.html": [ "23b467ebacc983122a632f4d5971c8daca569420", "reftest" @@ -452672,7 +452745,7 @@ "support" ], "interfaces/presentation-api.idl": [ - "c1e566538aa0211ecebbd8d177765fc1dd02c2ce", + "dfaa022b95249eb020e6fb8e0495156a8c0744ee", "support" ], "interfaces/proximity.idl": [ @@ -452736,7 +452809,7 @@ "support" ], "interfaces/shape-detection-api.idl": [ - "0144f04e046720d20f91a98af9d5c651e95b06fd", + "51c996959bea2acc1b2d0a3c3be438b0c6182e23", "support" ], "interfaces/speech-api.idl": [ @@ -452804,7 +452877,7 @@ "support" ], "interfaces/webaudio.idl": [ - "1b6af25b3b363411bfb365b1b3b21639584cfa76", + "3869d5d14a66c39e0281bb94a2e41ee5f2e395ba", "support" ], "interfaces/webauthn.idl": [ @@ -452831,6 +452904,10 @@ "732230b4a339d2484fa5242fdfc77224400796b2", "support" ], + "interfaces/webrtc-identity.idl": [ + "5a59a4887ac7eb0ad39cfd82fee052828d7af316", + "support" + ], "interfaces/webrtc-stats.idl": [ "c2dc1f7a0b0a482d226b881995414b558fbe2baf", "support" @@ -452840,7 +452917,7 @@ "support" ], "interfaces/webusb.idl": [ - "fcca851b8b535f4886bd56f30714971cf22c8c40", + "ad5c480454d7cd6feb178fa450663b9977eb51cd", "support" ], "interfaces/webvtt.idl": [ @@ -493376,7 +493453,7 @@ "support" ], "tools/wptrunner/wptrunner/metadata.py": [ - "42f3b00dab5b926f918c23a352bef935f07bbf4c", + "15bbf94c33cea80ab4d0fdd958618f264fa57ab1", "support" ], "tools/wptrunner/wptrunner/products.py": [ @@ -493952,7 +494029,7 @@ "support" ], "trusted-types/trusted-types-reporting.tentative.https.html": [ - "11ef305064d2af10ffc07ca09e51dcb1a3661e76", + "0104ba358058199a77f1af5afb27e3255da8da64", "testharness" ], "trusted-types/trusted-types-reporting.tentative.https.html.headers": [ @@ -499119,6 +499196,14 @@ "90363662f742fbf1d31634030d2b470e08fe1421", "support" ], + "webrtc-identity/idlharness.https.window-expected.txt": [ + "74bc96f2f15e4a8a9f09e8901dcd8e9b0d90ddf0", + "support" + ], + "webrtc-identity/idlharness.https.window.js": [ + "da1cb85a8e7ef147729d4a4f1a77493862dea48c", + "testharness" + ], "webrtc-quic/META.yml": [ "740c8d2fe84beafbcb7f98cef29aff2378721132", "support" @@ -501336,7 +501421,7 @@ "testharness" ], "webusb/idlharness.https.any.worker-expected.txt": [ - "20dc3beeab69a0f896ddfea362d1373b41a64e14", + "010de2f3aa60bb457f778de8e011ff81e95d7285", "support" ], "webusb/insecure-context.any.js": [
diff --git a/third_party/blink/web_tests/external/wpt/cookies/samesite/about-blank-subresource.https.html b/third_party/blink/web_tests/external/wpt/cookies/samesite/about-blank-subresource.https.html new file mode 100644 index 0000000..0a19f30 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/cookies/samesite/about-blank-subresource.https.html
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/cookies/resources/cookie-helper.sub.js"></script> +</head> +<body onload="doTests()"> + <script> + function doTests() { + promise_test(async function(t) { + var child = window.open(""); + child.onmessage = (ev) => { + child.opener.postMessage(ev.data, '*'); + }; + var grandKid = child.document.createElement("iframe"); + child.document.body.appendChild(grandKid); + var value = "" + Math.random(); + await resetSameSiteCookies(SECURE_ORIGIN, value); + + // Load at what cookies a subresource below an about:blank iframe + // inheritting this origin gets. + grandKid.src = SECURE_ORIGIN + "/cookies/samesite/resources/iframe-subresource-report.html" + var e = await wait_for_message("COOKIES", SECURE_ORIGIN); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_unspecified", value, true); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_lax", value, true); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_strict", value, true); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_none", value, true); + }, "SameSite cookies on subresource of top-level about:blank window"); + } + </script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/cookies/samesite/about-blank-toplevel.https.html b/third_party/blink/web_tests/external/wpt/cookies/samesite/about-blank-toplevel.https.html new file mode 100644 index 0000000..3a4dde76 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/cookies/samesite/about-blank-toplevel.https.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/cookies/resources/cookie-helper.sub.js"></script> +</head> +<body onload="doTests()"> + <script> + function doTests() { + promise_test(async function(t) { + var child = window.open(""); + child.onmessage = (ev) => { + child.opener.postMessage(ev.data, '*'); + }; + var grandKid = child.document.createElement("iframe"); + child.document.body.appendChild(grandKid); + var value = "" + Math.random(); + await resetSameSiteCookies(SECURE_ORIGIN, value); + + // Using postToParent.py here to see cookies used when navigating the page. + grandKid.src = SECURE_ORIGIN + "/cookies/resources/postToParent.py" + var e = await wait_for_message("COOKIES", SECURE_ORIGIN); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_unspecified", value, true); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_lax", value, true); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_strict", value, true); + assert_cookie(SECURE_ORIGIN, e.data, "samesite_none", value, true); + }, "SameSite cookies with top-level about:blank window"); + } + </script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/cookies/samesite/resources/iframe-subresource-report.html b/third_party/blink/web_tests/external/wpt/cookies/samesite/resources/iframe-subresource-report.html index fad8053..1dceb4e4 100644 --- a/third_party/blink/web_tests/external/wpt/cookies/samesite/resources/iframe-subresource-report.html +++ b/third_party/blink/web_tests/external/wpt/cookies/samesite/resources/iframe-subresource-report.html
@@ -6,7 +6,8 @@ credFetch(SECURE_ORIGIN + "/cookies/resources/list.py") .then(r => r.json()) .then(cookies => { cookies.type = "COOKIES"; - window.parent.postMessage(cookies, "*");}); + target = window.opener ? window.opener : window.parent; + target.postMessage(cookies, "*");}); } </script> </head>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/presentation-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/presentation-api.idl index c1e5665..dfaa022b 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/presentation-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/presentation-api.idl
@@ -48,7 +48,6 @@ }; enum PresentationConnectionState { "connecting", "connected", "closed", "terminated" }; -enum BinaryType { "blob", "arraybuffer" }; [SecureContext, Exposed=Window] interface PresentationConnection : EventTarget {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/shape-detection-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/shape-detection-api.idl index 0144f04..51c9969 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/shape-detection-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/shape-detection-api.idl
@@ -4,9 +4,9 @@ // Source: Accelerated Shape Detection in Images (https://wicg.github.io/shape-detection-api/) [Exposed=(Window,Worker), - SecureContext, - Constructor(optional FaceDetectorOptions faceDetectorOptions = {})] + SecureContext] interface FaceDetector { + constructor(optional FaceDetectorOptions faceDetectorOptions = {}); Promise<sequence<DetectedFace>> detect(ImageBitmapSource image); }; @@ -35,9 +35,9 @@ }; [Exposed=(Window,Worker), - SecureContext, - Constructor(optional BarcodeDetectorOptions barcodeDetectorOptions = {})] + SecureContext] interface BarcodeDetector { + constructor(optional BarcodeDetectorOptions barcodeDetectorOptions = {}); static Promise<sequence<BarcodeFormat>> getSupportedFormats(); Promise<sequence<DetectedBarcode>> detect(ImageBitmapSource image);
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webaudio.idl b/third_party/blink/web_tests/external/wpt/interfaces/webaudio.idl index 1b6af25..3869d5d1 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webaudio.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webaudio.idl
@@ -38,7 +38,7 @@ IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback); OscillatorNode createOscillator (); PannerNode createPanner (); - PeriodicWave createPeriodicWave (sequence<float> real, sequence<float> imag, optional PeriodicWaveConstraints constraints); + PeriodicWave createPeriodicWave (sequence<float> real, sequence<float> imag, optional PeriodicWaveConstraints constraints = {}); ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2); @@ -56,19 +56,19 @@ "playback" }; -[Exposed=Window, - Constructor (optional AudioContextOptions contextOptions)] +[Exposed=Window] interface AudioContext : BaseAudioContext { - readonly attribute double baseLatency; - readonly attribute double outputLatency; - AudioTimestamp getOutputTimestamp (); - Promise<void> resume (); - Promise<void> suspend (); - Promise<void> close (); - MediaElementAudioSourceNode createMediaElementSource (HTMLMediaElement mediaElement); - MediaStreamAudioSourceNode createMediaStreamSource (MediaStream mediaStream); - MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (MediaStreamTrack mediaStreamTrack); - MediaStreamAudioDestinationNode createMediaStreamDestination (); + constructor (optional AudioContextOptions contextOptions = {}); + readonly attribute double baseLatency; + readonly attribute double outputLatency; + AudioTimestamp getOutputTimestamp (); + Promise<void> resume (); + Promise<void> suspend (); + Promise<void> close (); + MediaElementAudioSourceNode createMediaElementSource (HTMLMediaElement mediaElement); + MediaStreamAudioSourceNode createMediaStreamSource (MediaStream mediaStream); + MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (MediaStreamTrack mediaStreamTrack); + MediaStreamAudioDestinationNode createMediaStreamDestination (); }; dictionary AudioContextOptions { @@ -81,10 +81,10 @@ DOMHighResTimeStamp performanceTime; }; -[Exposed=Window, - Constructor (OfflineAudioContextOptions contextOptions), - Constructor (unsigned long numberOfChannels, unsigned long length, float sampleRate)] +[Exposed=Window] interface OfflineAudioContext : BaseAudioContext { + constructor(OfflineAudioContextOptions contextOptions); + constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate); Promise<AudioBuffer> startRendering(); Promise<void> resume(); Promise<void> suspend(double suspendTime); @@ -98,9 +98,9 @@ required float sampleRate; }; -[Exposed=Window, - Constructor (DOMString type, OfflineAudioCompletionEventInit eventInitDict)] +[Exposed=Window] interface OfflineAudioCompletionEvent : Event { + constructor (DOMString type, OfflineAudioCompletionEventInit eventInitDict); readonly attribute AudioBuffer renderedBuffer; }; @@ -108,9 +108,9 @@ required AudioBuffer renderedBuffer; }; -[Exposed=Window, - Constructor (AudioBufferOptions options)] +[Exposed=Window] interface AudioBuffer { + constructor (AudioBufferOptions options); readonly attribute float sampleRate; readonly attribute unsigned long length; readonly attribute double duration; @@ -192,9 +192,9 @@ void stop(optional double when = 0); }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional AnalyserOptions options = {})] +[Exposed=Window] interface AnalyserNode : AudioNode { + constructor (BaseAudioContext context, optional AnalyserOptions options = {}); void getFloatFrequencyData (Float32Array array); void getByteFrequencyData (Uint8Array array); void getFloatTimeDomainData (Float32Array array); @@ -213,9 +213,9 @@ double smoothingTimeConstant = 0.8; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options = {})] +[Exposed=Window] interface AudioBufferSourceNode : AudioScheduledSourceNode { + constructor (BaseAudioContext context, optional AudioBufferSourceOptions options = {}); attribute AudioBuffer? buffer; readonly attribute AudioParam playbackRate; readonly attribute AudioParam detune; @@ -256,9 +256,9 @@ void setOrientation (float x, float y, float z, float xUp, float yUp, float zUp); }; -[Exposed=Window, - Constructor (DOMString type, AudioProcessingEventInit eventInitDict)] +[Exposed=Window] interface AudioProcessingEvent : Event { + constructor (DOMString type, AudioProcessingEventInit eventInitDict); readonly attribute double playbackTime; readonly attribute AudioBuffer inputBuffer; readonly attribute AudioBuffer outputBuffer; @@ -281,9 +281,9 @@ "allpass" }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional BiquadFilterOptions options = {})] +[Exposed=Window] interface BiquadFilterNode : AudioNode { + constructor (BaseAudioContext context, optional BiquadFilterOptions options = {}); attribute BiquadFilterType type; readonly attribute AudioParam frequency; readonly attribute AudioParam detune; @@ -300,27 +300,27 @@ float gain = 0; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional ChannelMergerOptions options = {})] +[Exposed=Window] interface ChannelMergerNode : AudioNode { + constructor (BaseAudioContext context, optional ChannelMergerOptions options = {}); }; dictionary ChannelMergerOptions : AudioNodeOptions { unsigned long numberOfInputs = 6; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional ChannelSplitterOptions options = {})] +[Exposed=Window] interface ChannelSplitterNode : AudioNode { + constructor (BaseAudioContext context, optional ChannelSplitterOptions options = {}); }; dictionary ChannelSplitterOptions : AudioNodeOptions { unsigned long numberOfOutputs = 6; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional ConstantSourceOptions options = {})] +[Exposed=Window] interface ConstantSourceNode : AudioScheduledSourceNode { + constructor (BaseAudioContext context, optional ConstantSourceOptions options = {}); readonly attribute AudioParam offset; }; @@ -328,9 +328,9 @@ float offset = 1; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional ConvolverOptions options = {})] +[Exposed=Window] interface ConvolverNode : AudioNode { + constructor (BaseAudioContext context, optional ConvolverOptions options = {}); attribute AudioBuffer? buffer; attribute boolean normalize; }; @@ -340,9 +340,9 @@ boolean disableNormalization = false; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional DelayOptions options = {})] +[Exposed=Window] interface DelayNode : AudioNode { + constructor (BaseAudioContext context, optional DelayOptions options = {}); readonly attribute AudioParam delayTime; }; @@ -351,9 +351,9 @@ double delayTime = 0; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional DynamicsCompressorOptions options = {})] +[Exposed=Window] interface DynamicsCompressorNode : AudioNode { + constructor (BaseAudioContext context, optional DynamicsCompressorOptions options = {}); readonly attribute AudioParam threshold; readonly attribute AudioParam knee; readonly attribute AudioParam ratio; @@ -370,9 +370,9 @@ float threshold = -24; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional GainOptions options = {})] +[Exposed=Window] interface GainNode : AudioNode { + constructor (BaseAudioContext context, optional GainOptions options = {}); readonly attribute AudioParam gain; }; @@ -380,9 +380,9 @@ float gain = 1.0; }; -[Exposed=Window, - Constructor (BaseAudioContext context, IIRFilterOptions options)] +[Exposed=Window] interface IIRFilterNode : AudioNode { + constructor (BaseAudioContext context, IIRFilterOptions options); void getFrequencyResponse (Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse); }; @@ -391,9 +391,9 @@ required sequence<double> feedback; }; -[Exposed=Window, - Constructor (AudioContext context, MediaElementAudioSourceOptions options)] +[Exposed=Window] interface MediaElementAudioSourceNode : AudioNode { + constructor (AudioContext context, MediaElementAudioSourceOptions options); [SameObject] readonly attribute HTMLMediaElement mediaElement; }; @@ -401,15 +401,15 @@ required HTMLMediaElement mediaElement; }; -[Exposed=Window, - Constructor (AudioContext context, optional AudioNodeOptions options = {})] +[Exposed=Window] interface MediaStreamAudioDestinationNode : AudioNode { + constructor (AudioContext context, optional AudioNodeOptions options = {}); readonly attribute MediaStream stream; }; -[Exposed=Window, - Constructor (AudioContext context, MediaStreamAudioSourceOptions options)] +[Exposed=Window] interface MediaStreamAudioSourceNode : AudioNode { + constructor (AudioContext context, MediaStreamAudioSourceOptions options); [SameObject] readonly attribute MediaStream mediaStream; }; @@ -417,9 +417,9 @@ required MediaStream mediaStream; }; -[Exposed=Window, - Constructor (AudioContext context, MediaStreamTrackAudioSourceOptions options)] +[Exposed=Window] interface MediaStreamTrackAudioSourceNode : AudioNode { + constructor (AudioContext context, MediaStreamTrackAudioSourceOptions options); }; dictionary MediaStreamTrackAudioSourceOptions { @@ -434,9 +434,9 @@ "custom" }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional OscillatorOptions options = {})] +[Exposed=Window] interface OscillatorNode : AudioScheduledSourceNode { + constructor (BaseAudioContext context, optional OscillatorOptions options = {}); attribute OscillatorType type; readonly attribute AudioParam frequency; readonly attribute AudioParam detune; @@ -461,9 +461,9 @@ "exponential" }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional PannerOptions options = {})] +[Exposed=Window] interface PannerNode : AudioNode { + constructor (BaseAudioContext context, optional PannerOptions options = {}); attribute PanningModelType panningModel; readonly attribute AudioParam positionX; readonly attribute AudioParam positionY; @@ -499,9 +499,9 @@ double coneOuterGain = 0; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional PeriodicWaveOptions options = {})] +[Exposed=Window] interface PeriodicWave { + constructor (BaseAudioContext context, optional PeriodicWaveOptions options = {}); }; dictionary PeriodicWaveConstraints { @@ -519,9 +519,9 @@ readonly attribute long bufferSize; }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional StereoPannerOptions options = {})] +[Exposed=Window] interface StereoPannerNode : AudioNode { + constructor (BaseAudioContext context, optional StereoPannerOptions options = {}); readonly attribute AudioParam pan; }; @@ -535,9 +535,9 @@ "4x" }; -[Exposed=Window, - Constructor (BaseAudioContext context, optional WaveShaperOptions options = {})] +[Exposed=Window] interface WaveShaperNode : AudioNode { + constructor (BaseAudioContext context, optional WaveShaperOptions options = {}); attribute Float32Array? curve; attribute OverSampleType oversample; }; @@ -566,11 +566,10 @@ readonly maplike<DOMString, AudioParam>; }; -[Exposed=Window, - SecureContext, - Constructor (BaseAudioContext context, DOMString name, - optional AudioWorkletNodeOptions options = {})] +[Exposed=Window, SecureContext] interface AudioWorkletNode : AudioNode { + constructor (BaseAudioContext context, DOMString name, + optional AudioWorkletNodeOptions options = {}); readonly attribute AudioParamMap parameters; readonly attribute MessagePort port; attribute EventHandler onprocessorerror; @@ -584,9 +583,9 @@ object processorOptions; }; -[Exposed=AudioWorklet, -Constructor (optional AudioWorkletNodeOptions options = {})] +[Exposed=AudioWorklet] interface AudioWorkletProcessor { + constructor (optional AudioWorkletNodeOptions options = {}); readonly attribute MessagePort port; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-identity.idl b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-identity.idl new file mode 100644 index 0000000..5a59a48 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-identity.idl
@@ -0,0 +1,67 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into reffy-reports +// (https://github.com/tidoust/reffy-reports) +// Source: Identity for WebRTC 1.0 (https://w3c.github.io/webrtc-identity/identity.html) + +[Global, Exposed=RTCIdentityProviderGlobalScope] +interface RTCIdentityProviderGlobalScope : WorkerGlobalScope { + readonly attribute RTCIdentityProviderRegistrar rtcIdentityProvider; +}; + +[Exposed=RTCIdentityProviderGlobalScope] +interface RTCIdentityProviderRegistrar { + void register(RTCIdentityProvider idp); +}; + +dictionary RTCIdentityProvider { + required GenerateAssertionCallback generateAssertion; + required ValidateAssertionCallback validateAssertion; +}; + +callback GenerateAssertionCallback = Promise<RTCIdentityAssertionResult> (DOMString contents, DOMString origin, RTCIdentityProviderOptions options); + +callback ValidateAssertionCallback = Promise<RTCIdentityValidationResult> (DOMString assertion, DOMString origin); + +dictionary RTCIdentityAssertionResult { + required RTCIdentityProviderDetails idp; + required DOMString assertion; +}; + +dictionary RTCIdentityProviderDetails { + required DOMString domain; + DOMString protocol = "default"; +}; + +dictionary RTCIdentityValidationResult { + required DOMString identity; + required DOMString contents; +}; + +partial interface RTCPeerConnection { + void setIdentityProvider(DOMString provider, optional RTCIdentityProviderOptions options); + Promise<DOMString> getIdentityAssertion(); + readonly attribute Promise<RTCIdentityAssertion> peerIdentity; + readonly attribute DOMString? idpLoginUrl; + readonly attribute DOMString? idpErrorInfo; +}; + +dictionary RTCIdentityProviderOptions { + DOMString protocol = "default"; + DOMString usernameHint; + DOMString peerIdentity; +}; + +[Constructor(DOMString idp, DOMString name), Exposed=Window] +interface RTCIdentityAssertion { + attribute DOMString idp; + attribute DOMString name; +}; + +partial dictionary MediaStreamConstraints { + DOMString peerIdentity; +}; + +partial interface MediaStreamTrack { + readonly attribute boolean isolated; + attribute EventHandler onisolationchange; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webusb.idl b/third_party/blink/web_tests/external/wpt/interfaces/webusb.idl index fcca851b..ad5c480 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webusb.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webusb.idl
@@ -39,11 +39,11 @@ }; [ - Constructor(DOMString type, USBConnectionEventInit eventInitDict), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBConnectionEvent : Event { + constructor(DOMString type, USBConnectionEventInit eventInitDict); [SameObject] readonly attribute USBDevice device; }; @@ -110,81 +110,81 @@ }; [ - Constructor(USBTransferStatus status, optional DataView? data), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBInTransferResult { + constructor(USBTransferStatus status, optional DataView? data); readonly attribute DataView? data; readonly attribute USBTransferStatus status; }; [ - Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBOutTransferResult { + constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0); readonly attribute unsigned long bytesWritten; readonly attribute USBTransferStatus status; }; [ - Constructor(USBTransferStatus status, optional DataView? data), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBIsochronousInTransferPacket { + constructor(USBTransferStatus status, optional DataView? data); readonly attribute DataView? data; readonly attribute USBTransferStatus status; }; [ - Constructor(sequence<USBIsochronousInTransferPacket> packets, optional DataView? data), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBIsochronousInTransferResult { + constructor(sequence<USBIsochronousInTransferPacket> packets, optional DataView? data); readonly attribute DataView? data; readonly attribute FrozenArray<USBIsochronousInTransferPacket> packets; }; [ - Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBIsochronousOutTransferPacket { + constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0); readonly attribute unsigned long bytesWritten; readonly attribute USBTransferStatus status; }; [ - Constructor(sequence<USBIsochronousOutTransferPacket> packets), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBIsochronousOutTransferResult { + constructor(sequence<USBIsochronousOutTransferPacket> packets); readonly attribute FrozenArray<USBIsochronousOutTransferPacket> packets; }; [ - Constructor(USBDevice device, octet configurationValue), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBConfiguration { + constructor(USBDevice device, octet configurationValue); readonly attribute octet configurationValue; readonly attribute DOMString? configurationName; readonly attribute FrozenArray<USBInterface> interfaces; }; [ - Constructor(USBConfiguration configuration, octet interfaceNumber), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBInterface { + constructor(USBConfiguration configuration, octet interfaceNumber); readonly attribute octet interfaceNumber; readonly attribute USBAlternateInterface alternate; readonly attribute FrozenArray<USBAlternateInterface> alternates; @@ -192,11 +192,11 @@ }; [ - Constructor(USBInterface deviceInterface, octet alternateSetting), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBAlternateInterface { + constructor(USBInterface deviceInterface, octet alternateSetting); readonly attribute octet alternateSetting; readonly attribute octet interfaceClass; readonly attribute octet interfaceSubclass; @@ -217,11 +217,11 @@ }; [ - Constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction), Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext ] interface USBEndpoint { + constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction); readonly attribute octet endpointNumber; readonly attribute USBDirection direction; readonly attribute USBEndpointType type; @@ -242,6 +242,7 @@ sequence<AllowedUSBDevice> allowedDevices = []; }; +[Exposed=(DedicatedWorker,SharedWorker,Window)] interface USBPermissionResult : PermissionStatus { attribute FrozenArray<USBDevice> devices; };
diff --git a/third_party/blink/web_tests/external/wpt/payment-handler/app-change-shipping-address.js b/third_party/blink/web_tests/external/wpt/payment-handler/app-change-shipping-address.js new file mode 100644 index 0000000..df39258 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/payment-handler/app-change-shipping-address.js
@@ -0,0 +1,44 @@ +self.addEventListener('canmakepayment', (event) => { + event.respondWith(true); +}); + +async function responder(event) { + const methodName = event.methodData[0].supportedMethods; + const shippingOption = event.shippingOptions[0].id; + const shippingAddress = { + addressLine: [ + '1875 Explorer St #1000', + ], + city: 'Reston', + country: 'US', + dependentLocality: '', + organization: 'Google', + phone: '+15555555555', + postalCode: '20190', + recipient: 'John Smith', + region: 'VA', + sortingCode: '', + }; + if (!event.changeShippingAddress) { + return { + methodName, + details: { + changeShippingAddressReturned: + 'The changeShippingAddress() method is not implemented.', + }, + }; + } + let changeShippingAddressReturned; + try { + const response = await event.changeShippingAddress(shippingAddress); + changeShippingAddressReturned = response; + } catch (err) { + changeShippingAddressReturned = err.message; + } + return {methodName, details: {changeShippingAddressReturned}, shippingAddress, + shippingOption}; +} + +self.addEventListener('paymentrequest', (event) => { + event.respondWith(responder(event)); +});
diff --git a/third_party/blink/web_tests/external/wpt/payment-handler/app-change-shipping-option.js b/third_party/blink/web_tests/external/wpt/payment-handler/app-change-shipping-option.js new file mode 100644 index 0000000..ac3307b6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/payment-handler/app-change-shipping-option.js
@@ -0,0 +1,44 @@ +self.addEventListener('canmakepayment', (event) => { + event.respondWith(true); +}); + +async function responder(event) { + const methodName = event.methodData[0].supportedMethods; + const shippingOption = event.shippingOptions[0].id; + const shippingAddress = { + addressLine: [ + '1875 Explorer St #1000', + ], + city: 'Reston', + country: 'US', + dependentLocality: '', + organization: 'Google', + phone: '+15555555555', + postalCode: '20190', + recipient: 'John Smith', + region: 'VA', + sortingCode: '', + }; + if (!event.changeShippingOption) { + return { + methodName, + details: { + changeShippingOptionReturned: + 'The changeShippingOption() method is not implemented.', + }, + }; + } + let changeShippingOptionReturned; + try { + const response = await event.changeShippingOption(shippingOption); + changeShippingOptionReturned = response; + } catch (err) { + changeShippingOptionReturned = err.message; + } + return {methodName, details: {changeShippingOptionReturned}, shippingAddress, + shippingOption}; +} + +self.addEventListener('paymentrequest', (event) => { + event.respondWith(responder(event)); +});
diff --git a/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-address-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-address-manual.https-expected.txt new file mode 100644 index 0000000..de7d406 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-address-manual.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Tests for PaymentRequestEvent.changeShippingAddress() Unhandled rejection: Not allowed to install this payment handler +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-address-manual.https.html b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-address-manual.https.html new file mode 100644 index 0000000..3b98d56 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-address-manual.https.html
@@ -0,0 +1,161 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>Tests for PaymentRequestEvent.changeShippingAddress()</title> + +<link rel="manifest" href="/payment-handler/basic-card.json" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="register-and-activate-service-worker.js"></script> +<p>If the payment sheet is shown, please authorize the mock payment.</p> +<script> + const methodName = window.location.origin + '/payment-handler/payment-app/'; + function createRequest() { + return new PaymentRequest([{supportedMethods: methodName}], { + total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}}, + shippingOptions: [{ + id: 'freeShippingOption', + label: 'Free global shipping', + amount: { + currency: 'USD', + value: '0', + }, + selected: false, + }], + }, {requestShipping: true}); + } + + async function completeAppSetUp(registration) { + await registration.paymentManager.instruments.clear(); + await registration.paymentManager.instruments.set('instrument-key', { + name: 'Instrument Name', + method: methodName, + }); + await navigator.serviceWorker.ready; + await registration.paymentManager.enableDelegations(['shippingAddress']); + } + + async function runTests(registration) { + await completeAppSetUp(registration); + promise_test(async (t) => { + const request = createRequest(); + // Intentionally do not respond to the 'shippingaddresschange' event. + const response = await test_driver.bless('showing a payment sheet', () => + request.show() + ); + const complete_promise = response.complete('success'); + + assert_equals(response.details.changeShippingAddressReturned, null); + + return complete_promise; + }, 'If updateWith(details) is not run, changeShippingAddress() returns null.'); + + promise_test(async (t) => { + const request = createRequest(); + request.addEventListener('shippingaddresschange', (event) => { + assert_equals(request.shippingAddress.organization, '', 'organization should be redacted'); + assert_equals(request.shippingAddress.phone, '', 'phone should be redacted'); + assert_equals(request.shippingAddress.recipient, '', 'recipient should be redacted'); + assert_equals(request.shippingAddress.addressLine.length, 0, 'addressLine should be redacted'); + assert_equals(request.shippingAddress.city, 'Reston'); + assert_equals(request.shippingAddress.country, 'US'); + assert_equals(request.shippingAddress.postalCode, '20190'); + assert_equals(request.shippingAddress.region, 'VA'); + event.updateWith({ + total: {label: 'Total', amount: {currency: 'GBP', value: '0.02'}}, + error: 'Error for test', + modifiers: [ + { + supportedMethods: methodName, + data: {soup: 'potato'}, + total: { + label: 'Modified total', + amount: {currency: 'EUR', value: '0.03'}, + }, + additionalDisplayItems: [ + { + label: 'Modified display item', + amount: {currency: 'INR', value: '0.06'}, + }, + ], + }, + { + supportedMethods: methodName + '2', + data: {soup: 'tomato'}, + total: { + label: 'Modified total #2', + amount: {currency: 'CHF', value: '0.07'}, + }, + additionalDisplayItems: [ + { + label: 'Modified display item #2', + amount: {currency: 'CAD', value: '0.08'}, + }, + ], + }, + ], + displayItems: [ + { + label: 'Display item', + amount: {currency: 'CNY', value: '0.04'}, + }, + ], + shippingOptions: [ + { + id: 'freeShippingOption', + label: 'express global shipping', + amount: { + currency: 'USD', + value: '0', + }, + selected: true, + } + ], + shippingAddressErrors: { + country: 'US only shipping', + } + }); + }); + const response = await test_driver.bless('showing a payment sheet', () => + request.show() + ); + const complete_promise = response.complete('success'); + const changeShippingAddressReturned = + response.details.changeShippingAddressReturned; + + assert_equals(changeShippingAddressReturned.total.currency, 'GBP'); + assert_equals(changeShippingAddressReturned.total.value, '0.02'); + assert_equals(changeShippingAddressReturned.total.label, undefined); + assert_equals(changeShippingAddressReturned.error, 'Error for test'); + assert_equals(changeShippingAddressReturned.modifiers.length, 1); + assert_equals(changeShippingAddressReturned.displayItems, undefined); + assert_equals(changeShippingAddressReturned.shippingOptions.length, 1); + assert_equals(changeShippingAddressReturned.paymentMethodErrors, undefined); + assert_equals(changeShippingAddressReturned.shippingAddressErrors.country, 'US only shipping'); + + const shipping_option = changeShippingAddressReturned.shippingOptions[0]; + assert_equals(shipping_option.id, 'freeShippingOption' ); + assert_equals(shipping_option.label, 'express global shipping'); + assert_equals(shipping_option.amount.currency, 'USD'); + assert_equals(shipping_option.amount.value, '0'); + assert_true(shipping_option.selected); + + const modifier = changeShippingAddressReturned.modifiers[0]; + assert_equals(modifier.supportedMethods, methodName); + assert_equals(modifier.data.soup, 'potato'); + assert_equals(modifier.total.label, ''); + assert_equals(modifier.total.amount.currency, 'EUR'); + assert_equals(modifier.total.amount.value, '0.03'); + assert_equals(modifier.additionalDisplayItems, undefined); + + return complete_promise; + }, 'The changeShippingAddress() returns some details from the "shippingaddresschange" event\'s updateWith(details) call.'); + } + + registerAndActiveServiceWorker( + 'app-change-shipping-address.js', + 'payment-app/', + runTests + ); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-option-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-option-manual.https-expected.txt new file mode 100644 index 0000000..4b23059b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-option-manual.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Tests for PaymentRequestEvent.changeShippingOption() Unhandled rejection: Not allowed to install this payment handler +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-option-manual.https.html b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-option-manual.https.html new file mode 100644 index 0000000..00d1aee --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/payment-handler/change-shipping-option-manual.https.html
@@ -0,0 +1,160 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>Tests for PaymentRequestEvent.changeShippingOption()</title> + +<link rel="manifest" href="/payment-handler/basic-card.json" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="register-and-activate-service-worker.js"></script> +<p>If the payment sheet is shown, please authorize the mock payment.</p> +<script> + const methodName = window.location.origin + '/payment-handler/payment-app/'; + function createRequest() { + return new PaymentRequest([{supportedMethods: methodName}], { + total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}}, + shippingOptions: [{ + id: 'freeShippingOption', + label: 'Free global shipping', + amount: { + currency: 'USD', + value: '0', + }, + selected: false, + }, + { + id: 'expressShippingOption', + label: 'express global shipping', + amount: { + currency: 'USD', + value: '0', + }, + selected: true, + }], + }, {requestShipping: true}); + } + + async function completeAppSetUp(registration) { + await registration.paymentManager.instruments.clear(); + await registration.paymentManager.instruments.set('instrument-key', { + name: 'Instrument Name', + method: methodName, + }); + await navigator.serviceWorker.ready; + await registration.paymentManager.enableDelegations(['shippingAddress']); + } + + async function runTests(registration) { + await completeAppSetUp(registration); + promise_test(async (t) => { + const request = createRequest(); + // Intentionally do not respond to the 'shippingoptionchange' event. + const response = await test_driver.bless('showing a payment sheet', () => + request.show() + ); + const complete_promise = response.complete('success'); + + assert_equals(response.details.changeShippingOptionReturned, null); + + return complete_promise; + }, 'If updateWith(details) is not run, changeShippingOption() returns null.'); + + promise_test(async (t) => { + const request = createRequest(); + request.addEventListener('shippingoptionchange', (event) => { + assert_equals(request.shippingOption, 'freeShippingOption'); + event.updateWith({ + total: {label: 'Total', amount: {currency: 'GBP', value: '0.02'}}, + error: 'Error for test', + modifiers: [ + { + supportedMethods: methodName, + data: {soup: 'potato'}, + total: { + label: 'Modified total', + amount: {currency: 'EUR', value: '0.03'}, + }, + additionalDisplayItems: [ + { + label: 'Modified display item', + amount: {currency: 'INR', value: '0.06'}, + }, + ], + }, + { + supportedMethods: methodName + '2', + data: {soup: 'tomato'}, + total: { + label: 'Modified total #2', + amount: {currency: 'CHF', value: '0.07'}, + }, + additionalDisplayItems: [ + { + label: 'Modified display item #2', + amount: {currency: 'CAD', value: '0.08'}, + }, + ], + }, + ], + displayItems: [ + { + label: 'Display item', + amount: {currency: 'CNY', value: '0.04'}, + }, + ], + shippingOptions: [ + { + id: 'freeShippingOption', + label: 'express global shipping', + amount: { + currency: 'USD', + value: '0', + }, + selected: true, + } + ], + }); + }); + const response = await test_driver.bless('showing a payment sheet', () => + request.show() + ); + const complete_promise = response.complete('success'); + const changeShippingOptionReturned = + response.details.changeShippingOptionReturned; + + assert_equals(changeShippingOptionReturned.total.currency, 'GBP'); + assert_equals(changeShippingOptionReturned.total.value, '0.02'); + assert_equals(changeShippingOptionReturned.total.label, undefined); + assert_equals(changeShippingOptionReturned.error, 'Error for test'); + assert_equals(changeShippingOptionReturned.modifiers.length, 1); + assert_equals(changeShippingOptionReturned.displayItems, undefined); + assert_equals(changeShippingOptionReturned.shippingOptions.length, 1); + assert_equals(changeShippingOptionReturned.paymentMethodErrors, undefined); + assert_equals(changeShippingOptionReturned.shippingAddressErrors, undefined); + + const shipping_option = changeShippingOptionReturned.shippingOptions[0]; + assert_equals(shipping_option.id, 'freeShippingOption' ); + assert_equals(shipping_option.label, 'express global shipping'); + assert_equals(shipping_option.amount.currency, 'USD'); + assert_equals(shipping_option.amount.value, '0'); + assert_true(shipping_option.selected); + + const modifier = changeShippingOptionReturned.modifiers[0]; + assert_equals(modifier.supportedMethods, methodName); + assert_equals(modifier.data.soup, 'potato'); + assert_equals(modifier.total.label, ''); + assert_equals(modifier.total.amount.currency, 'EUR'); + assert_equals(modifier.total.amount.value, '0.03'); + assert_equals(modifier.additionalDisplayItems, undefined); + + return complete_promise; + }, 'The changeShippingOption() returns some details from the "shippingoptionchange" event\'s updateWith(details) call.'); + } + + registerAndActiveServiceWorker( + 'app-change-shipping-option.js', + 'payment-app/', + runTests + ); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py index 42f3b00d..15bbf94 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py
@@ -221,8 +221,10 @@ if not data.get("known_intermittent"): return status_intern.store(data.get("status")) result = array.array("B") - result_parts = ([data["status"], data.get("expected", data["status"])] + - data["known_intermittent"]) + expected = data.get("expected") + if expected is None: + expected = data["status"] + result_parts = [data["status"], expected] + data["known_intermittent"] for i, part in enumerate(result_parts): value = status_intern.store(part) if i % 2 == 0: @@ -688,13 +690,6 @@ expected.set_leak_threshold(run_info, value) continue - if prop == "status": - status, known_intermittent = unpack_result(value) - value = Result(status, - known_intermittent, - default_expected_by_type[self.item_type, - subtest_id is not None]) - test_expected = expected_by_test[test_id] if subtest_id is None: item_expected = test_expected @@ -702,7 +697,13 @@ if isinstance(subtest_id, str): subtest_id = subtest_id.decode("utf8") item_expected = test_expected.get_subtest(subtest_id) + if prop == "status": + status, known_intermittent = unpack_result(value) + value = Result(status, + known_intermittent, + default_expected_by_type[self.item_type, + subtest_id is not None]) item_expected.set_result(run_info, value) elif prop == "asserts": item_expected.set_asserts(run_info, value)
diff --git a/third_party/blink/web_tests/external/wpt/webrtc-identity/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc-identity/idlharness.https.window-expected.txt new file mode 100644 index 0000000..74bc96f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/webrtc-identity/idlharness.https.window-expected.txt
@@ -0,0 +1,46 @@ +This is a testharness.js-based test. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface RTCPeerConnection: original interface defined +PASS Partial interface RTCPeerConnection: member names are unique +PASS Partial dictionary MediaStreamConstraints: original dictionary defined +PASS Partial dictionary MediaStreamConstraints: member names are unique +PASS Partial interface MediaStreamTrack: original interface defined +PASS Partial interface MediaStreamTrack: member names are unique +PASS Partial interface RTCPeerConnection[2]: member names are unique +PASS Partial interface RTCPeerConnection[3]: member names are unique +PASS Partial interface RTCPeerConnection[4]: member names are unique +PASS Partial interface RTCPeerConnection[5]: member names are unique +PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique +PASS RTCIdentityProviderGlobalScope interface: existence and properties of interface object +PASS RTCIdentityProviderRegistrar interface: existence and properties of interface object +FAIL RTCIdentityAssertion interface: existence and properties of interface object assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface object length assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface object name assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface: existence and properties of interface prototype object assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface: attribute idp assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion interface: attribute name assert_own_property: self does not have own property "RTCIdentityAssertion" expected property "RTCIdentityAssertion" missing +FAIL RTCIdentityAssertion must be primary interface of new RTCIdentityAssertion('idp', 'name') assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: RTCIdentityAssertion is not defined" +FAIL Stringification of new RTCIdentityAssertion('idp', 'name') assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: RTCIdentityAssertion is not defined" +FAIL RTCIdentityAssertion interface: new RTCIdentityAssertion('idp', 'name') must inherit property "idp" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: RTCIdentityAssertion is not defined" +FAIL RTCIdentityAssertion interface: new RTCIdentityAssertion('idp', 'name') must inherit property "name" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: RTCIdentityAssertion is not defined" +FAIL RTCPeerConnection interface: operation setIdentityProvider(DOMString, RTCIdentityProviderOptions) assert_own_property: interface prototype object missing non-static operation expected property "setIdentityProvider" missing +FAIL RTCPeerConnection interface: operation getIdentityAssertion() assert_own_property: interface prototype object missing non-static operation expected property "getIdentityAssertion" missing +FAIL RTCPeerConnection interface: attribute peerIdentity assert_true: The prototype object must have a property "peerIdentity" expected true got false +FAIL RTCPeerConnection interface: attribute idpLoginUrl assert_true: The prototype object must have a property "idpLoginUrl" expected true got false +FAIL RTCPeerConnection interface: attribute idpErrorInfo assert_true: The prototype object must have a property "idpErrorInfo" expected true got false +FAIL RTCPeerConnection interface: new RTCPeerConnection() must inherit property "setIdentityProvider(DOMString, RTCIdentityProviderOptions)" with the proper type assert_inherits: property "setIdentityProvider" not found in prototype chain +FAIL RTCPeerConnection interface: calling setIdentityProvider(DOMString, RTCIdentityProviderOptions) on new RTCPeerConnection() with too few arguments must throw TypeError assert_inherits: property "setIdentityProvider" not found in prototype chain +FAIL RTCPeerConnection interface: new RTCPeerConnection() must inherit property "getIdentityAssertion()" with the proper type assert_inherits: property "getIdentityAssertion" not found in prototype chain +FAIL RTCPeerConnection interface: new RTCPeerConnection() must inherit property "peerIdentity" with the proper type assert_inherits: property "peerIdentity" not found in prototype chain +FAIL RTCPeerConnection interface: new RTCPeerConnection() must inherit property "idpLoginUrl" with the proper type assert_inherits: property "idpLoginUrl" not found in prototype chain +FAIL RTCPeerConnection interface: new RTCPeerConnection() must inherit property "idpErrorInfo" with the proper type assert_inherits: property "idpErrorInfo" not found in prototype chain +FAIL MediaStreamTrack interface: attribute isolated assert_true: The prototype object must have a property "isolated" expected true got false +FAIL MediaStreamTrack interface: attribute onisolationchange assert_true: The prototype object must have a property "onisolationchange" expected true got false +FAIL MediaStreamTrack interface: track must inherit property "isolated" with the proper type assert_inherits: property "isolated" not found in prototype chain +FAIL MediaStreamTrack interface: track must inherit property "onisolationchange" with the proper type assert_inherits: property "onisolationchange" not found in prototype chain +PASS WorkerGlobalScope interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/webrtc-identity/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/webrtc-identity/idlharness.https.window.js new file mode 100644 index 0000000..da1cb85a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/webrtc-identity/idlharness.https.window.js
@@ -0,0 +1,24 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +idl_test( + ['webrtc-identity'], + ['webrtc', 'mediacapture-streams', 'html', 'dom'], + async idlArray => { + idlArray.add_objects({ + RTCPeerConnection: [`new RTCPeerConnection()`], + RTCIdentityAssertion: [`new RTCIdentityAssertion('idp', 'name')`], + MediaStreamTrack: ['track'], + // TODO: RTCIdentityProviderGlobalScope + // TODO: RTCIdentityProviderRegistrar + }); + + try { + self.track = await navigator.mediaDevices + .getUserMedia({audio: true}) + .then(m => m.getTracks()[0]); + } catch (e) {} + } +);
diff --git a/third_party/blink/web_tests/external/wpt/webusb/idlharness.https.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/webusb/idlharness.https.any.worker-expected.txt index 20dc3bee..010de2f3 100644 --- a/third_party/blink/web_tests/external/wpt/webusb/idlharness.https.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webusb/idlharness.https.any.worker-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 270 tests; 197 PASS, 73 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 276 tests; 196 PASS, 80 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation FAIL USB device setup promise_test: Unhandled rejection with value: object "TypeError: Cannot read property 'configurations' of undefined" @@ -266,7 +266,13 @@ FAIL USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: usbEndpoint is not defined" FAIL USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: usbEndpoint is not defined" FAIL USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: usbEndpoint is not defined" -PASS USBPermissionResult interface: existence and properties of interface object +FAIL USBPermissionResult interface: existence and properties of interface object assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing +FAIL USBPermissionResult interface object length assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing +FAIL USBPermissionResult interface object name assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing +FAIL USBPermissionResult interface: existence and properties of interface prototype object assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing +FAIL USBPermissionResult interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing +FAIL USBPermissionResult interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing +FAIL USBPermissionResult interface: attribute devices assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing PASS Navigator interface: existence and properties of interface object PASS WorkerNavigator interface: attribute usb PASS WorkerNavigator interface: navigator must inherit property "usb" with the proper type
diff --git a/third_party/blink/web_tests/fast/dom/HTMLLinkElement/prefetch-expected.txt b/third_party/blink/web_tests/fast/dom/HTMLLinkElement/prefetch-expected.txt index 78a7eb5..d009f9c 100644 --- a/third_party/blink/web_tests/fast/dom/HTMLLinkElement/prefetch-expected.txt +++ b/third_party/blink/web_tests/fast/dom/HTMLLinkElement/prefetch-expected.txt
@@ -1,4 +1,4 @@ -HTMLLinkElement/prefetch.link - willSendRequest <NSURLRequest URL HTMLLinkElement/prefetch.link, main document URL prefetch.html, http method GET> +HTMLLinkElement/prefetch.link - willSendRequest <NSURLRequest URL HTMLLinkElement/prefetch.link, http method GET> This test requires DumpRenderTree to see the log of what resources are loaded. SUCCESS! prefetch onload called.
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 5eda7169..e5d4a41 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -1061,6 +1061,8 @@ getter topOrigin getter total method changePaymentMethod + method changeShippingAddress + method changeShippingOption method constructor method openWindow method respondWith
diff --git a/third_party/blink/web_tests/security/block-test-expected.txt b/third_party/blink/web_tests/security/block-test-expected.txt index 9f3e427c..b895b94 100644 --- a/third_party/blink/web_tests/security/block-test-expected.txt +++ b/third_party/blink/web_tests/security/block-test-expected.txt
@@ -1,132 +1,132 @@ -http://255.255.255.255:1/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:1/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:1/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:1/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:1/test.jpg -http://255.255.255.255:7/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:7/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:7/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:7/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:7/test.jpg -http://255.255.255.255:9/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:9/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:9/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:9/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:9/test.jpg -http://255.255.255.255:11/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:11/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:11/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:11/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:11/test.jpg -http://255.255.255.255:13/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:13/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:13/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:13/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:13/test.jpg -http://255.255.255.255:15/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:15/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:15/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:15/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:15/test.jpg -http://255.255.255.255:17/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:17/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:17/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:17/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:17/test.jpg -http://255.255.255.255:19/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:19/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:19/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:19/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:19/test.jpg -http://255.255.255.255:20/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:20/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:20/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:20/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:20/test.jpg -http://255.255.255.255:21/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:21/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:21/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:21/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:21/test.jpg -http://255.255.255.255:22/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:22/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:22/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:22/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:22/test.jpg -http://255.255.255.255:23/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:23/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:23/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:23/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:23/test.jpg -http://255.255.255.255:25/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:25/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:25/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:25/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:25/test.jpg -http://255.255.255.255:37/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:37/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:37/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:37/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:37/test.jpg -http://255.255.255.255:42/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:42/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:42/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:42/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:42/test.jpg -http://255.255.255.255:43/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:43/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:43/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:43/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:43/test.jpg -http://255.255.255.255:53/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:53/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:53/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:53/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:53/test.jpg -http://255.255.255.255:77/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:77/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:77/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:77/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:77/test.jpg -http://255.255.255.255:79/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:79/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:79/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:79/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:79/test.jpg -http://255.255.255.255:87/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:87/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:87/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:87/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:87/test.jpg -http://255.255.255.255:95/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:95/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:95/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:95/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:95/test.jpg -http://255.255.255.255:101/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:101/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:101/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:101/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:101/test.jpg -http://255.255.255.255:102/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:102/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:102/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:102/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:102/test.jpg -http://255.255.255.255:103/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:103/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:103/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:103/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:103/test.jpg -http://255.255.255.255:104/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:104/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:104/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:104/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:104/test.jpg -http://255.255.255.255:109/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:109/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:109/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:109/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:109/test.jpg -http://255.255.255.255:110/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:110/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:110/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:110/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:110/test.jpg -http://255.255.255.255:111/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:111/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:111/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:111/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:111/test.jpg -http://255.255.255.255:113/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:113/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:113/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:113/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:113/test.jpg -http://255.255.255.255:115/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:115/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:115/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:115/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:115/test.jpg -http://255.255.255.255:117/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:117/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:117/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:117/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:117/test.jpg -http://255.255.255.255:119/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:119/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:119/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:119/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:119/test.jpg -http://255.255.255.255:123/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:123/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:123/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:123/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:123/test.jpg -http://255.255.255.255:135/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:135/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:135/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:135/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:135/test.jpg -http://255.255.255.255:139/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:139/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:139/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:139/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:139/test.jpg -http://255.255.255.255:143/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:143/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:143/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:143/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:143/test.jpg -http://255.255.255.255:179/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:179/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:179/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:179/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:179/test.jpg -http://255.255.255.255:389/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:389/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:389/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:389/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:389/test.jpg -http://255.255.255.255:465/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:465/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:465/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:465/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:465/test.jpg -http://255.255.255.255:512/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:512/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:512/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:512/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:512/test.jpg -http://255.255.255.255:513/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:513/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:513/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:513/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:513/test.jpg -http://255.255.255.255:514/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:514/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:514/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:514/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:514/test.jpg -http://255.255.255.255:515/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:515/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:515/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:515/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:515/test.jpg -http://255.255.255.255:526/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:526/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:526/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:526/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:526/test.jpg -http://255.255.255.255:530/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:530/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:530/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:530/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:530/test.jpg -http://255.255.255.255:531/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:531/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:531/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:531/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:531/test.jpg -http://255.255.255.255:532/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:532/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:532/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:532/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:532/test.jpg -http://255.255.255.255:540/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:540/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:540/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:540/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:540/test.jpg -http://255.255.255.255:556/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:556/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:556/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:556/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:556/test.jpg -http://255.255.255.255:563/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:563/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:563/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:563/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:563/test.jpg -http://255.255.255.255:587/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:587/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:587/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:587/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:587/test.jpg -http://255.255.255.255:601/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:601/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:601/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:601/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:601/test.jpg -http://255.255.255.255:636/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:636/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:636/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:636/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:636/test.jpg -http://255.255.255.255:993/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:993/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:993/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:993/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:993/test.jpg -http://255.255.255.255:995/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:995/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:995/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:995/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:995/test.jpg -http://255.255.255.255:2049/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:2049/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:2049/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:2049/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:2049/test.jpg -http://255.255.255.255:3659/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:3659/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:3659/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:3659/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:3659/test.jpg -http://255.255.255.255:4045/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:4045/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:4045/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:4045/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:4045/test.jpg -http://255.255.255.255:6000/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6000/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:6000/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6000/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:6000/test.jpg -http://255.255.255.255:6665/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6665/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:6665/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6665/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:6665/test.jpg -http://255.255.255.255:6666/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6666/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:6666/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6666/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:6666/test.jpg -http://255.255.255.255:6667/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6667/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:6667/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6667/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:6667/test.jpg -http://255.255.255.255:6668/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6668/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:6668/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6668/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:6668/test.jpg -http://255.255.255.255:6669/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6669/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:6669/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:6669/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:6669/test.jpg -http://255.255.255.255:65535/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:65535/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:65535/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:65535/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:65535/test.jpg CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:65536/test.jpg CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:4294967295/test.jpg @@ -135,10 +135,10 @@ CONSOLE MESSAGE: line 32: PASS: error event fired for ftp://255.255.255.255/test.jpg CONSOLE MESSAGE: line 32: PASS: error event fired for ftp://255.255.255.255:21/test.jpg CONSOLE MESSAGE: line 32: PASS: error event fired for ftp://255.255.255.255:22/test.jpg -http://255.255.255.255:0/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:0/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255:0/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:0/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:0/test.jpg -http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:80/test.jpg -http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> +http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, http method GET> CONSOLE MESSAGE: line 32: PASS: error event fired for http://255.255.255.255:/test.jpg This test attempts to change the src of an IMG tag to all black listed ports to confirm that each fires an error event. It also tries the FTP ports for exemptions.
diff --git a/third_party/blink/web_tests/security/block-test-no-port-expected.txt b/third_party/blink/web_tests/security/block-test-no-port-expected.txt index 9703433..1fe20b781 100644 --- a/third_party/blink/web_tests/security/block-test-no-port-expected.txt +++ b/third_party/blink/web_tests/security/block-test-no-port-expected.txt
@@ -1,2 +1,2 @@ -http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, main document URL block-test-no-port.html, http method GET> +http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, http method GET> This test attempts to change the src of an IMG tag to a blocked IP with no port to confirm that WebKit returns the correct error for it - blocked instead of cannot find. Due to the nature of this test, the results can only be processed automatically via DumpRenderTree. In addition, on some systems the results may depend on the behavior of the proxy.
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-clone.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-clone.html index 8e399e6..ccb8060 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-clone.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-clone.html
@@ -40,8 +40,6 @@ t.step(() => { assert_equals(container.renderSubtree, cloned.renderSubtree); - assert_true(container.displayLock.locked, "original is locked"); - assert_true(cloned.displayLock.locked, "cloned copy is locked"); t.done(); }); }
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-immediate-update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-immediate-update-and-commit.html deleted file mode 100644 index 26e8774..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-immediate-update-and-commit.html +++ /dev/null
@@ -1,49 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: acquire, immediate displayLock.updateAndCommit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> -<div id="container"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.getElementById("container"); - setInvisible(container); - - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.displayLock.updateAndCommit().then( - () => { finishTest("PASS"); }, - (e) => { finishTest("FAIL " + e.message); }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-on-display-contents.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-on-display-contents.html index 59efa75..df7de7a6 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-on-display-contents.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-on-display-contents.html
@@ -11,34 +11,14 @@ <body></body> <script> -async_test(async (t) => { - let div = document.createElement("div"); - div.style = "display: contents;"; - document.body.appendChild(div); - await setInvisible(div).then(() => { - // TODO(rakina): Change this once we support non-contained locking. - t.step(() => assert_false(div.displayLock.locked)); - t.done(); - }); -}, "Elements with display:contents can't be locked"); - -async_test(async (t) => { - let slot = document.createElement("slot"); - document.body.appendChild(slot); - await setInvisible(slot).then(() => { - // TODO(rakina): Change this once we support non-contained locking. - t.step(() => assert_false(slot.displayLock.locked)); - t.done(); - }); -}, "<slot> can't be locked"); +// TODO(vmpstr): Add tests for display:contents, slot, which cannot be locked. async_test(async (t) => { let slot = document.createElement("slot"); slot.style = "display: block;"; document.body.appendChild(slot); await setInvisible(slot).then(() => { - // TODO(rakina): Change this once we support non-contained locking. - t.step(() => assert_true(slot.displayLock.locked)); + t.step(() => assert_equals(slot.renderSubtree, "invisible")); t.done(); }); }, "<slot> with changed display type can be locked");
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-update-and-commit.html deleted file mode 100644 index bb53be1..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/acquire-update-and-commit.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: acquire, displayLock.updateAndCommit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - setInvisible(container).then(() => { - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.id = "container"; - document.body.appendChild(container); - - container.displayLock.updateAndCommit().then( - () => { finishTest("PASS"); }, - (e) => { finishTest("FAIL " + e.message); }); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-focus.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-focus.html index 3209160..bde2f4a 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-focus.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-focus.html
@@ -20,12 +20,12 @@ async_test(async(t) => { const lockedEl = document.getElementById("locked"); - t.step(() => { assert_true(lockedEl.displayLock.locked) }); + t.step(() => { assert_equals(lockedEl.renderSubtree, "invisible activatable") }); let axLocked = axElementById("locked"); t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); }); axElementById("child").takeFocus(); - t.step(() => { assert_false(lockedEl.displayLock.locked) }); + t.step(() => { assert_equals(lockedEl.renderSubtree, "") }); // Wait for the next frame for the ax object to be recreated. requestAnimationFrame(() => { requestAnimationFrame(() => {
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-press.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-press.html index c634314c..0ae0de2f 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-press.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-press.html
@@ -20,13 +20,13 @@ async_test(async(t) => { const lockedEl = document.getElementById("locked"); - t.step(() => { assert_true(lockedEl.displayLock.locked) }); + t.step(() => { assert_equals(lockedEl.renderSubtree, "invisible activatable") }); let axLocked = axElementById("locked"); t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); }); axElementById("child").press(); - t.step(() => { assert_false(lockedEl.displayLock.locked) }); + t.step(() => { assert_equals(lockedEl.renderSubtree, ""); }); // Wait for the next frame for the ax object to be recreated. requestAnimationFrame(() => { requestAnimationFrame(() => {
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-scroll.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-scroll.html index 0e47ee88..bee65918 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-scroll.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/accessibility-activatable-scroll.html
@@ -20,13 +20,13 @@ async_test(async(t) => { const lockedEl = document.getElementById("locked"); - t.step(() => { assert_true(lockedEl.displayLock.locked) }); + t.step(() => { assert_equals(lockedEl.renderSubtree, "invisible activatable") }); let axLocked = axElementById("locked"); t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); }); axElementById("child").scrollToMakeVisible(); - t.step(() => { assert_false(lockedEl.displayLock.locked) }); + t.step(() => { assert_equals(lockedEl.renderSubtree, "") }); // Wait for the next frame for the ax object to be recreated. requestAnimationFrame(() => { requestAnimationFrame(() => {
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-commit-same-frame.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-commit-same-frame.html index b1de819..b43e9257 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-commit-same-frame.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-commit-same-frame.html
@@ -42,7 +42,7 @@ let commit_promise = setVisible(container); await commit_promise; - t.step(() => assert_false(container.displayLock.locked, "context after commit & activation is unlocked")); + t.step(() => assert_equals(container.renderSubtree, "", "context after commit & activation is unlocked")); t.done(); }
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-and-commit-same-frame.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-and-commit-same-frame.html deleted file mode 100644 index b29e869..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-and-commit-same-frame.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!doctype HTML> -<html> -<meta charset="utf8"> -<title>Display Locking: activate update+commit same frame</title> -<link rel="author" title="Rakina Zata Amni" href="mailto:rakina@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> - -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="../resources/utils.js"></script> - -<style> -.spacer { - width: 150px; - height: 3000px; - background: lightblue; -} -#container { - width: 150px; - height: 150px; - background: lightgreen; -} -#target { - width: 100px; - height: 100px; - background: green; -} -</style> - -<div class="spacer"></div> -<div id="container"><div id="target"></div></div> - -<script> -async_test((t) => { - async function runTest() { - let container = document.getElementById("container"); - - let acquire_promise = setInvisibleActivatable(container); - await acquire_promise; - - target.scrollIntoView(); - let update_and_commit_promise = container.displayLock.updateAndCommit(); - await update_and_commit_promise; - t.step(() => assert_false(container.displayLock.locked, "context after update & activation is unlocked")); - t.done(); - } - - window.onload = function() { - requestAnimationFrame(() => requestAnimationFrame(runTest)); - }; -}, "scrollIntoView and calling updateAndCommit on the same frame should work"); - -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-same-frame.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-same-frame.html index c0f809e..b43e5ad 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-same-frame.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/activate-update-same-frame.html
@@ -41,7 +41,7 @@ target.scrollIntoView(); let update_promise = container.updateRendering(); await update_promise; - t.step(() => assert_false(container.displayLock.locked, "context after update & activation is unlocked")); + t.step(() => assert_equals(container.renderSubtree, "", "context after update & activation is unlocked")); t.done(); }
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links-ancestor.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links-ancestor.html index f728786..c2fa63b 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links-ancestor.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links-ancestor.html
@@ -33,10 +33,10 @@ promise_test(() => { return new Promise((resolve, reject) => { prepareTest().then(() => { - assert_false(outermost.displayLock.locked); - assert_true(outer.displayLock.locked); - assert_true(inner.displayLock.locked); - assert_false(innermost.displayLock.locked); + assert_equals(outermost.renderSubtree, ""); + assert_equals(outer.renderSubtree, "invisible activatable"); + assert_equals(inner.renderSubtree, "invisible activatable"); + assert_equals(innermost.renderSubtree, ""); let innerPromise = new Promise((resolve, reject) => { inner.onbeforeactivate = (e) => {
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links.html index 5e51e40d..b6d40ac1 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/anchor-links.html
@@ -31,7 +31,7 @@ promise_test(() => { return new Promise((resolve, reject) => { prepareTest().then(() => { - assert_true(inner.displayLock.locked); + assert_equals(inner.renderSubtree, "invisible activatable"); inner.onbeforeactivate = (e) => { assert_equals(e.activatedElement, inner); resolve();
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/commit-in-beforeactivate.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/commit-in-beforeactivate.html index c24b72a..bb823255 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/commit-in-beforeactivate.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/commit-in-beforeactivate.html
@@ -23,7 +23,7 @@ async function runTest() { const target = document.getElementById("target"); await setInvisibleActivatable(target); - t.step(() => assert_true(target.displayLock.locked)); + t.step(() => assert_equals(target.renderSubtree, "invisible activatable")); target.addEventListener("beforeactivate", () => commit(target)); target.scrollIntoView();
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/scroll-into-view-beforeactivate.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/scroll-into-view-beforeactivate.html index a672504..7fb53de 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/scroll-into-view-beforeactivate.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/scroll-into-view-beforeactivate.html
@@ -32,10 +32,10 @@ promise_test(() => { return new Promise((resolve, reject) => { prepareTest().then(() => { - assert_false(outermost.displayLock.locked); - assert_true(outer.displayLock.locked); - assert_true(inner.displayLock.locked); - assert_false(innermost.displayLock.locked); + assert_equals(outermost.renderSubtree, ""); + assert_equals(outer.renderSubtree, "invisible activatable"); + assert_equals(inner.renderSubtree, "invisible activatable"); + assert_equals(innermost.renderSubtree, ""); let innerPromise = new Promise((resolve, reject) => { inner.onbeforeactivate = (e) => {
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/selection.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/selection.html index 02125da..8e823944 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/selection.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/activation/selection.html
@@ -29,9 +29,9 @@ acquirePromise.then(() => { window.getSelection().selectAllChildren(container); assert_equals(window.getSelection().toString(), "foo\nbar"); - assert_equals(container.displayLock.locked, false); - assert_equals(nonActivatable.displayLock.locked, true); - assert_equals(nested.displayLock.locked, false); + assert_equals(container.renderSubtree, ""); + assert_equals(nonActivatable.renderSubtree, "invisible"); + assert_equals(nested.renderSubtree, ""); resolve(); }); });
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/commit-followed-by-update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/commit-followed-by-update-and-commit.html deleted file mode 100644 index ab7f6a9..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/commit-followed-by-update-and-commit.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: commit, displayLock.updateAndCommit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - setInvisible(container).then(() => { - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.id = "container"; - document.body.appendChild(container); - - const first_promise = setVisible(container); - const second_promise = container.displayLock.updateAndCommit(); - Promise.all([first_promise, second_promise]).then(() => finishTest("PASS")); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/element-in-template.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/element-in-template.html index cf8d827..879e1d3d 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/element-in-template.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/element-in-template.html
@@ -18,27 +18,26 @@ async function templateTest() { const templateChild = template.content.firstChild; - t.step(() => assert_not_equals(templateChild.displayLock, null, "Can access displayLock on element in template")); const acquirePromise = setInvisible(templateChild); await acquirePromise; - t.step(() => assert_true(templateChild.displayLock.locked, "Can lock element in template")); + t.step(() => assert_equals(templateChild.renderSubtree, "invisible", "Can lock element in template")); const adoptedNode = document.adoptNode(templateChild); - t.step(() => assert_true(adoptedNode.displayLock.locked, "Adopted element is still locked")); + t.step(() => assert_equals(adoptedNode.renderSubtree, "invisible", "Adopted element is still locked")); container.appendChild(adoptedNode); - t.step(() => assert_true(adoptedNode.displayLock.locked, "Still locked after appended")); + t.step(() => assert_equals(adoptedNode.renderSubtree, "invisible", "Still locked after appended")); await setVisible(adoptedNode); - t.step(() => assert_false(adoptedNode.displayLock.locked, "Can commit")); + t.step(() => assert_equals(adoptedNode.renderSubtree, "", "Can commit")); await setInvisible(adoptedNode); - t.step(() => assert_true(adoptedNode.displayLock.locked, "Can re-lock element")); + t.step(() => assert_equals(adoptedNode.renderSubtree, "invisible", "Can re-lock element")); await setVisible(adoptedNode); - t.step(() => assert_false(adoptedNode.displayLock.locked, "Can re-commit element")); + t.step(() => assert_equals(adoptedNode.renderSubtree, "", "Can re-commit element")); t.done(); }
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/intersection-observer.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/intersection-observer.html index 8eae086..c9e34cf 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/intersection-observer.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/intersection-observer.html
@@ -154,7 +154,7 @@ // Unlock target3. async function enqueueStep5() { - await target3.displayLock.commit(); + await setVisible(target3); requestAnimationFrame(() => { requestAnimationFrame(() => { runStep5();
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/locked-attribute.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/locked-attribute.html index a97df23..d521599 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/locked-attribute.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/locked-attribute.html
@@ -15,25 +15,23 @@ async_test((t) => { async function runTest() { const container = document.getElementById("container"); - t.step(() => assert_false(container.displayLock.locked, "initial context is unlocked")); - const acquire_promise = setInvisible(container); - t.step(() => assert_true(container.displayLock.locked, "context before acquire finishes is locked")); + t.step(() => assert_equals(container.renderSubtree, "invisible", "context before acquire finishes is locked")); await acquire_promise; - t.step(() => assert_true(container.displayLock.locked, "context after acquire finishes is locked")); + t.step(() => assert_equals(container.renderSubtree, "invisible", "context after acquire finishes is locked")); const update_promise = container.updateRendering(); - t.step(() => assert_true(container.displayLock.locked, "context during update is locked")); + t.step(() => assert_equals(container.renderSubtree, "invisible", "context during update is locked")); await update_promise; - t.step(() => assert_true(container.displayLock.locked, "context after update is locked")); + t.step(() => assert_equals(container.renderSubtree, "invisible", "context after update is locked")); const commit_promise = setVisible(container); - t.step(() => assert_false(container.displayLock.locked, "context during commit is unlocked")); + t.step(() => assert_equals(container.renderSubtree, "", "context during commit is unlocked")); await commit_promise; - t.step(() => assert_false(container.displayLock.locked, "context after commit is unlocked")); + t.step(() => assert_equals(container.renderSubtree, "", "context after commit is unlocked")); t.done(); }
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/multiple-update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/multiple-update-and-commit.html deleted file mode 100644 index d5ffb99..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/multiple-update-and-commit.html +++ /dev/null
@@ -1,53 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: multiple displayLock.updateAndCommit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - setInvisible(container).then(() => { - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.id = "container"; - document.body.appendChild(container); - - const promises = [] - for (let i = 0; i < 10; ++i) { - promises.push(container.displayLock.updateAndCommit()); - } - Promise.all(promises).then(() => finishTest("PASS")); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/nested-update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/nested-update-and-commit.html deleted file mode 100644 index e87bd3a..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/nested-update-and-commit.html +++ /dev/null
@@ -1,58 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: nested displayLock.updateAndCommit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#outer { - width: 100px; - height: 100px; -} -#inner { - width: 50px; - height: 50px; - background: lightgreen; -} -div > div > div { - width: 10px; - height: 10px; - background: red; -} -</style> - -<div id="log"></div> -<div id="outer" class="container"> - <div id="inner" class="container"></div> -</div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const outer = document.getElementById("outer"); - const inner = document.getElementById("inner"); - - Promise.all([ - setInvisible(outer), - setInvisible(inner)]) - .then(() => { - // Dirty the inner layout - inner.appendChild(document.createElement("div")); - inner.displayLock.updateAndCommit().then( - () => { finishTest("PASS"); }, - (e) => { finishTest("FAIL " + e.message); }); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/resources/utils.js b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/resources/utils.js index d223c1a..3e6d56e 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/resources/utils.js +++ b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/resources/utils.js
@@ -8,7 +8,7 @@ } function setVisible(element) { - return setRenderSubtree(element, "visible"); + return setRenderSubtree(element, ""); } function setRenderSubtree(element, value) {
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit-followed-by-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit-followed-by-commit.html deleted file mode 100644 index 404f75e0..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit-followed-by-commit.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: displayLock.updateAndCommit, commit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - setInvisible(container).then(() => { - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.id = "container"; - document.body.appendChild(container); - - const first_promise = container.displayLock.updateAndCommit(); - const second_promise = setVisible(container); - Promise.all([first_promise, second_promise]).then(() => finishTest("PASS")); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit-followed-by-update.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit-followed-by-update.html deleted file mode 100644 index b5a8615..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit-followed-by-update.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: displayLock.updateAndCommit, update</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - setInvisible(container).then(() => { - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.id = "container"; - document.body.appendChild(container); - - const first_promise = container.displayLock.updateAndCommit(); - const second_promise = container.updateRendering(); - Promise.all([first_promise, second_promise]).then(() => finishTest("PASS")); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit.html deleted file mode 100644 index c0ad7ac..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-and-commit.html +++ /dev/null
@@ -1,38 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: displayLock.updateAndCommit without acquire</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - container.id = "container"; - container.displayLock.updateAndCommit().then( - () => { finishTest("PASS"); }, - (e) => { finishTest("FAIL " + e.message); }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-followed-by-update-and-commit.html b/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-followed-by-update-and-commit.html deleted file mode 100644 index d9348dd..0000000 --- a/third_party/blink/web_tests/wpt_internal/display-lock/rendersubtree/update-followed-by-update-and-commit.html +++ /dev/null
@@ -1,51 +0,0 @@ -<!doctype HTML> -<html class="reftest-wait"> -<meta charset="utf8"> -<title>Display Locking: update, displayLock.updateAndCommit</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://github.com/WICG/display-locking"> -<link rel="match" href="pass-container-with-child-ref.html"> -<script src="/common/reftest-wait.js"></script> -<script src="resources/utils.js"></script> - -<style> -#container { - width: 150px; - height: 150px; - background: lightblue; -} -#child { - width: 50px; - height: 50px; - background: lightgreen; -} -</style> - -<div id="log"></div> - -<script> -function finishTest(status_string) { - if (document.getElementById("log").innerHTML === "") - document.getElementById("log").innerHTML = status_string; - takeScreenshot(); -} - -function runTest() { - const container = document.createElement("div"); - setInvisible(container).then(() => { - const child = document.createElement("div"); - child.id = "child"; - container.appendChild(child); - - container.id = "container"; - document.body.appendChild(container); - - const first_promise = container.updateRendering(); - const second_promise = container.displayLock.updateAndCommit(); - Promise.all([first_promise, second_promise]).then(() => finishTest("PASS")); - }); -} - -window.onload = runTest; -</script> -</html>
diff --git a/third_party/closure_compiler/externs/autofill_private.js b/third_party/closure_compiler/externs/autofill_private.js index 1263cf2..0384dba 100644 --- a/third_party/closure_compiler/externs/autofill_private.js +++ b/third_party/closure_compiler/externs/autofill_private.js
@@ -203,15 +203,8 @@ chrome.autofillPrivate.setCreditCardFIDOAuthEnabledState = function(enabled) {}; /** - * Fired when the address list has changed, meaning that an entry has been + * Fired when the perosnal data has changed, meaning that an entry has been * added, removed, or changed. |entries| The updated list of entries. * @type {!ChromeEvent} */ -chrome.autofillPrivate.onAddressListChanged; - -/** - * Fired when the credit card list has changed, meaning that an entry has been - * added, removed, or changed. |entries| The updated list of entries. - * @type {!ChromeEvent} - */ -chrome.autofillPrivate.onCreditCardListChanged; +chrome.autofillPrivate.onPersonalDataChanged;
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 66f83e5..722c99a 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-10-1-56-gc37a50145 -Revision: c37a501458e2b5389ac977ed2523eed3e2d9bd61 +Version: VER-2-10-1-59-g839a02361 +Revision: 839a023619b593b742f62ffab8e7e4f9da8c1593 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses" License File: src/docs/FTL.TXT
diff --git a/third_party/google_android_play_core/BUILD.gn b/third_party/google_android_play_core/BUILD.gn index 32d1ca78..d0530159 100644 --- a/third_party/google_android_play_core/BUILD.gn +++ b/third_party/google_android_play_core/BUILD.gn
@@ -5,6 +5,6 @@ import("//build/config/android/rules.gni") android_aar_prebuilt("com_google_android_play_core_java") { - aar_path = "core-1.6.2.aar" + aar_path = "core-1.6.4.aar" info_path = "com_google_android_play_core.info" }
diff --git a/third_party/google_android_play_core/README.chromium b/third_party/google_android_play_core/README.chromium index 02e2221..3a151ea3 100644 --- a/third_party/google_android_play_core/README.chromium +++ b/third_party/google_android_play_core/README.chromium
@@ -1,13 +1,13 @@ Name: Play Core Library Short Name: Play Core URL: https://developer.android.com/guide/app-bundle/playcore -Version: 1.6.2 +Version: 1.6.4 License: Android Software Development Kit License License File: LICENSE Security Critical: yes Description: -- Built from @264816199 +- Built from @272011728 Local Modifications: - Unproguarded verification API.
diff --git a/third_party/google_android_play_core/cipd.yaml b/third_party/google_android_play_core/cipd.yaml index e5946bc3..112d90d 100644 --- a/third_party/google_android_play_core/cipd.yaml +++ b/third_party/google_android_play_core/cipd.yaml
@@ -7,4 +7,4 @@ package: chromium/third_party/android_deps/libs/com_google_android_play_core_verification description: "" data: -- file: core-1.6.2.aar \ No newline at end of file +- file: core-1.6.4.aar
diff --git a/third_party/openscreen/OWNERS b/third_party/openscreen/OWNERS index 5dcd5c9a3..d763da3 100644 --- a/third_party/openscreen/OWNERS +++ b/third_party/openscreen/OWNERS
@@ -2,4 +2,4 @@ btolsch@chromium.org pthatcher@chromium.org -# COMPONENT: Blink>PresentationAPI +# COMPONENT: Internals>Cast>Providers
diff --git a/third_party/robolectric/custom_asynctask/java/src/org/chromium/base/task/test/ShadowAsyncTask.java b/third_party/robolectric/custom_asynctask/java/src/org/chromium/base/task/test/ShadowAsyncTask.java index 72bdc91..e927707 100644 --- a/third_party/robolectric/custom_asynctask/java/src/org/chromium/base/task/test/ShadowAsyncTask.java +++ b/third_party/robolectric/custom_asynctask/java/src/org/chromium/base/task/test/ShadowAsyncTask.java
@@ -28,7 +28,7 @@ public ShadowAsyncTask() { worker = new Callable<Result>() { @Override - public Result call() throws Exception { + public Result call() { return getBridge().doInBackground(); } };
diff --git a/tools/android/roll/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy b/tools/android/roll/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy index ab913e0..fa5b8a1 100644 --- a/tools/android/roll/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy +++ b/tools/android/roll/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy
@@ -301,9 +301,6 @@ // Target .aar file contains .so libraries that need to be extracted, // and android_aar_prebuilt template will fail if it's not set explictly. sb.append(' extract_native_libraries = true\n') - // InstallActivity class is downloaded as a part of DFM & we need to inject - // a call to SplitCompat.install() into it. - sb.append(' split_compat_class_names = [ "com/google/ar/core/InstallActivity" ]\n') break case 'androidx_test_rules': // Target needs Android SDK deps which exist in third_party/android_sdk.
diff --git a/tools/binary_size/libsupersize/archive.py b/tools/binary_size/libsupersize/archive.py index ca8f930..0f31348 100644 --- a/tools/binary_size/libsupersize/archive.py +++ b/tools/binary_size/libsupersize/archive.py
@@ -903,7 +903,7 @@ if elf_path: logging.debug('Validating section sizes') - elf_section_sizes = _SectionSizesFromElf(elf_path, tool_prefix) + _, elf_section_sizes = _SectionInfoFromElf(elf_path, tool_prefix) differing_elf_section_sizes = {} differing_map_section_sizes = {} for k, v in elf_section_sizes.iteritems(): @@ -1141,7 +1141,7 @@ def _ParseApkElfSectionSize(section_sizes, metadata, apk_elf_result): if metadata: logging.debug('Extracting section sizes from .so within .apk') - apk_build_id, apk_section_sizes, elf_overhead_size = apk_elf_result.get() + apk_build_id, _, apk_section_sizes, elf_overhead_size = apk_elf_result.get() assert apk_build_id == metadata[models.METADATA_ELF_BUILD_ID], ( 'BuildID from apk_elf_result did not match') @@ -1358,6 +1358,47 @@ raw_symbols[:] = [sym for sym in raw_symbols if sym.size or sym.IsNative()] +def _AddUnattributedSectionSymbols(raw_symbols, section_sizes, elf_result): + # Create symbols for ELF sections not covered by existing symbols. + logging.info('Searching for symbol gaps...') + section_addresses = elf_result.get()[1] + last_symbol_ends = collections.defaultdict(int) + for sym in raw_symbols: + if sym.end_address > last_symbol_ends[sym.section_name]: + last_symbol_ends[sym.section_name] = sym.end_address + for section_name, last_symbol_end in last_symbol_ends.iteritems(): + size_from_syms = last_symbol_end - section_addresses[section_name] + overhead = section_sizes[section_name] - size_from_syms + assert overhead >= 0, ( + ('End of last symbol (%x) in section %s is %d bytes after the end of ' + 'section from readelf (%x).') % + (last_symbol_end, section_name, -overhead, + section_sizes[section_name] + section_addresses[section_name])) + if overhead > 0 and section_name not in models.BSS_SECTIONS: + raw_symbols.append( + models.Symbol( + section_name, + overhead, + address=last_symbol_end, + full_name='** {} (unattributed)'.format(section_name))) + logging.info('Last symbol in %s does not reach end of section, gap=%d', + section_name, overhead) + + for section_name in section_addresses: + # Handle sections that don't appear in |raw_symbols|. + if section_name not in last_symbol_ends: + section_size = section_sizes[section_name] + logging.info('All bytes in %s are unattributed, gap=%d', section_name, + overhead) + raw_symbols.append( + models.Symbol( + models.SECTION_OTHER, + section_size, + full_name='** ELF Section: {}'.format(section_name))) + prev = section_sizes.setdefault(models.SECTION_OTHER, 0) + section_sizes[models.SECTION_OTHER] = prev + section_size + + def CreateSectionSizesAndSymbols(map_path=None, tool_prefix=None, output_directory=None, @@ -1472,6 +1513,8 @@ if elf_path: section_sizes, elf_overhead_size = _ParseApkElfSectionSize( section_sizes, metadata, apk_elf_result) + _AddUnattributedSectionSymbols(raw_symbols, section_sizes, apk_elf_result) + pak_symbols_by_id = _FindPakSymbolsFromApk( section_sizes, apk_path, size_info_prefix, knobs) @@ -1494,6 +1537,21 @@ section_sizes[models.SECTION_DEX_METHOD] = dex_method_size section_sizes[models.SECTION_DEX] = dex_size - dex_method_size + dex_other_size = int( + round( + sum(s.pss for s in dex_symbols + if s.section_name == models.SECTION_DEX))) + unattributed_dex = section_sizes[models.SECTION_DEX] - dex_other_size + # Compare against -5 instead of 0 to guard against round-off errors. + assert unattributed_dex >= -5, ('Dex symbols take up more space than ' + 'the dex sections have available') + if unattributed_dex > 0: + other_symbols.append( + models.Symbol( + models.SECTION_DEX, + unattributed_dex, + full_name='** .dex (unattributed)')) + raw_symbols.extend(other_symbols) elif pak_files and pak_info_file: @@ -1581,20 +1639,22 @@ return match.group(1) -def _SectionSizesFromElf(elf_path, tool_prefix): +def _SectionInfoFromElf(elf_path, tool_prefix): args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path] stdout = subprocess.check_output(args) + section_addresses = {} section_sizes = {} # Matches [ 2] .hash HASH 00000000006681f0 0001f0 003154 04 A 3 0 8 for match in re.finditer(r'\[[\s\d]+\] (\..*)$', stdout, re.MULTILINE): items = match.group(1).split() + section_addresses[items[0]] = int(items[2], 16) section_sizes[items[0]] = int(items[4], 16) - return section_sizes + return section_addresses, section_sizes def _ElfIsMainPartition(elf_path, tool_prefix): - section_names = _SectionSizesFromElf(elf_path, tool_prefix).keys() - return models.SECTION_PART_END in section_names + _, section_sizes = _SectionInfoFromElf(elf_path, tool_prefix) + return models.SECTION_PART_END in section_sizes.keys() def _ArchFromElf(elf_path, tool_prefix): @@ -1637,9 +1697,9 @@ f.write(apk.read(apk_so_path)) f.flush() build_id = BuildIdFromElf(f.name, tool_prefix) - section_sizes = _SectionSizesFromElf(f.name, tool_prefix) + section_addresses, section_sizes = _SectionInfoFromElf(f.name, tool_prefix) elf_overhead_size = _CalculateElfOverhead(section_sizes, f.name) - return build_id, section_sizes, elf_overhead_size + return build_id, section_addresses, section_sizes, elf_overhead_size def _AutoIdentifyInputFile(args):
diff --git a/tools/binary_size/libsupersize/testdata/Archive_Apk.golden b/tools/binary_size/libsupersize/testdata/Archive_Apk.golden index 41cd944..bbca0d7 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_Apk.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_Apk.golden
@@ -9,22 +9,22 @@ linker_name=gold map_file_name=../../../test.map tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ -Section .text: has 0.2% of 83792 bytes accounted for from 21 symbols. 35898456 bytes are unaccounted for. -* Padding accounts for 13808 bytes (16.5%) -* 16 have source paths. Accounts for 73986 bytes (88.3%). -* 16 have a component assigned. Accounts for 73986 bytes (88.3%). -* 4 placeholders exist (symbols that start with **). Accounts for 13840 bytes (16.5%). +Section .text: has 100.0% of 35982248 bytes accounted for from 22 symbols. 0 bytes are unaccounted for. +* Padding accounts for 13808 bytes (0.0%) +* 16 have source paths. Accounts for 73986 bytes (0.2%). +* 16 have a component assigned. Accounts for 73986 bytes (0.2%). +* 5 placeholders exist (symbols that start with **). Accounts for 35912296 bytes (99.8%). * 8 aliases exist, mapped to 3 unique addresses (100 bytes saved) * 0 symbols have shared ownership. -* 1 symbols are marked as "unlikely". Accounts for 69124 bytes (82.5%). -* 4 symbols are marked as "startup". Accounts for 128 bytes (0.2%). -* 3 symbols are clones. Accounts for 106 bytes (0.1%). -* 5 symbols are from generated sources. Accounts for 69660 bytes (83.1%). -Section .rodata: has 44.6% of 2641540 bytes accounted for from 11 symbols. 3286112 bytes are unaccounted for. -* Padding accounts for 2637946 bytes (99.9%) -* 8 have source paths. Accounts for 676149 bytes (25.6%). -* 8 have a component assigned. Accounts for 676149 bytes (25.6%). -* 3 placeholders exist (symbols that start with **). Accounts for 1965391 bytes (74.4%). +* 1 symbols are marked as "unlikely". Accounts for 69124 bytes (0.2%). +* 4 symbols are marked as "startup". Accounts for 128 bytes (0.0%). +* 3 symbols are clones. Accounts for 106 bytes (0.0%). +* 5 symbols are from generated sources. Accounts for 69660 bytes (0.2%). +Section .rodata: has 100.0% of 5927636 bytes accounted for from 12 symbols. 16 bytes are unaccounted for. +* Padding accounts for 2637946 bytes (44.5%) +* 8 have source paths. Accounts for 676149 bytes (11.4%). +* 8 have a component assigned. Accounts for 676149 bytes (11.4%). +* 4 placeholders exist (symbols that start with **). Accounts for 5251487 bytes (88.6%). * 3 string literals exist. Accounts for 21 bytes (0.0%) padding is 0 bytes. * 2 aliases exist, mapped to 1 unique addresses (5 bytes saved) * 0 symbols have shared ownership. @@ -32,15 +32,17 @@ Large padding of 675992 between: A) .rodata@284e398(size_without_padding=32,padding=0,full_name=chrome::mojom::FilePatcher::Name_,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) B) .rodata@28f3450(size_without_padding=48,padding=675992,full_name=kAnimationFrameTimeHistogramClassPath,object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={anon},num_aliases=1,component=Internal>Android) -Section .data.rel.ro: has 0.0% of 92 bytes accounted for from 3 symbols. 1065132 bytes are unaccounted for. +Section .data.rel.ro: has 100.0% of 1065224 bytes accounted for from 4 symbols. 0 bytes are unaccounted for. * Padding accounts for 0 bytes (0.0%) -* 3 have source paths. Accounts for 92 bytes (100.0%). -* 3 have a component assigned. Accounts for 92 bytes (100.0%). +* 3 have source paths. Accounts for 92 bytes (0.0%). +* 3 have a component assigned. Accounts for 92 bytes (0.0%). +* 1 placeholders exist (symbols that start with **). Accounts for 1065132 bytes (100.0%). * 0 symbols have shared ownership. -Section .data: has 0.2% of 168 bytes accounted for from 5 symbols. 101600 bytes are unaccounted for. +Section .data: has 100.0% of 101768 bytes accounted for from 6 symbols. 0 bytes are unaccounted for. * Padding accounts for 0 bytes (0.0%) -* 5 have source paths. Accounts for 168 bytes (100.0%). -* 5 have a component assigned. Accounts for 168 bytes (100.0%). +* 5 have source paths. Accounts for 168 bytes (0.2%). +* 5 have a component assigned. Accounts for 168 bytes (0.2%). +* 1 placeholders exist (symbols that start with **). Accounts for 101600 bytes (99.8%). * 0 symbols have shared ownership. Section .bss: has 40.3% of 524520 bytes accounted for from 6 symbols. 775936 bytes are unaccounted for. * Padding accounts for 196 bytes (0.0%) @@ -71,20 +73,23 @@ * 0 have source paths. Accounts for 0 bytes (0.0%). * 0 have a component assigned. Accounts for 0 bytes (0.0%). * 0 symbols have shared ownership. -Section .other: has 100.0% of 39147303 bytes accounted for from 5 symbols. 0 bytes are unaccounted for. -* Padding accounts for 33903399 bytes (86.6%) -* 3 have source paths. Accounts for 5243904 bytes (13.4%). -* 1 have a component assigned. Accounts for 1048576 bytes (2.7%). +Section .other: has 100.0% of 95595797 bytes accounted for from 27 symbols. 0 bytes are unaccounted for. +* Padding accounts for 33903399 bytes (35.5%) +* 3 have source paths. Accounts for 5243904 bytes (5.5%). +* 1 have a component assigned. Accounts for 1048576 bytes (1.1%). +* 22 placeholders exist (symbols that start with **). Accounts for 56448494 bytes (59.0%). * 0 symbols have shared ownership. -* 1 symbols are from generated sources. Accounts for 4194304 bytes (10.7%). +* 1 symbols are from generated sources. Accounts for 4194304 bytes (4.4%). .data@2de7000(size_without_padding=4,padding=0,full_name=google::protobuf::internal::pLinuxKernelCmpxchg,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1,component=Blink>Internal) .data@2de7004(size_without_padding=4,padding=0,full_name=google::protobuf::internal::pLinuxKernelMemoryBarrier,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) .data@2de7008(size_without_padding=152,padding=0,full_name=base::android::kBaseRegisteredMethods,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={rel},num_aliases=1,component=UI>Browser) .data@2de70a0(size_without_padding=4,padding=0,full_name=base::android::g_renderer_histogram_code,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={anon},num_aliases=1,component=UI>Browser) .data@2de70a4(size_without_padding=4,padding=0,full_name=base::android::g_library_version_number,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={anon,rel.loc},num_aliases=1,component=UI>Browser) +.data@2de70a8(size_without_padding=101600,padding=0,full_name=** .data (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .data.rel.ro@2cd8500(size_without_padding=56,padding=0,full_name=ChromeMainDelegateAndroid [vtable],object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={},num_aliases=1,component=Internal>Android) .data.rel.ro@2cd8538(size_without_padding=24,padding=0,full_name=mojo::MessageReceiver [vtable],object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1,component=Blink>Internal) .data.rel.ro@2cd8550(size_without_padding=12,padding=0,full_name=kMethodsAnimationFrameTimeHistogram,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1,component=Blink>Internal) +.data.rel.ro@2cd855c(size_without_padding=1065132,padding=0,full_name=** .data.rel.ro (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .data.rel.ro.local@2c176f0(size_without_padding=56,padding=0,full_name=ChromeMainDelegate [vtable],object_path=third_party/icu/icuuc/ucnv_ext.o,source_path=third_party/icu/ucnv_ext.c,flags={gen},num_aliases=1,component=Internal>Android) .data.rel.ro.local@2c17728(size_without_padding=24,padding=0,full_name=chrome::mojom::FieldTrialRecorder [vtable],object_path=third_party/icu/icuuc/ucnv_ext.o,source_path=third_party/icu/ucnv_ext.c,flags={gen},num_aliases=1,component=Internal>Android) .data.rel.ro.local@2c17740(size_without_padding=789904,padding=0,full_name=chrome::mojom::FieldTrialRecorderProxy [vtable],object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) @@ -283,6 +288,28 @@ .dex.method@0(size_without_padding=79,padding=0,full_name=org.chromium.chrome.browser.compositor.layouts.phone.stack.StackAnimationLandscape#getScreenPositionInScrollDirection(org.chromium.chrome.browser.compositor.layouts.phone.stack.StackTab): float,object_path=$APK/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimationLandscape,source_path=,flags={},num_aliases=1,component=) .dex.method@0(size_without_padding=54,padding=0,full_name=org.chromium.chrome.browser.compositor.layouts.phone.stack.StackAnimationLandscape#getScreenSizeInScrollDirection(): float,object_path=$APK/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimationLandscape,source_path=,flags={},num_aliases=1,component=) .dex.method@0(size_without_padding=52,padding=0,full_name=org.chromium.chrome.browser.compositor.layouts.phone.stack.StackAnimationLandscape#isDefaultDiscardDirectionPositive(): boolean,object_path=$APK/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimationLandscape,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=2655384,padding=0,full_name=** ELF Section: .rel.dyn,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=2816,padding=0,full_name=** ELF Section: .rel.plt,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=19,padding=0,full_name=** ELF Section: .interp,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=28,padding=0,full_name=** ELF Section: .note.gnu.gold-version,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=6496,padding=0,full_name=** ELF Section: .dynsym,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=42956,padding=0,full_name=** ELF Section: .got,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=812,padding=0,full_name=** ELF Section: .gnu.version,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=28,padding=0,full_name=** ELF Section: .gnu.version_d,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=436,padding=0,full_name=** ELF Section: .shstrtab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=36,padding=0,full_name=** ELF Section: .note.gnu.build-id,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=17166112,padding=0,full_name=** ELF Section: .symtab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=96,padding=0,full_name=** ELF Section: .gnu.version_r,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=4025,padding=0,full_name=** ELF Section: .dynstr,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=2684,padding=0,full_name=** ELF Section: .hash,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=183632,padding=0,full_name=** ELF Section: .ARM.extab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=1536456,padding=0,full_name=** ELF Section: .ARM.exidx,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=8,padding=0,full_name=** ELF Section: .fini_array,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=8,padding=0,full_name=** ELF Section: .init_array,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=304,padding=0,full_name=** ELF Section: .dynamic,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=4244,padding=0,full_name=** ELF Section: .plt,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=34841854,padding=0,full_name=** ELF Section: .strtab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=60,padding=0,full_name=** ELF Section: .ARM.attributes,object_path=,source_path=,flags={},num_aliases=1,component=) .other@0(size_without_padding=4194304,padding=0,full_name=smalltest.so,object_path=,source_path=$APK/smalltest.so,flags={gen},num_aliases=1,component=) .other@0(size_without_padding=1048576,padding=0,full_name=assets/icudtl.dat,object_path=,source_path=third_party/icu/android/icudtl.dat,flags={},num_aliases=1,component=Internal>Android) .other@0(size_without_padding=1024,padding=0,full_name=res/drawable-v13/test.xml,object_path=,source_path=chrome/android/res/drawable/test.xml,flags={},num_aliases=1,component=) @@ -299,6 +326,7 @@ .rodata@284e398(size_without_padding=32,padding=0,full_name=chrome::mojom::FilePatcher::Name_,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) .rodata@28f3450(size_without_padding=48,padding=675992,full_name=kAnimationFrameTimeHistogramClassPath,object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={anon},num_aliases=1,component=Internal>Android) .rodata@28f3480(size_without_padding=4,padding=0,full_name=blink::CSSValueKeywordsHash::findValueImpl(char const*, unsigned int)::value_word_list,object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={anon},num_aliases=1,component=Internal>Android) +.rodata@28f3484(size_without_padding=3286096,padding=0,full_name=** .rodata (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .text@28d900(size_without_padding=16,padding=0,full_name=_GLOBAL__sub_I_page_allocator.cc,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={startup},num_aliases=1,component=Blink>Internal) .text@28d910(size_without_padding=56,padding=0,full_name=_GLOBAL__sub_I_bbr_sender.cc,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={startup},num_aliases=1,component=Blink>Internal) .text@28d948(size_without_padding=28,padding=0,full_name=_GLOBAL__sub_I_pacing_sender.cc,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={startup},num_aliases=1,component=Blink>Internal) @@ -320,6 +348,7 @@ .text@2a2000(size_without_padding=32,padding=4002,full_name=** outlined function,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) .text@2a2020(size_without_padding=48,padding=0,full_name=** outlined function * 2,object_path=,source_path=,flags={},num_aliases=2,component=) .text@2a2020(size_without_padding=48,padding=0,full_name=aliasedWithOutlinedFunction(),object_path=,source_path=,flags={},num_aliases=2,component=) +.text@2a2050(size_without_padding=35898456,padding=0,full_name=** .text (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .bss@0(size_without_padding=262144,padding=0,full_name=ff_cos_131072,object_path=third_party/ffmpeg/libffmpeg_internal.a/fft_float.o,source_path=third_party/fft_float.cc,flags={},num_aliases=1,component=Internal>Android) .bss@0(size_without_padding=131072,padding=0,full_name=ff_cos_131072_fixed,object_path=third_party/ffmpeg/libffmpeg_internal.a/fft_fixed.o,source_path=third_party/fft_fixed.cc,flags={},num_aliases=1,component=Internal>Android) .bss@0(size_without_padding=131072,padding=0,full_name=ff_cos_65536,object_path=third_party/ffmpeg/libffmpeg_internal.a/fft_float.o,source_path=third_party/fft_float.cc,flags={},num_aliases=1,component=Internal>Android)
diff --git a/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden b/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden index cc1d32c..e29ad9d 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden
@@ -10,22 +10,22 @@ linker_name=gold map_file_name=../../../test.map tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ -Section .text: has 0.2% of 83792 bytes accounted for from 21 symbols. 35898456 bytes are unaccounted for. -* Padding accounts for 13808 bytes (16.5%) -* 16 have source paths. Accounts for 73986 bytes (88.3%). -* 16 have a component assigned. Accounts for 73986 bytes (88.3%). -* 4 placeholders exist (symbols that start with **). Accounts for 13840 bytes (16.5%). +Section .text: has 100.0% of 35982248 bytes accounted for from 22 symbols. 0 bytes are unaccounted for. +* Padding accounts for 13808 bytes (0.0%) +* 16 have source paths. Accounts for 73986 bytes (0.2%). +* 16 have a component assigned. Accounts for 73986 bytes (0.2%). +* 5 placeholders exist (symbols that start with **). Accounts for 35912296 bytes (99.8%). * 8 aliases exist, mapped to 3 unique addresses (100 bytes saved) * 0 symbols have shared ownership. -* 1 symbols are marked as "unlikely". Accounts for 69124 bytes (82.5%). -* 4 symbols are marked as "startup". Accounts for 128 bytes (0.2%). -* 3 symbols are clones. Accounts for 106 bytes (0.1%). -* 5 symbols are from generated sources. Accounts for 69660 bytes (83.1%). -Section .rodata: has 44.6% of 2641540 bytes accounted for from 11 symbols. 3286112 bytes are unaccounted for. -* Padding accounts for 2637946 bytes (99.9%) -* 8 have source paths. Accounts for 676149 bytes (25.6%). -* 8 have a component assigned. Accounts for 676149 bytes (25.6%). -* 3 placeholders exist (symbols that start with **). Accounts for 1965391 bytes (74.4%). +* 1 symbols are marked as "unlikely". Accounts for 69124 bytes (0.2%). +* 4 symbols are marked as "startup". Accounts for 128 bytes (0.0%). +* 3 symbols are clones. Accounts for 106 bytes (0.0%). +* 5 symbols are from generated sources. Accounts for 69660 bytes (0.2%). +Section .rodata: has 100.0% of 5927636 bytes accounted for from 12 symbols. 16 bytes are unaccounted for. +* Padding accounts for 2637946 bytes (44.5%) +* 8 have source paths. Accounts for 676149 bytes (11.4%). +* 8 have a component assigned. Accounts for 676149 bytes (11.4%). +* 4 placeholders exist (symbols that start with **). Accounts for 5251487 bytes (88.6%). * 3 string literals exist. Accounts for 21 bytes (0.0%) padding is 0 bytes. * 2 aliases exist, mapped to 1 unique addresses (5 bytes saved) * 0 symbols have shared ownership. @@ -33,15 +33,17 @@ Large padding of 675992 between: A) .rodata@284e398(size_without_padding=32,padding=0,full_name=chrome::mojom::FilePatcher::Name_,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) B) .rodata@28f3450(size_without_padding=48,padding=675992,full_name=kAnimationFrameTimeHistogramClassPath,object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={anon},num_aliases=1,component=Internal>Android) -Section .data.rel.ro: has 0.0% of 92 bytes accounted for from 3 symbols. 1065132 bytes are unaccounted for. +Section .data.rel.ro: has 100.0% of 1065224 bytes accounted for from 4 symbols. 0 bytes are unaccounted for. * Padding accounts for 0 bytes (0.0%) -* 3 have source paths. Accounts for 92 bytes (100.0%). -* 3 have a component assigned. Accounts for 92 bytes (100.0%). +* 3 have source paths. Accounts for 92 bytes (0.0%). +* 3 have a component assigned. Accounts for 92 bytes (0.0%). +* 1 placeholders exist (symbols that start with **). Accounts for 1065132 bytes (100.0%). * 0 symbols have shared ownership. -Section .data: has 0.2% of 168 bytes accounted for from 5 symbols. 101600 bytes are unaccounted for. +Section .data: has 100.0% of 101768 bytes accounted for from 6 symbols. 0 bytes are unaccounted for. * Padding accounts for 0 bytes (0.0%) -* 5 have source paths. Accounts for 168 bytes (100.0%). -* 5 have a component assigned. Accounts for 168 bytes (100.0%). +* 5 have source paths. Accounts for 168 bytes (0.2%). +* 5 have a component assigned. Accounts for 168 bytes (0.2%). +* 1 placeholders exist (symbols that start with **). Accounts for 101600 bytes (99.8%). * 0 symbols have shared ownership. Section .bss: has 40.3% of 524520 bytes accounted for from 6 symbols. 775936 bytes are unaccounted for. * Padding accounts for 196 bytes (0.0%) @@ -72,20 +74,23 @@ * 0 have source paths. Accounts for 0 bytes (0.0%). * 0 have a component assigned. Accounts for 0 bytes (0.0%). * 0 symbols have shared ownership. -Section .other: has 100.0% of 39147303 bytes accounted for from 5 symbols. 0 bytes are unaccounted for. -* Padding accounts for 33903399 bytes (86.6%) -* 3 have source paths. Accounts for 5243904 bytes (13.4%). -* 1 have a component assigned. Accounts for 1048576 bytes (2.7%). +Section .other: has 100.0% of 95595797 bytes accounted for from 27 symbols. 0 bytes are unaccounted for. +* Padding accounts for 33903399 bytes (35.5%) +* 3 have source paths. Accounts for 5243904 bytes (5.5%). +* 1 have a component assigned. Accounts for 1048576 bytes (1.1%). +* 22 placeholders exist (symbols that start with **). Accounts for 56448494 bytes (59.0%). * 0 symbols have shared ownership. -* 1 symbols are from generated sources. Accounts for 4194304 bytes (10.7%). +* 1 symbols are from generated sources. Accounts for 4194304 bytes (4.4%). .data@2de7000(size_without_padding=4,padding=0,full_name=google::protobuf::internal::pLinuxKernelCmpxchg,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1,component=Blink>Internal) .data@2de7004(size_without_padding=4,padding=0,full_name=google::protobuf::internal::pLinuxKernelMemoryBarrier,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) .data@2de7008(size_without_padding=152,padding=0,full_name=base::android::kBaseRegisteredMethods,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={rel},num_aliases=1,component=UI>Browser) .data@2de70a0(size_without_padding=4,padding=0,full_name=base::android::g_renderer_histogram_code,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={anon},num_aliases=1,component=UI>Browser) .data@2de70a4(size_without_padding=4,padding=0,full_name=base::android::g_library_version_number,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={anon,rel.loc},num_aliases=1,component=UI>Browser) +.data@2de70a8(size_without_padding=101600,padding=0,full_name=** .data (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .data.rel.ro@2cd8500(size_without_padding=56,padding=0,full_name=ChromeMainDelegateAndroid [vtable],object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={},num_aliases=1,component=Internal>Android) .data.rel.ro@2cd8538(size_without_padding=24,padding=0,full_name=mojo::MessageReceiver [vtable],object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1,component=Blink>Internal) .data.rel.ro@2cd8550(size_without_padding=12,padding=0,full_name=kMethodsAnimationFrameTimeHistogram,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1,component=Blink>Internal) +.data.rel.ro@2cd855c(size_without_padding=1065132,padding=0,full_name=** .data.rel.ro (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .data.rel.ro.local@2c176f0(size_without_padding=56,padding=0,full_name=ChromeMainDelegate [vtable],object_path=third_party/icu/icuuc/ucnv_ext.o,source_path=third_party/icu/ucnv_ext.c,flags={gen},num_aliases=1,component=Internal>Android) .data.rel.ro.local@2c17728(size_without_padding=24,padding=0,full_name=chrome::mojom::FieldTrialRecorder [vtable],object_path=third_party/icu/icuuc/ucnv_ext.o,source_path=third_party/icu/ucnv_ext.c,flags={gen},num_aliases=1,component=Internal>Android) .data.rel.ro.local@2c17740(size_without_padding=789904,padding=0,full_name=chrome::mojom::FieldTrialRecorderProxy [vtable],object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) @@ -284,6 +289,28 @@ .dex.method@0(size_without_padding=79,padding=0,full_name=org.chromium.chrome.browser.compositor.layouts.phone.stack.StackAnimationLandscape#getScreenPositionInScrollDirection(org.chromium.chrome.browser.compositor.layouts.phone.stack.StackTab): float,object_path=$APK/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimationLandscape,source_path=,flags={},num_aliases=1,component=) .dex.method@0(size_without_padding=54,padding=0,full_name=org.chromium.chrome.browser.compositor.layouts.phone.stack.StackAnimationLandscape#getScreenSizeInScrollDirection(): float,object_path=$APK/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimationLandscape,source_path=,flags={},num_aliases=1,component=) .dex.method@0(size_without_padding=52,padding=0,full_name=org.chromium.chrome.browser.compositor.layouts.phone.stack.StackAnimationLandscape#isDefaultDiscardDirectionPositive(): boolean,object_path=$APK/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimationLandscape,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=2655384,padding=0,full_name=** ELF Section: .rel.dyn,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=2816,padding=0,full_name=** ELF Section: .rel.plt,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=19,padding=0,full_name=** ELF Section: .interp,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=28,padding=0,full_name=** ELF Section: .note.gnu.gold-version,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=6496,padding=0,full_name=** ELF Section: .dynsym,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=42956,padding=0,full_name=** ELF Section: .got,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=812,padding=0,full_name=** ELF Section: .gnu.version,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=28,padding=0,full_name=** ELF Section: .gnu.version_d,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=436,padding=0,full_name=** ELF Section: .shstrtab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=36,padding=0,full_name=** ELF Section: .note.gnu.build-id,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=17166112,padding=0,full_name=** ELF Section: .symtab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=96,padding=0,full_name=** ELF Section: .gnu.version_r,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=4025,padding=0,full_name=** ELF Section: .dynstr,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=2684,padding=0,full_name=** ELF Section: .hash,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=183632,padding=0,full_name=** ELF Section: .ARM.extab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=1536456,padding=0,full_name=** ELF Section: .ARM.exidx,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=8,padding=0,full_name=** ELF Section: .fini_array,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=8,padding=0,full_name=** ELF Section: .init_array,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=304,padding=0,full_name=** ELF Section: .dynamic,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=4244,padding=0,full_name=** ELF Section: .plt,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=34841854,padding=0,full_name=** ELF Section: .strtab,object_path=,source_path=,flags={},num_aliases=1,component=) +.other@0(size_without_padding=60,padding=0,full_name=** ELF Section: .ARM.attributes,object_path=,source_path=,flags={},num_aliases=1,component=) .other@0(size_without_padding=4194304,padding=0,full_name=smalltest.so,object_path=,source_path=$APK/smalltest.so,flags={gen},num_aliases=1,component=) .other@0(size_without_padding=1048576,padding=0,full_name=assets/icudtl.dat,object_path=,source_path=third_party/icu/android/icudtl.dat,flags={},num_aliases=1,component=Internal>Android) .other@0(size_without_padding=1024,padding=0,full_name=res/drawable-v13/test.xml,object_path=,source_path=chrome/android/res/drawable/test.xml,flags={},num_aliases=1,component=) @@ -300,6 +327,7 @@ .rodata@284e398(size_without_padding=32,padding=0,full_name=chrome::mojom::FilePatcher::Name_,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) .rodata@28f3450(size_without_padding=48,padding=675992,full_name=kAnimationFrameTimeHistogramClassPath,object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={anon},num_aliases=1,component=Internal>Android) .rodata@28f3480(size_without_padding=4,padding=0,full_name=blink::CSSValueKeywordsHash::findValueImpl(char const*, unsigned int)::value_word_list,object_path=third_party/sub/PaintChunker.o,source_path=third_party/paint.cc,flags={anon},num_aliases=1,component=Internal>Android) +.rodata@28f3484(size_without_padding=3286096,padding=0,full_name=** .rodata (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .text@28d900(size_without_padding=16,padding=0,full_name=_GLOBAL__sub_I_page_allocator.cc,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={startup},num_aliases=1,component=Blink>Internal) .text@28d910(size_without_padding=56,padding=0,full_name=_GLOBAL__sub_I_bbr_sender.cc,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={startup},num_aliases=1,component=Blink>Internal) .text@28d948(size_without_padding=28,padding=0,full_name=_GLOBAL__sub_I_pacing_sender.cc,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={startup},num_aliases=1,component=Blink>Internal) @@ -321,6 +349,7 @@ .text@2a2000(size_without_padding=32,padding=4002,full_name=** outlined function,object_path=third_party/sub/ContiguousContainer.o,source_path=third_party/container/container.c,flags={},num_aliases=1,component=UI>Browser) .text@2a2020(size_without_padding=48,padding=0,full_name=** outlined function * 2,object_path=,source_path=,flags={},num_aliases=2,component=) .text@2a2020(size_without_padding=48,padding=0,full_name=aliasedWithOutlinedFunction(),object_path=,source_path=,flags={},num_aliases=2,component=) +.text@2a2050(size_without_padding=35898456,padding=0,full_name=** .text (unattributed),object_path=,source_path=,flags={},num_aliases=1,component=) .bss@0(size_without_padding=262144,padding=0,full_name=ff_cos_131072,object_path=third_party/ffmpeg/libffmpeg_internal.a/fft_float.o,source_path=third_party/fft_float.cc,flags={},num_aliases=1,component=Internal>Android) .bss@0(size_without_padding=131072,padding=0,full_name=ff_cos_131072_fixed,object_path=third_party/ffmpeg/libffmpeg_internal.a/fft_fixed.o,source_path=third_party/fft_fixed.cc,flags={},num_aliases=1,component=Internal>Android) .bss@0(size_without_padding=131072,padding=0,full_name=ff_cos_65536,object_path=third_party/ffmpeg/libffmpeg_internal.a/fft_float.o,source_path=third_party/fft_float.cc,flags={},num_aliases=1,component=Internal>Android)
diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids index 61eac42..be4d090 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids
@@ -83,91 +83,94 @@ "includes": [11000], "structures": [11800], }, - "chrome/browser/resources/bluetooth_internals/resources.grd": { - "includes": [11870], - }, "chrome/browser/resources/chromeos/camera/camera_resources.grd": { - "includes": [11930], - "structures": [11990], + "includes": [11870], + "structures": [11930], }, "chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd": { - "messages": [12030], + "messages": [11970], }, "chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": { - "structures": [12100], + "structures": [12040], }, "chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_resources.grd": { - "structures": [12110], + "structures": [12050], }, "chrome/browser/resources/component_extension_resources.grd": { - "includes": [12120], - "structures": [12260], + "includes": [12060], + "structures": [12200], }, "chrome/browser/resources/downloads/downloads_resources_vulcanized.grd": { - "includes": [12300], + "includes": [12240], }, "chrome/browser/resources/downloads/downloads_resources.grd": { - "includes": [12310], - "structures": [12320], + "includes": [12250], + "structures": [12260], }, "chrome/browser/resources/extensions/extensions_resources_vulcanized.grd": { - "includes": [12400], + "includes": [12340], }, "chrome/browser/resources/extensions/extensions_resources.grd": { - "structures": [12410], + "structures": [12350], }, "chrome/browser/resources/invalidations_resources.grd": { - "includes": [12500], + "includes": [12440], }, "chrome/browser/resources/local_ntp/local_ntp_resources.grd": { - "includes": [12540], + "includes": [12480], }, "chrome/browser/resources/net_internals/net_internals_resources.grd": { - "includes": [12600], + "includes": [12540], }, "chrome/browser/resources/print_preview/print_preview_resources_vulcanized.grd": { - "includes": [12610], + "includes": [12550], }, "chrome/browser/resources/print_preview/print_preview_resources.grd": { - "structures": [12620], + "structures": [12560], }, "chrome/browser/resources/quota_internals/quota_internals_resources.grd": { - "includes": [12810], + "includes": [12750], }, "chrome/browser/resources/settings/os_settings_resources_vulcanized.grd": { - "includes": [12830], + "includes": [12770], }, "chrome/browser/resources/settings/os_settings_resources.grd": { - "structures": [12840], + "structures": [12780], }, "chrome/browser/resources/settings/settings_resources_vulcanized.grd": { - "includes": [13340], + "includes": [13280], }, "chrome/browser/resources/settings/settings_resources.grd": { - "structures": [13350], + "structures": [13290], }, "chrome/browser/resources/sync_file_system_internals/sync_file_system_internals_resources.grd": { - "includes": [13860], + "includes": [13800], }, "chrome/browser/resources/tab_strip/tab_strip_resources.grd": { - "structures": [13880], - "includes": [13900], - }, - "chrome/browser/resources/usb_internals/resources.grd": { - "includes": [13910], + "structures": [13820], + "includes": [13840], }, "chrome/browser/resources/webapks/webapks_ui_resources.grd": { - "includes": [13920], + "includes": [13850], }, "chrome/browser/resources/welcome/welcome_resources.grd": { - "includes": [13930], - "structures": [13980], + "includes": [13860], + "structures": [13910], }, "chrome/browser/vr/testapp/vr_testapp_resources.grd": { - "includes": [14020], + "includes": [13950], }, # END chrome/browser section. + # START chrome/ WebUI resources section + "chrome/browser/resources/bluetooth_internals/resources.grd": { + "includes": [13970], + }, + "chrome/browser/resources/usb_internals/resources.grd": { + "includes": [14030], + }, + # END chrome/ WebUI resources section + # START chrome/ miscellaneous section. "chrome/common/common_resources.grd": { "includes": [14160], @@ -232,25 +235,6 @@ }, # END components/ section. - # START content/ section. - # content/ and ios/web/ must start at the same id. - # App only use one file depending on whether it is iOS or other platform. - "content/app/resources/content_resources.grd": { - "structures": [20000], - }, - "content/content_resources.grd": { - "includes": [20400], - }, - "content/shell/shell_resources.grd": { - "includes": [20500], - }, - - # This file is generated during the build. - "<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/tracing_resources.grd": { - "includes": [20550], - }, - # END content/ section. - # START ios/ section. # # chrome/ and ios/chrome/ must start at the same id. @@ -294,7 +278,28 @@ "ios/chrome/content_widget_extension/strings/ios_content_widget_extension_google_chrome_strings.grd": { "messages": [3080], }, + # END ios/ section. + # START content/ section. + # content/ and ios/web/ must start at the same id. + # App only use one file depending on whether it is iOS or other platform. + "content/app/resources/content_resources.grd": { + "structures": [20000], + }, + "content/content_resources.grd": { + "includes": [20400], + }, + "content/shell/shell_resources.grd": { + "includes": [20500], + }, + + # This file is generated during the build. + "<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/tracing_resources.grd": { + "includes": [20550], + }, + # END content/ section. + + # START ios/web/ section. # content/ and ios/web/ must start at the same id. # App only use one file depending on whether it is iOS or other platform. "ios/web/ios_web_resources.grd": { @@ -303,7 +308,7 @@ "ios/web/test/test_resources.grd": { "includes": [22000], }, - # END ios/ section. + # END ios/web/ section. # START "everything else" section. # Everything but chrome/, components/, content/, and ios/
diff --git a/tools/json_schema_compiler/feature_compiler.py b/tools/json_schema_compiler/feature_compiler.py index dc9e8ee..d643e29 100644 --- a/tools/json_schema_compiler/feature_compiler.py +++ b/tools/json_schema_compiler/feature_compiler.py
@@ -678,7 +678,7 @@ else: no_parent = 'noparent' in feature_value sep = feature_name.rfind('.') - if sep is -1 or no_parent: + if sep == -1 or no_parent: return None parent_name = feature_name[:sep]
diff --git a/tools/json_to_struct/json_to_struct.py b/tools/json_to_struct/json_to_struct.py index ec332a5..46cfd4a 100755 --- a/tools/json_to_struct/json_to_struct.py +++ b/tools/json_to_struct/json_to_struct.py
@@ -136,13 +136,6 @@ for element_name, element in description['elements'].items(): f.write('extern const %s %s;\n' % (schema['type_name'], element_name)) - if 'generate_array' in description: - f.write('\n') - f.write('extern const %s* const %s[];\n' % (schema['type_name'], - description['generate_array']['array_name'])) - f.write('extern const size_t %s;\n' % - (description['generate_array']['array_name'] + 'Length')) - if namespace: f.write('\n') f.write('} // namespace %s\n' % namespace) @@ -178,17 +171,6 @@ f.write(element_generator.GenerateElements(schema['type_name'], schema['schema'], description)) - if 'generate_array' in description: - f.write('\n') - f.write('const %s* const %s[] = {\n' % (schema['type_name'], - description['generate_array']['array_name'])) - for element_name, _ in description['elements'].items(): - f.write('\t&%s,\n' % element_name) - f.write('};\n') - f.write('const size_t %s = base::size(%s);\n' % - (description['generate_array']['array_name'] + 'Length', - description['generate_array']['array_name'])) - if namespace: f.write('\n') f.write('} // namespace %s\n' % namespace)
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 344a774b..078a707 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -18142,6 +18142,8 @@ <int value="615" label="DeviceLoginScreenMonoAudioEnabled"/> <int value="616" label="TotalMemoryLimitMb"/> <int value="617" label="DeviceLoginScreenAutoclickEnabled"/> + <int value="618" label="DeviceLoginScreenStickyKeysEnabled"/> + <int value="619" label="DeviceLoginScreenKeyboardFocusHighlightEnabled"/> </enum> <enum name="EnterprisePolicyInvalidations"> @@ -18811,8 +18813,9 @@ <int value="25" label="AUDIO_ON_DEVICES_CHANGED"/> <int value="26" label="AUDIO_ON_LEVEL_CHANGED"/> <int value="27" label="AUDIO_ON_MUTE_CHANGED"/> - <int value="28" label="AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED"/> - <int value="29" label="AUTOFILL_PRIVATE_ON_CREDIT_CARD_LIST_CHANGED"/> + <int value="28" label="AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED_DEPRECATED"/> + <int value="29" + label="AUTOFILL_PRIVATE_ON_CREDIT_CARD_LIST_CHANGED_DEPRECATED"/> <int value="30" label="AUTOMATION_INTERNAL_ON_ACCESSIBILITY_EVENT"/> <int value="31" label="AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED"/> <int value="32" label="BLUETOOTH_LOW_ENERGY_ON_CHARACTERISTIC_VALUE_CHANGED"/> @@ -19244,6 +19247,7 @@ <int value="441" label="LOGIN_STATE_ON_SESSION_STATE_CHANGED"/> <int value="442" label="PRINTING_METRICS_ON_PRINT_JOB_FINISHED"/> <int value="443" label="AUTOTESTPRIVATE_ON_CLIPBOARD_DATA_CHANGED"/> + <int value="444" label="AUTOFILL_PRIVATE_ON_PERSONAL_DATA_CHANGED"/> </enum> <enum name="ExtensionFileWriteResult"> @@ -35608,6 +35612,7 @@ <int value="-1143496217" label="enable-oop-rasterization"/> <int value="-1143108160" label="PasswordManagerOnboardingAndroid:enabled"/> <int value="-1143007275" label="EnableNewStyleLauncher:disabled"/> + <int value="-1142933895" label="ReduceDisplayNotifications:disabled"/> <int value="-1142034548" label="BuiltInModuleKvStorage:enabled"/> <int value="-1137696948" label="enable-chromeos-account-manager"/> <int value="-1137442543" label="enable-slimming-paint"/> @@ -36552,6 +36557,7 @@ <int value="106840653" label="mus"/> <int value="107900612" label="ChromeHomePersistentIph:disabled"/> <int value="109577361" label="ForbidSyncXHRInPageDismissal:enabled"/> + <int value="110888614" label="ReduceDisplayNotifications:enabled"/> <int value="112140177" label="DesktopPWAsUnifiedInstall:disabled"/> <int value="115915570" label="OmniboxUIExperimentHideSteadyStateUrlPathQueryAndRef:enabled"/>
diff --git a/tools/metrics/histograms/extract_histograms.py b/tools/metrics/histograms/extract_histograms.py index 0f59390..fb84caa9 100644 --- a/tools/metrics/histograms/extract_histograms.py +++ b/tools/metrics/histograms/extract_histograms.py
@@ -57,7 +57,13 @@ import copy import datetime -import HTMLParser + +try: + import html +except ImportError: # For Py2 compatibility + import HTMLParser + html = HTMLParser.HTMLParser() + import logging import re import xml.dom.minidom @@ -142,7 +148,7 @@ # Unescape using default ASCII encoding. Unescapes any HTML escaped character # like " etc. - return HTMLParser.HTMLParser().unescape(line) + return html.unescape(line) def _NormalizeAllAttributeValues(node):
diff --git a/tools/metrics/histograms/extract_histograms_test.py b/tools/metrics/histograms/extract_histograms_test.py index cc2afe3..fd0df12 100644 --- a/tools/metrics/histograms/extract_histograms_test.py +++ b/tools/metrics/histograms/extract_histograms_test.py
@@ -478,8 +478,8 @@ self.assertFalse(have_errors) self.assertIn('Test.Histogram', hists) self.assertIn('summary', hists['Test.Histogram']) - self.assertEquals('This is a summary with & and " and \'', - hists['Test.Histogram']['summary']) + self.assertEqual('This is a summary with & and " and \'', + hists['Test.Histogram']['summary']) if __name__ == "__main__": logging.basicConfig(level=logging.ERROR + 1)
diff --git a/tools/metrics/histograms/generate_expired_histograms_array.py b/tools/metrics/histograms/generate_expired_histograms_array.py index be99d8a..423f9e2 100755 --- a/tools/metrics/histograms/generate_expired_histograms_array.py +++ b/tools/metrics/histograms/generate_expired_histograms_array.py
@@ -148,7 +148,7 @@ def _HashName(name): """Returns hash for the given histogram |name|.""" - return "0x" + hashlib.md5(name).hexdigest()[:16] + return "0x" + hashlib.md5(name.encode()).hexdigest()[:16] def _GetHashToNameMap(histograms_names):
diff --git a/tools/metrics/histograms/generate_expired_histograms_array_unittest.py b/tools/metrics/histograms/generate_expired_histograms_array_unittest.py index 4c5ea73..1dd7ec1e 100755 --- a/tools/metrics/histograms/generate_expired_histograms_array_unittest.py +++ b/tools/metrics/histograms/generate_expired_histograms_array_unittest.py
@@ -93,7 +93,7 @@ "expires_after": "2000/10/01" } } - base_date = datetime.date(2000, 10, 01) + base_date = datetime.date(2000, 10, 1) current_milestone = 60 with self.assertRaises(generate_expired_histograms_array.Error) as error: @@ -129,7 +129,7 @@ content = "!!FOO!\nMAJOR_BRANCH_DATE=2010-01-01\n!FOO!!" base_date = generate_expired_histograms_array._GetBaseDate(content, regex) - self.assertEqual(base_date, datetime.date(2010, 01, 01)) + self.assertEqual(base_date, datetime.date(2010, 1, 1)) def testGenerateHeaderFileContent(self): header_filename = "test/test.h"
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 953bb0f..73dd315 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -30480,6 +30480,20 @@ </summary> </histogram> +<histogram name="DirectWrite.Fonts.Proxy.FamilyCountIndexingStart" + units="font files" expires_after="M82"> + <owner>drott@chromium.org</owner> + <owner>layout-dev@chromium.org</owner> + <summary> + Number of font families on the system as retrieved from DWrite API (usually + less than to number of font files reported in + DirectWrite.Fonts.Proxy.NumFontFiles as a family can contain multiple font + files). Recorded in DWriteFontTableBuilder at the time of starting scanning + the font files for their name meta information. Used for diagnosing + https://crbug.com/1009402. + </summary> +</histogram> + <histogram name="DirectWrite.Fonts.Proxy.FontProxyError" enum="DirectWriteFontProxyError"> <owner>drott@chromium.org</owner> @@ -94781,6 +94795,17 @@ </summary> </histogram> +<histogram name="OptimizationGuide.Hints.NavigationHostCoverage.BeforeCommit" + enum="BooleanCovered" expires_after="M85"> + <owner>sophiechang@chromium.org</owner> + <owner>mcrouse@chromium.org</owner> + <summary> + Records once per navigation if the host that was navigated to was included + in a hints fetch request in the last 7 days, even if no hints were returned, + or had a hint served via the Optimization Hints component before commit. + </summary> +</histogram> + <histogram name="OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount" units="units" expires_after="M82"> <owner>mcrouse@chromium.org</owner> @@ -147559,8 +147584,8 @@ </histogram> <histogram name="TileManager.ExceededMemoryBudget" enum="TileMemoryBudget" - expires_after="M77"> - <owner>reveman@chromium.org</owner> + expires_after="M87"> + <owner>pdr@chromium.org</owner> <owner>vmpstr@chromium.org</owner> <summary> Measures whether the tile manager exceeded the hard GPU memory budget
diff --git a/tools/perf/core/results_processor/formatters/__init__.py b/tools/perf/core/results_processor/formatters/__init__.py index f75ff697..c9f812e 100644 --- a/tools/perf/core/results_processor/formatters/__init__.py +++ b/tools/perf/core/results_processor/formatters/__init__.py
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +from core.results_processor.formatters import csv_output from core.results_processor.formatters import histograms_output from core.results_processor.formatters import html_output from core.results_processor.formatters import json3_output @@ -11,4 +12,5 @@ 'json-test-results': json3_output, 'histograms': histograms_output, 'html': html_output, + 'csv': csv_output, }
diff --git a/tools/perf/core/results_processor/formatters/csv_output.py b/tools/perf/core/results_processor/formatters/csv_output.py new file mode 100644 index 0000000..4c81b80 --- /dev/null +++ b/tools/perf/core/results_processor/formatters/csv_output.py
@@ -0,0 +1,60 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Output formatter for CSV format.""" + +import collections +import csv +import json +import os + +from core.results_processor.formatters import histograms_output +from py_utils import tempfile_ext +from tracing.value import histograms_to_csv + + +OUTPUT_FILENAME = 'results.csv' + + +def _ReadCsv(input_stream): + dicts = [] + header = None + for row in csv.reader(input_stream): + if header is None: + header = row + elif row: + dicts.append(collections.OrderedDict(zip(header, row))) + return dicts + + +def _WriteCsv(dicts, output_stream): + header = [] + for d in dicts: + for k in d.iterkeys(): + if k not in header: + header.append(k) + rows = [header] + for d in dicts: + rows.append([d.get(k, '') for k in header]) + csv.writer(output_stream).writerows(rows) + + +def Process(intermediate_results, options): + """Process intermediate results and write output in output_dir.""" + histogram_dicts = histograms_output.Convert(intermediate_results, + options.results_label) + + with tempfile_ext.NamedTemporaryFile() as hist_file: + json.dump(histogram_dicts, hist_file) + hist_file.close() + vinn_result = histograms_to_csv.HistogramsToCsv(hist_file.name) + csv_dicts = _ReadCsv(vinn_result.stdout.splitlines()) + + output_file = os.path.join(options.output_dir, OUTPUT_FILENAME) + if not options.reset_results and os.path.isfile(output_file): + with open(output_file) as input_stream: + csv_dicts += _ReadCsv(input_stream) + + with open(output_file, 'w') as output_stream: + _WriteCsv(csv_dicts, output_stream)
diff --git a/tools/perf/core/results_processor/processor_test.py b/tools/perf/core/results_processor/processor_test.py index f2a802c..65268f1 100644 --- a/tools/perf/core/results_processor/processor_test.py +++ b/tools/perf/core/results_processor/processor_test.py
@@ -9,12 +9,14 @@ with their expected contents. """ +import csv import json import os import shutil import tempfile import unittest +from core.results_processor.formatters import csv_output from core.results_processor.formatters import json3_output from core.results_processor.formatters import histograms_output from core.results_processor.formatters import html_output @@ -328,3 +330,121 @@ diag_values = [list(v) for v in out_histograms.shared_diagnostics] self.assertIn(['label1'], diag_values) self.assertIn(['label2'], diag_values) + + def testCsvOutput(self): + hist_file = os.path.join(self.output_dir, + histograms_output.HISTOGRAM_DICTS_NAME) + test_hist = histogram.Histogram('a', 'ms') + test_hist.AddSample(3000) + with open(hist_file, 'w') as f: + json.dump([test_hist.AsDict()], f) + + self.SerializeIntermediateResults( + test_results=[ + testing.TestResult( + 'benchmark/story', + artifacts={'histogram_dicts.json': testing.Artifact(hist_file)}, + ), + ], + diagnostics={ + 'benchmarks': ['benchmark'], + 'osNames': ['linux'], + 'documentationUrls': [['documentation', 'url']], + }, + ) + + processor.main([ + '--output-format', 'csv', + '--output-dir', self.output_dir, + '--intermediate-dir', self.intermediate_dir, + '--results-label', 'label', + ]) + + with open(os.path.join(self.output_dir, csv_output.OUTPUT_FILENAME)) as f: + lines = [line for line in f] + + actual = list(zip(*csv.reader(lines))) + expected = [ + ('name', 'a'), ('unit', 'ms'), ('avg', '3000'), ('count', '1'), + ('max', '3000'), ('min', '3000'), ('std', '0'), ('sum', '3000'), + ('architectures', ''), ('benchmarks', 'benchmark'), + ('benchmarkStart', ''), ('bots', ''), + ('builds', ''), ('deviceIds', ''), ('displayLabel', 'label'), + ('masters', ''), ('memoryAmounts', ''), ('osNames', 'linux'), + ('osVersions', ''), ('productVersions', ''), + ('stories', ''), ('storysetRepeats', ''), + ('traceStart', ''), ('traceUrls', '') + ] + self.assertEqual(actual, expected) + + def testCsvOutputResetResults(self): + hist_file = os.path.join(self.output_dir, + histograms_output.HISTOGRAM_DICTS_NAME) + with open(hist_file, 'w') as f: + json.dump([histogram.Histogram('a', 'unitless').AsDict()], f) + + self.SerializeIntermediateResults( + test_results=[ + testing.TestResult( + 'benchmark/story', + artifacts={'histogram_dicts.json': testing.Artifact(hist_file)}, + ), + ], + ) + + processor.main([ + '--output-format', 'csv', + '--output-dir', self.output_dir, + '--intermediate-dir', self.intermediate_dir, + '--results-label', 'label1', + ]) + + processor.main([ + '--output-format', 'csv', + '--output-dir', self.output_dir, + '--intermediate-dir', self.intermediate_dir, + '--results-label', 'label2', + '--reset-results', + ]) + + with open(os.path.join(self.output_dir, csv_output.OUTPUT_FILENAME)) as f: + lines = [line for line in f] + + self.assertEqual(len(lines), 2) + self.assertIn('label2', lines[1]) + + def testCsvOutputAppendResults(self): + hist_file = os.path.join(self.output_dir, + histograms_output.HISTOGRAM_DICTS_NAME) + with open(hist_file, 'w') as f: + json.dump([histogram.Histogram('a', 'unitless').AsDict()], f) + + self.SerializeIntermediateResults( + test_results=[ + testing.TestResult( + 'benchmark/story', + artifacts={'histogram_dicts.json': testing.Artifact(hist_file)}, + ), + ], + ) + + processor.main([ + '--output-format', 'csv', + '--output-dir', self.output_dir, + '--intermediate-dir', self.intermediate_dir, + '--results-label', 'label1', + ]) + + processor.main([ + '--output-format', 'csv', + '--output-dir', self.output_dir, + '--intermediate-dir', self.intermediate_dir, + '--results-label', 'label2', + ]) + + with open(os.path.join(self.output_dir, csv_output.OUTPUT_FILENAME)) as f: + lines = [line for line in f] + + self.assertEqual(len(lines), 3) + self.assertIn('label2', lines[1]) + self.assertIn('label1', lines[2])
diff --git a/tools/perf/process_perf_results.py b/tools/perf/process_perf_results.py index 47bd6e1f..683928dd 100755 --- a/tools/perf/process_perf_results.py +++ b/tools/perf/process_perf_results.py
@@ -57,6 +57,7 @@ GTEST_CONVERSION_WHITELIST = [ 'angle_perftests', 'cc_perftests', + 'components_perftests', 'gpu_perftests', 'latency_perftests', 'load_library_perf_tests',
diff --git a/tools/symsrc/source_index.py b/tools/symsrc/source_index.py index 07ed518..360c003 100755 --- a/tools/symsrc/source_index.py +++ b/tools/symsrc/source_index.py
@@ -3,7 +3,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Usage: <win-path-to-pdb.pdb> +"""Usage: Run with the '--help' flag to see how to use this script. This tool will take a PDB on the command line, extract the source files that were used in building the PDB, query the source server for which repository and revision these files are at, and then finally write this information back @@ -15,11 +15,32 @@ input files need to match the generated PDB, and we want the correct revision information for the exact files that were used for the build. -The following files from a windbg + source server installation are expected -to reside in the same directory as this python script: - dbghelp.dll - pdbstr.exe - srctool.exe +Here's a quick overview of what this script does: + - Extract the list of source files listed in the PDB, i.e. all the source + files that have been used to produce the matching binary. This list contains + some files for which the source code is accessible (e.g. files from the + Chromium repo) and some from private repos (e.g. files that have been used + to build the CRT static library that we link against). + - Iterate over the list of files from the previous step, from here there's a + few different possibilities: + - This file is coming from a public Git repository (e.g. Chromium), in + this case this script will list all the files that are contained in this + repository and index them all at once (and then remove them from the + file list it's iterating over). + - This file is a generated file produced during the build. It will likely + be living in a subdirectory of the build directory, if the "--build-dir" + flag has been passed to this flag this flag this directory will be + automatically ignored. + - The directory containing this file isn't part of a Git checkout, this + file will be excluded and all the files from this directory will get + added to an exclusion list. Specifying the toolchain directory (via the + "--toolchain-dir" flag) allow automatically skipping all the files from + the VS toolchain directory (e.g. all the CRT files), this is much faster + than using Git to check if these files are from a Git repo. + - This file doesn't exist on disk, which means that it is coming from a + third party static library. This file will be ignored. + - A map that associates each source file to a public URL will be added in a + new stream in the PDB. NOTE: Expected to run under a native win32 python, NOT cygwin. All paths are dealt with as win32 paths, since we have to interact with the Microsoft tools. @@ -27,97 +48,62 @@ from __future__ import print_function -import os +try: + # Python 3.x + from urllib.parse import urlparse +except ImportError: + # Python 2.x + from urlparse import urlparse + import optparse +import os +import re +import subprocess import sys import tempfile import time -import subprocess import win32api from collections import namedtuple -# This serves two purposes. First, it acts as a whitelist, and only files -# from repositories listed here will be source indexed. Second, it allows us -# to map from one URL to another, so we can map to external source servers. It -# also indicates if the source for this project will be retrieved in a base64 -# encoded format. -# TODO(sebmarchand): Initialize this variable in the main function and pass it -# to the sub functions instead of having a global variable. -REPO_MAP = { - 'http://src.chromium.org/svn': { - 'url': 'https://src.chromium.org/chrome/' - '{file_path}?revision={revision}', - 'base64': False - }, - 'https://src.chromium.org/svn': { - 'url': 'https://src.chromium.org/chrome/' - '{file_path}?revision={revision}', - 'base64': False - } -} +# Map that associates Git repository URLs with the URL that should be used to +# retrieve individual files from this repo. Entries in this map should have the +# following format: +# { +# 'url': |path to public URL, with the {revision} and {file_path} tags|, +# 'base64': |boolean indicating if the files are base64 encoded| +# } +# +# Here's an example of what the entry for the Chromium repo looks like: +# { +# 'url': 'chromium.googlesource/+/{revision}/{file_path}?format=TEXT', +# 'base64': True +# } +# +# The {revision} and {file_path} will be replaced by the appropriate values when +# building the source indexing map that gets added to the PDB. +# +# TODO(sebmarchand): Check if this is really needed, this is a legacy thing +# coming from when this script was used for SVN repos and we could probably do +# without it. +REPO_MAP = {} -PROJECT_GROUPS = [ - # Googlecode SVN projects - { - 'projects': [ - 'angleproject', - 'google-breakpad', - 'google-cache-invalidation-api', - 'google-url', - 'googletest', - 'leveldb', - 'libphonenumber', - 'libyuv', - 'open-vcdiff', - 'ots', - 'sawbuck', - 'sfntly', - 'smhasher', - 'v8', - 'v8-i18n', - 'webrtc', - ], - 'public_url': 'https://%s.googlecode.com/svn-history/' \ - 'r{revision}/{file_path}', - 'svn_urls': [ - 'svn://svn-mirror.golo.chromium.org/%s', - 'http://src.chromium.org/%s', - 'https://src.chromium.org/%s', - 'http://%s.googlecode.com/svn', - 'https://%s.googlecode.com/svn', - ], - }, - # Googlecode Git projects - { - 'projects': [ - 'syzygy', - ], - 'public_url': 'https://%s.googlecode.com/git-history/' \ - '{revision}/{file_path}', - 'svn_urls': [ - 'https://code.google.com/p/%s/', - ], - }, - # Chrome projects - { - 'projects': [ - 'blink', - 'chrome', - 'multivm', - 'native_client', - ], - 'public_url': 'https://src.chromium.org/%s/' \ - '{file_path}?revision={revision}', - 'svn_urls': [ - 'svn://chrome-svn/%s', - 'svn://chrome-svn.corp.google.com/%s', - 'svn://svn-mirror.golo.chromium.org/%s', - 'svn://svn.chromium.org/%s', - ], - }, -] +# Regex matching a junction at it's printed by the 'dir' command. +# It usually looks like this when the junction has been created with mklink: +# +# Directory of C:\a +# +# 07/23/2015 06:42 PM <JUNCTION> b [C:\real_a\b] +# +# The junctions created with the 'junction' utility look almost the same, except +# for a leading '\??\' on the junction target: +# +# 07/23/2015 06:42 PM <JUNCTION> b [\??\C:\real_a\b] +_DIR_JUNCTION_RE = re.compile(r""" + .*<JUNCTION\>\s+(?P<dirname>[^ ]+)\s+\[(\\\?\?\\)?(?P<real_path>.*)\] +""", re.VERBOSE) + # A named tuple used to store the information about a repository. # @@ -137,24 +123,15 @@ return win32api.GetLongPathName(win32api.GetShortPathName(unicode(filename))) -def FillRepositoriesMap(): - """ Fill the repositories map with the whitelisted projects. """ - for project_group in PROJECT_GROUPS: - for project in project_group['projects']: - for svn_url in project_group['svn_urls']: - REPO_MAP[svn_url % project] = { - 'url': project_group['public_url'] % project, - 'base64': False - } - REPO_MAP[project_group['public_url'] % project] = None +def FindSrcSrvFile(filename, toolchain_dir): + """Return the absolute path for a file in the srcsrv directory. -FillRepositoriesMap() - - -def FindFile(filename): - """Return the full windows path to a file in the same dir as this code.""" - thisdir = os.path.dirname(os.path.join(os.path.curdir, __file__)) - return os.path.abspath(os.path.join(thisdir, filename)) + If |toolchain_dir| is null then this will assume that the file is in this + script's directory. + """ + bin_dir = os.path.join(toolchain_dir, 'win_sdk', 'Debuggers', 'x64', 'srcsrv') + assert(os.path.exists(bin_dir)) + return os.path.abspath(os.path.join(bin_dir, filename)) def RunCommand(*cmd, **kwargs): @@ -184,29 +161,41 @@ return ret -def ExtractSourceFiles(pdb_filename): +def ExtractSourceFiles(pdb_filename, toolchain_dir): """Extract a list of local paths of the source files from a PDB.""" - src_files = RunCommand(FindFile('srctool.exe'), '-r', pdb_filename) - if not src_files or src_files.startswith("srctool: "): + + # Don't use |RunCommand| as it expect the return code to be 0 on success but + # srctool returns the number of files instead. + srctool = subprocess.Popen([FindSrcSrvFile('srctool.exe', toolchain_dir), + '-r', pdb_filename], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True) + src_files, _ = srctool.communicate() + + if (not src_files or src_files.startswith("srctool: ") or + srctool.returncode <= 0): raise Exception("srctool failed: " + src_files) - return set(x.lower() for x in src_files.split('\n') if len(x) != 0) + return set( + x.rstrip('\n').lower() for x in src_files.split('\n') if len(x) != 0) -def ReadSourceStream(pdb_filename): +def ReadSourceStream(pdb_filename, toolchain_dir): """Read the contents of the source information stream from a PDB.""" - srctool = subprocess.Popen([FindFile('pdbstr.exe'), + pdbstr = subprocess.Popen([FindSrcSrvFile('pdbstr.exe', toolchain_dir), '-r', '-s:srcsrv', '-p:%s' % pdb_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - data, _ = srctool.communicate() + data, _ = pdbstr.communicate() - if ((srctool.returncode != 0 and srctool.returncode != -1) or - data.startswith("pdbstr: ")): + # Old version of pdbstr.exe return -1 when the source requested stream is + # missing, while more recent ones return 1, use |abs| to workaround this. + if (((pdbstr.returncode != 0 and abs(pdbstr.returncode) != 1) or + data.startswith("pdbstr: "))): raise Exception("pdbstr failed: " + data) return data -def WriteSourceStream(pdb_filename, data): +def WriteSourceStream(pdb_filename, data, toolchain_dir): """Write the contents of the source information stream to a PDB.""" # Write out the data to a temporary filename that we can pass to pdbstr. (f, fname) = tempfile.mkstemp() @@ -214,7 +203,7 @@ f.write(data) f.close() - srctool = subprocess.Popen([FindFile('pdbstr.exe'), + srctool = subprocess.Popen([FindSrcSrvFile('pdbstr.exe', toolchain_dir), '-w', '-s:srcsrv', '-i:%s' % fname, '-p:%s' % pdb_filename], @@ -228,54 +217,6 @@ os.unlink(fname) -def GetSVNRepoInfo(local_path): - """Calls svn info to extract the SVN information about a path.""" - # We call svn.bat to make sure and get the depot tools SVN and not cygwin. - info = RunCommand('svn.bat', 'info', local_path, raise_on_failure=False) - if not info: - return - # Hack up into a dictionary of the fields printed by svn info. - vals = dict((y.split(': ', 2) for y in info.split('\n') if y)) - return vals - - -def ExtractSVNInfo(local_filename): - """Checks if a file is coming from a svn repository and if so returns some - information about it. - - Args: - local_filename: The name of the file that we want to check. - - Returns: - None if the file doesn't come from a svn repository, otherwise it returns a - RevisionInfo tuple. - """ - # Try to get the svn information about this file. - vals = GetSVNRepoInfo(local_filename) - if not vals: - return - - repo = vals['Repository Root'] - if not vals['URL'].startswith(repo): - raise Exception("URL is not inside of the repository root?!?") - rev = vals['Revision'] - - svn_local_root = os.path.split(local_filename)[0] - - # We need to look at the SVN URL of the current path to handle the case when - # we do a partial SVN checkout inside another checkout of the same repository. - # This happens in Chromium where we do some checkout of - # '/trunk/deps/third_party' in 'src/third_party'. - svn_root_url = os.path.dirname(vals['URL']) - - # Don't try to list all the files from this repository as this seem to slow - # down the indexing, instead index one file at a time. - file_list = [local_filename.replace(svn_local_root, '').lstrip(os.path.sep)] - - return RevisionInfo(repo=repo, rev=rev, files=file_list, - root_path=svn_local_root, path_prefix=svn_root_url.replace(repo, '')) - - def ExtractGitInfo(local_filename): """Checks if a file is coming from a git repository and if so returns some information about it. @@ -330,14 +271,22 @@ git_root_path = local_filename.replace(git_path, '') if repo not in REPO_MAP: - # Automatically adds the project coming from a git GoogleCode repository to - # the repository map. The files from these repositories are accessible via - # gitiles in a base64 encoded format. - if 'chromium.googlesource.com' in repo: + # Automatically adds the project coming from a git GoogleCode or Github + # repository to the repository map. + if urlparse(repo).netloc.endswith('.googlesource.com'): + # The files from these repositories are accessible via gitiles in a + # base64 encoded format. REPO_MAP[repo] = { 'url': '%s/+/{revision}/{file_path}?format=TEXT' % repo, 'base64': True } + elif urlparse(repo).netloc.endswith('github.com'): + raw_url = '%s/{revision}/{file_path}' % repo.replace('.git', '').replace( + 'github.com', 'raw.githubusercontent.com') + REPO_MAP[repo] = { + 'url': raw_url, + 'base64': False + } # Get the list of files coming from this repository. git_file_list = RunCommand('git.bat', 'ls-tree', '--full-name', '--name-only', @@ -349,28 +298,100 @@ root_path=git_root_path, path_prefix=None) -def IndexFilesFromRepo(local_filename, file_list, output_lines): - """Checks if a given file is a part of a revision control repository (svn or - git) and index all the files from this repository if it's the case. +def CheckForJunction(filename): + """Check if a directory containing a file is a junction to another directory. + + If so return 3 values: + - The real path to this file. + - The root directory of this checkout relative to |filename| (i.e. not + relative to the real path). + - The sub directory of the repository that has been checked out. + """ + # Process the path of |filename| from right to left until a junction has been + # found. + # + # Here's an example of what this does, for this example + # |filename| = 'C:/a/b/c/d.h' and 'C:/a' is a junction to 'C:/real_a/'. + # + # - We remove the filename part (we're only looking at directory junctions + # here), that left us with 'C:/a/b/c'. + # - During the first iteration we take 'C:/a/b' as our current root value and + # 'c' as the leaf value. + # - We run the 'dir' command on 'C:/a/b' and we look for a junction to 'c'. As + # we don't find any we go up one directory. Now the current root is 'C:/a' + # and the current leaf value is 'b'. + # - We run the 'dir' command on 'C:/a' and we look for a junction to 'b'. This + # time we find one so we return the following triplet: + # - C:/real_a/b/c/d.h # The real file path. + # - C:/a # The root directory containing this junction. + # - b # The name of the junction. + cur_root, cur_leaf = os.path.split(os.path.dirname(filename)) + while cur_leaf: + # Run the 'dir' command and look for a junction. + dir_cmd = RunCommand('cmd', '/c', 'dir', cur_root) + for entry in dir_cmd.splitlines(): + m = _DIR_JUNCTION_RE.match(entry) + if not m: + continue + if not m.group('dirname') == cur_leaf: + continue + real_path = filename.replace(os.path.join(cur_root, cur_leaf), + m.group('real_path')) + # This should always be the case. + # TODO(sebmarchand): Remove this check if it proves to be useless. + if os.path.exists(real_path): + return real_path, cur_root, cur_leaf + else: + print('Source indexing: error: Unexpected non existing file \'%s\'' % + real_path) + return None, None, None + cur_root, cur_leaf = os.path.split(cur_root) + return None, None, None + + +def IndexFilesFromRepo( + local_filename, file_list, output_lines, follow_junctions): + """Checks if a given file is a part of a Git repository and index all the + files from this repository if it's the case. Args: local_filename: The filename of the current file. file_list: The list of files that should be indexed. output_lines: The source indexing lines that will be appended to the PDB. + follow_junctions: Indicates if we should try to index the files in a + junction. Returns the number of indexed files. """ indexed_files = 0 - + patch_root = None # Try to extract the revision info for the current file. info = ExtractGitInfo(local_filename) - if not info: - info = ExtractSVNInfo(local_filename) + + # If we haven't been able to find information for this file it might be + # because its path contains a junction to another directory. It can be the + # case if you do a Git checkout in C:/real_a/ and you're adding a junction to + # one of the subdirectories (lets say 'b') of this checkout in another + # project (e.g. 'C:/a'), so you'll end up with a partial Git checkout in a + # junction, and any Git command in the path of the junction won't work (or + # it'll return information related to 'C:/a' instead of 'C:/real_a'). + if not info and follow_junctions: + real_filename, patch_root, patch_leaf = CheckForJunction(local_filename) + if real_filename: + info = ExtractGitInfo(real_filename) + + # Don't try to index the internal sources. + if not info or ('internal.googlesource.com' in info.repo): + return 0 repo = info.repo rev = info.rev files = info.files - root_path = info.root_path.lower() + if patch_root: + files = [x for x in files if x.startswith(patch_leaf)] + root_path = patch_root.lower() + else: + root_path = info.root_path.lower() # Checks if we should index this file and if the source that we'll retrieve # will be base64 encoded. @@ -412,40 +433,38 @@ return indexed_files -def DirectoryIsUnderPublicVersionControl(local_dir): - # Checks if this directory is from a Git checkout. +def DirectoryIsPartOfPublicGitRepository(local_dir): + # Checks if this directory is from a public Git checkout. info = RunCommand('git.bat', 'config', '--get', 'remote.origin.url', cwd=local_dir, raise_on_failure=False) if info: - return True - - # If not checks if it's from a SVN checkout. - info = GetSVNRepoInfo(local_dir) - if info: + if 'internal.googlesource.com' in info: + return False return True return False -def UpdatePDB(pdb_filename, verbose=True, build_dir=None, toolchain_dir=None): +def UpdatePDB(pdb_filename, verbose=True, build_dir=None, toolchain_dir=None, + follow_junctions=False): """Update a pdb file with source information.""" - dir_blacklist = { } + dir_exclusion_list = { } if build_dir: - # Blacklisting the build directory allows skipping the generated files, for + # Excluding the build directory allows skipping the generated files, for # Chromium this makes the indexing ~10x faster. build_dir = (os.path.normpath(build_dir)).lower() for directory, _, _ in os.walk(build_dir): - dir_blacklist[directory.lower()] = True - dir_blacklist[build_dir.lower()] = True + dir_exclusion_list[directory.lower()] = True + dir_exclusion_list[build_dir.lower()] = True if toolchain_dir: - # Blacklisting the directories from the toolchain as we don't have revision - # info for them. + # Exclude the directories from the toolchain as we don't have revision info + # for them. toolchain_dir = (os.path.normpath(toolchain_dir)).lower() - for directory, _, _ in os.walk(build_dir): - dir_blacklist[directory.lower()] = True - dir_blacklist[toolchain_dir.lower()] = True + for directory, _, _ in os.walk(toolchain_dir): + dir_exclusion_list[directory.lower()] = True + dir_exclusion_list[toolchain_dir.lower()] = True # Writes the header of the source index stream. # @@ -464,24 +483,28 @@ 'VERCTRL=Subversion', 'DATETIME=%s' % time.asctime(), 'SRCSRV: variables ------------------------------------------', - 'SRC_EXTRACT_TARGET_DIR=%targ%\%fnbksl%(%var2%)\%var3%', - 'SRC_EXTRACT_TARGET=%SRC_EXTRACT_TARGET_DIR%\%fnfile%(%var1%)', + 'SRC_EXTRACT_TARGET_DIR=%targ%\\%fnbksl%(%var2%)\\%var3%', + 'SRC_EXTRACT_TARGET=%SRC_EXTRACT_TARGET_DIR%\\%fnfile%(%var1%)', 'SRC_EXTRACT_CMD=cmd /c "mkdir "%SRC_EXTRACT_TARGET_DIR%" & python -c ' '"import urllib2, base64;' 'url = \\\"%var4%\\\";' 'u = urllib2.urlopen(url);' - 'print %var5%(u.read());" > "%SRC_EXTRACT_TARGET%""', + 'open(r\\\"%SRC_EXTRACT_TARGET%\\\", \\\"wb\\\").write(%var5%(' + 'u.read()))"', 'SRCSRVTRG=%SRC_EXTRACT_TARGET%', 'SRCSRVCMD=%SRC_EXTRACT_CMD%', 'SRCSRV: source files ---------------------------------------', ] - if ReadSourceStream(pdb_filename): + if ReadSourceStream(pdb_filename, toolchain_dir): raise Exception("PDB already has source indexing information!") - filelist = ExtractSourceFiles(pdb_filename) + filelist = ExtractSourceFiles(pdb_filename, toolchain_dir) number_of_files = len(filelist) indexed_files_total = 0 + + t_init = time.time() + t1 = t_init while filelist: filename = next(iter(filelist)) filedir = os.path.dirname(filename) @@ -489,11 +512,18 @@ print("[%d / %d] Processing: %s" % (number_of_files - len(filelist), number_of_files, filename)) - # This directory is blacklisted, either because it's not part of a - # repository, or from one we're not interested in indexing. - if dir_blacklist.get(filedir, False): + # Print a message every 60 seconds to make sure that the process doesn't + # time out. + if time.time() - t1 > 60: + t1 = time.time() + print*("Still working, %d / %d files have been processed." % + number_of_files - len(filelist), number_of_files) + + # This directory is in the exclusion listed, either because it's not part of + # a repository, or from one we're not interested in indexing. + if dir_exclusion_list.get(filedir, False): if verbose: - print(" skipping, directory is blacklisted.") + print(" skipping, directory is excluded.") filelist.remove(filename) continue @@ -504,12 +534,13 @@ # Try to index the current file and all the ones coming from the same # repository. - indexed_files = IndexFilesFromRepo(filename, filelist, lines) + indexed_files = IndexFilesFromRepo( + filename, filelist, lines, follow_junctions) if not indexed_files: - if not DirectoryIsUnderPublicVersionControl(filedir): - dir_blacklist[filedir] = True + if not DirectoryIsPartOfPublicGitRepository(filedir): + dir_exclusion_list[filedir] = True if verbose: - print("Adding %s to the blacklist." % filedir) + print("Adding %s to the exclusion list." % filedir) filelist.remove(filename) continue @@ -518,9 +549,11 @@ if verbose: print(" %d files have been indexed." % indexed_files) + print('Indexing took %d seconds' % (time.time() - t_init)) + lines.append('SRCSRV: end ------------------------------------------------') - WriteSourceStream(pdb_filename, '\r\n'.join(lines)) + WriteSourceStream(pdb_filename, '\r\n'.join(lines), toolchain_dir) if verbose: print("%d / %d files have been indexed." % (indexed_files_total, @@ -533,17 +566,23 @@ parser.add_option('--build-dir', help='The original build directory, if set ' 'all the files present in this directory (or one of its subdirectories) ' 'will be skipped.') - parser.add_option('--toolchain-dir', help='The directory containing the ' - 'toolchain that has been used for this build. If set all the files ' - 'present in this directory (or one of its subdirectories) will be ' - 'skipped.') + parser.add_option('--toolchain-dir', help='The directory containing the VS ' + 'toolchain that has been used for this build. All the files present in ' + 'this directory (or one of its subdirectories) will be skipped.') + parser.add_option('--follow-junctions', action='store_true',help='Indicates ' + 'if the junctions should be followed while doing the indexing.', + default=False) options, args = parser.parse_args() if not args: - parser.error('Specify a pdb') + parser.error('Specify a pdb.') + + if not options.toolchain_dir: + parser.error('The toolchain directory should be specified.') for pdb in args: - UpdatePDB(pdb, options.verbose, options.build_dir) + UpdatePDB(pdb, options.verbose, options.build_dir, options.toolchain_dir, + options.follow_junctions) return 0
diff --git a/ui/accessibility/ax_node_position.cc b/ui/accessibility/ax_node_position.cc index fd49d91..851884a 100644 --- a/ui/accessibility/ax_node_position.cc +++ b/ui/accessibility/ax_node_position.cc
@@ -139,13 +139,13 @@ void AXNodePosition::AnchorChild(int child_index, AXTreeID* tree_id, - int32_t* child_id) const { + AXNode::AXID* child_id) const { DCHECK(tree_id); DCHECK(child_id); if (!GetAnchor() || child_index < 0 || child_index >= AnchorChildCount()) { *tree_id = AXTreeIDUnknown(); - *child_id = INVALID_ANCHOR_ID; + *child_id = AXNode::kInvalidAXID; return; } @@ -187,10 +187,10 @@ base::stack<AXNode*> anchors; AXNode* current_anchor = GetAnchor(); - int32_t current_anchor_id = GetAnchor()->id(); + AXNode::AXID current_anchor_id = GetAnchor()->id(); AXTreeID current_tree_id = this->tree_id(); - int32_t parent_anchor_id = INVALID_ANCHOR_ID; + AXNode::AXID parent_anchor_id = AXNode::kInvalidAXID; AXTreeID parent_tree_id = AXTreeIDUnknown(); while (current_anchor) { @@ -205,12 +205,13 @@ return anchors; } -void AXNodePosition::AnchorParent(AXTreeID* tree_id, int32_t* parent_id) const { +void AXNodePosition::AnchorParent(AXTreeID* tree_id, + AXNode::AXID* parent_id) const { DCHECK(tree_id); DCHECK(parent_id); *tree_id = AXTreeIDUnknown(); - *parent_id = INVALID_ANCHOR_ID; + *parent_id = AXNode::kInvalidAXID; if (!GetAnchor()) return; @@ -221,12 +222,13 @@ if (!parent) { *tree_id = AXTreeIDUnknown(); - *parent_id = INVALID_ANCHOR_ID; + *parent_id = AXNode::kInvalidAXID; } } -AXNode* AXNodePosition::GetNodeInTree(AXTreeID tree_id, int32_t node_id) const { - if (node_id == INVALID_ANCHOR_ID) +AXNode* AXNodePosition::GetNodeInTree(AXTreeID tree_id, + AXNode::AXID node_id) const { + if (node_id == AXNode::kInvalidAXID) return nullptr; // Used for testing via AXNodePosition::SetTree @@ -306,40 +308,40 @@ ax::mojom::IntListAttribute::kWordEnds); } -int32_t AXNodePosition::GetNextOnLineID(int32_t node_id) const { +AXNode::AXID AXNodePosition::GetNextOnLineID(AXNode::AXID node_id) const { if (IsNullPosition()) - return INVALID_ANCHOR_ID; + return AXNode::kInvalidAXID; AXNode* node = GetNodeInTree(tree_id(), node_id); int next_on_line_id; if (!node || !node->data().GetIntAttribute( ax::mojom::IntAttribute::kNextOnLineId, &next_on_line_id)) { - return INVALID_ANCHOR_ID; + return AXNode::kInvalidAXID; } - return static_cast<int32_t>(next_on_line_id); + return static_cast<AXNode::AXID>(next_on_line_id); } -int32_t AXNodePosition::GetPreviousOnLineID(int32_t node_id) const { +AXNode::AXID AXNodePosition::GetPreviousOnLineID(AXNode::AXID node_id) const { if (IsNullPosition()) - return INVALID_ANCHOR_ID; + return AXNode::kInvalidAXID; AXNode* node = GetNodeInTree(tree_id(), node_id); int previous_on_line_id; if (!node || !node->data().GetIntAttribute(ax::mojom::IntAttribute::kPreviousOnLineId, &previous_on_line_id)) { - return INVALID_ANCHOR_ID; + return AXNode::kInvalidAXID; } - return static_cast<int32_t>(previous_on_line_id); + return static_cast<AXNode::AXID>(previous_on_line_id); } AXNode* AXNodePosition::GetParent(AXNode* child, AXTreeID child_tree_id, AXTreeID* parent_tree_id, - int32_t* parent_id) { + AXNode::AXID* parent_id) { DCHECK(parent_tree_id); DCHECK(parent_id); *parent_tree_id = AXTreeIDUnknown(); - *parent_id = INVALID_ANCHOR_ID; + *parent_id = AXNode::kInvalidAXID; if (!child) return nullptr;
diff --git a/ui/accessibility/ax_node_position.h b/ui/accessibility/ax_node_position.h index 16b9cf4..68bc87c 100644 --- a/ui/accessibility/ax_node_position.h +++ b/ui/accessibility/ax_node_position.h
@@ -12,7 +12,6 @@ #include "base/strings/string16.h" #include "ui/accessibility/ax_enum_util.h" #include "ui/accessibility/ax_export.h" -#include "ui/accessibility/ax_node.h" #include "ui/accessibility/ax_position.h" #include "ui/accessibility/ax_tree.h" @@ -27,7 +26,7 @@ static AXPositionInstance CreatePosition(AXTreeID tree_id, const AXNode& node, - int32_t offset, + int offset, ax::mojom::TextAffinity affinity); static void SetTree(AXTree* tree) { tree_ = tree; } @@ -48,20 +47,20 @@ AXNodePosition(const AXNodePosition& other) = default; void AnchorChild(int child_index, AXTreeID* tree_id, - int32_t* child_id) const override; + AXNode::AXID* child_id) const override; int AnchorChildCount() const override; int AnchorIndexInParent() const override; base::stack<AXNode*> GetAncestorAnchors() const override; - void AnchorParent(AXTreeID* tree_id, int32_t* parent_id) const override; - AXNode* GetNodeInTree(AXTreeID tree_id, int32_t node_id) const override; + void AnchorParent(AXTreeID* tree_id, AXNode::AXID* parent_id) const override; + AXNode* GetNodeInTree(AXTreeID tree_id, AXNode::AXID node_id) const override; bool IsInLineBreakingObject() const override; ax::mojom::Role GetRole() const override; AXNodeTextStyles GetTextStyles() const override; std::vector<int32_t> GetWordStartOffsets() const override; std::vector<int32_t> GetWordEndOffsets() const override; - int32_t GetNextOnLineID(int32_t node_id) const override; - int32_t GetPreviousOnLineID(int32_t node_id) const override; + AXNode::AXID GetNextOnLineID(AXNode::AXID node_id) const override; + AXNode::AXID GetPreviousOnLineID(AXNode::AXID node_id) const override; private: static AXTree* tree_; @@ -72,7 +71,7 @@ static AXNode* GetParent(AXNode* child, AXTreeID child_tree_id, AXTreeID* parent_tree_id, - int32_t* parent_id); + AXNode::AXID* parent_id); AXPositionInstance CreateUnignoredPositionFromLeafTextPosition( AdjustmentBehavior adjustment_behavior) const;
diff --git a/ui/accessibility/ax_node_position_unittest.cc b/ui/accessibility/ax_node_position_unittest.cc index 8a2ee49..8a1d33f 100644 --- a/ui/accessibility/ax_node_position_unittest.cc +++ b/ui/accessibility/ax_node_position_unittest.cc
@@ -31,15 +31,15 @@ namespace { -int32_t ROOT_ID = 1; -int32_t BUTTON_ID = 2; -int32_t CHECK_BOX_ID = 3; -int32_t TEXT_FIELD_ID = 4; -int32_t STATIC_TEXT1_ID = 5; -int32_t INLINE_BOX1_ID = 6; -int32_t LINE_BREAK_ID = 7; -int32_t STATIC_TEXT2_ID = 8; -int32_t INLINE_BOX2_ID = 9; +constexpr AXNode::AXID ROOT_ID = 1; +constexpr AXNode::AXID BUTTON_ID = 2; +constexpr AXNode::AXID CHECK_BOX_ID = 3; +constexpr AXNode::AXID TEXT_FIELD_ID = 4; +constexpr AXNode::AXID STATIC_TEXT1_ID = 5; +constexpr AXNode::AXID INLINE_BOX1_ID = 6; +constexpr AXNode::AXID LINE_BREAK_ID = 7; +constexpr AXNode::AXID STATIC_TEXT2_ID = 8; +constexpr AXNode::AXID INLINE_BOX2_ID = 9; class AXPositionTest : public testing::Test { public: @@ -115,7 +115,7 @@ } void AssertTextLengthEquals(const AXTree* tree, - int32_t node_id, + AXNode::AXID node_id, int expected_text_length) { TestPositionType text_position = AXNodePosition::CreateTextPosition( tree->data().tree_id, node_id, 0 /* text_offset */,
diff --git a/ui/accessibility/ax_position.h b/ui/accessibility/ax_position.h index 8880215..9db23a85 100644 --- a/ui/accessibility/ax_position.h +++ b/ui/accessibility/ax_position.h
@@ -22,6 +22,7 @@ #include "base/strings/utf_string_conversions.h" #include "ui/accessibility/ax_enum_util.h" #include "ui/accessibility/ax_enums.mojom.h" +#include "ui/accessibility/ax_node.h" #include "ui/accessibility/ax_node_text_styles.h" #include "ui/accessibility/ax_role_properties.h" #include "ui/accessibility/ax_text_boundary.h" @@ -108,7 +109,6 @@ // // This class can be copied using the |Clone| method. It is designed to be // immutable. - template <class AXPositionType, class AXNodeType> class AXPosition { public: @@ -124,21 +124,20 @@ // position in order to make it valid. enum class AdjustmentBehavior { kMoveLeft, kMoveRight }; - static const int32_t INVALID_ANCHOR_ID = -1; static const int BEFORE_TEXT = -1; static const int INVALID_INDEX = -2; static const int INVALID_OFFSET = -1; static AXPositionInstance CreateNullPosition() { AXPositionInstance new_position(new AXPositionType()); - new_position->Initialize(AXPositionKind::NULL_POSITION, AXTreeIDUnknown(), - INVALID_ANCHOR_ID, INVALID_INDEX, INVALID_OFFSET, - ax::mojom::TextAffinity::kDownstream); + new_position->Initialize( + AXPositionKind::NULL_POSITION, AXTreeIDUnknown(), AXNode::kInvalidAXID, + INVALID_INDEX, INVALID_OFFSET, ax::mojom::TextAffinity::kDownstream); return new_position; } static AXPositionInstance CreateTreePosition(AXTreeID tree_id, - int32_t anchor_id, + AXNode::AXID anchor_id, int child_index) { AXPositionInstance new_position(new AXPositionType()); new_position->Initialize(AXPositionKind::TREE_POSITION, tree_id, anchor_id, @@ -149,7 +148,7 @@ static AXPositionInstance CreateTextPosition( AXTreeID tree_id, - int32_t anchor_id, + AXNode::AXID anchor_id, int text_offset, ax::mojom::TextAffinity affinity) { AXPositionInstance new_position(new AXPositionType()); @@ -167,7 +166,7 @@ // API that works with positions as opaque objects. struct SerializedPosition { AXPositionKind kind; - int32_t anchor_id; + AXNode::AXID anchor_id; int child_index; int text_offset; ax::mojom::TextAffinity affinity; @@ -262,10 +261,10 @@ } AXTreeID tree_id() const { return tree_id_; } - int32_t anchor_id() const { return anchor_id_; } + AXNode::AXID anchor_id() const { return anchor_id_; } AXNodeType* GetAnchor() const { - if (tree_id_ == AXTreeIDUnknown() || anchor_id_ == INVALID_ANCHOR_ID) + if (tree_id_ == AXTreeIDUnknown() || anchor_id_ == AXNode::kInvalidAXID) return nullptr; DCHECK_GE(anchor_id_, 0); return GetNodeInTree(tree_id_, anchor_id_); @@ -374,13 +373,14 @@ // // We assume that white space separates lines. if (text_position->IsInWhiteSpace() && - GetNextOnLineID(text_position->anchor_id_) == INVALID_ANCHOR_ID && + GetNextOnLineID(text_position->anchor_id_) == + AXNode::kInvalidAXID && text_position->AtEndOfAnchor()) { return true; } return GetPreviousOnLineID(text_position->anchor_id_) == - INVALID_ANCHOR_ID && + AXNode::kInvalidAXID && text_position->AtStartOfAnchor(); } } @@ -414,10 +414,10 @@ // of white space that is on a line by itself as being at the end of // that line. Note that white space that ends a line of text should be // connected to that text with a "previous on line ID". - if (GetNextOnLineID(text_position->anchor_id_) == INVALID_ANCHOR_ID) + if (GetNextOnLineID(text_position->anchor_id_) == AXNode::kInvalidAXID) return (!text_position->IsInWhiteSpace() || GetPreviousOnLineID(text_position->anchor_id_) == - INVALID_ANCHOR_ID) + AXNode::kInvalidAXID) ? text_position->AtEndOfAnchor() : text_position->AtStartOfAnchor(); @@ -1163,10 +1163,10 @@ return CreateNullPosition(); AXTreeID tree_id = AXTreeIDUnknown(); - int32_t child_id = INVALID_ANCHOR_ID; + AXNode::AXID child_id = AXNode::kInvalidAXID; AnchorChild(child_index, &tree_id, &child_id); DCHECK_NE(tree_id, AXTreeIDUnknown()); - DCHECK_NE(child_id, INVALID_ANCHOR_ID); + DCHECK_NE(child_id, AXNode::kInvalidAXID); switch (kind_) { case AXPositionKind::NULL_POSITION: NOTREACHED(); @@ -1193,9 +1193,9 @@ return CreateNullPosition(); AXTreeID tree_id = AXTreeIDUnknown(); - int32_t parent_id = INVALID_ANCHOR_ID; + AXNode::AXID parent_id = AXNode::kInvalidAXID; AnchorParent(&tree_id, &parent_id); - if (tree_id == AXTreeIDUnknown() || parent_id == INVALID_ANCHOR_ID) + if (tree_id == AXTreeIDUnknown() || parent_id == AXNode::kInvalidAXID) return CreateNullPosition(); switch (kind_) { @@ -2320,7 +2320,7 @@ // Reset to the null position. kind_ = AXPositionKind::NULL_POSITION; tree_id_ = AXTreeIDUnknown(); - anchor_id_ = INVALID_ANCHOR_ID; + anchor_id_ = AXNode::kInvalidAXID; child_index_ = INVALID_INDEX; text_offset_ = INVALID_OFFSET; affinity_ = ax::mojom::TextAffinity::kDownstream; @@ -2754,8 +2754,6 @@ }; template <class AXPositionType, class AXNodeType> -const int32_t AXPosition<AXPositionType, AXNodeType>::INVALID_ANCHOR_ID; -template <class AXPositionType, class AXNodeType> const int AXPosition<AXPositionType, AXNodeType>::BEFORE_TEXT; template <class AXPositionType, class AXNodeType> const int AXPosition<AXPositionType, AXNodeType>::INVALID_INDEX;
diff --git a/ui/accessibility/ax_range_unittest.cc b/ui/accessibility/ax_range_unittest.cc index 8b1a87ba..484504c 100644 --- a/ui/accessibility/ax_range_unittest.cc +++ b/ui/accessibility/ax_range_unittest.cc
@@ -26,29 +26,29 @@ namespace { -constexpr int32_t ROOT_ID = 1; -constexpr int32_t DIV1_ID = 2; -constexpr int32_t BUTTON_ID = 3; -constexpr int32_t DIV2_ID = 4; -constexpr int32_t CHECK_BOX1_ID = 5; -constexpr int32_t CHECK_BOX2_ID = 6; -constexpr int32_t TEXT_FIELD_ID = 7; -constexpr int32_t STATIC_TEXT1_ID = 8; -constexpr int32_t INLINE_BOX1_ID = 9; -constexpr int32_t LINE_BREAK1_ID = 10; -constexpr int32_t STATIC_TEXT2_ID = 11; -constexpr int32_t INLINE_BOX2_ID = 12; -constexpr int32_t LINE_BREAK2_ID = 13; -constexpr int32_t PARAGRAPH_ID = 14; -constexpr int32_t STATIC_TEXT3_ID = 15; -constexpr int32_t INLINE_BOX3_ID = 16; +constexpr AXNode::AXID ROOT_ID = 1; +constexpr AXNode::AXID DIV1_ID = 2; +constexpr AXNode::AXID BUTTON_ID = 3; +constexpr AXNode::AXID DIV2_ID = 4; +constexpr AXNode::AXID CHECK_BOX1_ID = 5; +constexpr AXNode::AXID CHECK_BOX2_ID = 6; +constexpr AXNode::AXID TEXT_FIELD_ID = 7; +constexpr AXNode::AXID STATIC_TEXT1_ID = 8; +constexpr AXNode::AXID INLINE_BOX1_ID = 9; +constexpr AXNode::AXID LINE_BREAK1_ID = 10; +constexpr AXNode::AXID STATIC_TEXT2_ID = 11; +constexpr AXNode::AXID INLINE_BOX2_ID = 12; +constexpr AXNode::AXID LINE_BREAK2_ID = 13; +constexpr AXNode::AXID PARAGRAPH_ID = 14; +constexpr AXNode::AXID STATIC_TEXT3_ID = 15; +constexpr AXNode::AXID INLINE_BOX3_ID = 16; class TestAXRangeScreenRectDelegate : public AXRangeScreenRectDelegate { public: TestAXRangeScreenRectDelegate(AXTree* tree) : tree_(tree) {} gfx::Rect GetInnerTextRangeBoundsRect(AXTreeID tree_id, - int32_t node_id, + AXNode::AXID node_id, int start_offset, int end_offset) override { if (tree_->data().tree_id != tree_id) @@ -66,7 +66,7 @@ ui::AXClippingBehavior::kClipped, &ignore_offscreen_result); } - gfx::Rect GetBoundsRect(AXTreeID tree_id, int32_t node_id) override { + gfx::Rect GetBoundsRect(AXTreeID tree_id, AXNode::AXID node_id) override { if (tree_->data().tree_id != tree_id) return gfx::Rect(); @@ -109,7 +109,7 @@ // AXTreeManager implementation. AXNode* GetNodeFromTree(const AXTreeID tree_id, - const int32_t node_id) const override; + const AXNode::AXID node_id) const override; AXTreeID GetTreeID() const override; AXTreeID GetParentTreeID() const override; AXNode* GetRootAsAXNode() const override; @@ -323,7 +323,7 @@ } AXNode* AXRangeTest::GetNodeFromTree(const AXTreeID tree_id, - const int32_t node_id) const { + const AXNode::AXID node_id) const { if (GetTreeID() == tree_id) return tree_->GetFromId(node_id);
diff --git a/ui/android/BUILD.gn b/ui/android/BUILD.gn index 3561984..d49f0a0d 100644 --- a/ui/android/BUILD.gn +++ b/ui/android/BUILD.gn
@@ -247,6 +247,7 @@ "java/src/org/chromium/ui/base/Clipboard.java", "java/src/org/chromium/ui/base/DeviceFormFactor.java", "java/src/org/chromium/ui/base/EventForwarder.java", + "java/src/org/chromium/ui/base/EventOffsetHandler.java", "java/src/org/chromium/ui/base/IdleDetector.java", "java/src/org/chromium/ui/base/LocalizationUtils.java", "java/src/org/chromium/ui/base/PermissionCallback.java", @@ -378,6 +379,7 @@ "junit/src/org/chromium/ui/AsyncViewStubTest.java", "junit/src/org/chromium/ui/AsyncViewProviderTest.java", "junit/src/org/chromium/ui/base/ClipboardTest.java", + "junit/src/org/chromium/ui/base/EventOffsetHandlerTest.java", "junit/src/org/chromium/ui/base/LocalizationUtilsTest.java", "junit/src/org/chromium/ui/base/SelectFileDialogTest.java", "junit/src/org/chromium/ui/drawable/StateListDrawableBuilderTest.java",
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/EventOffsetHandler.java b/ui/android/java/src/org/chromium/ui/base/EventOffsetHandler.java similarity index 92% rename from weblayer/browser/java/org/chromium/weblayer_private/EventOffsetHandler.java rename to ui/android/java/src/org/chromium/ui/base/EventOffsetHandler.java index 5afe01b..a8542b1 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/EventOffsetHandler.java +++ b/ui/android/java/src/org/chromium/ui/base/EventOffsetHandler.java
@@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.weblayer_private; +package org.chromium.ui.base; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import org.chromium.ui.base.SPenSupport; - /** * A class to update motion event offset while dragging. This is needed to compensate the change * caused by top control. - * TODO: Note this class is copied from src/chrome and should be shared. */ public class EventOffsetHandler { /** * A delegate for EventOffsetHandler. */ - interface EventOffsetHandlerDelegate { + public interface EventOffsetHandlerDelegate { float getTop(); void setCurrentTouchEventOffsets(float top); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/EventOffsetHandlerTest.java b/ui/android/junit/src/org/chromium/ui/base/EventOffsetHandlerTest.java similarity index 76% rename from chrome/android/junit/src/org/chromium/chrome/browser/compositor/EventOffsetHandlerTest.java rename to ui/android/junit/src/org/chromium/ui/base/EventOffsetHandlerTest.java index 6f4c2d23..8d829d7 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/EventOffsetHandlerTest.java +++ b/ui/android/junit/src/org/chromium/ui/base/EventOffsetHandlerTest.java
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.chrome.browser.compositor; +package org.chromium.ui.base; import static org.junit.Assert.assertEquals; @@ -27,24 +27,20 @@ private EventOffsetHandler.EventOffsetHandlerDelegate mDelegate = new EventOffsetHandler.EventOffsetHandlerDelegate() { @Override - public RectF getViewport() { - return mViewport; + public float getTop() { + return mViewport.top; } @Override - public void setCurrentTouchEventOffsets(float x, float y) { - mOffsetX = x; - mOffsetY = y; + public void setCurrentTouchEventOffsets(float top) { + mOffsetY = top; } - }; private RectF mViewport; - private float mOffsetX; private float mOffsetY; - private void assertOffsets(float x, float y) { - assertEquals(x, mOffsetX, 0.0); + private void assertOffsets(float y) { assertEquals(y, mOffsetY, 0.0); } @@ -52,7 +48,7 @@ public void setUp() { mHandler = new EventOffsetHandler(mDelegate); mViewport = new RectF(100, 200, 600, 800); - assertOffsets(0, 0); + assertOffsets(0); } @Test @@ -61,20 +57,20 @@ mHandler.onPostDispatchDragEvent(DragEvent.ACTION_DRAG_STARTED); // Viewport position has been negated. - assertOffsets(-100, -200); + assertOffsets(-200); MotionEvent motionStart = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 100, 100, 0); mHandler.onInterceptTouchEvent(motionStart); - assertOffsets(-100, -200); + assertOffsets(-200); MotionEvent motionEnd = MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 100, 100, 0); mHandler.onInterceptTouchEvent(motionStart); - assertOffsets(-100, -200); + assertOffsets(-200); mHandler.onPreDispatchDragEvent(DragEvent.ACTION_DRAG_ENDED); mHandler.onPostDispatchDragEvent(DragEvent.ACTION_DRAG_ENDED); - assertOffsets(0, 0); + assertOffsets(0); } }
diff --git a/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java b/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java index ed3b30db..49e622b 100644 --- a/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java +++ b/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java
@@ -95,7 +95,7 @@ } @Test - public void testPhotoPickerLaunchAndMimeTypes() throws Throwable { + public void testPhotoPickerLaunchAndMimeTypes() { ShadowMimeTypeMap shadowMimeTypeMap = Shadows.shadowOf(MimeTypeMap.getSingleton()); shadowMimeTypeMap.addExtensionMimeTypMapping("jpg", "image/jpeg"); shadowMimeTypeMap.addExtensionMimeTypMapping("gif", "image/gif"); @@ -140,7 +140,7 @@ } @Test - public void testMultipleFileSelectorWithFileUris() throws Throwable { + public void testMultipleFileSelectorWithFileUris() { SelectFileDialog selectFileDialog = new SelectFileDialog(0); Uri[] filePathArray = new Uri[] { Uri.parse("file:///storage/emulated/0/DCIM/Camera/IMG_0.jpg"),
diff --git a/ui/android/junit/src/org/chromium/ui/modelutil/ModelListAdapterTest.java b/ui/android/junit/src/org/chromium/ui/modelutil/ModelListAdapterTest.java index 1879925..604427ca 100644 --- a/ui/android/junit/src/org/chromium/ui/modelutil/ModelListAdapterTest.java +++ b/ui/android/junit/src/org/chromium/ui/modelutil/ModelListAdapterTest.java
@@ -99,7 +99,7 @@ } @Test - public void testNullConvertView() throws TimeoutException, InterruptedException { + public void testNullConvertView() throws TimeoutException { // Set a property to test that it gets bound. mModel.set(BOOLEAN_PROPERTY, true); @@ -117,7 +117,7 @@ } @Test - public void testNullTypeConvertView() throws TimeoutException, InterruptedException { + public void testNullTypeConvertView() throws TimeoutException { // Set a property to test that it gets bound. mModel.set(BOOLEAN_PROPERTY, true); @@ -130,8 +130,7 @@ } @Test - public void testSameTypeConvertView_SameProperties() - throws TimeoutException, InterruptedException { + public void testSameTypeConvertView_SameProperties() throws TimeoutException { // Construct a test model for the convertView. PropertyModel convertViewModel = new PropertyModel(BOOLEAN_PROPERTY, FLOAT_PROPERTY, INT_PROPERTY, OBJECT_PROPERTY); @@ -174,8 +173,7 @@ } @Test - public void testSameTypeConvertView_DifferentProperties() - throws TimeoutException, InterruptedException { + public void testSameTypeConvertView_DifferentProperties() throws TimeoutException { // Construct a test model for the convertView. PropertyModel convertViewModel = new PropertyModel(BOOLEAN_PROPERTY, FLOAT_PROPERTY, INT_PROPERTY, OBJECT_PROPERTY); @@ -195,7 +193,7 @@ } @Test - public void testDifferentTypeConvertView() throws TimeoutException, InterruptedException { + public void testDifferentTypeConvertView() throws TimeoutException { // Construct a test model for the convertView. PropertyModel convertViewModel = new PropertyModel(BOOLEAN_PROPERTY, FLOAT_PROPERTY, INT_PROPERTY, OBJECT_PROPERTY); @@ -216,8 +214,7 @@ } @Test - public void testBindNewModel_NullOldModel_SetPropertyValues() - throws TimeoutException, InterruptedException { + public void testBindNewModel_NullOldModel_SetPropertyValues() throws TimeoutException { mModel.set(BOOLEAN_PROPERTY, true); mModel.set(FLOAT_PROPERTY, 1.2f); mModel.set(INT_PROPERTY, 3); @@ -275,8 +272,7 @@ } @Test - public void testBindNewModel_NonNullOldModel_DifferentPropertyValues() - throws TimeoutException, InterruptedException { + public void testBindNewModel_NonNullOldModel_DifferentPropertyValues() throws TimeoutException { PropertyModel oldModel = new PropertyModel(BOOLEAN_PROPERTY, FLOAT_PROPERTY, INT_PROPERTY, OBJECT_PROPERTY); @@ -299,8 +295,7 @@ } @Test - public void testBindNewModel_NonNullOldModel_UnsetPropertyValues() - throws TimeoutException, InterruptedException { + public void testBindNewModel_NonNullOldModel_UnsetPropertyValues() throws TimeoutException { PropertyModel oldModel = new PropertyModel(BOOLEAN_PROPERTY, FLOAT_PROPERTY, INT_PROPERTY, OBJECT_PROPERTY);
diff --git a/ui/events/devices/device_data_manager.cc b/ui/events/devices/device_data_manager.cc index 42ccc9eda..2af605d 100644 --- a/ui/events/devices/device_data_manager.cc +++ b/ui/events/devices/device_data_manager.cc
@@ -49,7 +49,7 @@ new DeviceDataManager(); // TODO(bruthig): Replace the DeleteInstance callbacks with explicit calls. - base::AtExitManager::RegisterTask(base::Bind(DeleteInstance)); + base::AtExitManager::RegisterTask(base::BindOnce(DeleteInstance)); } // static
diff --git a/ui/events/devices/x11/device_data_manager_x11.cc b/ui/events/devices/x11/device_data_manager_x11.cc index 7a37554..91abd2b 100644 --- a/ui/events/devices/x11/device_data_manager_x11.cc +++ b/ui/events/devices/x11/device_data_manager_x11.cc
@@ -154,7 +154,7 @@ // TODO(bruthig): Replace the DeleteInstance callbacks with explicit calls. base::AtExitManager::RegisterTask( - base::Bind(DeviceDataManager::DeleteInstance)); + base::BindOnce(DeviceDataManager::DeleteInstance)); } // static
diff --git a/ui/events/ozone/evdev/event_device_info.cc b/ui/events/ozone/evdev/event_device_info.cc index 3d87bcd..9cd6df9ea 100644 --- a/ui/events/ozone/evdev/event_device_info.cc +++ b/ui/events/ozone/evdev/event_device_info.cc
@@ -340,6 +340,10 @@ return abs_info_[code].maximum; } +int32_t EventDeviceInfo::GetAbsResolution(unsigned int code) const { + return abs_info_[code].resolution; +} + int32_t EventDeviceInfo::GetAbsValue(unsigned int code) const { return abs_info_[code].value; }
diff --git a/ui/events/ozone/evdev/event_device_info.h b/ui/events/ozone/evdev/event_device_info.h index bd3e318..5ef1c73 100644 --- a/ui/events/ozone/evdev/event_device_info.h +++ b/ui/events/ozone/evdev/event_device_info.h
@@ -84,6 +84,7 @@ // Properties of absolute axes. int32_t GetAbsMinimum(unsigned int code) const; int32_t GetAbsMaximum(unsigned int code) const; + int32_t GetAbsResolution(unsigned int code) const; int32_t GetAbsValue(unsigned int code) const; input_absinfo GetAbsInfoByCode(unsigned int code) const; uint32_t GetAbsMtSlotCount() const;
diff --git a/ui/events/ozone/evdev/event_device_info_unittest.cc b/ui/events/ozone/evdev/event_device_info_unittest.cc index f09d730..d963c6f 100644 --- a/ui/events/ozone/evdev/event_device_info_unittest.cc +++ b/ui/events/ozone/evdev/event_device_info_unittest.cc
@@ -264,5 +264,11 @@ EXPECT_EQ(ui::InputDeviceType::INPUT_DEVICE_USB, devinfo.device_type()); } +TEST(EventDeviceInfoTest, Nocturne_Touchscreen) { + EventDeviceInfo devinfo; + EXPECT_TRUE(CapabilitiesToDeviceInfo(kNocturneTouchScreen, &devinfo)); + EXPECT_EQ(40, devinfo.GetAbsResolution(ABS_MT_POSITION_X)); + EXPECT_EQ(10404, devinfo.GetAbsMaximum(ABS_MT_POSITION_X)); +} } // namespace ui
diff --git a/ui/events/ozone/evdev/touch_evdev_types.h b/ui/events/ozone/evdev/touch_evdev_types.h index d064671b..d48c5fc 100644 --- a/ui/events/ozone/evdev/touch_evdev_types.h +++ b/ui/events/ozone/evdev/touch_evdev_types.h
@@ -25,6 +25,9 @@ // Current touch major of this slot. int major = 0; + // Current touch minor of this slot. + int minor = 0; + // Current tool type of this slot. int tool_type = 0;
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.cc b/ui/events/ozone/evdev/touch_event_converter_evdev.cc index 66568e5c..78bac04 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc +++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
@@ -227,16 +227,17 @@ // Optional bits. int touch_major = info.GetAbsMtSlotValueWithDefault(ABS_MT_TOUCH_MAJOR, i, 0); + int touch_minor = + info.GetAbsMtSlotValueWithDefault(ABS_MT_TOUCH_MINOR, i, 0); events_[i].radius_x = touch_major * touch_major_scale_ / 2.0f; - events_[i].radius_y = - info.GetAbsMtSlotValueWithDefault(ABS_MT_TOUCH_MINOR, i, 0) * - touch_minor_scale_ / 2.0f; + events_[i].radius_y = touch_minor * touch_minor_scale_ / 2.0f; events_[i].pressure = ScalePressure( info.GetAbsMtSlotValueWithDefault(ABS_MT_PRESSURE, i, 0)); int tool_type = info.GetAbsMtSlotValueWithDefault(ABS_MT_TOOL_TYPE, i, MT_TOOL_FINGER); events_[i].tool_type = tool_type; events_[i].major = touch_major; + events_[i].minor = touch_minor; events_[i].stylus_button = false; if (events_[i].cancelled) cancelled_state = true; @@ -421,6 +422,7 @@ break; case ABS_MT_TOUCH_MINOR: events_[current_slot_].radius_y = input.value * touch_minor_scale_ / 2.0f; + events_[current_slot_].minor = input.value; break; case ABS_MT_POSITION_X: events_[current_slot_].x = input.value;
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc index 2d1d5d0..838e854b 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
@@ -1879,7 +1879,7 @@ {time, EV_ABS, ABS_MT_POSITION_Y, 5559}, {time, EV_ABS, ABS_MT_PRESSURE, 217}, {time, EV_ABS, ABS_MT_TOUCH_MAJOR, 14}, - {time, EV_ABS, ABS_MT_TOUCH_MINOR, 14}, + {time, EV_ABS, ABS_MT_TOUCH_MINOR, 11}, {time, EV_KEY, BTN_TOUCH, 1}, {time, EV_ABS, ABS_X, 1795}, {time, EV_ABS, ABS_Y, 5559}, @@ -1905,5 +1905,9 @@ EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, event.pointer_details.pointer_type); EXPECT_FLOAT_EQ(280.f, event.pointer_details.radius_x); + EXPECT_FLOAT_EQ(220.f, event.pointer_details.radius_y); + const ui::InProgressTouchEvdev& in_progress_event = dev->event(0); + EXPECT_FLOAT_EQ(14.f, in_progress_event.major); + EXPECT_FLOAT_EQ(11.f, in_progress_event.minor); } } // namespace ui
diff --git a/ui/events/platform/platform_event_source_unittest.cc b/ui/events/platform/platform_event_source_unittest.cc index 0c04090..edfd010 100644 --- a/ui/events/platform/platform_event_source_unittest.cc +++ b/ui/events/platform/platform_event_source_unittest.cc
@@ -336,20 +336,20 @@ : TestPlatformEventDispatcher(id, list) {} ~RunCallbackDuringDispatch() override {} - void set_callback(const base::Closure& callback) { - callback_ = callback; + void set_callback(base::OnceClosure callback) { + callback_ = std::move(callback); } protected: // PlatformEventDispatcher: uint32_t DispatchEvent(const PlatformEvent& event) override { if (!callback_.is_null()) - callback_.Run(); + std::move(callback_).Run(); return TestPlatformEventDispatcher::DispatchEvent(event); } private: - base::Closure callback_; + base::OnceClosure callback_; DISALLOW_COPY_AND_ASSIGN(RunCallbackDuringDispatch); }; @@ -364,7 +364,8 @@ TestPlatformEventDispatcher third(20, &list); TestPlatformEventDispatcher fourth(30, &list); - second.set_callback(base::Bind(&RemoveDispatcher, base::Unretained(&third))); + second.set_callback( + base::BindOnce(&RemoveDispatcher, base::Unretained(&third))); std::unique_ptr<PlatformEvent> event = CreatePlatformEvent(); source()->Dispatch(*event); @@ -384,7 +385,8 @@ RunCallbackDuringDispatch second(15, &list); TestPlatformEventDispatcher third(20, &list); - second.set_callback(base::Bind(&RemoveDispatcher, base::Unretained(&second))); + second.set_callback( + base::BindOnce(&RemoveDispatcher, base::Unretained(&second))); std::unique_ptr<PlatformEvent> event = CreatePlatformEvent(); source()->Dispatch(*event); @@ -404,7 +406,8 @@ TestPlatformEventDispatcher first(10, &list); RunCallbackDuringDispatch second(15, &list); - second.set_callback(base::Bind(&RemoveDispatcher, base::Unretained(&second))); + second.set_callback( + base::BindOnce(&RemoveDispatcher, base::Unretained(&second))); std::unique_ptr<PlatformEvent> event = CreatePlatformEvent(); source()->Dispatch(*event); @@ -423,7 +426,8 @@ RunCallbackDuringDispatch second(15, &list); TestPlatformEventDispatcher third(20, &list); - second.set_callback(base::Bind(&RemoveDispatcher, base::Unretained(&first))); + second.set_callback( + base::BindOnce(&RemoveDispatcher, base::Unretained(&first))); std::unique_ptr<PlatformEvent> event = CreatePlatformEvent(); source()->Dispatch(*event); @@ -444,9 +448,8 @@ RunCallbackDuringDispatch third(15, &list); TestPlatformEventDispatcher fourth(20, &list); - third.set_callback(base::Bind(&RemoveDispatchers, - base::Unretained(&first), - base::Unretained(&second))); + third.set_callback(base::BindOnce( + &RemoveDispatchers, base::Unretained(&first), base::Unretained(&second))); std::unique_ptr<PlatformEvent> event = CreatePlatformEvent(); source()->Dispatch(*event); @@ -475,7 +478,7 @@ EXPECT_EQ(10, list[0]); EXPECT_EQ(15, list[1]); - second.set_callback(base::Bind(&AddDispatcher, base::Unretained(&third))); + second.set_callback(base::BindOnce(&AddDispatcher, base::Unretained(&third))); list.clear(); source()->Dispatch(*event); ASSERT_EQ(3u, list.size()); @@ -483,7 +486,8 @@ EXPECT_EQ(15, list[1]); EXPECT_EQ(20, list[2]); - second.set_callback(base::Bind(&AddDispatcher, base::Unretained(&fourth))); + second.set_callback( + base::BindOnce(&AddDispatcher, base::Unretained(&fourth))); list.clear(); source()->Dispatch(*event); ASSERT_EQ(4u, list.size()); @@ -571,8 +575,8 @@ handler_ = std::move(handler); } - void set_callback(const base::Closure& callback) { - callback_ = callback; + void set_callback(base::OnceClosure callback) { + callback_ = std::move(callback); } private: @@ -583,14 +587,13 @@ handler_.reset(); uint32_t action = TestPlatformEventDispatcher::DispatchEvent(event); if (!callback_.is_null()) { - callback_.Run(); - callback_ = base::Closure(); + std::move(callback_).Run(); } return action; } std::unique_ptr<ScopedEventDispatcher> handler_; - base::Closure callback_; + base::OnceClosure callback_; DISALLOW_COPY_AND_ASSIGN(DestroyScopedHandleDispatcher); };
diff --git a/ui/events/platform/x11/x11_hotplug_event_handler.cc b/ui/events/platform/x11/x11_hotplug_event_handler.cc index 8a30e23..db071e7 100644 --- a/ui/events/platform/x11/x11_hotplug_event_handler.cc +++ b/ui/events/platform/x11/x11_hotplug_event_handler.cc
@@ -57,14 +57,14 @@ DEVICE_TYPE_OTHER }; -typedef base::Callback<void(const std::vector<InputDevice>&)> - KeyboardDeviceCallback; +using KeyboardDeviceCallback = + base::OnceCallback<void(const std::vector<InputDevice>&)>; -typedef base::Callback<void(const std::vector<TouchscreenDevice>&)> - TouchscreenDeviceCallback; +using TouchscreenDeviceCallback = + base::OnceCallback<void(const std::vector<TouchscreenDevice>&)>; -typedef base::Callback<void(const std::vector<InputDevice>&)> - InputDeviceCallback; +using InputDeviceCallback = + base::OnceCallback<void(const std::vector<InputDevice>&)>; // Used for updating the state on the UI thread once device information is // parsed on helper threads. @@ -73,7 +73,7 @@ TouchscreenDeviceCallback touchscreen_callback; InputDeviceCallback mouse_callback; InputDeviceCallback touchpad_callback; - base::Closure hotplug_finished_callback; + base::OnceClosure hotplug_finished_callback; }; // Stores a copy of the XIValuatorClassInfo values so X11 device processing can @@ -222,10 +222,9 @@ // Helper used to parse keyboard information. When it is done it uses // |reply_runner| and |callback| to update the state on the UI thread. -void HandleKeyboardDevicesInWorker( - const std::vector<DeviceInfo>& device_infos, - scoped_refptr<base::TaskRunner> reply_runner, - const KeyboardDeviceCallback& callback) { +void HandleKeyboardDevicesInWorker(const std::vector<DeviceInfo>& device_infos, + scoped_refptr<base::TaskRunner> reply_runner, + KeyboardDeviceCallback callback) { std::vector<InputDevice> devices; for (const DeviceInfo& device_info : device_infos) { @@ -240,14 +239,15 @@ devices.push_back(keyboard); } - reply_runner->PostTask(FROM_HERE, base::BindOnce(callback, devices)); + reply_runner->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), devices)); } // Helper used to parse mouse information. When it is done it uses // |reply_runner| and |callback| to update the state on the UI thread. void HandleMouseDevicesInWorker(const std::vector<DeviceInfo>& device_infos, scoped_refptr<base::TaskRunner> reply_runner, - const InputDeviceCallback& callback) { + InputDeviceCallback callback) { std::vector<InputDevice> devices; for (const DeviceInfo& device_info : device_infos) { if (device_info.type != DEVICE_TYPE_MOUSE || @@ -259,14 +259,15 @@ devices.push_back(InputDevice(device_info.id, type, device_info.name)); } - reply_runner->PostTask(FROM_HERE, base::BindOnce(callback, devices)); + reply_runner->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), devices)); } // Helper used to parse touchpad information. When it is done it uses // |reply_runner| and |callback| to update the state on the UI thread. void HandleTouchpadDevicesInWorker(const std::vector<DeviceInfo>& device_infos, scoped_refptr<base::TaskRunner> reply_runner, - const InputDeviceCallback& callback) { + InputDeviceCallback callback) { std::vector<InputDevice> devices; for (const DeviceInfo& device_info : device_infos) { if (device_info.type != DEVICE_TYPE_TOUCHPAD || @@ -278,7 +279,8 @@ devices.push_back(InputDevice(device_info.id, type, device_info.name)); } - reply_runner->PostTask(FROM_HERE, base::BindOnce(callback, devices)); + reply_runner->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), devices)); } // Helper used to parse touchscreen information. When it is done it uses @@ -287,7 +289,7 @@ const std::vector<DeviceInfo>& device_infos, const DisplayState& display_state, scoped_refptr<base::TaskRunner> reply_runner, - const TouchscreenDeviceCallback& callback) { + TouchscreenDeviceCallback callback) { std::vector<TouchscreenDevice> devices; if (display_state.mt_position_x == x11::None || display_state.mt_position_y == x11::None) @@ -337,23 +339,25 @@ } } - reply_runner->PostTask(FROM_HERE, base::BindOnce(callback, devices)); + reply_runner->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), devices)); } // Called on a worker thread to parse the device information. -void HandleHotplugEventInWorker( - const std::vector<DeviceInfo>& devices, - const DisplayState& display_state, - scoped_refptr<base::TaskRunner> reply_runner, - const UiCallbacks& callbacks) { - HandleTouchscreenDevicesInWorker( - devices, display_state, reply_runner, callbacks.touchscreen_callback); - HandleKeyboardDevicesInWorker( - devices, reply_runner, callbacks.keyboard_callback); - HandleMouseDevicesInWorker(devices, reply_runner, callbacks.mouse_callback); +void HandleHotplugEventInWorker(const std::vector<DeviceInfo>& devices, + const DisplayState& display_state, + scoped_refptr<base::TaskRunner> reply_runner, + UiCallbacks callbacks) { + HandleTouchscreenDevicesInWorker(devices, display_state, reply_runner, + std::move(callbacks.touchscreen_callback)); + HandleKeyboardDevicesInWorker(devices, reply_runner, + std::move(callbacks.keyboard_callback)); + HandleMouseDevicesInWorker(devices, reply_runner, + std::move(callbacks.mouse_callback)); HandleTouchpadDevicesInWorker(devices, reply_runner, - callbacks.touchpad_callback); - reply_runner->PostTask(FROM_HERE, callbacks.hotplug_finished_callback); + std::move(callbacks.touchpad_callback)); + reply_runner->PostTask(FROM_HERE, + std::move(callbacks.hotplug_finished_callback)); } DeviceHotplugEventObserver* GetHotplugEventObserver() { @@ -435,11 +439,11 @@ display_state.mt_position_y = gfx::GetAtom("Abs MT Position Y"); UiCallbacks callbacks; - callbacks.keyboard_callback = base::Bind(&OnKeyboardDevices); - callbacks.touchscreen_callback = base::Bind(&OnTouchscreenDevices); - callbacks.mouse_callback = base::Bind(&OnMouseDevices); - callbacks.touchpad_callback = base::Bind(&OnTouchpadDevices); - callbacks.hotplug_finished_callback = base::Bind(&OnHotplugFinished); + callbacks.keyboard_callback = base::BindOnce(&OnKeyboardDevices); + callbacks.touchscreen_callback = base::BindOnce(&OnTouchscreenDevices); + callbacks.mouse_callback = base::BindOnce(&OnMouseDevices); + callbacks.touchpad_callback = base::BindOnce(&OnTouchpadDevices); + callbacks.hotplug_finished_callback = base::BindOnce(&OnHotplugFinished); // Parse the device information asynchronously since this operation may block. // Once the device information is extracted the parsed devices will be @@ -449,7 +453,8 @@ {base::ThreadPool(), base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::BindOnce(&HandleHotplugEventInWorker, device_infos, display_state, - base::ThreadTaskRunnerHandle::Get(), callbacks)); + base::ThreadTaskRunnerHandle::Get(), + std::move(callbacks))); } } // namespace ui
diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc index 312a6b2..c00e4d1f7 100644 --- a/ui/events/test/event_generator.cc +++ b/ui/events/test/event_generator.cc
@@ -351,7 +351,7 @@ const base::TimeDelta& step_delay, int steps) { GestureScrollSequenceWithCallback(start, end, step_delay, steps, - base::Bind(&DummyCallback)); + base::BindRepeating(&DummyCallback)); } void EventGenerator::GestureScrollSequenceWithCallback(
diff --git a/ui/gfx/font_fallback_linux.cc b/ui/gfx/font_fallback_linux.cc index 7086af8..769645d0 100644 --- a/ui/gfx/font_fallback_linux.cc +++ b/ui/gfx/font_fallback_linux.cc
@@ -9,9 +9,7 @@ #include <map> #include <memory> #include <string> -#include <vector> -#include "base/containers/mru_cache.h" #include "base/lazy_instance.h" #include "base/memory/ptr_util.h" #include "base/no_destructor.h" @@ -26,16 +24,6 @@ const char kFontFormatTrueType[] = "TrueType"; const char kFontFormatCFF[] = "CFF"; -// The fallback cache is a mapping from a font family name to it's potential -// fallback fonts. -using FallbackCache = base::MRUCache<std::string, std::vector<Font>>; -constexpr int kFallbackCacheSize = 64; - -FallbackCache* GetFallbackCacheInstance() { - static base::NoDestructor<FallbackCache> fallback_cache(kFallbackCacheSize); - return fallback_cache.get(); -} - std::string GetFilenameFromFcPattern(FcPattern* pattern) { const char* c_filename = nullptr; if (FcPatternGetString(pattern, FC_FILE, 0, @@ -82,6 +70,13 @@ } // namespace +FallbackFontsCache* GetFallbackFontsCacheInstance() { + constexpr int kFallbackCacheSize = 64; + static base::NoDestructor<FallbackFontsCache> fallback_cache( + kFallbackCacheSize); + return fallback_cache.get(); +} + bool GetFallbackFont(const Font& font, const std::string& locale, base::StringPiece16 text, @@ -147,7 +142,7 @@ std::string font_family = font.GetFontName(); // Lookup in the cache for already processed family. - FallbackCache* font_cache = GetFallbackCacheInstance(); + FallbackFontsCache* font_cache = GetFallbackFontsCacheInstance(); auto cached_fallback_fonts = font_cache->Get(font_family); if (cached_fallback_fonts != font_cache->end()) { // Already in cache.
diff --git a/ui/gfx/font_fallback_linux.h b/ui/gfx/font_fallback_linux.h index ac9cd572..9ac56ee 100644 --- a/ui/gfx/font_fallback_linux.h +++ b/ui/gfx/font_fallback_linux.h
@@ -6,13 +6,21 @@ #define UI_GFX_FONT_FALLBACK_LINUX_H_ #include <string> +#include <vector> +#include "base/containers/mru_cache.h" #include "third_party/icu/source/common/unicode/uchar.h" +#include "ui/gfx/font.h" #include "ui/gfx/font_fallback.h" #include "ui/gfx/gfx_export.h" namespace gfx { +// The fallback cache is a mapping from a font family name to its potential +// fallback fonts. +using FallbackFontsCache = base::MRUCache<std::string, std::vector<Font>>; +GFX_EXPORT FallbackFontsCache* GetFallbackFontsCacheInstance(); + // Return a font family which provides a glyph for the Unicode code point // specified by character. // c: a UTF-32 code point
diff --git a/ui/gfx/font_fallback_linux_unittest.cc b/ui/gfx/font_fallback_linux_unittest.cc index e49862b..1e1db2f 100644 --- a/ui/gfx/font_fallback_linux_unittest.cc +++ b/ui/gfx/font_fallback_linux_unittest.cc
@@ -15,10 +15,18 @@ const char kDefaultApplicationLocale[] = "us-en"; } // namespace +class FontFallbackLinuxTest : public testing::Test { + public: + void SetUp() override { + // Clear the font fallback cache. + GetFallbackFontsCacheInstance()->Clear(); + } +}; + // If the Type 1 Symbol.pfb font is installed, it is returned as fallback font // for the PUA character 0xf6db. This test ensures we're not returning Type 1 // fonts as fallback. -TEST(FontFallbackLinuxTest, NoType1InFallbackFonts) { +TEST_F(FontFallbackLinuxTest, NoType1InFallbackFonts) { FallbackFontData font_fallback_data = GetFallbackFontForChar(0xf6db, std::string()); if (font_fallback_data.filename.length() >= 3u) { @@ -30,7 +38,7 @@ } } -TEST(FontFallbackLinuxTest, GetFallbackFont) { +TEST_F(FontFallbackLinuxTest, GetFallbackFont) { Font base_font; Font fallback_font_cjk; @@ -44,16 +52,24 @@ EXPECT_EQ(fallback_font_khmer.GetFontName(), "Noto Sans Khmer"); } -TEST(FontFallbackLinuxTest, Fallbacks) { +TEST_F(FontFallbackLinuxTest, Fallbacks) { + EXPECT_EQ(0U, GetFallbackFontsCacheInstance()->size()); + Font default_font("sans", 13); std::vector<Font> fallbacks = GetFallbackFonts(default_font); EXPECT_FALSE(fallbacks.empty()); + EXPECT_EQ(1U, GetFallbackFontsCacheInstance()->size()); // The first fallback should be 'DejaVu Sans' which is the default linux // fonts. The fonts on linux are mock with test_fonts (see // third_party/tests_font). if (!fallbacks.empty()) EXPECT_EQ(fallbacks[0].GetFontName(), "DejaVu Sans"); + + // Second lookup should not increase the cache size. + fallbacks = GetFallbackFonts(default_font); + EXPECT_FALSE(fallbacks.empty()); + EXPECT_EQ(1U, GetFallbackFontsCacheInstance()->size()); } } // namespace gfx
diff --git a/ui/gl/init/create_gr_gl_interface.cc b/ui/gl/init/create_gr_gl_interface.cc index 0a387f1..315dc166 100644 --- a/ui/gl/init/create_gr_gl_interface.cc +++ b/ui/gl/init/create_gr_gl_interface.cc
@@ -640,13 +640,22 @@ // gl->glFlushMappedNamedBufferRangeEXTFn; // functions->fTextureBuffer = gl->glTextureBufferEXTFn; - functions->fDebugMessageControl = gl->glDebugMessageControlFn; - functions->fDebugMessageInsert = gl->glDebugMessageInsertFn; - functions->fDebugMessageCallback = gl->glDebugMessageCallbackFn; - functions->fGetDebugMessageLog = gl->glGetDebugMessageLogFn; - functions->fPushDebugGroup = gl->glPushDebugGroupFn; - functions->fPopDebugGroup = gl->glPopDebugGroupFn; - functions->fObjectLabel = gl->glObjectLabelFn; + // Some drivers report GL_KHR_debug but do not provide functions. Validate and + // remove reported extension from the list if necessary + // See https://crbug.com/1008125 + if (gl->glDebugMessageControlFn && gl->glDebugMessageInsertFn && + gl->glDebugMessageCallbackFn && gl->glGetDebugMessageLogFn && + gl->glPushDebugGroupFn && gl->glPopDebugGroupFn && gl->glObjectLabelFn) { + functions->fDebugMessageControl = gl->glDebugMessageControlFn; + functions->fDebugMessageInsert = gl->glDebugMessageInsertFn; + functions->fDebugMessageCallback = gl->glDebugMessageCallbackFn; + functions->fGetDebugMessageLog = gl->glGetDebugMessageLogFn; + functions->fPushDebugGroup = gl->glPushDebugGroupFn; + functions->fPopDebugGroup = gl->glPopDebugGroupFn; + functions->fObjectLabel = gl->glObjectLabelFn; + } else { + extensions.remove("GL_KHR_debug"); + } // GL_EXT_window_rectangles functions->fWindowRectangles = gl->glWindowRectanglesEXTFn;
diff --git a/ui/latency/OWNERS b/ui/latency/OWNERS index d0e31cd..b72d1d8 100644 --- a/ui/latency/OWNERS +++ b/ui/latency/OWNERS
@@ -3,6 +3,4 @@ tdresser@chromium.org nzolghadr@chromium.org -# frame metrics -brianderson@chromium.org # COMPONENT: Speed>Metrics
diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd index 9a6daa6..0daa84f 100644 --- a/ui/strings/ui_strings.grd +++ b/ui/strings/ui_strings.grd
@@ -871,10 +871,7 @@ Remove </message> <message name="IDS_APP_LIST_START_ASSISTANT" desc="Tooltip for the button that starts Google Assistant from the search box in the app list."> - Start Google Assistant - </message> - <message name="IDS_APP_LIST_START_ASSISTANT_VOICE_QUERY" desc="Tooltip for the button that starts Google Assistant voice query from the search box in the app list."> - Start Google Assistant voice query + Google Assistant </message> <message name="IDS_APP_LIST_PAGE_SWITCHER" desc="Tooltip for page switcher for each page in fullscreen view which shows all apps."> Page <ph name="selected_page">$1<ex>1</ex></ph> of <ph name="total_page_num">$2<ex>3</ex></ph>
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index a127ead..b479ec87 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc
@@ -173,6 +173,8 @@ int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { if (!bounds().Contains(point)) return HTNOWHERE; + if (hit_test_transparent_) + return HTTRANSPARENT; if (close_->GetVisible() && close_->GetMirroredBounds().Contains(point)) return HTCLOSE;
diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h index 0958130d..403410f 100644 --- a/ui/views/bubble/bubble_frame_view.h +++ b/ui/views/bubble/bubble_frame_view.h
@@ -111,6 +111,14 @@ preferred_arrow_adjustment_ = adjustment; } + // TODO(crbug.com/1007604): remove this in favor of using + // Widget::InitParams::accept_events. In the mean time, don't add new uses of + // this flag. + bool hit_test_transparent() const { return hit_test_transparent_; } + void set_hit_test_transparent(bool hit_test_transparent) { + hit_test_transparent_ = hit_test_transparent; + } + // Get/set the corner radius of the bubble border. int corner_radius() const { return bubble_border_ ? bubble_border_->corner_radius() : 0; @@ -237,6 +245,10 @@ PreferredArrowAdjustment preferred_arrow_adjustment_ = PreferredArrowAdjustment::kMirror; + // If true the view is transparent to all hit tested events (i.e. click and + // hover). DEPRECATED: See note above set_hit_test_transparent(). + bool hit_test_transparent_ = false; + InputEventActivationProtector input_protector_; DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
diff --git a/url/BUILD.gn b/url/BUILD.gn index 8dee2f5..71cc92c 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn
@@ -97,6 +97,19 @@ } if (is_android) { + static_library("origin_android") { + sources = [ + "android/origin_android.cc", + ] + + deps = [ + ":url", + ":url_jni_headers", + "//base", + "//url/mojom:url_mojom_origin", + ] + } + android_library("url_java") { java_files = [ "android/java/src/org/chromium/url/IDNStringUtil.java" ] deps = [ @@ -104,9 +117,18 @@ ] } + android_library("origin_java") { + java_files = [ "android/java/src/org/chromium/url/Origin.java" ] + deps = [ + "//base:base_java", + "//url/mojom:url_mojom_origin_java", + ] + } + generate_jni("url_jni_headers") { sources = [ "android/java/src/org/chromium/url/IDNStringUtil.java", + "android/java/src/org/chromium/url/Origin.java", ] } }
diff --git a/url/android/java/src/org/chromium/url/Origin.java b/url/android/java/src/org/chromium/url/Origin.java new file mode 100644 index 0000000..89bcf52 --- /dev/null +++ b/url/android/java/src/org/chromium/url/Origin.java
@@ -0,0 +1,47 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.url; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; + +import java.nio.ByteBuffer; + +/** An origin is either a (scheme, host, port) tuple or is opaque. */ +@JNINamespace("url") +public class Origin { + // The internal representation of the origin that should never be used directly. + private final org.chromium.url.internal.mojom.Origin mInternal; + + /** @return The scheme of the origin. Returns an empty string for an opaque origin. */ + public String getScheme() { + return !isOpaque() ? mInternal.scheme : ""; + } + + /** @return The host of the origin. Returns an empty string for an opaque origin. */ + public String getHost() { + return !isOpaque() ? mInternal.host : ""; + } + + /** @return The port of the origin. Returns 0 for an opaque origin. */ + public int getPort() { + return !isOpaque() ? mInternal.port : 0; + } + + /** @return Whether the origin is opaque. */ + public boolean isOpaque() { + return mInternal.nonceIfOpaque != null; + } + + @CalledByNative + private static ByteBuffer serialize(Origin origin) { + return origin.mInternal.serialize(); + } + + @CalledByNative + private Origin(ByteBuffer byteBuffer) { + mInternal = org.chromium.url.internal.mojom.Origin.deserialize(byteBuffer); + } +} \ No newline at end of file
diff --git a/url/android/origin_android.cc b/url/android/origin_android.cc new file mode 100644 index 0000000..1cdecf6 --- /dev/null +++ b/url/android/origin_android.cc
@@ -0,0 +1,42 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "url/origin.h" + +#include <cstdint> +#include <vector> + +#include "base/android/jni_string.h" +#include "base/android/scoped_java_ref.h" +#include "url/mojom/origin.mojom.h" +#include "url/mojom/origin_mojom_traits.h" +#include "url/url_jni_headers/Origin_jni.h" + +namespace url { + +base::android::ScopedJavaLocalRef<jobject> Origin::CreateJavaObject() const { + std::vector<uint8_t> byte_vector = mojom::Origin::Serialize(this); + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jobject> byte_buffer = + base::android::ScopedJavaLocalRef<jobject>( + env, + env->NewDirectByteBuffer(byte_vector.data(), byte_vector.size())); + return Java_Origin_Constructor(env, byte_buffer); +} + +// static +Origin Origin::FromJavaObject( + const base::android::JavaRef<jobject>& java_origin) { + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jobject> byte_buffer = + Java_Origin_serialize(env, java_origin); + Origin result; + bool success = mojom::Origin::Deserialize( + static_cast<jbyte*>(env->GetDirectBufferAddress(byte_buffer.obj())), + env->GetDirectBufferCapacity(byte_buffer.obj()), &result); + DCHECK(success); + return result; +} + +} // namespace url
diff --git a/url/mojom/origin.mojom b/url/mojom/origin.mojom index 5a9e319..a8bb7477 100644 --- a/url/mojom/origin.mojom +++ b/url/mojom/origin.mojom
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +[JavaPackage="org.chromium.url.internal.mojom"] module url.mojom; import "mojo/public/mojom/base/unguessable_token.mojom";
diff --git a/url/origin.h b/url/origin.h index cfcba14..f0b85a3 100644 --- a/url/origin.h +++ b/url/origin.h
@@ -16,12 +16,26 @@ #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/unguessable_token.h" +#include "build/build_config.h" #include "ipc/ipc_param_traits.h" #include "url/scheme_host_port.h" #include "url/third_party/mozilla/url_parse.h" #include "url/url_canon.h" #include "url/url_constants.h" +#if defined(OS_ANDROID) +#include <jni.h> + +namespace base { +namespace android { +template <typename> +class ScopedJavaLocalRef; +template <typename> +class JavaRef; +} // namespace android +} // namespace base +#endif // OS_ANDROID + class GURL; namespace blink { @@ -266,6 +280,12 @@ // and precursor information. std::string GetDebugString() const; +#if defined(OS_ANDROID) + base::android::ScopedJavaLocalRef<jobject> CreateJavaObject() const; + static Origin FromJavaObject( + const base::android::JavaRef<jobject>& java_origin); +#endif // OS_ANDROID + private: friend class blink::SecurityOrigin; friend class OriginTest;
diff --git a/weblayer/browser/java/BUILD.gn b/weblayer/browser/java/BUILD.gn index 1c9db1f..ca607a9 100644 --- a/weblayer/browser/java/BUILD.gn +++ b/weblayer/browser/java/BUILD.gn
@@ -12,7 +12,6 @@ "org/chromium/weblayer_private/BrowserObserverProxy.java", "org/chromium/weblayer_private/ContentView.java", "org/chromium/weblayer_private/ContentViewRenderView.java", - "org/chromium/weblayer_private/EventOffsetHandler.java", "org/chromium/weblayer_private/NavigationControllerImpl.java", "org/chromium/weblayer_private/NavigationImpl.java", "org/chromium/weblayer_private/ProfileImpl.java", @@ -56,9 +55,9 @@ android_aidl("aidl") { import_include = [ "org/chromium/weblayer_private/aidl" ] sources = [ - "org/chromium/weblayer_private/aidl/IBrowserFragmentController.aidl", "org/chromium/weblayer_private/aidl/IBrowserController.aidl", "org/chromium/weblayer_private/aidl/IBrowserControllerClient.aidl", + "org/chromium/weblayer_private/aidl/IBrowserFragmentController.aidl", "org/chromium/weblayer_private/aidl/IChildProcessService.aidl", "org/chromium/weblayer_private/aidl/IClientNavigation.aidl", "org/chromium/weblayer_private/aidl/INavigation.aidl",
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/ContentView.java b/weblayer/browser/java/org/chromium/weblayer_private/ContentView.java index 9a51ac4..9bd86d50 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/ContentView.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/ContentView.java
@@ -32,6 +32,7 @@ import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsAccessibility; import org.chromium.ui.base.EventForwarder; +import org.chromium.ui.base.EventOffsetHandler; /** * The containing view for {@link WebContents} that exists in the Android UI hierarchy and exposes
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/TopControlsContainerView.java b/weblayer/browser/java/org/chromium/weblayer_private/TopControlsContainerView.java index 1fe57fa..0fe5bb5 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/TopControlsContainerView.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/TopControlsContainerView.java
@@ -15,6 +15,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; import org.chromium.content_public.browser.WebContents; +import org.chromium.ui.base.EventOffsetHandler; import org.chromium.ui.resources.dynamics.ViewResourceAdapter; /**
diff --git a/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/BrowserObserverTest.java b/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/BrowserObserverTest.java index 17546a4..16572bd 100644 --- a/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/BrowserObserverTest.java +++ b/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/BrowserObserverTest.java
@@ -87,7 +87,7 @@ @Test @SmallTest - public void testLoadEvents() throws Exception { + public void testLoadEvents() { String startupUrl = "about:blank"; WebLayerShellActivity activity = mActivityTestRule.launchShellWithUrl(startupUrl); Assert.assertNotNull(activity);
diff --git a/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java b/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java index 07b3dfa..5347e671 100644 --- a/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java +++ b/weblayer/shell/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java
@@ -41,8 +41,7 @@ notifyCalled(); } - public void assertCalledWith(int currentCallCount, String uri) - throws TimeoutException, InterruptedException { + public void assertCalledWith(int currentCallCount, String uri) throws TimeoutException { waitForCallback(currentCallCount); Assert.assertEquals(mUri.toString(), uri); } @@ -70,7 +69,7 @@ @Test @SmallTest - public void testBaseStartup() throws Exception { + public void testBaseStartup() { WebLayerShellActivity activity = mActivityTestRule.launchShellWithUrl(URL); Assert.assertNotNull(activity);